How to use other font than HERSHEY with cvPutText and cvfontQt (Bug #4155)


Added by ankita gawde about 10 years ago. Updated about 10 years ago.


Status:Done Start date:2015-01-29
Priority:High Due date:
Assignee:- % Done:

100%

Category:highgui-images
Target version:2.4.11
Affected version:2.4.0 - 2.4.8 Operating System:Windows
Difficulty:Hard HW Platform:x86
Pull request:

Description

i want to use arial font to write a text on am image for which i am using cvfontqt the code works gud with its default font and cvputtext but it throws this error: 'cvAddText' : cannot convert parameter 4 from 'CvFont' to 'CvFont *'

i tried searching this on web bt couldnt not find any help

code:

IplImage* src=cvLoadImage("C:\images1.jpg");

CvFont font = cvFontQt("Arial",-1,cvScalarAll(0),CV_FONT_NORMAL,CV_STYLE_NORMAL,0);

cvAddText( src,"Hello world", cvPoint(1,1),font);


Associated revisions

Revision d0c43f16
Added by Vadim Pisarevsky over 9 years ago

Merge pull request #4155 from MSOpenTech:highgui_contrib

History

Updated by Paarth Neekhara about 10 years ago

That's an error in your code. cvAddText takes parameter as a pointer to CvFont. Change the last line to:

cvAddText( src,"Hello world", cvPoint(1,1), &font);

This would work.

  • % Done changed from 0 to 100
  • Status changed from New to Done

Updated by Steven Puttemans about 10 years ago

Why do you keep using ancient and depricated C API?
Use the C++ interface and all your headaches will be gone!

Also available in: Atom PDF