4.0

4.0 | 1 rating Rate this file 16 Downloads (last 30 days) File Size: 40.58 KB File ID: #13662

Spot Border Detection

by Eduard Polityko

 

15 Jan 2007 (Updated 15 Jan 2007)

Spot on image ? get border as numeric array and a number of measurements of a spot and a border

| Watch this File

File Information
Description

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.

Acknowledgements
This submission has inspired the following:
Path Tracing, Measurements, Fragmentation for Doubly-Connected Spot
MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
09 Feb 2007 stef kour  
22 Mar 2007 Rachsuda Jiamthapthaksin

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

>> [x1,y1,varargout]=digis1(z)
??? Attempted to access I1(1,3); index out of bounds because size(I1)=[9,2].

Error in ==> cmssn at 14
 while ~I1(x(i),y(i)+ii)

Error in ==> digis1 at 249
cmssn;

where z is 2D array.

Do you have any idea what's wrong with the code or this testing?

02 Jun 2007 Polityko Eduard

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.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
measurements Eduard Polityko 22 Oct 2008 08:57:01
path tracing Eduard Polityko 22 Oct 2008 08:57:01
border Eduard Polityko 22 Oct 2008 08:57:01
contour Eduard Polityko 22 Oct 2008 08:57:01
mass center Eduard Polityko 22 Oct 2008 08:57:01
image processing Eduard Polityko 22 Oct 2008 08:57:01
image me Eduard Polityko 22 Oct 2008 08:57:01

Contact us at files@mathworks.com