<div dir="ltr">Try RGBToLuminanceImageFilter<div><br></div><div><a href="http://itk.org/Wiki/ITK/Examples/ImageProcessing/RGBToLuminanceImageFilter">http://itk.org/Wiki/ITK/Examples/ImageProcessing/RGBToLuminanceImageFilter</a><br>
</div><div><br></div><div style>Bill</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 24, 2013 at 5:02 AM, chasank <span dir="ltr"><<a href="mailto:chasank@gmail.com" target="_blank">chasank@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm reading a JPEG Image and trying to process a blur filter<br>
(BinomialBlurImageFilter) on it. Because BinomialBlurImageFilter does not<br>
accept RGBImageType, first I'm trying to convert the RGBImageType to<br>
FloatImageType however I'm getting compiling errors; The sample code is<br>
below; What conversion should I do for processing a RGB Image ?<br>
<br>
typedef itk::Image< itk::RGBPixel <unsigned char>, 2 > RGBImageType;<br>
typedef itk::Image< float, 2 ><br>
FloatImageType;<br>
<br>
itk::VTKImageToImageFilter< RGBImageType >::Pointer converter =<br>
itk::VTKImageToImageFilter<RGBImageType> :: New();<br>
converter->SetInput(this->image);<br>
converter->Update();<br>
<br>
itk::CastImageFilter<RGBImageType, FloatImageType>::Pointer caster =<br>
itk::CastImageFilter<RGBImageType, FloatImageType>::New();<br>
caster->SetInput(converter->GetOutput());<br>
caster->Update();<br>
<br>
itk::BinomialBlurImageFilter< FloatImageType, FloatImageType ><br>
::Pointer blurFilter =<br>
itk::BinomialBlurImageFilter < FloatImageType,<br>
FloatImageType> ::New();<br>
blurFilter->SetInput( caster->GetOutput() );<br>
blurFilter->SetRepetitions(2);<br>
blurFilter->Update();<br>
<br>
itk::CastImageFilter<FloatImageType, RGBImageType>::Pointer caster2<br>
=<br>
itk::CastImageFilter<FloatImageType, RGBImageType>::New();<br>
caster2->SetInput(blurFilter->GetOutput());<br>
caster2->Update();<br>
<br>
/usr/local/include/ITK-4.3/itkConceptChecking.h: In member function 'void<br>
itk::Concept::Convertible<T1, T2>::Constraints::constraints() [with T1 =<br>
itk::RGBPixel<unsigned char>, T2 = float]':<br>
/usr/local/include/ITK-4.3/itkConceptChecking.h:192: instantiated from<br>
'itk::Concept::Convertible<itk::RGBPixel&lt;unsigned char>, float>'<br>
/usr/local/include/ITK-4.3/itkCastImageFilter.h:116: instantiated from<br>
'itk::CastImageFilter<itk::Image&lt;itk::RGBPixel&lt;unsigned char>, 2u>,<br>
itk::Image<float, 2u> >'<br>
../Program/program.cpp:67: instantiated from here<br>
/usr/local/include/ITK-4.3/itkConceptChecking.h:185: error: invalid<br>
static_cast from type 'itk::RGBPixel<unsigned char>' to type 'float'<br>
/usr/local/include/ITK-4.3/itkCastImageFilter.h: In member function 'TOutput<br>
itk::Functor::Cast<TInput, TOutput>::operator()(const TInput&) const [with<br>
TInput = itk::RGBPixel<unsigned char>, TOutput = float]':<br>
/usr/local/include/ITK-4.3/itkUnaryFunctorImageFilter.hxx:175:<br>
instantiated from 'void itk::UnaryFunctorImageFilter<TInputImage,<br>
TOutputImage, TFunction>::ThreadedGenerateData(const typename<br>
TOutputImage::RegionType&, itk::ThreadIdType) [with TInputImage =<br>
itk::Image<itk::RGBPixel&lt;unsigned char>, 2u>, TOutputImage =<br>
itk::Image<float, 2u>, TFunction =<br>
itk::Functor::Cast<itk::RGBPixel&lt;unsigned char>, float>]'<br>
../Program/program.cpp:151: instantiated from here<br>
/usr/local/include/ITK-4.3/itkCastImageFilter.h:83: error: invalid<br>
static_cast from type 'const itk::RGBPixel<unsigned char>' to type 'float'<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://itk-insight-users.2283740.n2.nabble.com/RGBImageType-to-FloatImageType-wit-CastImageFilter-tp7583155.html" target="_blank">http://itk-insight-users.2283740.n2.nabble.com/RGBImageType-to-FloatImageType-wit-CastImageFilter-tp7583155.html</a><br>
Sent from the ITK Insight Users mailing list archive at Nabble.com.<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>