Some knowledge of computer graphics processing

Recently, I am working on opencv to do some simple image recognition. Since image recognition is involved, first we need to re-understand the image. Most people see a photo may be a simple photo. In human eyes, it's not that simple.

Classification of Computer Graphics

(1) Bitmap (Bitmap)

Also known as bitmap, grid image, pixel map, simply put, it is a map composed of pixels in the smallest unit, and scaling will be distorted. The smallest unit that constitutes a bitmap is a pixel. A bitmap is achieved by the arrangement of pixel arrays. Each pixel has its own color information. When editing a bitmap image, the operable The object is each pixel, we can change the hue, saturation, and brightness of the image, thereby changing the display effect of the image. For example, a bitmap image is like a good painting on a huge sand table. When you look at it from a distance, the picture is delicate and colorful, but when you get very close, you can see the composition Every grain of sand in the picture and its pure immutable color

(2) Vector (Vector)

Also called a vector image, simply put, it is an image format that scales without distortion. The vector diagram is generated by the combination of multiple objects, and the recording method of each object is realized by mathematical functions, that is to say, the vector diagram does not actually record every point on the screen like a bitmap. Instead, it records the algorithm of the shape and color of the element. When you open a vector diagram, the software will operate the function corresponding to the image, and display the operation result [shape and color of the graphic] to you. Regardless of whether the display screen is large or small, the algorithm corresponding to the objects on the screen is unchanged, so even if the screen is scaled by a considerable multiple, the display effect is still the same [undistorted]. For example, a vector diagram is like a picture drawn on a very high-quality rubber film. No matter how the rubber film is doubled and stretched, the picture is still clear, no matter how close you are to see it. You will see the smallest unit of the graph.

Advantages and disadvantages of both:

The advantage of bitmap is that the color changes are rich, and the color display effect of any shape area can be changed in editing. Correspondingly, the more complex the effect to be achieved, the more pixels required, and the size of the image file [length and width] And the volume [storage space] is bigger.

The advantage of vectors is that the shape of the outline is easier to modify and control, but for individual objects, the implementation of color changes is not as convenient and straightforward as bitmaps. In addition, the applications that support the vector format are far less than those that support bitmaps. Many vector graphics require specially designed programs to be opened, browsed and edited.

Commonly used bitmap drawing software includes adobe photoshop, corel painter, etc. The corresponding file formats are [.psd .tif][.rif], etc., and there are also [.jpg][.gif][.png][.bmp] Wait.

Commonly used vector drawing software includes adobe illustrator, coreldraw, freehand, flash, etc. The corresponding file formats are [.ai .eps][.cdr][.fh][.fla/.swf], etc. In addition, there are [.dwg] ][.wmf][.emf] etc.

Vector graphics can be easily converted into bitmaps, but it is not easy to convert bitmaps into vector graphics, and often requires more complicated operations and manual adjustments.

Vectors and bitmaps can also be combined in applications, such as embedding bitmaps in vector files to achieve special effects, and using vector modeling and bitmap maps to achieve realistic visual effects in 3D images.

These two kinds of graphics are widely used in publishing, printing, Internet [such as flash and svg] and other aspects. They have their own advantages and disadvantages, and their respective advantages are almost irreplaceable. Therefore, for a long time, vector and bit The graph has always been evenly divided in the application.

Classification of digital images

A digital image is a representation of a two-dimensional image with finite digital pixels. Typically, pixels are stored in a computer as a raster image of a two-dimensional array of integers, and these values ​​are often transmitted and stored in a compressed format.

Digital images can be generated by many different input devices and technologies, such as digital cameras, scanners, coordinate measuring machines, seismographic profiling, airborne radar, etc., and can also be synthesized from arbitrary non-image data, such as mathematical functions or 3D geometric models, Three-dimensional geometric models are a major branch of computer graphics. The field of digital image processing is to study their transformation algorithms.

Each image pixel usually corresponds to a specific 'location' in two-dimensional space, and has one or more sampled values ​​associated with that point that make up a numerical value. Different digital images can be divided into:

(1) Binary image:

The intensity value (Intensity) of each pixel in the image can only be taken from an image of 0 or 1, so it is also called a 1-bit image.

(2) Grayscale image:

Also known as grayscale images: Each pixel in an image can be represented by an Intensity value ranging from 0 (black) to 255 (white). Different gray levels are represented between 0-255.

(3) Color image:

