This last activity is about demonstration of restoration of a corrupted grayscale image with a known degradation function which in this case is motion blur and additive noise using Weiner filtering.
The following schematic diagram is a model of the image degradation and restoration process.
From the diagram, f_hat(x, y) is the approximate original image after the degraded image passes through one or more restoration filters, then the degraded image in the spatial domain can then be written in an equation as follows.
Here, h(x, y) represents the degradation function, f(x, y) is the original image and n(x, y) embodies the added noise. Meanwhile, its frequency representation in Fourier space is shown below.
The transfer function of image degradation implemented here is the following.
The variable T corresponds to the duration of exposure while a and b are the blurring displacements in the horizontal or x and vertical or y direction respectively.
In restoring the original image, the estimate image f_hat and the corrupted image f must have minimum mean square error between them. This condition is satisfied through the expression as follows called the minimum mean square error filter or the Weiner filter.
Note that the power spectrum of the noise and the original image are included in the Weiner filter which are shown below.
The power spectrum is similar to the modulus of the degradation transfer function as in the following equation.
As usual the first factor in the right hand side of the expression above denotes the complex conjugate of H(u, v).
In most cases, the power spectrum of the noise and undergraded image are not known, hence the Weiner filter can be approximated in the expression as follows.
Instead of the power spectra, it is replaced by K which is a constant that can be varied.
At first, the following grayscale image is obtained from the internet.
Source: http://tvtropes.org/pmwiki/pmwiki.php/Main/Ptitlefjcz80qe
A Gaussian noise with mean and standard deviation of 0.02 is then applied to the image. Next, the degradation transfer function parameters a, b, and T are varied resulting to the set of images as shown below (Arranged from top to bottom, left to right).
For T = 1: (1) a = 0.1, b = 0.1; (2) a = 0.01, b = 0.01; (3) a = 0.001, b = 0.001
For a = 0.01, b = 0.01: (1) T = 0.01; (2) T = 0.1; (3) T = 10; (4) T = 100
For constant exposure time, it can be observed that the degraded image becomes more discernible as the blurring displacements a and b decrease. Meanwhile, for constant blurring displacements, the added Gaussian noise is masked by the blurred image as the exposure time T increases.
Shown as follows are the restored images using Weiner filtering with the spectrum of the noise and undergraded image for different degradation transfer function parameters (Arranged from top to bottom, left to right).
For T = 1: (1) a = 0.1, b = 0.1; (2) a = 0.01, b = 0.01; (3) a = 0.001, b = 0.001
For a = 0.01, b = 0.01: (1) T = 0.01; (2) T = 0.1; (3) T = 10; (4) T = 100
Apparently, the restoration approaches the original image as the blurring displacements decrease as well as the exposure time increases.
The following last set of images is composed of restored images using Weiner filter with varying K values (Arranged from top to bottom, left to right).
For a = 0.01, b = 0.01, T = 1: (1) K = 0; (2) K = 0.000001; (3) K = 0.00001; (4) K = 0.0001; (5) K = 0.001; (6) K = 0.01; (7) K = 0.1; (8) K = 1
It can be noticed that since a constant, which is based from the ratio of the power spectrum of the noise to the undergraded image, is added in all the elements of the matrix in the process Weiner filtering, the added Gaussian noise is eliminated at the same time magnifying the blurring effect as K increases.
Weiner filtering with the power spectrum of the noise and the undergraded image is then recommended to be used when the power spectrum of the added noise and the undergraded image is known and also with minimal degradation while Weiner filtering with the constant K is more applicable for various corrupted image even without the power spectra as long as K is carefully chosen.
Since I am able to demonstrate a corrupted image with motion blur and additive noise, and restore it using Weiner filtering successfully, I grade myself 10/10.
I have worked individually in this activity however I have shared my insights to my classmates.
Appendix
The Scilab code below is utilized in this activity.
stacksize(4e7);
image = gray_imread('dissidia.jpg');
//scf(0);
//imshow(image, []);
//imwrite(normal(image), 'bwdissidia.bmp');
s = size(image);
noise_gauss = grand(s(1), s(2), 'nor', 0.02, 0.02);
noisy_image = image + noise_gauss;
N = fft2(noise_gauss);
F = fft2(image);
a = 0.01;
b = 0.01;
T = 1;
H = [];
for i = 1:s(1)
for j = 1:s(2)
H(i, j) = (T/(%pi*(i*a + j*b)))*(sin(%pi*(i*a + j*b)))*exp(-%i*%pi*(i*a + j*b));
end
end
G = H.*F + N;
noisy_blurred = abs(ifft(G));
//scf(1);
//imshow(noisy_blurred, []);
//imwrite(normal(noisy_blurred), 'noisy blurred_a001_b001_T1.bmp');
SN = N.*conj(N);
SF = F.*conj(F);
restore1 = (((1)./H).*((H.*conj(H))./((H.*conj(H)) + (SN./SF)))).*G;
restore1 = abs(ifft(restore1));
//scf(2);
//imshow(restore1, []);
//imwrite(normal(restore1), 'restore_a001_b001_T1.bmp');
K = 0.01;
restore2 = (((1)./H).*((H.*conj(H))./((H.*conj(H)) + K))).*G;
restore2 = abs(ifft(restore2));
//scf(3);
//imshow(restore2, []);
//imwrite(normal(restore2), 'restoreK001.bmp');
The following schematic diagram is a model of the image degradation and restoration process.
From the diagram, f_hat(x, y) is the approximate original image after the degraded image passes through one or more restoration filters, then the degraded image in the spatial domain can then be written in an equation as follows.
Here, h(x, y) represents the degradation function, f(x, y) is the original image and n(x, y) embodies the added noise. Meanwhile, its frequency representation in Fourier space is shown below.
The transfer function of image degradation implemented here is the following.
The variable T corresponds to the duration of exposure while a and b are the blurring displacements in the horizontal or x and vertical or y direction respectively.
In restoring the original image, the estimate image f_hat and the corrupted image f must have minimum mean square error between them. This condition is satisfied through the expression as follows called the minimum mean square error filter or the Weiner filter.
Note that the power spectrum of the noise and the original image are included in the Weiner filter which are shown below.
The power spectrum is similar to the modulus of the degradation transfer function as in the following equation.
As usual the first factor in the right hand side of the expression above denotes the complex conjugate of H(u, v).
In most cases, the power spectrum of the noise and undergraded image are not known, hence the Weiner filter can be approximated in the expression as follows.
Instead of the power spectra, it is replaced by K which is a constant that can be varied.
At first, the following grayscale image is obtained from the internet.
Source: http://tvtropes.org/pmwiki/pmwiki.php/Main/Ptitlefjcz80qe
A Gaussian noise with mean and standard deviation of 0.02 is then applied to the image. Next, the degradation transfer function parameters a, b, and T are varied resulting to the set of images as shown below (Arranged from top to bottom, left to right).
For T = 1: (1) a = 0.1, b = 0.1; (2) a = 0.01, b = 0.01; (3) a = 0.001, b = 0.001
For a = 0.01, b = 0.01: (1) T = 0.01; (2) T = 0.1; (3) T = 10; (4) T = 100
For constant exposure time, it can be observed that the degraded image becomes more discernible as the blurring displacements a and b decrease. Meanwhile, for constant blurring displacements, the added Gaussian noise is masked by the blurred image as the exposure time T increases.
Shown as follows are the restored images using Weiner filtering with the spectrum of the noise and undergraded image for different degradation transfer function parameters (Arranged from top to bottom, left to right).
For T = 1: (1) a = 0.1, b = 0.1; (2) a = 0.01, b = 0.01; (3) a = 0.001, b = 0.001
For a = 0.01, b = 0.01: (1) T = 0.01; (2) T = 0.1; (3) T = 10; (4) T = 100
Apparently, the restoration approaches the original image as the blurring displacements decrease as well as the exposure time increases.
The following last set of images is composed of restored images using Weiner filter with varying K values (Arranged from top to bottom, left to right).
For a = 0.01, b = 0.01, T = 1: (1) K = 0; (2) K = 0.000001; (3) K = 0.00001; (4) K = 0.0001; (5) K = 0.001; (6) K = 0.01; (7) K = 0.1; (8) K = 1
It can be noticed that since a constant, which is based from the ratio of the power spectrum of the noise to the undergraded image, is added in all the elements of the matrix in the process Weiner filtering, the added Gaussian noise is eliminated at the same time magnifying the blurring effect as K increases.
Weiner filtering with the power spectrum of the noise and the undergraded image is then recommended to be used when the power spectrum of the added noise and the undergraded image is known and also with minimal degradation while Weiner filtering with the constant K is more applicable for various corrupted image even without the power spectra as long as K is carefully chosen.
Since I am able to demonstrate a corrupted image with motion blur and additive noise, and restore it using Weiner filtering successfully, I grade myself 10/10.
I have worked individually in this activity however I have shared my insights to my classmates.
Appendix
The Scilab code below is utilized in this activity.
stacksize(4e7);
image = gray_imread('dissidia.jpg');
//scf(0);
//imshow(image, []);
//imwrite(normal(image), 'bwdissidia.bmp');
s = size(image);
noise_gauss = grand(s(1), s(2), 'nor', 0.02, 0.02);
noisy_image = image + noise_gauss;
N = fft2(noise_gauss);
F = fft2(image);
a = 0.01;
b = 0.01;
T = 1;
H = [];
for i = 1:s(1)
for j = 1:s(2)
H(i, j) = (T/(%pi*(i*a + j*b)))*(sin(%pi*(i*a + j*b)))*exp(-%i*%pi*(i*a + j*b));
end
end
G = H.*F + N;
noisy_blurred = abs(ifft(G));
//scf(1);
//imshow(noisy_blurred, []);
//imwrite(normal(noisy_blurred), 'noisy blurred_a001_b001_T1.bmp');
SN = N.*conj(N);
SF = F.*conj(F);
restore1 = (((1)./H).*((H.*conj(H))./((H.*conj(H)) + (SN./SF)))).*G;
restore1 = abs(ifft(restore1));
//scf(2);
//imshow(restore1, []);
//imwrite(normal(restore1), 'restore_a001_b001_T1.bmp');
K = 0.01;
restore2 = (((1)./H).*((H.*conj(H))./((H.*conj(H)) + K))).*G;
restore2 = abs(ifft(restore2));
//scf(3);
//imshow(restore2, []);
//imwrite(normal(restore2), 'restoreK001.bmp');
































