当前位置:网站首页>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 - 900. RLE 迭代器
- (2)接口中新增的方法
- LeetCode - 706 设计哈希映射(设计) *
- 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
- After clicking the Save button, you can only click it once
- When the reference is assigned to auto
- Application of 51 single chip microcomputer timer
- An executable binary file contains more than machine instructions
- openEuler kernel 技术分享 - 第1期 - kdump 基本原理、使用及案例介绍
- Dictionary tree prefix tree trie
猜你喜欢

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

Leetcode - 895 maximum frequency stack (Design - hash table + priority queue hash table + stack)*

2.Elment Ui 日期选择器 格式化问题

LeetCode - 705 设计哈希集合(设计)

Installation and removal of MySQL under Windows

03 fastjason solves circular references

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

Leetcode - 933 number of recent requests

Opencv notes 20 PCA

Basic knowledge of communication interface
随机推荐
Opencv feature extraction sift
An executable binary file contains more than machine instructions
新系列单片机还延续了STM32产品家族的低电压和节能两大优势
QT self drawing button with bubbles
Development of intelligent charging pile (I): overview of the overall design of the system
Leetcode interview question 17.20 Continuous median (large top pile + small top pile)
Exception handling of arm
Assignment to '*' form incompatible pointer type 'linkstack' {aka '*'} problem solving
LeetCode - 1670 設計前中後隊列(設計 - 兩個雙端隊列)
Opencv Harris corner detection
Embedded systems are inherently flawed. Compared with the Internet, there are so many holes that it is simply difficult to walk away from
JS foundation - prototype prototype chain and macro task / micro task / event mechanism
Do you understand automatic packing and unpacking? What is the principle?
The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving
2020-08-23
应用最广泛的8位单片机当然也是初学者们最容易上手学习的单片机
My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
[combinatorics] Introduction to Combinatorics (combinatorial idea 3: upper and lower bound approximation | upper and lower bound approximation example Remsey number)
Stm32 NVIC interrupt priority management
LeetCode - 460 LFU 缓存(设计 - 哈希表+双向链表 哈希表+平衡二叉树(TreeSet))*