Image processing notes (OpenCV)

Image processing notes (OpenCV)

Preface

When I wrote the fifth chapter of data structure before , when talking about arrays, I wanted to write a note on image processing, because the content of the fifth chapter of data structure is two-dimensional array compression, which is related to image processing.

It just so happened that I could still find the notes of image processing in my junior year, so I migrated the notes I wrote in Word to the blog. Supplement the knowledge section on my blog.

When writing blog notes during this period, I found that mind maps and blogs have their own merits and need to be combined. Simple mind maps are inconvenient to understand, and simple documents are inconvenient to have an overall understanding.

In the future, if efficiency permits, use mind maps to introduce the thinking structure, use pictures to show key points of view, use tables for comparison, and use articles to tell the content.

If efficiency is not allowed, then it is still pure mind map and text. After all, typesetting and foreshadowing require too much energy.

notes

Chapter One Introduction

Insert picture description here

1. Image processing applications : face recognition, license plate recognition, pedestrian recognition, gesture recognition, fingerprint recognition, iris recognition, motion recognition

2. The field of image processing : daily life, film and television entertainment industry, military field, infrared imaging, medical imaging, computer vision

Chapter 2 Digitalization of Images

Chapter 2 Digitalization of Images

\1. Image digitization : refers to the digital representation of the image after the analog image is discretized, including spatial discretization (ie sampling) and the discretization of light and dark representation data (ie quantization).

\2. Sampling : refers to the operation of converting a spatially continuous image into a discrete set of sampling points (ie pixels). Since the image is two-dimensionally distributed information, sampling is performed in both the x-axis and y-axis directions. In general, the sampling interval in the x-axis direction and the y-axis direction are the same.

\3. Resolution : refers to the size of the scene element mapped to a single pixel on the image plane.

Unit: pixel/inch, pixel/cm (eg: scanner index 300dpi)

Unit: Pixels (eg: digital camera index 300,000 pixels (640 480))

\4. Sampling interval : If the sampling interval is too small, the amount of data will be increased; if it is too large, information will be aliased, resulting in unrecognizable details (such as mosaic).

\5. Quantization : After discretizing the light and dark information contained in each pixel, it is represented by numbers. The general quantization value is an integer. After fully considering the recognition ability of the human eye, the current non-special-purpose images are all 8-bit quantization, that is, an integer from 0 to 255 is used to describe "from black to white". Quantization below 3bit, false contour phenomenon will appear; poster drawing; 2-level gray scale is binarization

6. Description of digital image : refers to how to represent an image in a numerical way. A digital image is a digital representation of an image, and the pixel is its smallest unit. Because the matrix is ​​two-dimensional, it can be used to describe digital images. The matrix describing the digital image currently uses an integer matrix, that is, the brightness of each pixel, which is represented by an integer.

7. A gray scale image is an image information of each pixel by a quantized gray level is described, no color information.

8. A color image refers to an image in which the information of each pixel is composed of the three primary colors of RGB, where RGB is described by different gray levels. Color images can't be described by one matrix. Generally, three matrices are used to describe at the same time.

image-20201027104431355

image-20201027104441842

9. **The overall structure of the bitmap file: **File header, information header, true color mode (RGB value of the pixel), index color mode (palette + color index value); gray inversion is the negative effect

Chapter Three Binary Image Processing

Chapter Three Binary Image Processing

1. The problem of binary image processing : there are false targets in the extracted target; multiple targets have adhesions or breaks; multiple targets have different forms.

2. Connection : There are four connections and eight connections (the current pixel is black, and at least one of its eight neighboring pixels is black);

3. Connected domain : The collection of black pixels connected to each other is called a connected domain.

4. Analysis methods of binary images : labeling, corrosion, expansion, opening operation, closing operation, thinning method

5. Labeling:

6. Corrosion : It is a process of removing the boundary points of the connected domain and shrinking the boundary inward. Corrosion treatment can separate different objects that are stuck together, and can remove small particle noise.

7. Expansion : is the process of merging the background points of the target area into the target, and expanding the boundary of the target to the outside.

8. Proposal of opening operation and closing operation: The expansion and corrosion operation introduced in the background has a very good effect on the post-processing of the target. However, one disadvantage of the corrosion and expansion calculations is that they change the size of the original target. In order to solve this problem, considering that corrosion and expansion are a pair of inverse calculations, the expansion and corrosion calculations are performed simultaneously. This constitutes an open operation and a closed operation.

9. Open operation : Corrosion processing is performed on the original image first, and then expansion processing is performed. The open operation can basically keep the size of the original target while separating the adhered target.

10. Close operation : it is to expand the original image first, and then corrode. The closed operation can basically maintain the size of the original target while merging the broken target.

\11. Thinning process : The process of finding the skeleton of an image. After the thinning process, the amplitude of all lines in the image is one pixel.

