In: Computer Science
Explain in your own word about the "bwdist" function in MATLAB.
Compare the different between Euclidean, City block, Chessboard, and Quasi-Euclidean in "bwdist" function
ans )
The bwdist function is accociated with the Distance Transform of a Binary Image, which means it calculates the distance between each pixel that is from the 0 to the nearby non-zero image( 1 ) for a input binary image.
*Distance Transform of a Binary Image : distance transform measures the distance between the points in a image.
bwdist function supports metrics like : Euclidean, City block, Chessboard, and Quasi-Euclidean
each of them in detail :
Euclidean :
Euclidean distance is the straight-line distance between two pixels in a given input image.
City block :
measures path between the pixels based on the 4-connected neighbourhood. pixels which are touching edges are considered as 1 uint apart and touching with diagonal are 4 unit .
what is 4-connected and eight connected : ?
the 4- connected neighbourhood means if take one pixel then set
of all pixels which are connected by one common edge, so in a
33
image pixel , if take a centre pixel point then there are 4
adjacent pixels which touches with it, called by 4-connected
8-connected: including the 4-connected pixels and the pixels connecting diagonaly(corners ) , so a total of 8 connected pixels.
Chessboard :
measures the path between pixels on an 8-connected neighbourhood. pixels touching edgewise or corner wise are taken as "1" unit distance apart.
Quasi-Euclidean :
Quasi-Euclidean will measure the total Euclidean distance throughout a path of horizontal, vertical, dioganal of the pixels.