[Insight-users] Sobel operator gives fat edges

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Mar 14 09:59:40 EDT 2012


I would also suggest looking at the ZeroCrossingBasedEdgeDetectionImageFilter. This extracts where the laplacian of the image crosses zero.


On Mar 14, 2012, at 4:22 AM, Sergio Vera wrote:

> 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
> _____________________________________
> 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

========================================================
Bradley Lowekamp  
Medical Science and Computing for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120314/75e49d63/attachment.htm>


More information about the Insight-users mailing list