Accessing VideoCapture settings
Hello guys!
I have problem setting my default format for camera access to RGB.
The thing is, I have a camera (FLIR) which has its own open source code (running on STM). I can manupulate this code, so I was analysing it. In the function there is many of possible formats like (RGB3, YUYV, RGB565 etc.). They are all inside the switch case which is evaluating so called "formatindex" like so:
switch(....formatIndex) (
- case RBG3: some code here
- case UYVY: some code here
- case RGB565: some code here
- .
- more possible formats follows )
So this code is running on camera, and I am using OpenCV + VS to access the camera. And it depends on the host's (the setting in opencv) which of these cases in switch structure will execute. So if you demand the RGB565 format with your software, then case RGB565 will execute, if I request RGB format in OpenCV (or any other camera stream software) the RGB3 case will be executed and so on.
But no matter what I try in visual studio (and I tried quite a lot of things) it always request YUYV format and YUYV case executes, which is not what I want. I tried following things:
- cap.set(CV_CAP_PROP_FORMAT, CV_8UC3); // trying to set RGB3 requesting format
- cap.set(CV_CAP_PROP_MODE, CV_CAP_MODE_RGB);
- cap.retrieve(frame, CV_CAP_MODE_BGR);
Now I am lost, I always get this YUYV format.
The code on camera is correct, because if I try to get image with different software on my computer (just basic .exe application for camera stream, nothing special) it always picks up the RGB3 format by default, and if RGB565 is requested the camera switches to that format... Do you have any clue how to achieve to manually set capturing format. And this cap.set.. is not working...
I hope that I didn't complicate too much. Any help is highly appreciated.
it's probably far easier, to get a cv::Mat from your camera software, than to bend cv::VideoCapture.
(if you can get some "pixel-pointer", it's like:
Mat image(h, w, CV_8UC3, pointer);