Page 1 of 1

the result image data is always flip verticalized.

Posted: 2015-12-05T03:50:08-07:00
by 2049651
Hi I am using Intel IPL library and ImageMagicK Library.
When I firstly get image date from ImageMagicK I put the data to IPL.
Then IPL can get image data.

When I display what I got a image data form IPL. I found the result image data is always flip verticalized. you can see as following the problem.

original image
Image


and then I've got a image as following.


Image

But the result are all the same when I changed the options IPL_ORIGIN_TL, IPL_ORIGIN_BL.

the code like this.



m_image.read(fileposition);

IplImage* IPL_image = iplCreateImageHeader(
3, // number of channels
0, // alpha channel
IPL_DEPTH_8U, // data of byte type
"RGB", "BGR", // color model and channel seq
IPL_DATA_ORDER_PIXEL, // channel arrangement
IPL_ORIGIN_TL, // bottom left orientation
IPL_ALIGN_DWORD, // 4 bytes align
m_image.columns(),
m_image.rows(), // image width and height
NULL, // ROI
NULL, NULL, NULL // no mask ROI, image ID, not tiled
);

iplAllocateImage(IPL_image,0,0);


Magick2Ipl(m_image,IPL_image);

ipView( IPL_image, "RGB", is_modal );



void Cmfc_test5Dlg::Magick2Ipl(Image magicImage, IplImage* cvImage)
{
int width= magicImage.size().width();
int height = magicImage.size().height();
int buff_size = width*height*3;
unsigned char* buffer = new unsigned char[buff_size];

magicImage.write(0,0, width, height, "BGR", Magick::CharPixel, buffer);

memcpy(cvImage->imageData, buffer, cvImage->imageSize);
delete[] buffer;
}


What am I missing ? Does anyone know what should I do for solving?

Why the result image are always vertical flipping?

Re: the result image data is always flip verticalized.

Posted: 2015-12-05T10:59:15-07:00
by fmw42
IPL is probably not seeing the rotation information in the meta data. IM has a -auto-orient that you can use to fix the orientation.

Re: the result image data is always flip verticalized.

Posted: 2015-12-05T22:40:36-07:00
by 2049651
fmw42 wrote:IPL is probably not seeing the rotation information in the meta data. IM has a -auto-orient that you can use to fix the orientation.
What is a -auto-orient?
How can I use to fix the orientation?

Re: the result image data is always flip verticalized.

Posted: 2015-12-05T23:38:20-07:00
by fmw42

Re: the result image data is always flip verticalized.

Posted: 2015-12-06T02:06:29-07:00
by 2049651
Thanks, But It seems that it need EXIF information as following instruction.





-auto-orient
adjusts an image so that its orientation is suitable for viewing (i.e. top-left orientation).

This operator reads and resets the EXIF image profile setting 'Orientation' and then performs the appropriate 90 degree rotation on the image to orient the image, for correct viewing.

This EXIF profile setting is usually set using a gravity sensor in digital camera, however photos taken directly downward or upward may not have an appropriate value. Also images that have been orientation 'corrected' without reseting this setting, may be 'corrected' again resulting in a incorrect result. If the EXIF profile was previously stripped, the -auto-orient operator will do nothing.

Re: the result image data is always flip verticalized.

Posted: 2015-12-06T12:30:13-07:00
by fmw42
Ask on an IPL forum. I do not know what to tell you. Does it display correctly in IM or your browsers? You can always just use -flip in IM to flip it for proper viewing in IPL