Interpolation in an image at specific query points

1 view (last 30 days)
I am trying to interpolate an image of size 120x160 at specific query points. say R = [ r1,r2,r3,....rn]; C = [ c1,c2,c3,....cn]. I would like to interpolate the values at (r1,c1), (r2,c2)...(rn,cn) from the original image. I see that interp2, griddata,scatteredInterpolant, griddedInterpolant, seem to need a meshgrid of query points. Is there a way to estimate the interpolation at just these point (r,c)? If not, how do I convert such scattered points into a meshgrid?

Accepted Answer

KSSV
KSSV on 19 Apr 2017
Edited: KSSV on 19 Apr 2017
load clown ;
imagesc(X);
colormap gray ;
[nx,ny] = size(X) ;
r = 1:ny ;
c = 1:nx ;
[R,C] = meshgrid(r,c) ;
%%do interpolation
Ri = 5 ; Ci = 5 ;
Xi1 = interp2(R,C,X,Ri,Ci) ;
% or can be used without mesh grid like below
Xi2 = interp2(r,c,X,Ri,Ci) ;

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!