to find length of edges

4 vues (au cours des 30 derniers jours)
christian  bale
christian bale le 10 Jan 2012
is there any function for finding out the length of the edges and average number of edges...?actually i hav to determine the edges using canny edge detection method.So how can i find out the length and average number of edges?
  1 commentaire
Walter Roberson
Walter Roberson le 10 Jan 2012
The number of edges averaged over what?

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 10 Jan 2012
The edge image returned by edge() is a logical image. So to get the length of all the edges, you do
lengthOfEdges = sum(edgeImage);
To get the number of edges:
[labeledImage numberOfEdges] = bwlabel(edgeImage);
To get average edge length (which you didn't ask for but I'm giving you anyway in case you need it), it's
averageEdgeLength = lengthOfEdges / numberOfEdges;
To get the average number of edges you have to define (like Walter asked) what you're averaging over.
  2 commentaires
David Young
David Young le 11 Jan 2012
I think you mean sum(edgeImage(:)) or sum(sum(edgeImage))
Image Analyst
Image Analyst le 11 Jan 2012
Correct - good catch!

Connectez-vous pour commenter.

Plus de réponses (1)

David Young
David Young le 10 Jan 2012
Guessing a little, but I suspect that the following functions will be sufficient:
  • sum
  • bwlabel
  • regionprops
  1 commentaire
christian  bale
christian bale le 12 Jan 2012
thks..

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by