function FINDCENTER (image_height, image_width, image, threshold, row, column) return identifies the centroid |
coordinates of a PL region |
inputs: image_height, height of the image |
image_width, width of the image |
image, captured grayscale image |
threshold, lower limit of brightness to identify pixels belonging to PL blob |
row, row coordinate of known pixel belonging to PL blob |
column, column coordinate of known pixel belonging to PL blob |
|
minCol ← column |
maxCol ← column |
While maxCol < image_width AND image[row][maxCol] ≥ threshold |
maxCol ← maxCol + 1 |
minCol ≥ 0 AND image[row][minCol] ≥ threshold |
minCol ← minCol − 1 |
distanceCol ← maxCol – minCol |
centerCol ← minCol + distanceCol/2 |
minRow ← row |
maxRow ← row |
while maxRow < image_height AND image[maxRow][centerCol] ≥ threshold do |
maxRow ← maxRow + 1 |
while minRow ≥ 0 AND image[minRow][centerCol] ≥ threshold do |
minRow ← minRow – 1 |
distanceRow ← maxCol – minCol |
centerRow ← minCol + distanceRow/2 |
return (centerRow, centerCol) |