A collection of files for path tracing is intended for detecting an external border of spot ? 1-connected black pixels set.
A c c e p t data: a file with an image or an appropriate array.
O u t p u t: two integer arrays with coordinates of spot border pixels.
In order to find a first point of spot border (starting pixel) we move from left upper pixel along first column until value of matrix element not equals zero. If no zero element in the first column then repeat detecting for second one and so on. Then we move along a border clockwise. It means that we move along black pixels and must always have a white pixel on the left hand.
Other o u t p u t s:
coordinates (position in input array) of points of optimal location (centers of mass) for a spot and for spot border (the mass of each pixel are supposed to be all equal with each other). Optimal location means that sum of distances from all points under consideration to this point is minimal;
border length as count of external edges of border pixels;
perimeter as length of line connected centers of border pixels;
coordinates (position in output arrays) of the most remote pixels and distance between them;
count of black pixels of spot and its border;
coordinates of ends of diagonal of minimal rectangle which includes a spot (sides of rectangle are supposed to be parallel to axes).
If a spot has ?rays? ? one pixel width lines connected with border you will be suggested delete it by virtue of a special procedure. This procedure doesn't delete vertices of polygons as it does ?spur? option of bwmorf function of Image Processing Toolbox. Time of path tracing significantly increases.
The application could be used in image processing, image recognition, measurements etc. and doesn?t use an Image Processing Toolbox.
Eduard Polityko (2021). Spot Border Detection (https://www.mathworks.com/matlabcentral/fileexchange/13662-spot-border-detection), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!