"Matlab" image interpolation function Interp2 understanding

Source: Internet
Author: User

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:

    • X,y-sample Grid points
      matrices | Vectors

    • V-sample values
      Matrix

    • Xq,yq-query points
      scalars | Vectors | matrices | Arrays
    • K-refinement factor
      1 (default) | Real, nonnegative, integer scalar
    • Method-interpolation method
      ' Linear ' (default) | ' Nearest ' | ' Cubic ' | ' Spline '
    • Extrapval-function value outside domain of X and Y
      Scalar

Output:

    • vq-interpolated values
      scalar | Vector | Matrix

"Matlab" image interpolation function Interp2 understanding

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.