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.
and then I've got a image as following.
But the result are all the same when I changed the options IPL_ORIGIN_TL, IPL_ORIGIN_BL.
the code like this.
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.rows(), // image width and height
NULL, // ROI
NULL, NULL, NULL // no mask ROI, image ID, not tiled
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);
What am I missing ? Does anyone know what should I do for solving?
Why the result image are always vertical flipping?
Though I am not aware of all libs, but most of the image processing libraries reads the RGB/BGR frames from bottom to top. And if they are supplied with original (top to bottom order) buffer then output is a vertically flipped image. So I believe it is the same case here also.
Your problem should get resolved if you provide the data to IPL in bottom to top order, means create a new buffer and fill it by copying bottom row first from original buffer and continue till top row. Supply this new buffer to IPL.
Hope it works.