Ask Your Question
0

How to put Chinses into Mat use opencv android sdk

asked 2019-07-01 02:35:21 -0600

liuao gravatar image

How to put Chinese into Mat use opencv android sdk,it always appear garbled

edit retag flag offensive close merge delete

Comments

what are you trying to do ? can you try to explain ? show some code ?

in general, opencv does not support unicode for filenames, putText(), etc, only ascii.

berak gravatar imageberak ( 2019-07-01 04:01:39 -0600 )edit

I just want to write Chinese to Mat use android sdk, likeImgproc.putText(mat, "中文", point, Imgproc.FONT_HERSHEY_COMPLEX, 1, new Scalar(0, 255, 255));,but the text display int the frame is "??",I want to know how to fix the problem,can you help me?

liuao gravatar imageliuao ( 2019-07-02 21:39:21 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2019-07-03 02:16:14 -0600

berak gravatar image

putText() only supports (a small subset of) ascii, no unicode or utf.

it's a debugging facility, not meant to be used for a real program, so it's very limited.

you can (re-) build the opencv android SDK with the freetype module from opencv_contrib, and then use freetype::putText() with chinese encoding, but maybe you also have to look for alternative methods on android here.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-07-01 02:35:21 -0600

Seen: 380 times

Last updated: Jul 03 '19