2.3.1의 opencv_tutorials.pdf 파일에 들어있는 예제이다.
$ cat opencv_font.c #include "opencv/cv.h"
#include "opencv/highgui.h"
int main ( int argc, char **argv )
{
cvNamedWindow( "My Window", 1 );
IplImage *img = cvCreateImage( cvSize( 640, 480 ), IPL_DEPTH_8U, 1 );
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( img, "Hello World!", cvPoint( 200, 400 ), &font, cvScalar( 255, 255, 0 ) );
cvShowImage( "My Window", img );
cvWaitKey();
return 0;
}
|
| $ gcc -lhighgui -lcv opencv_font.c
opencv_font.c: In function ‘main’:
opencv_font.c:12: error: too few arguments to function ‘cvInitFont’
opencv_font.c:14: error: too few arguments to function ‘cvScalar’
opencv_font.c:16: error: too few arguments to function ‘cvWaitKey’ |
gcc로 하면 에러가 나니 g++로 바꾸어서 컴파일 해준다.
| $ g++ -lhighgui -lcv opencv_font.c $ ./a.out |
좌표계는 좌측 상단이 (0,0)인듯 하다.
'Programming > openCV' 카테고리의 다른 글
| opencv2 on ubuntu (2) | 2013.11.10 |
|---|---|
| openCV Mat / iplImage (0) | 2012.02.21 |
| Cmake로 openCV 컴파일 설정 및 설치하기 (0) | 2012.02.12 |
| ubuntu opencv 패키지 버전 정보 (0) | 2012.02.12 |
| 우분투에서 openCV 카메라 영상받기 예제 (0) | 2012.02.04 |