Chapter 4 Color Image Processing

We will discuss methods such as color level correction, image smoothing and filtering, image sharpening processing, etc., as well as methods such as color compensation and color balance

Chapter 5 Image Noise Suppression

Chapter 5 Image Noise Suppression

1. The so-called image noise is the random interference signal received when the image is taken or transmitted. The common ones are salt and pepper noise and Gaussian noise .

2. The characteristics of salt and pepper noise: The appearance position is random , but the amplitude of the noise is basically the same .

The characteristics of Gaussian noise: it appears at a certain position (at each point ), but the amplitude of the noise is random .

3. Image noise suppression methods: mean filter, median filter, boundary preserving filter

4. Mean filter: On the image, the pixels to be processed are given a template, which includes the neighboring pixels around it. The method of replacing the original pixel value with the average value of all pixels in the template . The disadvantage of the mean filter is that it will blur the image because it treats all points equally. While apportioning the noise points, it also apportions the boundary points of the scene.

5. Median filter: Because of noise (such as salt and pepper noise), the pixel at this point is much brighter (darker) than the surrounding pixels .

If in a certain template, the pixels are rearranged from small to large , then the brightest or darkest points must be arranged on both sides . By replacing the value of the pixel to be processed (current position) with the gray value of the pixel in the middle position of the template, the purpose of filtering noise can be achieved .

\6. The core of the boundary preserving filter is to determine boundary points and non-boundary points .

Chapter 6 Image Enhancement

Chapter 6 Image Enhancement

1. Image enhancement is the use of a series of technologies to improve the visual effect of an image, or to transform the image into a form that is more suitable for human or machine analysis and processing.

2. Starting from the scope of enhancement, image enhancement methods can be divided into spatial domain enhancement and frequency domain enhancement.

Spatial domain enhancement is to directly process each pixel of the image ;

Frequency domain enhancement is to process the spectral components of the image after Fourier transform , and then inverse Fourier transform to obtain the desired image.

3. A linear contrast stretch: by the light-dark difference (i.e., contrast ) to expand to the human part out of concern emphasized .

4. Gray-level window: actually a special form of linear contrast broadening. Only the interesting part is kept, and the rest is set to 0.

5. Linear dynamic range adjustment: By compressing the dynamic range, the gray scale change range of the concerned part can be expanded .

6. Non-linear dynamic range adjustment: Because the piecewise linear mapping of linear dynamic range adjustment is not smooth enough .

  • Logarithmic transformation: expand the dark part while suppressing the bright part . Overall brighter
  • Exponential transformation: overall darkening;
  • Power law transformation: free adjustment

7. Histogram equalization

Chapter 7 Image Geometric Transformation

The geometric transformation of the image includes the shape transformation and the position transformation of the image.

The shape transformation of the image refers to the enlargement, reduction and miscutting of the image.

The position transformation of the image refers to the translation, mirroring and rotation of the image.

Chapter 8 Image Sharpening

The purpose of image sharpening is to enhance the detailed edges and contours of the scene in the image. The role of sharpening is to enhance the grayscale contrast.

Because the edges and contours are located at the place where the gray level changes suddenly. So the realization of the sharpening algorithm is based on the differential action.

Chapter 9 Image Transformation

The characteristic of image mathematical transformation lies in its precise mathematical background, which is the basis of many image processing techniques. Among these transformations, one is carried out in the spatial domain. Another important mathematical transformation is to convert the image originally defined in the image space into some other space (frequency domain) in some form, and use the unique properties of the input image in these spaces to efficiently and quickly process the image. analysis.

The most typical transforms are discrete Fourier transform, Gabor transform, wavelet transform, discrete cosine transform, KL transform and so on.

Whether it is mathematical transformation in the spatial domain or the mathematical transformation in the frequency domain, they have very typical and important applications in image analysis, filtering, enhancement, compression and other processing.

Chapter 10 Image Coding

The research content of data coding includes data representation, transmission, transformation and coding methods, the purpose is to reduce the space required for data storage and the time used for transmission.

Image coding and compression is to transform and combine image data according to certain rules, so as to express as much image information as possible with as few codes (symbols) as possible. bmp jpeg psd

OpenCV overview

OpenCV overview

to sum up

Today I wrote this graph processing note because I reviewed the knowledge and talked about the application case of the array in the data structure .

After that, I am going to study video coding, specifically the application of image processing. I mentioned video conversion and digital video basics when I wrote a review of the basics of digital film and television technology , but because the content was too much, it didn't expand, so I am going to write some concepts of video conversion and digital video basics.

Update address: GitHub

For more content, please pay attention to: CSDN , GitHub , Nuggets

Guess you like

Origin blog.csdn.net/weixin_42875245/article/details/109306519