I want to use a homomorphic filter to work on an underwater image. I tried to encode it with codes found on the Internet, but I always have a black image ... I tried to normalize my result, but did not work.
Here are my functions:
void HomomorphicFilter::butterworth_homomorphic_filter(Mat &dft_Filter, int D, int n, float high_h_v_TB, float low_h_v_TB) { Mat single(dft_Filter.rows, dft_Filter.cols, CV_32F); Point centre = Point(dft_Filter.rows/2, dft_Filter.cols/2); double radius; float upper = (high_h_v_TB * 0.01); float lower = (low_h_v_TB * 0.01);
and here is my main code:
/**************************/ /****Homomorphic filter****/ /**************************/ /**********************************************/ //Getting the frequency and magnitude of image// /**********************************************/ Mat image_phase, image_mag; HomomorphicFilter().Fourier_Transform(frame_bw, image_phase, image_mag); /******************/ //Shifting the DFT// /******************/ HomomorphicFilter().Shifting_DFT(image_mag); /********************************/ //Butterworth homomorphic filter// /********************************/ int high_h_v_TB = 101; int low_h_v_TB = 99; int D = 10;// radius of band pass filter parameter int order = 2;// order of band pass filter parameter HomomorphicFilter().butterworth_homomorphic_filter(image_mag, D, order, high_h_v_TB, low_h_v_TB); /******************/ //Shifting the DFT// /******************/ HomomorphicFilter().Shifting_DFT(image_mag); /*******************************/ //Inv Discret Fourier Transform// /*******************************/ Mat inverseTransform; HomomorphicFilter().Inv_Fourier_Transform(image_phase, image_mag, inverseTransform); imshow("Result", inverseTransform);
If someone can explain my mistakes to me, I would really appreciate :). Thanks and sorry for my bad english.
EDIT: Now I have something, but it's not perfect ... I changed 2 things in my code. I applied log (mag + 1) after dft and not on the input image. I removed exp () after idft.
here are the results (I can publish only 2 links ...):
my input image:
final result: 
having seen several topics, I find similar results for the butterworth filter and for my size after dft / shifting. Unfortunately, my end result is not very good. Why do I have so much "noise"?