当前位置:网站首页>CV learning notes - edge extraction
CV learning notes - edge extraction
2022-07-03 10:07:00 【Moresweet cat】
Edge extraction
1. summary
1. edge
Definition : The edge of the image refers to the part where the brightness of the local area of the image changes significantly , The gray profile of this area can generally be regarded as a step , That is, from a gray value that changes sharply in a small buffer area to another gray value with a large difference in gray level .
characteristic : There are positive and negative edges , From dark to light is positive , From light to dark is negative .
Algorithm for calculating edge amplitude :sobel、Roberts、prewitt、Laplacian、Canny operator (Canny The effect of operator is better than others , But it is more complicated )
2. Definition of edge extraction
Edge detection is mainly the measurement of the gray change of the image 、 Detection and location
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-yMup7bj0-1636788374062)(./imgs/image-20211113135932840.png)]](/img/a9/b213b2a3052668dffd1a5d6f58e65e.jpg)
3. Application of edge extraction
For example, semantic segmentation 、 Instance segmentation
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-U0KLeAwl-1636788374064)(./imgs/image-20211113140107396.png)]](/img/0e/ecb04d5c1ba6cad6f6cff924f68e29.jpg)
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-x1EVmwS7-1636788374065)(./imgs/image-20211113140131836.png)]](/img/ba/eb159fb868c8a78b5fef3b264d2091.jpg)
2. principle
1. high frequency & Low frequency signal
The low-frequency and high-frequency signals in the image are also called low-frequency components and high-frequency components . High frequency component refers to image intensity in the sense of image ( brightness / Grayscale ) Where there are drastic changes , That is, the edge ( outline ); The low-frequency component in the image refers to the image intensity in the sense of image ( brightness / Grayscale ) Where the change is gentle , It is characterized by large areas of color patches .
notes : Human eyes are more sensitive to areas of high-frequency signals
2. Principle and steps of edge detection
principle : At the edge , Pixel values appear ” jumping “ Or a big change . If you find the first derivative at this edge , You'll see extreme values appear , And where the first derivative is the extreme value , The second derivative is 0, Based on this principle , Edge detection can be carried out . And in the image , It's a two-dimensional space , Two dimensional space requires derivation in two directions , The extreme value can be found by locating the pixel whose gradient value is greater than the neighborhood ( Or it can be extended to more than a threshold ).
3. Common filter operators
Sharpen the image :( Laplace transform kernel function ), Image sharpening is to compensate the contour of the image , Enhance the edge of the image and the gray jump part , Make the image clear . Image sharpening is to highlight the edge of the object on the image 、 outline 、 Or the characteristics of some linear objective elements . This filtering method improves the contrast between the object edge and the surrounding pixels , So it's also called edge enhancement .
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-IVKmD2d7-1636788374067)(./imgs/image-20211113142433776.png)]](/img/47/554debdf147173a337a23dc7502bac.jpg)
Image smoothing : Image smoothing refers to a wide area used to highlight an image 、 Low frequency components 、 Trunk components or image processing methods that suppress image noise and interfere with high-frequency components , The purpose is to make the brightness of the image smooth and gradual , Reduce the mutation gradient , Improve image quality .
Sobel operator :
Definition : Contains two groups 3*3 Matrix , Transverse and longitudinal formwork respectively , Convolute it with the image , Then we can get the approximate values of the horizontal and longitudinal brightness difference respectively . In practice , The following two templates are commonly used to detect image edges :
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-maikkOR4-1636788374068)(./imgs/image-20211113143052407.png)]](/img/77/685f93235d0c55258a6d3027344830.jpg)
advantage :Sobel Operator is a typical first derivative edge detection operator , Due to the introduction of an operation similar to local average , Therefore, it can smooth the noise , It can eliminate the influence of noise , The influence of pixel position is weighted , Therefore, Prewitt Better than operator .
shortcoming :Sobel The operator does not process based on the gray level of the image , Therefore, the theme of the image cannot be strictly separated from the background , because Sobel Operators do not strictly simulate human visual physiological characteristics , So sometimes the extracted image contour is not satisfactory .
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-SOIzCSVZ-1636788374070)(./imgs/image-20211113143652244.png)]](/img/f4/aa28da40214e5570852f6cfa81fb4d.jpg)
Prewitt operator
Prewitt Operator is a kind of edge detection of first order differential operator , Use pixels up and down 、 The gray difference between the left and right adjacent points , Reach the extreme detection edge at the edge , Remove some false edges , It can smooth the noise . The principle is to use two direction templates to convolute the image neighborhood in the image space , These two direction templates detect a horizontal edge , A detection of vertical edges .
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-zVyTBUjc-1636788374071)(./imgs/image-20211113144222879.png)]](/img/93/1f4e9e623c816f6a6039056cba660c.jpg)
4. Canny Edge detection algorithm
1. Grayscale the image
Process the image into gray image .
2. Gaussian filter the image
According to the gray values of the pixels to be filtered and their neighborhood points, the weighted average is carried out according to certain parameter rules . This can effectively filter the high-frequency noise superimposed in the ideal image .
Gaussian smoothing presents Gaussian distribution in horizontal and vertical directions ( A two-dimensional ), It has better smoothing effect than mean filtering .
A one-dimensional 、 Two dimensional Gaussian probability density function :
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-xxR86lEv-1636788374072)(./imgs/image-20211113145433724.png)]](/img/41/29dc0cd165039cda5885e215175cb5.jpg)
The choice of the size of Gaussian convolution kernel will affect Canny The performance of the detector : The bigger the size , The lower the sensitivity of the detector to noise , However, the positioning error of edge detection will also increase slightly .
notes : Generally, the actual choice 5*5, In most scenes, the comprehensive effect is the best .
example
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-yStmHx7P-1636788374073)(./imgs/image-20211113145753873.png)]](/img/50/896b1b2f8a2d0ba53b3499f9a4817e.jpg)
3. Detect the level in the image 、 Vertical and diagonal edges ( Such as Prewitt、Sobel Operators, etc )
See the previous section “ Common filter operators ”
4. Non maximum suppression of gradient amplitude value
Non maximum suppression (NMS): Search for local maximum , Suppress non maxima .
Purpose : Eliminate redundant boxes
Method : For overlapping candidate boxes , Calculate their overlap , If greater than the specified threshold , Delete ; Below the threshold, keep . For candidate boxes without overlap , All reserved .
- Compare the gradient intensity of the current pixel with two pixels along the positive and negative gradient direction .
- If the gradient intensity of the current pixel is the largest compared with the other two pixels , Then the pixel point remains as the edge point , Otherwise, the pixel will be suppressed ( Set to gray value 0).
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-UrvqRUyi-1636788374075)(./imgs/image-20211113150659513.png)]](/img/12/04bdbae7d643267911350500f8378b.jpg)
Example : Take target detection as an example : In the process of target detection, it is likely to produce some overlapping candidate boxes at the position of the same target , At this point, you need to find the most appropriate target bounding box , Non maximum suppression is a good solution to eliminate redundant bounding boxes .
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-JRfJc00j-1636788374076)(./imgs/image-20211113150946301.png)]](/img/5f/f74dab959acb81807858dc0b53b30e.jpg)
5. Using double threshold algorithm to detect and connect edges
background : The output result of the image after non maximum suppression processing is a non edge point with a gray value of 0, The local gray maximum point that may be the edge is non-zero ( Usually take 128) The binary image of . Many false edges caused by noise or other reasons are retained in the result . Based on the background of this problem , Double threshold detection is proposed .
Double threshold detection :
- If the gradient value of the edge pixel is higher than the threshold , Then mark it as a strong edge pixel ;
- If the gradient value of the edge pixel is lower than the high threshold and higher than the low threshold , Then mark it as a weak edge pixel ;
- If the gradient value of the edge pixel is lower than the low threshold , It will be inhibited .
The idea of double threshold detection : Above the high threshold is a strong edge , Below the low threshold is not an edge , Between the middle is the weak edge .
notes : The choice of threshold depends on the content of a particular image , There is no universally applicable threshold .
Suppress isolated threshold points :
For weak edges , It can be either real edges or retained by noise or color changes , therefore , The weak edges introduced by the latter case should be suppressed , Suppress inappropriate weak edges based on the following two theoretical steps .
- In general , Weak edges introduced by real edges will be connected to strong edge pixels , The noise response is not connected
- To track edge connections , By looking at the weak edge pixels and their 8 Neighborhood pixels , As long as one of them is a strong edge pixel , Then the weak edge point can be kept as the real edge .
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-68DJViXK-1636788374077)(./imgs/image-20211113152536120.png)]](/img/14/96a41b0a39f1401cb0b26ef9faad0e.jpg)
Personal study notes , Learning exchange only , Reprint please indicate the source !
边栏推荐
- LeetCode - 895 最大频率栈(设计- 哈希表+优先队列 哈希表 + 栈) *
- Dictionary tree prefix tree trie
- QT detection card reader analog keyboard input
- Leetcode - 933 number of recent requests
- Education is a pass and ticket. With it, you can step into a higher-level environment
- Yocto technology sharing phase IV: customize and add software package support
- Drive and control program of Dianchuan charging board for charging pile design
- Leetcode - 895 maximum frequency stack (Design - hash table + priority queue hash table + stack)*
- QT self drawing button with bubbles
- There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way
猜你喜欢

