Ask Your Question
0

putText: multiple lines?

asked 2013-11-28 13:02:32 -0600

Aiya gravatar image

updated 2013-11-28 13:09:58 -0600

Can I use newline characters in cv::putText to write multiple lines on an image? My \n characters are not recognized.

Sample Code: std::string outputText = "Left \n Right \n"; cv::putText(imageOutput, outputText, cvPoint(30, 20), cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0,0,0));

My final image ends up with the following text on one line: Left ? Right ?

I'm using Mac OS X Mavericks, OpenCV 2.4.5, xCode

Thanks!

edit retag flag offensive close merge delete

Comments

1

AFAIK it doesn't work. You know the font size so you can easily split it up with two putText() commands.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-28 14:15:45 -0600 )edit
1

Thanks. That's what I was thinking. I was just hoping there was a cleaner way to do this since I have about 10 lines to write.

I had found this post about newline (\n) characters, but I guess it hasn't yet been implemented (see the response by OpenCV in the comments).

https://github.com/Itseez/opencv/pull/313

Aiya gravatar imageAiya ( 2013-11-29 08:29:36 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-09-09 02:52:38 -0600

i have a very simple solution for this specific problem, you can check that out: https://gist.github.com/imneonizer/b6...

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-11-28 13:02:32 -0600

Seen: 13,427 times

Last updated: Nov 28 '13