# How can I do to interpolate an image using bilinear interpolation or nearest neighbor? I would not use any function of the package image.

7 messages
Open this post in threaded view
|

## How can I do to interpolate an image using bilinear interpolation or nearest neighbor? I would not use any function of the package image.

 Is there any function that can help me or need to implement the algorithms to work pixel by pixel -- View this message in context: http://octave.1599824.n4.nabble.com/How-can-I-do-to-interpolate-an-image-using-bilinear-interpolation-or-nearest-neighbor-I-would-not-us-tp4647952.htmlSent from the Octave - General mailing list archive at Nabble.com. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: How can I do to interpolate an image using bilinear interpolation or nearest neighbor? I would not use any function of the package image.

 Administrator On Dec 15, 2012, at 12:05 PM, eduardo silva wrote: > Is there any function that can help me or need to implement the algorithms to > work pixel by pixel Have you looked at interp2? Ben _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: How can I do to interpolate an image using bilinear interpolation or nearest neighbor? I would not use any function of the package image.

 On Dec 16, 2012, at 11:27 PM, Ben Abbott wrote: > On Dec 15, 2012, at 12:05 PM, eduardo silva wrote: > >> Is there any function that can help me or need to implement the algorithms to >> work pixel by pixel > > Have you looked at interp2? Or 'imresize' from the 'image' package (this is just a glorified wrapper around 'interp2'). Søren _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: How can I do to interpolate an image using bilinear interpolation or nearest neighbor? I would not use any function of the package image.

 In reply to this post by bpabbott I need to work out pixel by pixel. I want the user to enter the scale that it will use to enlarge the image (x and y coordinates), so I can calculate the size of the output. But I do not see how to traverse the array output and set its pixels. Should I call the function interp2 for each pixel output? Researched function interp2 but am confused with the parameters needed. Can you give me an example of using? Image on the package, I would not use it, I understand the interpolation.
Open this post in threaded view
|

## Re: How can I do to interpolate an image using bilinear interpolation or nearest neighbor? I would not use any function of the package image.

 On Sun, Dec 16, 2012 at 10:01 PM, eduardo silva <[hidden email]> wrote: > I need to work out pixel by pixel. > > I want the user to enter the scale that it will use to enlarge the image (x > and y coordinates), so I can calculate the size of the output. But I do not > see how to traverse the array output and set its pixels. Should I call the > function interp2 for each pixel output? > > Researched function interp2 but am confused with the parameters needed. Can > you give me an example of using? > > Image on the package, I would not use it, I understand the interpolation. > > > > -- > View this message in context: http://octave.1599824.n4.nabble.com/How-can-I-do-to-interpolate-an-image-using-bilinear-interpolation-or-nearest-neighbor-I-would-not-us-tp4647984p4647998.html> Sent from the Octave - General mailing list archive at Nabble.com. > _______________________________________________ > Help-octave mailing list > [hidden email] > https://mailman.cae.wisc.edu/listinfo/help-octaveHere would be one way to use interp2: ===== [xx, yy] = meshgrid([-2:.1:2]); zz = 1./(xx.^2+yy.^2+1); [xxi, yyi] = meshgrid([-2:.05:2]); new_zz = interp2(xx, yy, zz, xxi, yyi, 'nearest'); ===== or like this: x_scale = 2; y_scale = 3; [xx, yy] = meshgrid([-2:.1:2]); zz = 1./(xx.^2+yy.^2+1); [xxi, yyi] = meshgrid(1:(1/x_scale):size(zz,1), 1:(1/y_scale):size(zz,2)); new_zz = interp2(zz, xxi, yyi, 'nearest'); ===== Hope this helps, James Sherman Jr. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave