[Insight-users] About Hough Circle Filter and PNG file

Luis Ibanez luis.ibanez at kitware.com
Sun May 9 17:31:26 EDT 2010


Hi Jiangtao,

Thanks for sharing your findings.

Hoever, they seen quite strange.

The Hough filter works with an image of scalars,
so your conversion from RGBA is changing some
secondary characteristic of the image.

Can you please post that input image in a public
web site ?

We need to look at the image in order to figure
out the source of the problem,


      Thanks


            Luis


--------------------------------------------------
On Wed, May 5, 2010 at 12:00 AM, Jiangtao Li <nelfylee at gmail.com> wrote:
> Dear All,
>
> When I use below code to save sampled image as a PNG file (RGBA), and then
> read it again, the Hough Circle Filter works!
> I found Hough Filter only support the image pixel has 4 components, well, if
> so, I will change my image to 4 components first,
> I change it back to Gray image by RGBToLuminanceImageFilter for Hough
> filter, however, Hough filter gives wrong result again.
>
> typedef itk::Image<itk::RGBAPixel<unsigned char>> RGBAImage;
> typedef itk::ComposeRGBAImageFilter<ImageUChar2D, RGBAImage>
> ComposeRGBAImageFilter;
> ComposeRGBAImageFilter::Pointer rgba = ComposeRGBAImageFilter::New();
>   rgba->SetInput(0, resampler->GetOutput());
> rgba->SetInput(1, resampler->GetOutput());
> rgba->SetInput(2, resampler->GetOutput());
> rgba->SetInput(3, dup->GetOutput());
>   rgba->Update();
> // typedef itk::ImageFileWriter<RGBAImage> ImageFileWriter2;
> // ImageFileWriter2::Pointer writer = ImageFileWriter2::New();
> // writer->SetInput(rgba->GetOutput());
> // writer->SetFileName("E:/Resample.png");
> // writer->Update();
> // typedef itk::ImageFileReader<ImageUChar2D> ImageFileReader;
> // ImageFileReader::Pointer reader = ImageFileReader::New();
> // reader->SetFileName("E:/Resample.png");
> // reader->Update();
> typedef itk::RGBToLuminanceImageFilter<RGBAImage, ImageUChar2D>
> RGBToLuminanceImageFilter;
> RGBToLuminanceImageFilter::Pointer rgba2gray =
> RGBToLuminanceImageFilter::New();
> rgba2gray->SetInput(rgba->GetOutput());
> rgba2gray->Update();
> typedef itk::HoughTransform2DCirclesImageFilter<unsigned char, float>
> HoughTransformFilterType;
> HoughTransformFilterType::Pointer hough = HoughTransformFilterType::New();
> hough->SetInput(rgba2gray->GetOutput());
> hough->SetNumberOfCircles(1);
> hough->SetMinimumRadius(10);
> hough->SetMaximumRadius(300);
> hough->SetVariance(5);
> hough->SetSigmaGradient(1);
> hough->SetDiscRadiusRatio(2);
> hough->Update();
>
>
> Any ideas? I really need your help. thank you very much !
>
> Best Regards!
>
>
> Jiangtao
> --
> From Jiangtao Li @ Seoul National University
>
> _____________________________________
> 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.html
>
> 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://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list