How can I resize a rectangular image of size 1280x512 to a square image of size (2048x2048)? I have used the following code. Is it correct or is there any other better methods to perform resizing?

14 次查看(过去 30 天)
% First read the image I of size (1280x512) using imread, then used imresize to change the size of I to (2048x2048) and used imwrite to save the image
I=imread('I.tif');
J=imresize(I,[2048 2048],'bicubic');
imwrite(J,'J.tif','tiff');

采纳的回答

Walter Roberson
Walter Roberson 2012-12-4
It depends on your purpose. If the purpose is the human visual system, then you might possibly get more-appreciated output using imresize() with 'lanczos3'. See http://en.wikipedia.org/wiki/Lanczos_resampling#Limitations
  4 个评论
VENKATESAN
VENKATESAN 2012-12-4
Thank you very much for your details about image resizing. Actually, the resolution of our image depends on field of view (FOV). Resolution = FOV/No. of pixels. FOV defines the distance of the total number of pixels in an image in millimeter, so that we can able to calculate the size of the object that we are imaging. Since we are changing the dimension of the image from (1280x512) to (2048x2048), whether the change in number of pixels will affect FOV.
Image Analyst
Image Analyst 2012-12-4
Gee, Hollywood & Burbank do it all the time. In movies and TV, you just zoom into your crummy surveillance video by a factor of 50 or 100 and now you can read license plates and newspapers and see peoples' faces in super high resolution. But my favorite scene was in the movie "No way out" http://www.youtube.com/watch?v=m4SBMyd0yEQ where they had a Polaroid negative of Kevin Costner and the CIA or FBI was spending days trying to process this thing, which was getting more and more focused pass after pass. Of course all they had to do was to negate the image, but anyway... Kevin Costner wanted to delay this process so he got his friend in charge of the group to delay it and he went by the image analysts and told them "The eigenvalue is off. We're pulling away from our reference information. Program a Fourier transform." Friends wondered why I laugh out loud at that scene.
When you change the size of your image, of course it does not change the field of view. Increasing the resolution in pixels will not increase the real-world spatial resolution in mm either. However decreasing the size of your image will reduce the size of objects you can resolve in your image (because you're throwing away information).

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by