perform an erode on this with a 3x3 box of 1's 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 0 0 0 255 255 255 255 255 255 255 0 0 0 255 255 255 255 255 255 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 perform a dilate on this with a 3x3 box of 1's 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 0 0 0 255 255 255 255 255 255 255 0 0 0 255 255 255 255 255 255 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ====== Connected components algorithm on this: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 0 0 0 255 255 255 255 255 255 255 0 0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 255 255 0 255 0 0 255 255 0 0 255 255 0 255 0 0 255 255 0 0 255 255 0 255 0 0 255 255 255 255 255 255 0 0 0 0 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 region with label 3 (the U shaped region) compute: area, centroid, perimeter (4-adjacency), perimeter length Consider the origin to be at top left pixel, increases to right for column numbers (0 to 9) and increases down for row numbers (0 to 10) suppose three histograms: normalize them and then determine which of the h2 or h3 is closer to h1 using L1 distance h1: 150 165 275 300 10 0 200 400 h2: 90 140 175 10 100 85 50 350 h3: 400 450 300 0 0 0 0 0