[ITK] [ITK-users] Convert ITK image to cv::Mat image
Tammy Diprima
tammy.diprima at stonybrook.edu
Mon Sep 5 13:31:58 EDT 2016
Greetings! Hope everyone is having a good day...
So... we are passing around a grayscale image... and we're using unsigned
in (as opposed to unsigned char):
typedef itk::Image<unsigned int, ImageDimension> itkUIntImageType;
typedef itkUIntImageType itkLabelImageType;
I need to convert it to cv::Mat in order to pass it to another program:
cv::Mat resultImage = itk::OpenCVImageBridge::ITKImageToCVMat<
itkLabelImageType >( m_objectLabelImage );
The problem is, the compiler is telling me "OpenCV does not support the
input pixel type".
So my question is -- is this true? Can I only convert from unsigned char?
Would a good solution be to:
A) Convert from one pixel type to another, or
B) Or can I just read in the m_objectLabelImage to an Image::Pointer thing
that is of type unsigned char?
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20160905/e46455b1/attachment.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list