02 cvPutText文字

openCV 的文字指令 cvPutText文字

[PHP]
#include

#include

#include

#include

#include

#include

using namespace cv;

int main(int argc,char **argv)

{

int width,height;

if(argc<=1) { std::cout<<"Error:Please Load a picture!"<建立視窗

namedWindow("image",CV_WINDOW_AUTOSIZE);

//讀取圖片

image=cvLoadImage(argv[1]);

width=image->width;

height=image->height;

CvFont font;

double hScale=1.0;

double vScale=1.0;

int lineWidth=1;

cvInitFont(&font,CV_FONT_HERSHEY_SIMPLEX|CV_FONT_ITALIC, hScale,vScale,0,lineWidth);

cvPutText (image,"www.powenko.com",cvPoint(0,height/2), &font, cvScalar(0,0,255));

cvShowImage("image",image);

waitKey(0);

cvDestroyAllWindows();

cvReleaseImage(&image);

system("pause");

return 0;

}

[/PHP]

1-16

OpenCV
CH01 簡介CH02 OpenCV APICH03 繪圖CH04 應用範例CH06 haarcascadesCH06 surf和siftCH07 OCRCH09 FaceCH5 輪廓(findContours、drawContours)