Image interpolation is the use of grayscale values (or tri-color values in RGB images) of known neighboring pixels to produce gray values of unknown pixel points so that images with higher resolution are regenerated from the original image.
Use the example to understand the INTERP2 function:
[X,Y]meshgrid(-3:3%产生网格坐标V = peaks(X,Y); %通过网格坐标计算函数值,产生三维凹凸面figuresurf(X,Y,V)title(‘Original Sampling‘);%原始面
To interpolate a value
[Xq,Yq]meshgrid(-3:0.25:3); %产生插值所需要的网格Vq = interp2(X,Y,V,Xq,Yq); %通过对V线性插值(默认的)得到新的面Vqfiguresurf(Xq,Yq,Vq);title(‘Linear Interpolation Using Finer Grid‘);
Use format:
Vq = Interp2 (X,Y,V,XQ,YQ)
Vq = Interp2 (V,XQ,YQ)
Vq = Interp2 (V)
Vq = Interp2 (v,k)
Vq = Interp2 (_, method)
Vq = Interp2 (_, Method,extrapval)
Input:
Output:
- vq-interpolated values
scalar | Vector | Matrix
"Matlab" image interpolation function Interp2 understanding