Ask Your Question
0

how can i put text on image using opencv puttext function

asked 2016-02-08 01:59:14 -0600

Zulfi gravatar image

updated 2016-02-09 07:54:39 -0600

hello guys

I am working on visual studio 2010 and opencv-2.4.9 and i want to put unicode text on image using puttext function but puttext function not working properly with unicode text(japanease,arabic etc) and dispaly text on image as"??????" but puttext() with english text work properly.

code snippet:

cv::Mat m=img;  

cv::putText(m,"名前",cv::Point((m.cols/2,m.rows/2),cv::FONT_ITALIC,.5,cv::Scalar(180,180,180),1,CV_AA);
please help me for showing unicode text on image

your help will be appreciated. thanks

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2016-02-08 02:08:21 -0600

berak gravatar image

the short answer is: you can't.

putText only supports a small ascii subset, not unicode or utf characters.

if you need that, you will have to build your own bitmap font renderer (or even display pre-rendered images for your words)

edit flag offensive delete link more

Comments

Is there any function in opencv for unicode utf text

Zulfi gravatar imageZulfi ( 2016-02-08 02:12:53 -0600 )edit
1

again, NO. (unfortunately)

berak gravatar imageberak ( 2016-02-08 02:18:45 -0600 )edit

Just want to tell you, that when building software using a universal library, it is best to keep your names, variables, and such to the language of the package. If by any means, you run into problems later on, then nobody will help if your code is cramped with non english content.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-09 08:00:22 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-02-08 01:59:14 -0600

Seen: 5,391 times

Last updated: Feb 09 '16