Explain a simple code
I'm a newbie in OpenCV, so I don't understand when reading this code below. Please explain to me what it means.
uchar* ptr = (uchar*) (image->imageData + y*image->widthStep);
I'm a newbie in OpenCV, so I don't understand when reading this code below. Please explain to me what it means.
uchar* ptr = (uchar*) (image->imageData + y*image->widthStep);
first note: Avoid this.
This code basically had pointer of type unsigned character which is assigned the address of the yth row of the image. the address is cast to Unsigned char type before assignment.
for IplImage structure
->imageData is the start of image data skipping the image header data
->widthStep is the size of a row of pixels in the image.
that seems to retrieve a pointer to row y in an old IplImage.
but honestly, you shouldn't be using code like that. they migrated to c++ 4 years ago, and so should you ..
if you see code, that's using IplImages, cv* functions, - avoid it, it's clearly outdated.
Asked: 2014-01-27 10:13:36 -0600
Seen: 474 times
Last updated: Jan 27 '14