這BLOG真是讓人意猶未盡!!.........................
ReplyDeleteBirthdays are good for you. The more you have, the longer you live.............................................
ReplyDeletemay the blessing be always with you!! ........................................
ReplyDeletewonderful...................................................
ReplyDelete如果擬任為輸贏是最重要的事,那你輸了........................................
ReplyDelete處順境須謹慎,處逆境要忍耐。......................................................
ReplyDelete成人色情圖片激情聊天室火辣美眉520sex赤裸美女成人自拍貼圖18限性影片觀賞av色情影音聊天手淫激情成人聊天室成人色情圖片網sex520自拍走光照片淫慾18禁成人影音聊天美女台灣性網限制級女生手淫成人聊天春宮裙底風光情趣丁字褲極度震撼情色論壇露點成人視訊聊天avlive show愛愛明星露點台灣色情網站自慰少婦成人聊天網美女視訊成人頻道人妻熟女蕩婦一對多激情成人色情聊天室av成人上空秀巨奶視訊網愛聊天室一夜正妹色情貼片一對多免費美女視訊粉紅乳頭作愛影片美女聊天sexy成人色情圖片網女人胸部圖片視訊色情情色網站性關係辣妹聊天室大奶子
ReplyDelete感謝是愛心的第一步..................................................
ReplyDelete非常感謝~3Q~....................................................
ReplyDelete以簡單的行為愉悅他人的心靈,勝過千人低頭禱告。........................................
ReplyDeleteThank you for Posts~............................................................
ReplyDelete人間好話,要如海綿遇水牢牢吸住..................................................
ReplyDelete本土天堂自拍台灣夫妻自拍做愛自拍照片打炮自拍貼圖夫妻自拍片免費線上直播片銀赫歐美av線上歐美av線上看歐美女自慰歐美成人女星歐美成人片女星歐美成人免費線上歐美成人情色歐美色情圖貼歐美免費成人電影歐美免費成人影片觀看歐美免費自拍歐美免費做愛片歐美免費情色影片模特兒平台標題樣?嫚雪兒免費小說影片avi影片a直播影片下?影片分享fuck影片成人片影片成人免費凹凸色色卡通圖片免費即時通視訊成人論壇巨乳
ReplyDelete一個人想法的大小,決定他成就的大小。 ....................................................
ReplyDelete你不能改變容貌~~但你可以展現笑容..................................................................
ReplyDeleteKeep in contact. Good Luck..................................................
ReplyDelete欣賞是一種美德~回應是最大的支持^^.................................................................
ReplyDelete生存乃是不斷地在內心與靈魂交戰;寫作是坐著審判自己。......................................................................
ReplyDelete人有兩眼一舌,是為了觀察倍於說話的緣故。............................................................
ReplyDelete人有兩眼一舌,是為了觀察倍於說話的緣故。............................................................
ReplyDelete欣賞你的內容是美德~~支持你是最大回應..................................................................
ReplyDeleteA good medicine tastes bitter. ..................................................................
ReplyDelete當你真心渴望某一樣東西,整個宇宙都會聯合起來幫助你。..................................................
ReplyDelete責人之心責己,恕己之心恕人。..................................................................
ReplyDelete感謝分享~希望有更多的好文章分享給大家............................................................
ReplyDelete人並不是生來要吃敗仗的。人可被毀滅,但不可被擊倒。..................................................................
ReplyDelete在莫非定律中有項笨蛋定律:「一個組織中的笨蛋,恆大於等於三分之二。」............................................................
ReplyDelete偶爾上來逛逛,下次不知是否還有緣再進來,先祝您平安順利!!!...............................................................
ReplyDelete耐心是一株很苦的植物,但果實卻很甜美。..................................................
ReplyDelete拒絕冒險和成長的人,終將被生命的潮流陶汰。.......................................................
ReplyDeleteNo pains, no gains..................................................................
ReplyDelete人生最重要的一件事,就是從生活中認識你自己。......................................................
ReplyDelete如果你批評他人。你就沒有時間付出愛......................................................................
ReplyDeleteJoy often comes after sorrow, like morning after night.. . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReplyDelete心平氣和~祝你也快樂~~............................................................
ReplyDelete時間就是靈魂的生命。................. ................................................
ReplyDelete噴泉的高度,不會超過它的源頭。一個人的事業也是如此,它的成就絕不會超過自己的信念。......................................... ........................
ReplyDelete與朋友在一起,分擔的痛苦是減半的痛苦,分享的快樂是加倍的快樂。......................................................................
ReplyDelete原來天鵝嫁給癩蛤蟆就會生出醜小鴨。。。. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReplyDelete