Matlab中批量处理图像(例:gaussian)

path = '......';                   	%输入目录
path_d = '......';					%保存目录
file = dir(fullfile(path,'*.jpg'));
w = fspecial('gaussian',300,80);
for i = 1 : length(file)
    % 连接路径和文件名得到完整的文件路径
    Img = imread(strcat(path,file(i).name));%文件所在路径
    Img_1 = imfilter(Img, w, 'replicate');
    imwrite(Img_1,strcat(path_d,file(i).name))
    %figure,imshow(Img);

end

你可能感兴趣的:(Matlab中批量处理图像(例:gaussian))