Python opencv返回错误的属性

Python opencv返回错误的属性,python,c,opencv,Python,C,Opencv,我有一个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);

我有一个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;
这将返回
0.0

有什么想法吗

  • 在和中检查打开的cv版本:

    从cv2导入版本 版本

    并使用
    CV\u版本

  • 输出用于什么
    capture.get(cv2.cv.cv\u CAP\u PROP\u FRAME\u HEIGHT)

  • python和foo.mov是否位于同一目录上


  • 谢谢你的帮助。所以这两个版本都是相同的-2.4.2。高度属性也是0.0。而foo.mov实际上位于另一个文件夹中,为了简洁起见,我将foo.mov放在那里。
    import cv2
    
    capture = cv2.VideoCapture('foo.mov')
    
    print capture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)