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.
The test was 2d-array which contained coordinates of black pixels instead of matrix with pixel intensities (values). 0 or 1 for binary spot for example.
I tried to run your codes to find a set of border points in 2D array. My input is 2D array and I directly called function digis1.m However, it generate this error
??? Attempted to access I1(1,3); index out of bounds because size(I1)=[9,2].
Error in ==> cmssn at 14
Error in ==> digis1 at 249
where z is 2D array.
Do you have any idea what's wrong with the code or this testing?
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.