No subject
Fri Mar 19 13:53:46 EDT 2010
--0016362842429cda510485d0de49
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Dear All,=C2=A0<div><br></div><div><br></div><div>When I use below code to =
save sampled image as a PNG file (RGBA), and then read it again, the Hough =
Circle Filter works!</div><div><br></div><div>I found Hough Filter only sup=
port the image pixel has 4 components, well, if so, I will change my image =
to 4 components first,</div>
<div><br></div><div>I change it back to Gray image by=C2=A0RGBToLuminanceIm=
ageFilter for Hough filter, however, Hough filter gives wrong result again.=
</div><div><br></div><div><br></div><div><div><span class=3D"Apple-tab-span=
" style=3D"white-space:pre"> </span>typedef itk::Image<itk::RGBAPixel&=
lt;unsigned char>> RGBAImage;</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>typ=
edef itk::ComposeRGBAImageFilter<ImageUChar2D, RGBAImage> ComposeRGBA=
ImageFilter;</div><div><span class=3D"Apple-tab-span" style=3D"white-space:=
pre"> </span>ComposeRGBAImageFilter::Pointer rgba =3D ComposeRGBAImageFil=
ter::New();</div>
<div>=C2=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre"> </sp=
an>rgba->SetInput(0, resampler->GetOutput());</div><div><span class=
=3D"Apple-tab-span" style=3D"white-space:pre"> </span>rgba->SetInput(1=
, resampler->GetOutput());</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>rgb=
a->SetInput(2, resampler->GetOutput());</div><div><span class=3D"Appl=
e-tab-span" style=3D"white-space:pre"> </span>rgba->SetInput(3, dup-&g=
t;GetOutput());</div>
<div>=C2=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre"> </sp=
an>rgba->Update();</div><div><br></div><div>// <span class=3D"Apple-tab-=
span" style=3D"white-space:pre"> </span>typedef itk::ImageFileWriter<R=
GBAImage> ImageFileWriter2;</div>
<div>// <span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>=
ImageFileWriter2::Pointer writer =3D ImageFileWriter2::New();</div><div>// =
<span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>writer-&=
gt;SetInput(rgba->GetOutput());</div>
<div>// <span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>=
writer->SetFileName("E:/Resample.png");</div><div>// <span cla=
ss=3D"Apple-tab-span" style=3D"white-space:pre"> </span>writer->Update=
();</div>
<div><br></div><div>// <span class=3D"Apple-tab-span" style=3D"white-space:=
pre"> </span>typedef itk::ImageFileReader<ImageUChar2D> ImageFileRe=
ader;</div><div>// <span class=3D"Apple-tab-span" style=3D"white-space:pre"=
> </span>ImageFileReader::Pointer reader =3D ImageFileReader::New();</div=
>
<div>// <span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>=
reader->SetFileName("E:/Resample.png");</div><div>// <span cla=
ss=3D"Apple-tab-span" style=3D"white-space:pre"> </span>reader->Update=
();</div>
<div><br></div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre=
"> </span>typedef itk::RGBToLuminanceImageFilter<RGBAImage, ImageUChar=
2D> RGBToLuminanceImageFilter;</div><div><span class=3D"Apple-tab-span" =
style=3D"white-space:pre"> </span>RGBToLuminanceImageFilter::Pointer rgba=
2gray =3D RGBToLuminanceImageFilter::New();</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>rgb=
a2gray->SetInput(rgba->GetOutput());</div><div><span class=3D"Apple-t=
ab-span" style=3D"white-space:pre"> </span>rgba2gray->Update();</div><=
div>
<br></div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> =
</span>typedef itk::HoughTransform2DCirclesImageFilter<unsigned char, fl=
oat> HoughTransformFilterType;</div><div><span class=3D"Apple-tab-span" =
style=3D"white-space:pre"> </span>HoughTransformFilterType::Pointer hough=
=3D HoughTransformFilterType::New();</div>
<div><br></div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre=
"> </span>hough->SetInput(rgba2gray->GetOutput());</div><div><span =
class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>hough->SetN=
umberOfCircles(1);</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>hou=
gh->SetMinimumRadius(10);</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span>hough->SetMaximumRadius(300);</div><div><=
span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>hough->=
;SetVariance(5);</div>
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>hou=
gh->SetSigmaGradient(1);</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span>hough->SetDiscRadiusRatio(2);</div><div><=
span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>hough->=
;Update();</div>
</div><div><br></div><div><br></div><div><br></div><div>Any ideas? I really=
need your help. thank you very much !</div><div><br></div><div><br></div><=
div>Best Regards!</div><div><br></div><div><br></div><div><br></div><div>
Jiangtao</div><div><br>-- <br>From Jiangtao Li @ Seoul National University<=
br>
</div>
--0016362842429cda510485d0de49--
More information about the Insight-users
mailing list