Ask Your Question

Blurring of image in resizing

asked 2015-02-13 04:45:33 -0500

Mahavir gravatar image

Hello everyone I am doing project on video watermarking where i have to resize given watermark several times from arbitrary values say 81x81 to 84x84 to 78x78. I have used resize function each time but watermark is getting blurred and looking bad. How to resize it without getting blurred? Thanks in advance!!!

edit retag flag offensive close merge delete



Can you please share your code on how you are doing it? How else can we decide what is wrong?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-02-13 05:43:36 -0500 )edit

I was resizing as resize(imcap,imcap,Size(81,81),0,0,1); dst and input image names were same so I was getting blured image but now by different dst, problem is resolved..

Mahavir gravatar imageMahavir ( 2015-02-13 11:45:25 -0500 )edit

Indeed, most geometric applications change the source image in order to achieve their desired output. Therefore it is always suggested to use a deep clone of the input image to avoid this. For example:

cv::resize(original.clone(), original, wantedSize, ...);

This will ensure that you do not adapt the original data! Reason that this is happening is the use of smart pointers all pointing to the same data location!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-02-14 02:16:50 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-02-13 06:23:05 -0500

thdrksdfthmn gravatar image

I think (because I do not see the code) your problem is because you are resizing the same image, so try a

cv::Mat resized;
cv::resize(initImage, resized, wantedSize, ...);
// do your verifications

Repeat this step for each resize, in fact you can have a function that receives as input parameter the initial image, the wantedSize and applies the verification you need and then it returns true or false, or whatever you want.

edit flag offensive delete link more


@ thdrksdfthmn Thanks a lot..problem is resolved !!!!

Mahavir gravatar imageMahavir ( 2015-02-13 11:42:50 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-02-13 04:45:33 -0500

Seen: 729 times

Last updated: Feb 13 '15