Engine
Engine

Reputation: 5422

adjusting the resolution of a video capture

I have a 1280x1024 video input device, I wrote a small opencv project to capture images from it, but I get only a 640x480 images ?? any body has idea why I get that , here is my code :

 #include <opencv2\highgui\highgui.hpp>
 #include <opencv2\core\core.hpp>
 #include <opencv2\opencv.hpp>

using namespace std;

 int main(){
cv::VideoCapture cap(2);
cv::Mat  frame;
int key = 0;
while(key != 27){
    cap.read(frame);


    cv::imshow("test",frame);
    key = cv::waitKey(10);
}
return 0 ;}

thanks in advance for your help

Upvotes: 1

Views: 637

Answers (1)

zakinster
zakinster

Reputation: 10688

As of the last version of OpenCV:

cap.set(CV_CAP_PROP_FRAME_WIDTH, 1280);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 1024);

Upvotes: 1

Related Questions