step of Mat is incorrect and it courses MFC display issue (Bug #1317)
Description
OpenCV 2011.8.15 SVN / Visual Studio 2010
I have a jpg image, its width is 374.
After loading it to a Mat (img1) using imread, I check the step value, it is 1122(exactly 374*3).
Then I try the traditional way of IplImage (img2), its stepwidth is 1124(aligned).
I use imshow/cvShowImage to show both img1 and img2, it's OK.
Because of class CvvImage is missing in OpenCV2.3, I picked the code from older version and put it in my project.
When I use CvvImage::DrawTOHDC to show image in a MFC picturecontrol, img2 is fine, but img1 is morphed strangely and its color is incorrect.
I compare img1(converted to IplImage without copy underlying data) and img2 in the Visual Studio Watch window, all the member values are the same except size and stepwidth.
Associated revisions
Merge pull request #1317 from jet47:gpu-tvl1-optimization
History
Updated by Vadim Pisarevsky over 13 years ago
Mat does not have gaps in the end of each line, by design. There are no any claims in documentation that Mat is aligned. So, it's not bug. Also, as you can see, imshow() displays Mat correctly. Therefore, you need to modify your code, the bug is there.
- Status changed from Open to Done
- (deleted custom field) set to invalid
Updated by Andrey Kamaev over 12 years ago
- Status changed from Done to Cancelled
- Category changed from highgui-images to trash