我有可以工作并返回良好属性的 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
有任何想法吗?