Ask Your Question

OpenCV, non specific text

asked 2012-10-13 13:35:48 -0500

stefanosarta gravatar image

updated 2012-10-13 13:36:18 -0500

   CvSeq* circles = cvHoughCircles(tempFrame, storage, CV_HOUGH_GRADIENT, 1, tempFrame->height/4, 50, 50, 20, 75);
    for (size_t i = 0; i < circles->total; i++)
     // round the floats to an int
     float* p = (float*)cvGetSeqElem(circles, i);
 cv::Point center(cvRound(p[0]), cvRound(p[1]));

     int radius = cvRound(p[2]);
     cvCircle(pFrame, center, 3, CV_RGB(0,255,0), -1, 8, 0 );//Ζωγράφισε το κέντρο του κύκλου.
     cvCircle(pFrame, center, radius+1, CV_RGB(0,0,255), 2, 8, 0 );//Ζωγράφισε το περίγραμμα του κύκλου.
 if (center.y == 240 )
 printf("x: %d y: %d r: %d t: %d\n",center.x,center.y, radius,t);

 CvFont font;
     cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX, 1.0, 1.0, 0, 1, CV_AA);
 cvPutText(pProcessedFrame, "blabla", cvPoint(10, 130), &font, cvScalar(255, 255, 255, 0));

    cvShowImage("WebCam", pFrame);//Εμφάνισε τα κανονικά frame στο παράθυρο αυτό
    cvShowImage("Processed WebCam", pProcessedFrame);//Δείξε τα επεξεργασμένα frame στο παράθυρο αυτό.

    keypress = cvWaitKey(20);//Περίμενε 20 msec.
    if (keypress == 27)//Άλλαξε το flag σε quit αν πατηθεί το πλήκτρο escape.
        quit = true;
    }} //Τέλος του while

Hello guys, i believe this question isn't that hard but for some reason i cant seem to find any answers on the internet. Maybe i am not doing some good research.

I am having a counter(integer) on my program which is the one named t. It changes from time to time according to some camera interactions i am doing. I just want this to be shown in the video result, the one named pProcessedFrame.

Command cvPutText that i am including here, doesnt work for me because it can only show specific text. I want it to change from time to time like i mentioned before.

Any other command i am not aware of?

edit retag flag offensive close merge delete



Your comments are very suggestive, especially for those of us who've seen greek letters only in physics forumulas...

sammy gravatar imagesammy ( 2012-10-14 06:06:59 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2012-10-15 01:26:35 -0500

Vladislav Vinogradov gravatar image

You can use sprintf:

char buf[100];
sprintf(buf, "Frame [%d]", t);
cvPutText(pProcessedFrame, buf, ...);
edit flag offensive delete link more

Question Tools


Asked: 2012-10-13 13:35:48 -0500

Seen: 261 times

Last updated: Oct 15 '12