I am currently using directshow as the frame grabber from webcam, and for each frame my software developed with opencv/c++ is called. The data from directshow is a pointer to a BYTE buffer.
For each call to opencv I have to get the whole image (1600x1200 I think), but the AOI/ROI is about 100x100 pixels.
The buffer representing the image is of a RGB 24bit type.
So. Is there a way to copy only the ROI/AOI of the frame with opencv?
I need the high resolution, so I cant just change camera.
I would suggest first of all including the frame grabbing by using the VideoCapture class. It will push your captured frame towards a single matrix element, giving you the chance of applying the region of interest operator before your processing.
Some example code:
VideoCapture cap(0); // open the default camera Mat frame; cap >> frame; // get a new frame from camera Rect region_of_interest(50,50,100,100); // generates a 100x100 pixels region of interest, starting at position [50,50] for top left corner. Mat sub = frame(region_of_interest).clone(); // sub will now contain the region only
Does this suit your needs?
It states that:
Yes, its called DirectShow - it used to be part of the Direct X SDK but its now on the Platform SDK (and pressumeably the Windows\Vista SDK). The main sample to look at is AmCap - you could probably just google that. DirectShow is COM based so theres VB code too...though C++ is better
So my guess would be to download that amcap code example, look at the source and then try to reconstruct the code you would need to set parameters for your cam.
Asked: 2013-05-15 07:10:37 -0500
Seen: 264 times
Last updated: May 16 '13