VB Image Processing (2) Application of quadratic linear interpolation

Source: Internet
Author: User

The last time we talked about how to use the DIB method to retrieve the pixels of an image. From this time on, we will use the obtained pixels to process the image.
There are many methods for interpolation and amplification of images, mainly including quadratic and cubic linear interpolation.
This time I will publish the quadratic linear interpolation algorithm used in my program to everyone. I hope it will be helpful to anyone who wants to use VB to write similar programs.
For the APIS, data types, and global variables used in the program, see the previous article:
VB Image Processing (I) Acquisition and output of pixels
Public Sub ZoomImage (ByVal OutPutWidth As Long, ByVal OutputHeight As Long)
Dim I As Long
Dim L As Long
Dim X As Long
Dim Y As Long
Dim Xb As Long
Dim Yb As Long
Dim Xe As Long
Dim Ye As Long
Dim M As Integer
Dim N As Integer
Dim CurR As Long
Dim CurG As Long
Dim CurB As Long
Dim NxtR As Integer
Dim NxtG As Integer
Dim NxtB As Integer
Dim DR As Single
Dim DG As Single
Dim DB As Single
Dim DRt As Single
Dim DGt As Single
Dim DBt As Single
Dim Xratio As Single
Dim Yratio As Single
Dim CurStep As Single
Dim NxtStep As Single
Dim NegN As Single
On Error GoTo ErrLine
If Not CanZoom Then Exit Sub
Done = False
OutPutWid = OutPutWidth-1
OutPutHei = OutputHeight-1
I = (Bits 8)-1
ReDim ColTmp (I, InPutWid, OutPutHei) 'First scales in the Y direction, and the results are saved in the intermediate array.
ReDim ColOut (I, OutPutWid, OutPutHei)
Xratio = OutPutWid/InPutWid
Yratio = OutPutHei/InPutHei
TimeZoom = timeGetTime
NegN = 1/Int (Yratio + 1)
For X = 0 To InPutWid
CurR = ColVal (0, X, 0)
CurG = ColVal (1, X, 0)
CurB = ColVal (2, X, 0)

Related Article

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.