how we can amplify an image with nearest neighbour interpolation
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Show older comments
0 votes
how we can amplify an image with nearest neighbour interpolation
Accepted Answer
Mohammad Abouali
on 30 Sep 2014
Amplify?? you mean resize? if that's what you mean here is the code
IResized= imresize(I,scale,'nearest');
6 Comments
Image Analyst
on 30 Sep 2014
Get rid of 'nearest' - that will just take the nearest value instead of using bicubic interpolation of nearest neighbors.
Mohammad Abouali
on 1 Oct 2014
But he wants to have nearest neighbor interpolation.
Image Analyst
on 1 Oct 2014
Nearest neighbor interpolation means that if the output pixel lands in between the input pixels, you will interpolate. Say if you were using bilinear interpolation and you had a pixel at column 42 with value 100 and a pixel at column 43 with value 200. Now let's say you were resizing or resampling the image and you needed to get the value of the image at column 42.75. That's 3/4 (75%) of the way from 42 to 43, so the output pixel would have a value of 175, which is 3/4 of the way from 100 to 200. If you use the 'nearest' option, it will say that the pixel at 43 is closest to the pixel needed at 42.75, so it would just take that value - a value of 200 - because it's the nearest. So no interpolation takes place in that case. This option is there because it's the fastest - no interpolation needed - but it's not the most accurate.
Mohammad Abouali
on 2 Oct 2014
Edited: Mohammad Abouali
on 2 Oct 2014
I understand what is nearest neighbor interpolation and what is bilinear interpolation
1) it is a C0 interpolation and as you perfectly described, it just takes the value of the closest point. Although it might sound strange, but that is still type of interpolation and it is known as C0 interpolation.
2) (s)he wants to do nearest neighbor interpolation, (read his/her question). I don't know why that is the method being requested, but nearest neighbor is the method requested in the question.
If it was atmospheric data, I could imagine why using nearest neighbor interpolation. Also in processing spectral images (in remote sensing) we often prefer nearest neighbor interpolation because those numbers are measurements and we don't want to mess up the measurements.
So I don't know why (s)he asked for that method. But I am guessing there is a reason for it. Nearest neighbor doesn't necessary gives an smooth surface anyway.
Image Analyst
on 2 Oct 2014
OK, that's fine. I agree with everything you said. I've never heard of "C0 Interpolation" but if that's standard terminology in some sub-field of image processing, that's fine.
Mohammad Abouali
on 3 Oct 2014
Actually I made a mistake it is C-1. It is one order lower than the polynomial being used. It means continuity. C0 means the curves touches at the boundary( Which in nearest neighbor clearly doesn't). C1 means the first derivative is also continuous and so on.
Go down to parametric continuity.
More Answers (0)
Categories
Find more on Neighborhood and Block Processing in Help Center and File Exchange
Products
Tags
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)