the result image data is always flip verticalized.

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
2049651
Posts: 29
Joined: 2015-10-20T07:29:42-07:00
Authentication code: 1151

the result image data is always flip verticalized.

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: the result image data is always flip verticalized.

Post 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.
2049651
Posts: 29
Joined: 2015-10-20T07:29:42-07:00
Authentication code: 1151

Re: the result image data is always flip verticalized.

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: the result image data is always flip verticalized.

Post by fmw42 »

2049651
Posts: 29
Joined: 2015-10-20T07:29:42-07:00
Authentication code: 1151

Re: the result image data is always flip verticalized.

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: the result image data is always flip verticalized.

Post 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
Post Reply