[Insight-users] Sobel operator gives fat edges
Sergio Vera
sergio.vera at alma3d.com
Wed Mar 14 04:22:04 EDT 2012
Have you tried CannyEdge Detection Filter? Canny always returns the
thinnest edges.
Hope to help Regards
On Wed, Mar 14, 2012 at 2:59 AM, Emma Ryan <eryanvtk at yahoo.com> wrote:
>
> Hi ,
>
> I am using the sobelOperator provided in itk. The following is my code
> snippet. I would like to understand
>
> 1. the default setting of the sobel and
> 2. how I can tune it. There dont seem to be too many member functions to
> manipulate the sobel.
> 3. If I need to use Erosion filter to thin the edges, how do I design a
> 'line' structuring element. My code ( also added below) does not seem to
> allow line (which I am guessing derives from Box, line = 1-D Box)
>
> Any help/suggestions is truly appreciated.
>
> Thank you,
> Emma
>
>
> typedef itk::ConstNeighborhoodIterator<ImageType> NeighborhoodIteratorType;
> typedef itk::ImageRegionIterator< ImageType> IteratorType;
>
> itk::SobelOperator<PixelType, 2> sobel;
> sobel.SetDirection(1);
> itk::Size<2> radius_s;
> radius_s.Fill(1);
> sobel.CreateToRadius(radius_s);
>
>
> NeighborhoodIteratorType::RadiusType radius = sobel.GetRadius();
> NeighborhoodIteratorType it( radius, my_image,
> my_image->GetRequestedRegion() );
> itk::NeighborhoodInnerProduct<ImageType> inner_product;
>
> ImageType::Pointer output = ImageType::New();
> output->SetRegions(my_image->GetRequestedRegion());
> output->Allocate();
>
> IteratorType out(output, my_image->GetRequestedRegion());
>
> for (it.GoToBegin(), out.GoToBegin(); !it.IsAtEnd(); ++it, ++out)
> {
> out.Set( inner_product( it, sobel ) );
> }
>
> output->Update();
>
>
> //Erosion Structuring Element: The following fails to compile if I use '1'
> instead of '2'
> typedef itk::FlatStructuringElement<2> StructuringElementType;
> StructuringElementType::RadiusType element_radius;
> element_radius.Fill(5);
>
> StructuringElementType strel =
> StructuringElementType::Box(element_radius);
>
> _____________________________________
> 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://www.itk.org/mailman/listinfo/insight-users
>
>
--
Sergio Vera
Alma IT Systems
C/ Vilana, 4B, 4º 1ª
08022 Barcelona
T. (+34) 932 380 592
www.alma3d.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120314/3decd5bc/attachment.htm>
More information about the Insight-users
mailing list