LeetCode - 895 最大频率栈(设计- 哈希表+优先队列 哈希表 + 栈) *

When you need to use some functions of STM32, but 51 can't realize them, 32 naturally doesn't need to learn

Leetcode interview question 17.20 Continuous median (large top pile + small top pile)

There is no specific definition of embedded system

In third tier cities and counties, it is difficult to get 10K after graduation

Cases of OpenCV image enhancement

Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction

03 fastjason solves circular references

Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn

Opencv notes 17 template matching
随机推荐
2021-10-27
When the reference is assigned to auto
ADS simulation design of class AB RF power amplifier
应用最广泛的8位单片机当然也是初学者们最容易上手学习的单片机
Stm32f407 key interrupt
My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
2312、卖木头块 | 面试官与狂徒张三的那些事(leetcode,附思维导图 + 全部解法)
Cases of OpenCV image enhancement
SCM career development: those who can continue to do it have become great people. If they can't endure it, they will resign or change their careers
I didn't think so much when I was in the field of single chip microcomputer. I just wanted to earn money to support myself first
Open Euler Kernel Technology Sharing - Issue 1 - kdump Basic Principles, use and Case Introduction
byte alignment
Timer and counter of 51 single chip microcomputer
Sending and interrupt receiving of STM32 serial port
Tensorflow built-in evaluation
STM32 general timer 1s delay to realize LED flashing
Application of external interrupts
Notes on C language learning of migrant workers majoring in electronic information engineering
JS基础-原型原型链和宏任务/微任务/事件机制
yocto 技术分享第四期:自定义增加软件包支持