Pseudocode
PROCEDURE distance(x_0, y_0, x_1, y_1)
c0 <- pixel(x_0, y_0)
c1 <- pixel(x_1, y_1)
acc <- 0
FOR i = 0 .. 2 DO
acc <- (c0_i - c1_i) ** 2
END FOR
d <- sqrt( acc )
return d
END FOR
END FOR
END PROCEDURE
Description
Get the two pixels which will be compared (c0 and c1) based on thier X and Y coordinates in the image. For each component in the pixel, caculate the difference and square it. Sum these squares together and finally calculate the square root of this total.
This approach does not take into account human colour perception.
Ecludian Distance
This is basically calculating the Ecludian distance between the two pixels. This formula is expressed as:
\[\sqrt{ \sum_i{(A_i - B_i)}^2 }\]
Where A and B are the two vectors being considered.
Related Concepts
-
Ecludian Distance
Acknowledgements
Adapted from Pseudocode produced for COMP120 by Dr. Micheal Scott.