Blob tracking?


I just started to use OpenFrameworks and am a total newbie to both programming and OF. So I am in a desperate need for some help! :slight_smile:

So I am doing a project where I need to track 4 IR lights with a ir-webcam that are in the corners of a square formed cardboard. I changed the openCV example so it is sending x and y coordinates to OSC but the tracked points keep jumping back and forth.
I somehow have to decide the positions of the blobs so that the right corner will be used for the right IR-led and thus building the square form.

I was thinking about doing this with telling the program that:

point1x > point3x and point4x.
point1y > point2y

pint2x > point3x and point4x
point2x < point2y

and so on…

I don’t really know how to write this or if there is a better way, i know that this would flip the image if the cardboard was turned around and that is not really what I want.

Anyone out there that could help me write the code or point me in the right direction?