Color images are mainly divided into two types, RGB and CMYK. The RGB color image is composed of three different color components, one is red, one is green, and the other is blue. The CMYK type image is composed of four color components: cyan C, magenta M, yellow Y, and black K. CMYK type images are mainly used in the printing industry.

(4) False color image

(5) Multi-spectral thematic

(6) Stereoscopic image:

Stereo images are a pair of images of an object taken from different angles. Usually, we can use the stereo images to calculate the depth information of the images.

(7) Three-dimensional image:

A 3D image is composed of a stack of two-bit images. Each image represents a cross-section of the object.

Common Image Terms

(1) Pixels:

Every image is made up of color points, and each color point is called a pixel. A picture consists of 300,000 color points, and the pixel of this picture is 30W. We often say how many pixels a camera has. This pixel means how many sensor devices the camera has. A camera with 100W photosensitive devices is a 100W pixel camera, a camera with 4000W photosensitive devices is 4000W pixels, and so on. A photo taken by a 100W pixel camera will be a little clearer than a 6-inch photo that is washed to a 5-inch size.

(2) Image resolution:

Image resolution refers to the number of pixels per inch of the image. Image resolution has units called pixels per inch. The higher the resolution, the higher the pixel density, and the more realistic the image is (this is why when doing large-scale inkjet printing, the picture resolution is required to be high, to ensure that there are more pixels per inch of the screen).

(3) Screen resolution:

The screen resolution is the number of pixels per row of the screen * the number of pixels per column, and each screen has its own resolution. The higher the screen resolution, the more colors and sharpness are rendered.

Some dimensionality reduction methods for image processing

In the field of image recognition, we basically operate bitmaps. Usually, the photos taken by our mobile phones are called color images, also called: RGB images, which contain both color and color intensity (which can also become Brightness), reflected in the computer, the color image is composed of 3 dimensions: [x, y, (R, G, B)] where each value of R, G, B can be between 0-255 Any integer, so we call the color picture a three-dimensional matrix (matrix) = x * y * 3

In the field of image processing, usually after getting a color image, the first step is to do grayscale (grayscale), grayscale image, we can understand that it removes the color in the color image, leaving only the Color intensity (can also be called brightness), thus becomes a 2D matrix = x * y * 1 consisting of: [x,y,(0-255)].

Grayscale refers to the color depth of a point in a black and white image, generally ranging from 0 to 255, white is 255, and black is 0, so black and white images are also called grayscale images, which are widely used in the fields of medicine and image recognition, such as medical X-rays, magnetic resonance imaging, and CT films are all grayscale photos.

There are several ways to convert color pictures to grayscale photos:

1.浮点算法:Gray=R*0.3+G*0.59+B*0.11

2.整数方法:Gray=(R*30+G*59+B*11)/100

3.移位方法:Gray =(R*28+G*151+B*77)>>8;

4.平均值法:Gray=(R+G+B)/3;

 5.仅取绿色:Gray=G;

After doing grayscale, the next step is to do binarization to further simplify the color. The entire picture can only have two colors of black and white, and it still belongs to a two-dimensional matrix = x * y * 1. The composition is: [x,y,( 0 or (1 or 255))]. Note that 0 represents black, 1 and 255 represent white, and the grayscale image is converted to a binary image. It is very simple to set the brightness in the pixel less than a certain threshold (usually 127) to 0, and convert it to 255 if it is greater than 127. Usually 1 replace.

The basic idea seen here is dimensionality reduction. After the dimensionality reduction of the image, its processing complexity becomes smaller, which is more conducive to us to find the gradient or eigenvalue of the image. Of course, not all image processing needs to do this. Also divided into scenes.

Summarize:

This article introduces the basic knowledge of computer graphics processing, such as the types of graphics, the classification of digital images, some dimensionality reduction methods for processing pictures, and the difference between RGB images and grayscale and binarized images. After understanding these, we will process images. It will be very helpful, so that you can know what is and why.

Reference link:

https://zh.wikipedia.org/wiki/%E6%95%B0%E5%AD%97%E5%9B%BE%E5%83%8F

https://zh.wikipedia.org/wiki/%E7%9F%A2%E9%87%8F%E5%9B%BE%E5%BD%A2

https://zh.wikipedia.org/wiki/%E4%BD%8D%E5%9B%BE

http://www.cnblogs.com/areliang/archive/2006/04/29/388769.html

https://www.quora.com/Does-grayscale-image-means-1-dimensional-image

https://www.quora.com/What-is-the-difference-between-a-binary-image-and-a-gray-scale-image

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325472992&siteId=291194637