First time here? Check out the FAQ!

Ask Your Question
0

How to display text on the windows (webcam windows) openCV? [closed]

asked May 20 '14

norzanbzura gravatar image

Actually I want to display a text on the popup windows but I have no idea how to code it. There's anyone can help me? Thanks for your consideration.

Preview: (hide)

Closed for the following reason duplicate question by Martin Peris
close date 2014-05-21 01:54:24.413159

1 answer

Sort by » oldest newest most voted
1

answered May 21 '14

The functions that you need to check out are getTextSize and putText

You have a nice code example under the documentation of getTextSize

I hope this helps you.

Preview: (hide)

Comments

Here is my code, but I've no idea where to put it and how to code it.

include "opencv/highgui.h"

include "opencv/cv.h"

include <opencv/cxcore.h>

include <iostream>

include <stdio.h>

include <stdlib.h>

using namespace cv; using namespace std;

int main(int, char**) { Mat src; Mat src_gray; int thresh = 100; int max_thresh = 255; RNG rng (12345);

cv::Mat frame;
VideoCapture capture;
capture.open(0);

while (true)
{
    capture.read(frame);
    Mat threshold_output;
    vector&lt;vector&lt;Point&gt;&gt; contours;
    vector&lt;Vec4i&gt; hierarchy;

    cvtColor(frame, src_gray, CV_BGR2GRAY); //produce out2, a one-channel image (CV_BUC1)
    blur(src_gray, src_gray, Size(5,5));

    threshold(src_gray, threshold_output, thresh, max_thresh, CV_THRESH_BINARY_INV);

    findContours(threshold_output, contour
norzanbzura gravatar imagenorzanbzura (May 21 '14)edit

Hi norzanbzura, could you please update your question with the code that you just posted? The comment section has a limited number of characters, so we can not see it all. Thanks

Martin Peris gravatar imageMartin Peris (May 21 '14)edit

Hi Martin, I have posted updated question with my full code. Kindly please take a look. Thanks for your consideration.

norzanbzura gravatar imagenorzanbzura (May 21 '14)edit

Question Tools

Stats

Asked: May 20 '14

Seen: 270 times

Last updated: May 20 '14