MATLAB Answers

0

edge & non-edge pixels

Asked by matlab_image on 31 Aug 2012
Latest activity Commented on by Ram
on 23 Feb 2016
How to find total no. of edge and non-edge pixels from any edge detected image. I am finding no. of edge images with nnz(img) method. Is this right way? If yes then tell me how to count non-edge pixels & If not then tell me about both.. Thanks in advance.

  0 Comments

Sign in to comment.

Products

1 Answer

Answer by Kevin Moerman on 31 Aug 2012
Edited by Kevin Moerman on 31 Aug 2012
 Accepted Answer

If img is a logic say where ones define edge pixels and zeros define non-edge pixels then you are correct nnz(img): counts the number of non-zero entries and therefore the number of edge pixels this would be equivalent to say: sum(img(:)) If img is a logic then you can also count the non-edge pixels using the nnz command, e.g. : nnz(~img) Where ~ is NOT. Another method would be to say that the non-edge pixels are simply: numel(img)-nnz(img) I.e. the number of elements (all) minus the edge pixels.
Good luck,
Kevin

  2 Comments

matlab_image on 4 Sep 2012
thanks a lot.......
Ram
on 23 Feb 2016
what are edge pixels in a image ? how to find edge pixels for a given image

Sign in to comment.