Image processing toolbox- bwtraceboundary function

1 view (last 30 days)
I have a figure for which i have to trace all the boundaries. I shall phrase my question into two parts 1) I want to run bwtraceboundary in the figure and automatically get information about all the boundaries. While doing this in a loop, the problem i faced was that one direction specified in the function (say north)is not sufficient to cover the entire figure and in the middle of the loop i get the following error
"??? Error using ==> bwtraceboundarymex The boundary trace failed to terminate correctly. The problem may have been caused by specifying an initial step direction that was inconsistent with the trace direction. Try specifying the trace direction explicitly."
So my question is how can i apply bwtraceboundary to get all the boundaries in the figure automatically without intervention.
2) I have applied a few other functions from bwmorph to make the figure better for bwtraceboundary, for ex- endpoints and remove. But in this process i am having some points whose boundary does not form a loop. Will this create some problem? In the case when i dont use bwmorph the figures are worse as compared to when i use them.
I hope i can get an answer mainly to my first question.
Thank you very Much, Karthik IIT Madras

Answers (1)

Steve Eddins
Steve Eddins on 14 Feb 2011
For question 1, use bwboundaries instead of bwtraceboundary. The function bwboundaries is intended to automatically trace all boundaries in a figure without intervention.
  1 Comment
Meagan
Meagan on 10 Mar 2011
I would like to know if there is a way to use bwtraceboundary such that it does not matter which direction the function needs to go.
I also want to use this function to find the information about all of my boundaries, but I then take the specific boundary locations and further analyze them, so the format in which bwboundaries comes back does not work for me. Is there a way to specify in bwtraceboundary that if, for example, 'E' does not work, then try 'SE', or something to that effect? Thanks.

Sign in to comment.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!