FEATURE_OBJECTS_CVIP
feature_objects_cvip() - extracts features from a group of objects in a single image and a single image mask for the objects, output is a csv file.
Contents
SYNTAX
final_table = feature_objects_cvip( input_img, mask_img,objLabel, out_file_name,bin_feat,his_feat, rst_feat, tex_feat, spec_feat,varargin)
Input parameters include:
- input_img - The input image for feature extraction. A gray scale or color image.
- mask_img - A 2d mask that has integers assigned to objects and 0 to other areas in the image. It should have the same number of row and columns as the input_img.
- out_file_name - Name of the output file. It can be empty. The output is a CSV file
- bin_feat - A row vector of 8 elements at most, that selects the desired binary features to be extracted. For more details look at binary_feature_cvip.
- his_feat - A row vector of 5 elemets at most,that selects the desired histogram features to be extracted.For more details look at hist_feature_cvip.
- rst_feat - A row vector of 7 elemets at most,that selects the desired rst invariant features to be extracted.For more details look at rst_invariant_cvip.
- tex_feat - A row vector of 20 elemets at most,that selects the desired texture features to be extracted.For more details look at texture_features_cvip.
- spec_feat - A row vector of 2 elemets at most,that determines the number of rings and sectors to be used.
- [optional] - The default values for texDist,quantLvl, statsType,normWidth,normHeight can be overwritten by specifying the new values as optional input arguments. For each of these,first,the name should be given as a string, and then the value,i.e. (..., 'par_name', value) For example:feature_objects_cvip( ... , 'quantLvl', 2)
DESCRIPTION
The function extracts the features from a group of objects present in a single input image and outputs a .CSV file that contains all the extracted features. The objects can be isolated with the use of a mask image that contains '0' in all the elements except where the objects are present. The features extracted depend on the feature selection given as input by the user. The user can select different features from five different feature areas. The function is most useful in Image analysis applications.
REFERENCE
1.Scott E Umbaugh. DIGITAL IMAGE PROCESSING AND ANALYSIS: Applications with MATLAB and CVIPtools, 3rd Edition.
EXAMPLE
% Read image input_img = imread('Stripey.jpg'); % Mask image mask_img = zeros(size(input_img)); mask_img = mask_img(:,:,1); mask_img(50:200,25:95) = 1; mask_img(100:300,255:400) = 2; % Output file name out_file_name = 'sdfsdf'; % Object label objLabel = [1 ;2]; % Binary features row vector 8 elements at most bin_feat = [1 0 1]; % Histogram features row vector 5 elements at most his_feat = [0 1 1]; % RST feature row vector 7 elements at most rst_feat = [1 0 0 1]; % Texture features row vector 20 elements at most tex_feat = [1 0 0 0]; % Spectral features row vector 2 elements at most spec_feat = [0 0]; % Optional texDist,quantLv1,statsType texDist = 4; quantLvl = 2; statsType = [0 0 1]; normWidth = 12; normHeight = 15; % Output feature objects b = feature_objects_cvip( input_img, mask_img,objLabel, out_file_name,bin_feat,his_feat, rst_feat, tex_feat, spec_feat, 'statstype', [1 0 1])
The settings for texture features are as follows: Texture distance = 2 Quantization level = -1 Statistics type = 1 0 1 b = Columns 1 through 5 'obj_id' 'ASM_Avg' 'ASM_Var' 'rst1' 'rst4' [ 1] [ 0.2626] [8.9010e-06] [0.2164] [ 0] [ 2] [ 0.2500] [1.2646e-11] [0.1753] [7.4800e-07] Columns 6 through 10 'Area' 'Centroid_r' 'Centroid_c' 'STD_1' 'STD_2' [10721] [ 125] [ 60] [58.5869] [ 67.1601] [29346] [ 200] [ 328] [80.6615] [100.3378] Columns 11 through 14 'STD_3' 'Skew_1' 'Skew_2' 'Skew_3' [ 72.3852] [-0.5756] [-0.9963] [-1.0611] [113.3581] [-0.6471] [ 0.1495] [ 0.4221]
CREDITS
Author: Mehrdad Alvandipour, March 2017
Copyright © 2017-2018 Scott
E Umbaugh
For updates visit CVIP Toolbox Website