gpt4 book ai didi

Python opencv 返回 Bad Properties

转载 作者:太空宇宙 更新时间:2023-11-03 21:54:32 25 4
gpt4 key购买 nike

我有 C 代码可以工作并返回良好的属性:

int main(int argc, char** argv) {

CvCapture *capture = NULL;
const char* filename = "foo.mov";

capture = cvCreateFileCapture(filename);
int w = (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH);
int h = (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT);

std::cout << "Width: " << w << std::endl;
std::cout << "Height: " << h << std::endl;

但是 Python 等价物只为所有内容返回 0:

import cv2

capture = cv2.VideoCapture('foo.mov')

print capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)

这将返回 0.0

有什么想法吗?

最佳答案

  1. 查看python中的公开简历版本在c :

    from cv2 import version version

    并使用 CV_VERSION 宏。

  2. 输出是什么capture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)

  3. python 和 foo.mov 是否位于同一个目录?

关于Python opencv 返回 Bad Properties,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15670309/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com