Ask Your Question

Revision history [back]

opencv cature video roi

Want to capture upper left corner of frame from USB Webcam, whitout first have to capture entire frame. How can I do?

using namespace cv;

int main() { Mat image; Mat image2; VideoCapture cap; cap.open(0); namedWindow("window", CV_WINDOW_AUTOSIZE);

while(1) {

// This do not work

cap>>image2(Rect(0,0,10,20));
imshow("window", image2);

// This works

cap>>image;
image2=image(Rect(0,0,10,20)); imshow("window", image2);

waitKey(10); }

return 0; }