hel
hello , im trying to recover the coordination of a detected target and print it , im not expert in openCV neither C++ , this is my first code and i really need you're help , here's the code:
#include "stdafx.h"
#include <highgui.h>
#include <opencv2/video/background_segm.hpp>
#include<opencv2/opencv.hpp>
#include<vector>
#include<opencv2\imgproc\imgproc.hpp>
#include <cv.h>
#include <ostream>
#include<ostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
std::vector<std::vector<cv::Point> > contours;
cv::BackgroundSubtractorMOG2 bg;
bg.bShadowDetection=false;
cv::Mat frame;
cv::Mat fore;
cv::Mat back;
CvCapture* capture = cvCaptureFromCAM(0); // capture from video device
cvNamedWindow("Orignal", CV_WINDOW_AUTOSIZE); // create a window to display the images
cvNamedWindow("Processed", CV_WINDOW_AUTOSIZE); // create a window to display the images
while(1) {
frame=cvQueryFrame(capture); // Grabs and returns a frame from a
cv::cvtColor(frame,fore,CV_BGR2GRAY);
cv::erode(fore,fore,cv::Mat());
cv::dilate(fore,fore,cv::Mat());
cv::imshow("Orignal",frame);
cv::imshow("Processed",fore);
if(cvWaitKey(10)==27) // to exit the loop using ESCP
break;
}
return 0;
}
so the detected object is in fore matrix , i need to get its X,Y position printed out .. is it possible ?