Grayscale image--filtering homomorphic filtering in frequency domain

Source: Internet
Author: User
Tags natural logarithm

Study Dip 27th Day

reproduced please indicate the source of this article: Http://blog.csdn.net/tonyshengtan, Welcome to reprint, found that the blog is reproduced in some forums, the image can not be normal display, unable to express my views, to this expression is very dissatisfied. Some sites reproduced my blog, very happy is that they write something more people see, but not happy is this paragraph was removed, also did not indicate the source of reprint, although this does not have the copyright protection, but the feeling is not very good, out of respect for the author's labor, reproduced please indicate the source!!!!

Article code is hosted, Welcome to co-development:Https://github.com/Tony-Tan/DIPpro

The opening crap.

today's nonsense is that image processing is a very confusing subject, because any content is at least two large frames, such as on-state filtering, sounds like a frequency domain filter, but its other identity is image enhancement. If you simply want to classify the content, this is difficult, because the knowledge structure of the image is a graph, not a simple tree.

Newly bought a book "Image Processing Fundamentals", such as a dictionary, or a question bank, the title of the inside like 100,000 why, to participate in school recruit students can temporarily review, of course, when we study this book is a good guide, like a paper wiki, a good reference book.

This article structure diagram:


Imaging principles

The principle of imaging is why we can see the principle of things, and optics, but here we are abstract, if the principle of complete modeling imaging, will be a very complex model, for the time being without considering the complexity of the situation, and only consider two main parameters, the incident component and the reflection component.

For example, for an image, for a pixel (x, y) we set its value to f (x, y) so we can determine that f (x, y) is greater than 0 and is finite:


The imaged object is irradiated by the light source, reflected in the imaging element or the human eye is the part of the incident light reflection, in the understanding that the reflection component is similar to a attenuation factor, such as the incident beam 1, the reflection component is 0.7, then we see the 1x0.7=0.7, if the object is a black hole, then the reflection component is 0, If there is absolutely no reduced reflection, then the reflection component is 1, the incident component is I (x, y), the reflection component (I feel called the reflection coefficient is more accurate) R (x, y), then the image can be described as:


And there is a relationship:



For monochrome images, the pixel value of the image represents the gray intensity of the point


grayscale intensity is between the maximum and minimum values, and the minimum value is greater than 0, the maximum value is limited, actually meet , , called grayscale is usually [0,max], and for 8bit grayscale pixels, the grayscale level is [0,255].

Homomorphic filteringbefore introducing homomorphic filtering, it is necessary to understand why it is called homomorphism, because this problem I also studied for a long time, according to the wiki, the nature of the homomorphism is a mapping, but this kind of mapping has a special nature, this property is to maintain the relevant properties are unchanged, related attributes include, unitary, inverse, two-dollar operation. Look at an example:
A typical example would be:
where F can be:
so f (2+4) =f (2) *f (4). This mapping f is a homomorphism mapping. The result of the unitary 0 mapping of the addition operation is the unitary 1 of the multiplication. Meet the nature we mentioned before. Mathematical Principles

according to the previous imaging principle, and the same state definition, we propose homomorphic filtering, homomorphic filtering, homomorphic filtering is characterized by the compression of the gray scale range, while enhancing the contrast, contrast is similar to the increase in the pixel gray variance, and the compressed gray value to a certain extent limits the size of the variance, so the homomorphic filter is somewhat similar to, To give you a cut in wages, but also to make your work more enthusiastic .....

Based on the assumption of the imaging principle above, the image f (x, Y) =i (x, y) *r (x, y), but there is no relation to the Fourier transform (DFT), because the Fourier transform of the multiplication is not the multiplication of the Fourier transform:


So we have introduced the natural logarithm function, a magical operation that makes multiplication into addition, we define:


Then you can use Fourier's linearity to get:


Or:


Fi and Fr are Fourier transforms of ln i (x, y) and ln R (x, y) respectively. We design a filter to filter z, we can get:


With Fourier inverse transformation, the spatial image is obtained:


Where we can get the following definition:


So the processed image S can be expressed as:


Because before we did the natural logarithm operation, as a restore, we calculated:


which


I0 and R0 are the incident and reflection components after filtering processing.

The whole process is represented by the following flowchart:


Further, in the image, the transformation of the slow part of the irradiation component, and the occurrence of mutations is usually composed of reflective components, especially the object connection, corresponding to the spectrum is the high frequency and low frequency part, although only a rough approximation, but the results are very useful in the image.

Mathematical formula:


The shape of the filter:


Application

Preprocessing of images with obvious changes in illumination, reducing the characteristics of image illumination changes, and enhancing the details of darker parts

Code

#include "Homomorphicfilter.h" static double Distance (int x,int y,int c_x,int c_y) {        return sqrt ((x-c_x) * (x-c_x) + ( y-c_y) * (y-c_y));} void Homorphicfilter (double *filter,int width,int height,double cut_off_frequency,double lambda_l,double lambda_h, Double c) {    int center_x=width/2;    int CENTER_Y=HEIGHT/2;    double distance;    Double distance_2;    Double cut_off_frequency_2=cut_off_frequency*cut_off_frequency;    for (int i=0;i


Example

Original:


: Cutoff frequency 20,lambda_l=1.5,lambda_h=10,c=1

: Cutoff frequency 20,lambda_l=0.1,lambda_h=10,c=2


Summarize

In conclusion, homomorphic filtering can effectively solve the problem of the dark detail elimination caused by the light imbalance, and balanced illumination, frequency domain filtering can deal with various problems, But it comes down to the following: 1. The portion of the image to be retained and the part to be removed must be distinct in frequency; the properties of the 2 filter determine the processing result; 3 analysis of the spectrum is an important link.

Grayscale image--filtering homomorphic filtering in frequency domain

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.