[Insight-users] ITK and OpenCV: ItkImage to IplImage Conversion issue

Jayachandran, Ganesh ganesh.jayachandran at philips.com
Wed Jan 11 07:37:56 EST 2012


Hi,

I am trying to convert Itkimage to Iplimage. I do not use the openCV bridge, but have wrote a function to do it the same way as said in openCV bridge. But orientation of the image is modified. Any pointer of what I have done wrong would be helpful. The code is shown as below:

IplImage* ConvertItkToIplImage( const ImageType* input )
{

  const unsigned int numberOfChannels = 1;
  const int depth = IPL_DEPTH_8U;
  IplImage* out;
  unsigned int w = input->GetLargestPossibleRegion().GetSize()[0];
  unsigned int h = input->GetLargestPossibleRegion().GetSize()[1];

  out = cvCreateImage(cvSize(w,h), IPL_DEPTH_8U, numberOfChannels);
 memcpy(out->imageData, input->GetBufferPointer(), out->imageSize);

  return out;
}

Regards,
Ganesh


________________________________
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120111/566a1c4e/attachment.htm>


More information about the Insight-users mailing list