我應該設計和實現一個自適應濾波器來消除醫學圖像中的脈衝噪聲! 我是圖像處理新手。並不知道如何設計一個過濾器! 我檢查了預定義的過濾器...他們不是我想要的! 請幫助這是我的B.S.項目!如何設計和實現用於脈衝噪聲去除的自適應濾波器?
0
A
回答
0
脈衝噪聲通常使用median
濾波器進行處理。
要構建自適應濾波器,我會使用統計數據來確定在窗口內是否有光滑的部分。
我會在使用Windows的圖像上工作。
在每個窗口中我會檢查中位數和平均值。
如果他們彼此遠離,我會應用median
過濾器,否則,應用本地LPF過濾器什麼也不做。
它是簡單...
-1
我已經找到一個關於它的文件,這是我實現
function adaptive()
I = imread('1.png');
x = rgb2gray(I);
%%-------adding Noise-----------------------
disp('Noise density lies between 0 and 1');
disp(' ');
ND = input('Enter Noise Density [0.5] : ');
if isempty(ND)
ND = 0.5;
end
y=x;
Narr = rand(size(y));
N = Narr;
N(N>=ND)=0;
N1 = N;
N1 = N1(N1>0);
Imn=min(N1(:));
Imx=max(N1(:));
N=(((N-Imn).*(255-0))./(Imx-Imn));
y(Narr<ND) = N(Narr<ND);
y=double(y);
%%------noise detection------------------------
adj = imadjust(y);
L = max(adj);
[M,N] = size(y);
for i = 1:M
for j = 1:N
if y(i,j) == L(j)-1 || y(i,j) == 0
alpha(i,j) = 1; %%the value 1 presents the 「noise pixel」
else
alpha(i,j) = 0; %%the value 0 presents the 「noise-free pixel」.
end
end
end
K=0;
for i = 1:M
for j = 1:N
if alpha(i,j) == 1;
K=K+1; %%total number of the 「noise pixel」, K.
end
end
end
n = K/(M*N); %%the ratio of the 「noise pixels」 to
%%the total number of pixels contained in the image
%%------noise elimination------------------------
%%R=1;
R = floor(0.5 * sqrt(7/(1-n)));
m = ones(size(y(:)));
for i = 1:M
for j = 1:N
if alpha(i,j) == 1 %% this is a noise pixel
nnum=0; %%noise number
while nnum <= 8
R = R+1; %% This will make the filter window 2pixels larger
clear tmp;
if i-R <= 0 || i+R >= M
while i-R <= 0
R=R-1;
end
while i+R >= M
R=R-1;
end
end
if j-R <= 0 || j+R >= N
while i-R <= 0
R=R-1;
end
while i+R >= M
R=R-1;
end
end
tmp = y(i-R:i+R , j-R:j+R); %% filter window
w = 2*R +1 ; %% Size of filter window
for s = 1:w
for p = 1:w
if tmp(s,p) == 0 || tmp(s,p) == L(j)-1
nnum=nnum+1; %%number of free noise pixels in the window
end
end
end
end
clear temp;
temp = y(i-R:i+R , j-R:j+R); %% filter window
S = sort(temp(:));
if S(1) < S(R+1) && S(R+1) < S(w) && 0 < S(R+1) && S(R+1) < L(j)
m(i,j) = S(R+1);
end
if S(1) >= S(R+1) || S(R+1) >= S(w) || S(R+1) == L(j) && S(R+1) == 0
t = y(i,j-1);
m(i,j) = t;
end
end
end
end
for i = 1:M
for j = 1:N
if alpha(i,j) == 0 %% the value of z(i,j) is copied directly as the value of y(i,j).
z = y(i,j);
else
z = m(i,j); %%the output value z(i,j) is equal to m(i,j).
end
end
end
imshow(x);
figure,imshow(y);
figure,imshow(z);
end
我做了一個錯誤,請大家幫忙代碼!
錯誤:內存不足。爲您的選項鍵入HELP MEMORY。 自適應錯誤(96行) m(i,j)= t;
和
標指標必須是真正的正整數或 邏輯值。 自適應錯誤(第73行) tmp = y(i-R:i + R,j-R:j + R); %%過濾器 窗口
相關問題
- 1. 用SVG濾波器實現自適應閾值濾波器
- 2. C++ FIR噪聲濾波器
- 3. 如何使用Matlab中的濾波器去除Fourier級數產生的方波脈衝中的紋波?
- 4. 邊框噪聲去除實現
- 5. 如何使用matlab的濾波函數來計算濾波器的脈衝響應樣本?
- 6. 設計抄襲檢測引擎噪聲濾波器在Ruby中
- 7. MatLab中的濾波器噪聲
- 8. 在Python中使用卡爾曼濾波器濾除加速度計噪聲
- 9. 在matlab中使用維納濾波器去除椒鹽噪音
- 10. 使用過濾器2去除高斯噪聲
- 11. 設計濾波器
- 12. matlab中去噪圖像的幾何均值濾波器
- 13. 用脈衝產生方波
- 14. 從圖像中去除胡椒噪聲和鹽噪聲
- 15. 泊松噪聲去除,MATLAB
- 16. 試圖從加速度計和陀螺儀濾波器(噸)噪聲
- 17. Flash中的Perlin噪聲如何實現?
- 18. 如何實現Raphael.js中的Perlin噪聲?
- 19. 如何設計多濾波器集合
- 20. 使用IIR濾波器生成粉紅噪聲
- 21. 手動添加圖像中的脈衝噪聲
- 22. Prewitt濾波器實現Matlab
- 23. 使用opencv去除噪聲像素
- 24. 爲solr設計濾波器
- 25. 應用於圖像的高斯噪聲(用於模擬傳感器噪聲)
- 26. 解釋卡爾曼濾波器中的過程噪聲術語
- 27. 噪聲背景,我該如何實現?
- 28. 如何爲iPhone加速計實現高通濾波器?
- 29. 數據表濾波器去除
- 30. Android的自定義按鈕紋波/脈衝效應
有點含糊。我想你應該決定是否需要線性濾波器和非線性濾波器。這可能是一個開始。 – Jiminion
當我學習了自適應濾波器之後,它們在某些情況下像線性濾波器一樣工作,並且像其他濾波器中的非線性濾波器一樣... 您的建議是什麼? –
你可以描述空間衝動嗎?他們總是積極的還是消極的?或兩者?如果你有這個尺寸,我會建議使用線性濾波器來平滑它(保留信息)或者非線性濾波器來完全去除它(不保留所有信息)。 – Jiminion