CITY_BLOCK_CVIP

city_block_cvip() - calculates the city block distance between feature vectors.

Contents

SYNTAX

d =  city_block_cvip( vector1, vector2)

Input Parameters include :

Output Parameter include:

DESCRIPTION

This function calculates the city block or absolute value distance measure from the elements of the two arrays x and y.

The city block distance for two vector x, and y is defined as:

$$|| x - y ||_1 = \sum_{i=1}^n |x_i - y_i|$$

REFERENCE

1. Scott E Umbaugh. DIGITAL IMAGE PROCESSING AND ANALYSIS: Applications with MATLAB and CVIPtools, 3rd Edition.

EXAMPLE

% input vectors

  vector1 = [1 3 4 2];

  vector2 = [-3 3.2 sqrt(2) pi];

% city block distance between two vectors.

  d =  city_block_cvip( vector1, vector2);
  fprintf('city block distance: %d', d);
city block distance: 7.927379e+00

CREDITS

Author: Mehrdad Alvandipour, March 2017
Copyright © 2017-2018 Scott E Umbaugh
For updates visit CVIP Toolbox Website