影像行畫素處理

XiaoShan_whpu發表於2020-12-16
% this is a funciton deal with thress pixel neiberhude 
clc;
clear all;
file = dir('*.bmp');

image_data =  imread(file(1).name);

[h, w ,d]=size(image_data);

temp = image_data(:,:,1);

for j = 2:(w-3)
    for i = 1:h
        if(temp(i,j)==temp(i,j+3))
            if((temp(i,j)==temp(i,j+1))&&(temp(i,j+1)==temp(i,j+2)))
                %do nothing
            else
                image_data(i,j+1,:)=[255 204 102];
                image_data(i,j+2,:)=[255 204 102];
                disp(j);
            end
        end
    end
end
%imshow(image_data);
imwrite(image_data,'a.bmp');

 

相關文章