当前位置:网站首页>Salient map drawing based on OpenCV

Salient map drawing based on OpenCV

2022-07-04 15:44:00 Xiaobai learns vision

Saliency is a prominent part of the image , Our brain pays special attention to this part . The above figure highlights the parts we will notice when we see a scene or image . for example , Have you ever been attracted by some special content when watching advertisements , For this reason, we specially stopped to watch it for a while ? This is the significance of advertising , Even if we can see advertisements at a glance , Will also be attracted to him .

01. install OpenCV

First , You need to install OpenCV library . If already installed pip, You can run the following command to complete .

> pipinstall opencv-python
> pip install opencv-contrib-python

We can verify whether the installation is successful by the following command .

> python
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49)
Type "help", "copyright", "credits" or "license" for more information.
>> import cv2
>> cv2.saliency

02. Static significance detection

There are many ways to detect significance . stay OpenCV in , The algorithms provided for saliency detection fall into three categories :

Saliency diagram

We will discuss static saliency . The static saliency detection algorithm uses different image features that allow the detection of salient objects in non dynamic images .OpenCV Two algorithms have been implemented in , That is, spectrum residual algorithm and fine Algorithm .

03. Spectral residue

The algorithm analyzes the log spectrum of the input image , The spectral residual of the image in the spectral domain is extracted , A fast method for constructing saliency graphs is proposed , This salient figure suggests the location of the prototype object .

Similarity means redundancy . For systems designed to minimize redundant visual information , It must be aware of the statistical similarity of input stimuli . therefore , In different logarithmic spectra where great shape similarity can be observed , What we should pay attention to is the information that jumps out of the smooth curve . We think , The statistical singularity in the spectrum may be the reason for the abnormal region of abnormal objects in the image .

and , If you draw a saliency map , We can get the following output image .

Spectral residue

Reference resources :Hou, Xiaodi, and Liqing Zhang. “Saliency detection: A spectral residual approach.” Computer Vision and Pattern Recognition, 2007. CVPR‘07. IEEE Conference on. IEEE, 2007

04. Fine grain

The retina of the human eye is composed of ganglion cells . There are two types of ganglion cells , At center and eccentric . The center is located in a bright area surrounded by a dark background . Eccentricity reacts to dark areas surrounded by bright backgrounds . The algorithm calculates the significance according to the difference between the center and the outside of the center .

Central ganglion cells and central ganglion cells and their approximation on the visual saliency calculation model

In our example , The central roundness difference is effectively realized by using the integral image , This paper demonstrates a method to generate a fine-grained feature map of visual significance in real time with the resolution of the original image .

and , If you draw a salient figure , You will get the output image below .

04. reference

B. Wang and P. Dudek “A Fast Self-tuning Background Subtraction Algorithm”, in proc of IEEE Workshop on Change Detection, 2014

原网站

版权声明
本文为[Xiaobai learns vision]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202141224392127.html