We need a Test Forum!
ratronic
Posts: 1,451
I found my test page!!
ratronic wrote:testing
/* track largest red object and send serial screen location/area */ #include /* 110x80 video A = live video plus text info and tracking square, video B = binary masked objects */ #include #include using namespace cv; using namespace std; int main() { VideoCapture capture(0); int fd(serialOpen("/dev/ttyAMA0", 115200)); int big, fps; Mat image, imgCopy, hsv, thresh, threshCopy; stringstream ss; namedWindow("A"); namedWindow("B"); moveWindow("A", 0, 100); moveWindow("B", 200, 100); while(1) { int t = (int)getTickCount(); capture >> image; resize(image, image, Size(200, 140)); image.copyTo(imgCopy); // blur(image, image, Size(4, 4)); cvtColor(image, hsv, CV_BGR2HSV); inRange(hsv, Scalar(0, 40, 40), Scalar(3, 255, 255), thresh); thresh.copyTo(threshCopy); vector contours; vector hierarchy; findContours(thresh, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0)); vector mu(contours.size()); int maxArea = 0; for (unsigned int cnt(0); cnt < contours.size(); cnt++) { int area = contourArea(contours[cnt]); mu[cnt] = moments(contours[cnt], false); if (area > maxArea) { maxArea = area; big = cnt; } }test1
Comments
Or a forum test, or so?
Mike