Ask Your Question
2

Pixelization

asked 2012-09-18 06:16:03 -0600

Despair gravatar image

updated 2012-09-18 06:55:07 -0600

Andrey Pavlenko gravatar image

Hi, I've been trying to manipulate an 800x600 image to be 80x60 image ( kinda pixalated ) and grayscaled but to be seen as 800x600 size

what I do is the following:

img_gray=cvLoadImage(FILENAME,CV_LOAD_IMAGE_GRAYSCALE);
img_gray_smaller=cvCreateImage(cvSize(80, 60),IPL_DEPTH_8U,1);
img_gray_regular=cvCreateImage(cvSize(800, 600),IPL_DEPTH_8U,1);

which is loading the image as grayscale to begin with resizing it to 80x60 and then resizing it again to 800x600

but it doesnt look very well, any suggestions on

How to look at a low resolution image magnified to 800*600?

(maybe its the depth? the channels? tried mixing with those but the program fails)

awesome thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-09-18 07:06:00 -0600

Andrey Pavlenko gravatar image

updated 2012-09-18 07:08:16 -0600

If I understand you correctly, you need to resize the original picture down, than resize it up with INTER_NEAREST interpolation type.

edit flag offensive delete link more

Comments

img_gray=cvLoadImage(FILENAME,CV_LOAD_IMAGE_GRAYSCALE);
img_gray_smaller=cvCreateImage(cvSize(80, 60),IPL_DEPTH_8U,1);
img_gray_regular=cvCreateImage(cvSize(800, 600),IPL_DEPTH_8U,1);
cvResize(img_gray,img_gray_smaller,CV_INTER_LINEAR);
cvResize(img_gray_smaller,img_gray_regular,CV_INTER_NN);
cvShowImage(WINDOWTITLE, img_gray_regular);

the nearest is the NN part? i've just changed it to this and it does look better, can see the pixles. though still i think it can look a bit better, is it the linear part maybe?

Thanks for your help!

Despair gravatar imageDespair ( 2012-09-18 07:41:46 -0600 )edit

Question Tools

Stats

Asked: 2012-09-18 06:16:03 -0600

Seen: 667 times

Last updated: Sep 18 '12