XIMEA Image format incorrect after DOWNSAMPLING (Bug #3836)
Description
If I open a XIMA camera and set the downsampling, the retrieved capture frames will have the wrong dimensions.
// Open the camera: cv::VideoCapture cam; cv::Mat bufferFrame; int columns = 0; cam.open(inputName); cam.read(bufferFrame); columns = bufferFrame.columns; // _Columns value is 2592_ cam.set(CV_CAP_PROP_XI_DATA_FORMAT, XI_RGB24 ); cam.set(CV_CAP_PROP_XI_DOWNSAMPLING, ximeaDefaultBinningMode); // In the thread loop cam.read(bufferFrame); columns = bufferFrame.columns; // _Columns value is still 2592_
Now, that seems to come from the fact that, in cap_ximea.cpp,
void CvCaptureCAM_XIMEA::resetCvImage() // Called from CvCaptureCAM_XIMEA::retrieveFrame() { ... if( (int)image.width != width || (int)image.height != height || image.frm != (XI_IMG_FORMAT)format) ... }
the validation checks for the identity of the image dimensions (which are the same, since they were updated by the internal CvCaptureCAM_XIMEA::grabFrame() call), but does not check for the identity of the frame dimensions (which have not been changed, and need to).
An easy fix probably would be to add a check of the frame.cols and frame.rows in that condition line.
Associated revisions
Merge pull request #3836 from Dmitry-Me:uninitializedMember
History
Updated by Dmitry Retinskiy over 10 years ago
Jean-Yves, thanks for the report.
Could you put your suggested correction in the form of pull request?
(see http://www.code.opencv.org/projects/opencv/wiki/How_to_contribute for details).
Thanks.
- Status changed from New to Open
- Description changed from If I open a XIMA camera and set the downsampling, the retrieved capture frame... to If I open a XIMA camera and set the downsampling, the retrieved capture frame... More
- Target version deleted (
2.4.10) - Assignee set to Jean-Yves Deschenes
Updated by Maksim Shabunin over 9 years ago
Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4798