VB Image Processing (I) pixel acquisition and Output

Source: Internet
Author: User

I always wanted to write an image processing software by myself. Find technical articles on image processing on the Internet.
However, it is inconvenient to find examples written in C ++ or other languages.
In fact, most of the time, I want to find only a description or pseudo code, which is both helpful to understanding and rewrite to any language version.
Recently, I have written some of my image processing knowledge into an ImageCast applet. I made a "packaging" of my skills in processing, and I felt that the data collection was inconvenient and I learned the bit by bit in VB. The algorithm is provided for your reference. I hope that some of my friends who cannot find anything on the Internet will be helpful.
To process an image, first obtain the pixel value of the image. Although the PICTURE control provided by VB can open many types of images, however, the POINT method provided by it is too slow to read pixels. The GetPixel API can be used quickly, because the PIONT method itself is a package for GetPixel.
In VB, the DIB method is used to quickly obtain an image opened in PICTURE, and the DDB method is also used, however, the DDB method also needs to take into account the processing of images with different color depths separately. The implementation of the program is relatively complex, and the DIB method is not required, in addition, the processing speed is slower than that of the DDB method.
Process 1: obtain all pixels of an image opened in the PICTURE control.
Public Sub DibGet (ByVal IdSource As Long, XBegin As Long, ByVal YBegin As Long, ByVal XEnd As Long, ByVal YEnd As Long)
Dim iBitmap As Long
Dim iDC As Long
Dim I As LongDim
Dim W As Long
Dim H As Long
On Error GoTo ErrLine
Done = False
TimeGet = timeGetTime
InPutWid = XEnd-XBegin
InPutHei = YEnd-YBegin
W = InPutWid + 1
H = InPutHei + 1
I = (Bits 8)-1
ReDim ColVal (I, InPutWid, InPutHei)
With bi24BitInfo. bmiHeader
. BiBitCount = Bits
. BiCompression = 0 &
. BiPlanes = 1
. BiSize = Len (bi24BitInfo. bmiHeader)

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.