# MATLAB CVIP Toolbox Functions ## Pattern Classification: Distance/Similairty Metrics

The pattern classification functions provide a valuable tool for the development of computer vision algorithms. It is a large group with separate function categories for feature extraction, distance and similarity metrics, data normalization, and the classification algorithms. In general there are two types of functions – those that operate on individual objects or individual feature vectors and those that operate on groups of images, objects or feature vectors. The higher level functions that operate on groups use matrices, or comma separated value (csv) files, to pass information between functions. The format of the csv files is similar to the CVIPtools feature files (for details see the Help documentation).

The feature functions available include binary object (shape) features, histogram features, texture features and spectral features. City block, Euclidean, maximum value, and Minkowski distance metrics as well as Tanimoto and vector inner product similarity metrics are available for comparison of feature vectors. For data normalization we include min-max, standard normal density (SND), range based, softmax scaling and unit vector normalization, or the user can opt to perform no data normalization. The pattern classification methods we include are the basic methods: nearest neighbor, K nearest neighbor and nearest centroid. Note that MATLAB has a variety of related functions of interest that can be used in conjunction with our functions. Neural networks, support vector machines, genetic learning algorithms and many others are available for pattern classification, depending on the other toolboxes that are installed.

• city_block_cvip - calculates the city block distance between two feature vectors
• euclidean_distance_cvip - calculates the Euclidean distance between two feature vectors
• maximum_value_metric_cvip - calculates the maximum value distance between two feature vectors
• minkowsi_distance_cvip - calculates the Minkowski distance between two feature vectors
• pattern_city_block_cvip - takes two csv files as input, test and training set, then calculates the city block distance metric by comparing each vector in the test set to each in the training set
• pattern_euclidean_cvip - takes two csv files as input, test and training set, then calculates the Euclidean distance metric by comparing each vector in the test set to each in the training set
• pattern_maximum_cvip - takes two csv files as input, test and training set, then calculates the maximum value distance metric by comparing each vector in the test set to each in the training set
• pattern_minkowski_cvip - takes two csv files as input, test and training set, then calculates the minkowski distance metric by comparing each vector in the test set to each in the training set
• pattern_tanimoto_cvip - takes two csv files as input, test and training set, then calculates the Tanimoto similarity metric by comparing each vector in the test set to each in the training set
• pattern_vector_inner_product_cvip - takes two csv files as input, test and training set, then calculates the normalized vector inner product metric by comparing each vector in the test set to each in the training set
• tanimoto_metric_cvip - calculates the Tanimoto similarity metric between two feature vectors
• vector_inner_product_cvip - calculates the normalized vector inner product similarity metric between two feature vectors