Search code examples
matlabimage-processingedge-detection

Counting the edge points of an image in Matlab


I have detected the edge points of an image as shown in the following image: enter image description here

then i have divided the image into different blocks of the same size as shown here: enter image description here

Now what i want is to count the number of edge points in every image block.

Can someone please let me know how to do that

your assistance is much appreciated


Solution

  • assuming that by the edge points you mean white pixels, on black backround, you can do something along these lines:

       % some random block, simulating your case
    >> a_blk = rand(10,5)-0.5;
       % edge pixels are greater than 0 (as a assume).
    >> sum(sum(a_blk>0))