this is great . thank you
code works perfect . easily can change the red color to green or blue by changing 1 to 2(green) or 3 in :
i had a problem in objects were far from cam to recognize, which solved by reducing the number in :
diff_im = bwareaopen(diff_im,600);
still don't know how to extract the coordinates and save them ??