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&lt;itk::RGBAPixel&=
lt;unsigned char&gt;&gt; RGBAImage;</div>

<div><span class=3D"Apple-tab-span" style=3D"white-space:pre">			</span>typ=
edef itk::ComposeRGBAImageFilter&lt;ImageUChar2D, RGBAImage&gt; 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-&gt;SetInput(0, resampler-&gt;GetOutput());</div><div><span class=
=3D"Apple-tab-span" style=3D"white-space:pre">			</span>rgba-&gt;SetInput(1=
, resampler-&gt;GetOutput());</div>

<div><span class=3D"Apple-tab-span" style=3D"white-space:pre">			</span>rgb=
a-&gt;SetInput(2, resampler-&gt;GetOutput());</div><div><span class=3D"Appl=
e-tab-span" style=3D"white-space:pre">			</span>rgba-&gt;SetInput(3, dup-&g=
t;GetOutput());</div>

<div>=C2=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">			</sp=
an>rgba-&gt;Update();</div><div><br></div><div>// <span class=3D"Apple-tab-=
span" style=3D"white-space:pre">			</span>typedef itk::ImageFileWriter&lt;R=
GBAImage&gt; 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-&gt;GetOutput());</div>

<div>// <span class=3D"Apple-tab-span" style=3D"white-space:pre">			</span>=
writer-&gt;SetFileName(&quot;E:/Resample.png&quot;);</div><div>// <span cla=
ss=3D"Apple-tab-span" style=3D"white-space:pre">			</span>writer-&gt;Update=
();</div>

<div><br></div><div>// <span class=3D"Apple-tab-span" style=3D"white-space:=
pre">			</span>typedef itk::ImageFileReader&lt;ImageUChar2D&gt; 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-&gt;SetFileName(&quot;E:/Resample.png&quot;);</div><div>// <span cla=
ss=3D"Apple-tab-span" style=3D"white-space:pre">			</span>reader-&gt;Update=
();</div>

<div><br></div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre=
">			</span>typedef itk::RGBToLuminanceImageFilter&lt;RGBAImage, ImageUChar=
2D&gt; 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-&gt;SetInput(rgba-&gt;GetOutput());</div><div><span class=3D"Apple-t=
ab-span" style=3D"white-space:pre">			</span>rgba2gray-&gt;Update();</div><=
div>

<br></div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">			=
</span>typedef itk::HoughTransform2DCirclesImageFilter&lt;unsigned char, fl=
oat&gt; 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-&gt;SetInput(rgba2gray-&gt;GetOutput());</div><div><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">			</span>hough-&gt;SetN=
umberOfCircles(1);</div>

<div><span class=3D"Apple-tab-span" style=3D"white-space:pre">			</span>hou=
gh-&gt;SetMinimumRadius(10);</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre">			</span>hough-&gt;SetMaximumRadius(300);</div><div><=
span class=3D"Apple-tab-span" style=3D"white-space:pre">			</span>hough-&gt=
;SetVariance(5);</div>

<div><span class=3D"Apple-tab-span" style=3D"white-space:pre">			</span>hou=
gh-&gt;SetSigmaGradient(1);</div><div><span class=3D"Apple-tab-span" style=
=3D"white-space:pre">			</span>hough-&gt;SetDiscRadiusRatio(2);</div><div><=
span class=3D"Apple-tab-span" style=3D"white-space:pre">			</span>hough-&gt=
;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