Ask Your Question
2

Why is my call to putText creating a wavy image of lines?

asked 2012-09-13 14:33:02 -0600

ZachTM gravatar image

updated 2012-09-14 01:57:34 -0600

Andrey Pavlenko gravatar image

I have the following code trying to display the letter A on a window:

Mat letter = Mat(80,60,CV_8UC1);
putText(letter,"A",Point(0,0),CV_FONT_HERSHEY_PLAIN,8,Scalar(255,255,255));
namedWindow("Display",CV_WINDOW_NORMAL);
imshow("Display",letter);
imwrite("A.jpg",letter);
cvWaitKey(0);

That outputs this: image description

I do not understand what is going wrong can anyone tell me? I would really appreciate it!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
4

answered 2012-09-13 15:16:07 -0600

AgentCain gravatar image

updated 2012-09-13 16:41:15 -0600

I would guess that these lines are just "memory garbage" since you dont load any kind of image on Mat letter. Also if im not mistaken, Point(0,0) is the upper left corner of the image (1st cell of a 2D matrix so its the upper-left-most cell) and it points to the lower left corner of your string "A" (so actually your letter "A" resides somewhere off the borders of the Mat)

Try Point (40,30) and then position it accordingly (since its more or less dead center)

edit flag offensive delete link more

Comments

THanks you were right!

ZachTM gravatar imageZachTM ( 2012-09-13 15:46:26 -0600 )edit

Question Tools

Stats

Asked: 2012-09-13 14:33:02 -0600

Seen: 496 times

Last updated: Sep 14 '12