Red spot in image - position to be detected later |
Input image :
This image has a red colored spot. And our objective is to track the position coordinate of the spot in image.The example below uses thresholding in HSV space and simple moment calculations given in OpenCV library.
You can use this code to track an object in a video sequence - say live web-cam capture video.
- The code for capturing webcam using JavaCV is here.
- Help on Configuring a JavaCV project in Eclipse+windows is here.
Detecting Position of a spot in Threshold image:
static Dimension getCoordinates(IplImage thresholdImage) {
int posX = 0;
int posY = 0;