First time here? Check out the FAQ!

Ask Your Question
2

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

asked Sep 13 '12

ZachTM gravatar image

updated Sep 14 '12

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!

Preview: (hide)

1 answer

Sort by » oldest newest most voted
4

answered Sep 13 '12

AgentCain gravatar image

updated Sep 13 '12

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)

Preview: (hide)

Comments

THanks you were right!

ZachTM gravatar imageZachTM (Sep 13 '12)edit

Question Tools

Stats

Asked: Sep 13 '12

Seen: 537 times

Last updated: Sep 14 '12