distorted frame with CvCaptureFile and retrieveFrame (Bug #1980)
Description
I'm using CvCaptureFile and retrieveFrame and it works pretty well.
However someone sent me a bug report with the video below that, while playing perfectly, returns completely distorted frames. If I don't use openCV and process the frames with CGContext the result is sent properly.
This is the mov: http://arcadia.timisoara.roedu.net/tieG8thuEe3aik2uGa3ahs1m.mov
Associated revisions
fixed possible video distortion problem when cap_avfoundation.mm is used to capture video (ticket #1980)
Merge pull request #1980 from alalek:ocl_interop_initialization
History
Updated by Radu Spineanu almost 13 years ago
This is the fix for the bug. rowbytes is retrieved via CVPixelBufferGetBytesPerRow earlier.
1--- cap_avfoundation.mm.old 2012-06-03 18:37:13.000000000 +0300
2+++ cap_avfoundation.mm 2012-06-03 18:37:50.000000000 +0300
3@@ -946,7 +946,7 @@
4 image->height = height;
5 image->nChannels = 4;
6 image->depth = IPL_DEPTH_8U;
7- image->widthStep = width*4;
8+ image->widthStep = rowBytes;
9 image->imageData = imagedata;
10 image->imageSize = currSize;
11
12@@ -959,7 +959,7 @@
13 bgr_image->height = height;
14 bgr_image->nChannels = 3;
15 bgr_image->depth = IPL_DEPTH_8U;
16- bgr_image->widthStep = width*4;
17+ bgr_image->widthStep = rowBytes;
18 bgr_image->imageData = bgr_imagedata;
19 bgr_image->imageSize = currSize;
Updated by Andrey Kamaev almost 13 years ago
- Target version set to 2.4.2
- Assignee set to Vadim Pisarevsky
Updated by Vadim Pisarevsky over 12 years ago
thanks! the proposed patch was put to SVN, r8833.
- Status changed from Open to Done