matlab 修改rbg图像中指定范围内像素点的rgb值

function  imgto=color_mark(img, diam,color_to )
%UNTITLED2 Summary of this function goes here
%   img is input image which is a rgb image
%   diam is a pixel scale in image [208,313,375,705]; [208 313] is
%   lefttop,[375,705] is right bottom
imgto=img;
for x = diam(2):diam(4)
    for y = diam(1):diam(3)
    R=imgto(x,y,1);
    G=imgto(x,y,2);
    B=imgto(x,y,3);
    if (R~=255|G~=255|B~=255);
        imgto(x,y,1)=color_to(1);
        imgto(x,y,2)=color_to(2);
        imgto(x,y,3)=color_to(3);
    end
    end
    
end
return;
end

你可能感兴趣的:(image,processing)