Research Article

LoCoBoard: Low-Cost Interactive Whiteboard Using Computer Vision Algorithms

Algorithm 6

Pseudo code Algorithm A5 adapted from [21, page 57].
function ALGORITHM (image_height, image_width, image, threshold) return centroids’ coordinates of each
identified PL
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
/ recursive function to compute the connected components of a binary image /
LB (−1)threshold(image, threshold)
label 0
for 0 image_height
for 0 image_width
if [L,P] = −1 then
label label + 1
 SEARCH(LB, label, L, P)
 / FINDCENTROID function returns centroid of just labeled region /
 (centroids.row[label], centroids.col[label]) FINDCENTROID(LB, L, P, label)
return (centroids.row, centroids.col)
function SEARCH(LB, label, L, P)
LB[L,P]label
Nset NEIGHBORS(L,P)
for each Nset
LB = −1 then
 SEARCH(LB, label, , )