I need to detect contour (object) and find the perimeter of a detected object.
For example, I have the following image:
All images are binary, so they consist of only 0
and 1
.
I need to firstly detect objects, and then find the perimeter of the object contour, the area will be known I guess because this is just the sum of all object pixels.
I am using 4-pixel coherence while finding objects.
I have found some algorithms, but cannot figure out how they work and how to implement them if I have an array of 1 and 0.
Please, can someone provide explanation or code example of the easiest to understand the algorithm.
I need to do this without using OpenCV
or any other library.
Here is what you can do: