What if the histogram is filtered in the frequency domain?

Source: Internet
Author: User

Original histogram:

Perform one-dimensional discrete cosine transformation. The formula is as follows:

ReferenceCodeAs follows:

View code

 Private   Int  [] Fourier (){  Int [] Ft = New   Int [ 256  ];  Int N = 256  ; Double Cu = 1  ;  For ( Int U = 0 ; U <n; U ++ ){  If (U = 0  ) {Cu = 1.0 /Math. SQRT ( 2  );}  Double Sum = 0  ;  For ( Int X = 0 ; X <n; X ++ ) {Sum + = Grays [x] * Math. Cos (( 2 * X + 1 ) * U * Math. PI /( 2 * N ));}  Double Temp = Cu * Math. SQRT ( 2.0 /N )*SUM; ft [u] = ( Int  ) Temp ;}  Return  FT ;} 

 

The inverse transformation formula is as follows:

The reference code is as follows:

View code

 Private   Int  [] Invertfourier (){  Int [] Inverseft = New   Int [256  ];  Int N = 256  ;  For ( Int X = 0 ; X <n; X ++ ){  Double Sum = 0  ; Sum = ( 1 /Math. SQRT ( 2.0 ) * Ditong [0  ];  For ( Int U = 1 ; U <n; U ++ ) {Sum + = Ditong [u] * Math. Cos (( 2 * X + 1 ) * U * Math. PI /( 2 * N ));}  Double Temp = math. SQRT ( 2.0 /N )*SUM; inverseft [x] = Math. Abs (( Int  ) Temp );}  Return  Inverseft ;} 

 

In the two formula, the value of the coefficient C (u) follows the following rules:

Here, U is the frequency field variable, X is the gray value, and f (x) is the statistic corresponding to the gray value.

After the histogram is transformed by DCT, the spectrum image is obtained.

According to the original idea, filtering out the high-frequency part can smooth the waveform.

Low-pass

Assume that an ideal low-pass filter is used, that is, a threshold value of D0 is set, and the frequency of the part above D0 is restrained. The part below D0 can pass through.

Assuming that D0 is 0.618 times of the DC component, the effect of filtering in the frequency domain and inverse DCT transformation is:

If you set D0 to 0.5 times of the DC component, the effect is:

Set D0 to 0.2 times of the DC component, and the effect is:

Set D0 to 0.1 times of the DC component, and the effect is:

 

Qualcomm-frequency based on the number of trade-offs

If you perform a high-pass operation on the histogram curve, the following results will be displayed:

Case 1: When only the DC component is retained:

Case 2: retain the DC component, and the first 10 AC components:

By comparing the original histogram, we can see that a rough outline has been displayed:

Case 3: When the DC component and the first 20 AC components are retained:

At this point, the form is closer to the original histogram:

Case 4: When the DC component and the first 30 AC components are retained:

Case 5: When the DC component and the first 50 AC components are retained

Qualcomm-choose Based on Frequency

When D0 = 0.9 * DC component:

When D0 = 0.8 * DC component:

When D0 = 0.5 * DC component:

When D0 = 0.4 * DC component:

When D0 = 0.3 * DC component:

When D0 = 0.2 * DC component:

When D0 = 0.1 * DC component:

When D0 = 0.05 * DC component:

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.