Statistical Object Features Jin Tao Introduction w We
Statistical Object Features - Jin, Tao
Introduction w We have modified the image from the lowest level of pixel data into higher-level representations, using image segmentation and transforms. w Image segmentation allows us to look at object features. w Object features include the geometric properties of binary objects, histogram features, and color features.
Geometric Object features w To extract object features, we need an image that has undergone image segmentation and any necessary morphological filtering. This will provide us with clearly defined objects, which can then be labeled and processed independently. w Labeled image is used to extract the features of interest. w The binary object features include area, center of area, axis of least second moment, perimeter, Euler number, projections, thinness ratio, and aspect ratio. w Area, center of area, axis of least second moment, perimeter tell us something about where the object is. The other four tell about the shape of the objects.
Area w The area Ai is measured in pixels and indicates the relative size of the object. Ai = ΣΣ Ii(r, c) (0 <= r, c <= N-1) Where: Ii(r, c) = 1 0 if I(r, c) = ith object otherwise
Center of area w We define the center of area for an object by the pair (ri, ci) ri = (ΣΣ r. Ii(r, c) )/Ai (0 <= r, c <= N-1) ci = (ΣΣ c. Ii(r, c) )/Ai (0 <= r, c <= N-1) (sum of the r, c value of all the pixels divides the number of pixels) w Theses correspond to the row coordinate of the center of area for the ith object ri, and the column coordinate of the center of area for the ith object ci. w This feature will help to locate an object in the twodimensional image plan.
Axis of Least Second Moment w The axis of least second moment provides information about the object’s orientation w This axis corresponds to the line about which it takes the least amount of energy to spin an object of like shape. w If we move the origin to the center of area (r, c), the axis of least second moment is defined as: tan(2θi) = 2 ΣΣrc. Ii(r, c)/(ΣΣr 2 Ii(r, c) - ΣΣc 2 Ii(r, c))
Axis of Least Second Moment(2) center c θ r Axis of least second moment
Perimeter w The perimeter of the object can help us to locate in in space and provide information about the shape of the object. w The perimeter can be found in the original binary image by counting the number of ‘ 1’ pixels that have ‘ 0’ pixels as neighbors. w Or it can be found by applying an edge detector to the object, followed by counting the ‘ 1’ pixels. Finding the ‘area’ of the border.
Matlab - imfeature w Matlab image processing toolbox provides the imfeature function stats=imfeature(L, measurements) w L: labeled binary image w Measurement: name of the features w Output: struct array with fields. 80 x 1 struct array with fields: Area Centroid Bounding. Box Major. Axis. Length Minor. Axis. Length Eccentricity Orientation Convex. Hull Convex. Image Convex. Area Image Filled. Area Euler. Number Extrema Equiv. Diameter Solidity Extent Pixel. List
Experiment – Get labeled binary image I=imread('rice. tif'); figure('Name', 'Original image'), imshow(I) I=im 2 double(I); bkg=blkproc(I, [32, 32], 'min(x(: ))'); bkg=imresize(bkg, [256, 256], 'biliniear'); I 2 = I - bkg; I 2 = max(min(I 2, 1), 0); I 3 = imadjust(I 2, [0 max(I 2(: ))], [0 1]); % apply thresholding to the image bw = I 3>0. 2; % label components [L, num. Obj] = bwlabel(bw, 4); map = hot(num. Obj+1); %create a colormap figure('Name', 'labeled binary image'), imshow(L+1, map);
Experiment – Extract object features % Compute feature measurements of objects in the image Feature. Data = imfeature(L, 'all'); Feature. Data = 80 x 1 struct array with fields: Area Centroid Bounding. Box Major. Axis. Length Minor. Axis. Length Eccentricity Orientation Convex. Hull Convex. Image Convex. Area Image Filled. Area Euler. Number Extrema Equiv. Diameter Solidity Extent Pixel. List
Experiment - Area Array = [Feature. Data. Area]; Min = min(Array); Max = max(Array); Mean = mean(Array); Std = std(Array); figure('Name', 'histogram for area'), hist(Array, 20); idx = find(Array < (Mean-Std)); L 2 = ismember(L, idx); L 2 = I. *L 2; figure('Name', 'Objects below mean-std : area'), imshow(L 2); idx = find(Array > (Mean+Std)); L 2 = ismember(L, idx); L 2 = I. *L 2; figure('Name', 'Objects above mean+std : area'), imshow(L 2); idx = find((Array < (Mean+Std)) & (Array > (Mean-Std))); L 2 = ismember(L, idx); L 2 = I. *L 2; figure('Name', 'Objects between mean-std and mean+std : area'), imshow(L 2);
Experiment – Area(cont. )
Experiment - centroid Array = [Feature. Data. Centroid]; Array = reshape(Array, 2, num. Obj); Min = [min(Array(1, : )); min(Array(2, : ))]; Max = [max(Array(1, : )); max(Array(2, : ))]; Mean = [mean(Array(1, : )); mean(Array(2, : ))]; Std = [std(Array(1, : )); std(Array(2, : ))]; figure('Name', 'histogram for Centroid. row'), hist(Array(1, : ), 20); figure('Name', 'histogram for Centroid. col'), hist(Array(2, : ), 20); [row, col] = find( (Array(1, : ) < (Mean(1, 1)-Std(1, 1))) & (Array(2, : ) < (Mean(2, 1)-Std(2, 1)))); L 2 = ismember(L, col); L 2 = I. *L 2; figure('Name', 'Objects below mean-std : Centroid'), imshow(L 2); [row, col] = find( (Array(1, : ) > (Mean(1, 1)+Std(1, 1))) & (Array(2, : ) > (Mean(2, 1)+Std(2, 1)))); L 2 = ismember(L, col); L 2 = I. *L 2; figure('Name', 'Objects above mean+std : Centroid'), imshow(L 2); [row, col] = find( (Array(1, : ) > (Mean(1, 1)-Std(1, 1))) & (Array(2, : ) > (Mean(2, 1)-Std(2, 1))) &. . . (Array(1, : ) < (Mean(1, 1)+Std(1, 1))) & (Array(2, : ) < (Mean(2, 1)+Std(2, 1)))); L 2 = ismember(L, col); L 2 = I. *L 2; figure('Name', 'Objects between mean-std and mean+std : Centroid'), imshow(L 2);
Experiment – centeroid(cont. )
Experiment – Axis of least second moment Array = [Feature. Data. Orientation]; Min = min(Array); Max = max(Array); Mean = mean(Array); Std = std(Array); figure('Name', 'histogram for Orientation'), hist(Array, 20); idx = find((Array < 0) & (Array > -90)); L 2 = ismember(L, idx); L 2 = I. *L 2; figure('Name', 'Objects between -90 to 0 degree'), imshow(L 2); idx = find((Array > 0) & (Array < 90)); L 2 = ismember(L, idx); L 2 = I. *L 2; figure('Name', 'Objects between 0 and 90 degree'), imshow(L 2); idx = find((Array < 180) & (Array > 90)); L 2 = ismember(L, idx); L 2 = I. *L 2; figure('Name', 'Objects between 90 and 180 degree'), imshow(L 2);
Experiment – axis of least second moment(cont. ) Note: The orientation of imfeature is different with the text book, and the value is in degree.
- Slides: 17