C # Digital Image processing Algorithm learning Note (i) the 3 method of--c# image processing

Source: Internet
Author: User

C # Digital Image processing Algorithm learning Note (i) the 3 method of--c# image processing

Bitmap class: This class encapsulates a bitmap in GDI +, which consists of pixel data for a graphical image and its properties. Therefore, this class is an object used to manipulate the graphics of the pixel data definition. The main methods and properties of this class are as follows:

GetPixel and SetPixel methods: Gets or sets the color of the specified pixel of an image.

PixelFormat property: Returns the pixel format of the image.

Height and Width: Returns the height and breadth of the image.

LockBits and Unlockbits method: Lock and unlock the bit image in the system memory respectively.

The LockBits method returns an object of type BitmapData.

The Unlockbits method requires a parameter of type BitmapData.

BitmapData class:

Height property, Width property: The altitude and width that are locked.

Pixformat property: The actual pixel format of the data.

Scan0 property: The first byte address of the locked array. If the entire image is locked, it is the first byte address of the image.

Stride Properties: Stride, also known as scan width.

Graphics class: This class is the key to GDI +. Many objects are represented by the graphics class, which defines the methods and properties for drawing and populating drawing objects. An application only needs to be drawn and shaded, and he must use a graphics object.

Color image grayscale: In order to accelerate the speed of image processing, in the graph algorithm, color image is often converted to grayscale image. In order to adapt to the human eye induction, the following algorithm is used:

Gray (i,j) =0.299*r (i,j) +0587*g (i,j) +0.114*b (I,J)

R (I,j), G (I,j), B (I,J) refer to the R,g,b component values of the object pixels respectively.

The 3 methods of image processing in C # are: extracting pixel method, memory method, pointer method :

Pixel Extraction method: Obtain the corresponding pixel information by getpixel method, processing, and then set the corresponding pixel information through SetPixel. This approach is to traverse all the pixels and process them, which is easy to understand for beginners, but inefficient.

Memory method: Copy the image data into memory, so the program will run much faster. The LockBits and Unlockbits methods are used. The computation rate of the memory method is much higher than the pixel extraction method.

Pointer method: This method is similar to the memory method and also uses the LockBits and Unlockbits methods. However, in order to ensure type safety, C # does not support pointers. To use pointers, you must use the unsafe keyword. The computational efficiency of pointer method is higher than that of memory method.

C # Digital Image processing Algorithm learning Note (i) the 3 method of--c# image processing

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.