Chạy chương trình Matlab để mô phỏng thuật toán lọc ảnh trung bình như thế nào với các kiểu ảnh có mật độ nhiễu khác nhau: nhiễu 10%, 20%, 30%,.....80%, 90% với 1 ảnh gốc Lena, cho nhiễu các mức độ khác nhau trên Matlab sau đó đưa vào lọc để xử lý, lưu ảnh kết quả lại.
Em có cái code này mà sao chạy hoài ko đc cái bác giúp em cái
function output_image = ro_filt(image_file,order);
%
% filename: ro_filt.m
% author: Tony Nelson
% date: 1/11/00
% detail: performs basic 3x3 rank order filtering
%
input_image = LoadImage(image_file); % loads image into input_image
[ylength,xlength] = size(input_image); % determines size of input image
output_image(1:ylength,1:xlength) = zeros; %inits output_image
% loops to simulate SE window passing over image
for y=1:ylength-2
for x=1:xlength-2
window = [input_image(y
y+2),x
x+2))];
window_v = [[window(1,1:3)] [window(2,1:3)] [window(3,1:3)]];
sorted_list = sort(window_v);
output_image(y+1,x+1) = sorted_list(order);
sorted_list(order);
end
end
%plots ro filtered image
figure;
image(output_image)
colormap(gray(256));
title('Rank Order Filter Output');
đấy là thuật toán chạy Rank Order Fillter đó