Object contour technique

In this tutorial, I would like to give a short guide for traversing contour. Below is figure of image and show how to start traversing.

Traverse on image until it  meets first pixel which has desired intensity.
Start checking and traversing neighbor pixels.

Traverse neighbor pixels in clockwise,
Entry direction was calculated from direction between previous point and current point.
Let take a look for first 4 steps in traversing. Red arrow is entry direction
Next step, you will know how to determine entry direction
Pink arrow is direction between previous and current point
Direction entry will be perpendicular to  pink arrow. Base on this rule, we will get next step at following:
I will show you more specific about entry direction at next example
Traversing on image will be terminated if following conditions occurs
+ When start point is same to last point.
+ When there is not any pixel which belongs to neighbor pixels has same intensity.

Comments