face_test_luminance.m

来自「这是一个关于人脸识别的MATLAB程序。。。。。。。」· M 代码 · 共 35 行

M
35
字号
Ori_Face=imread('k001.JPG');
copy=Ori_Face;
figure(1);
imshow(copy);
Chrom=rgb2ycbcr(copy);
figure(2);
imshow(Chrom)
for i=1:size(Chrom,1)%Read row pixels
    for j=1:size(Chrom,2)%Read column pixels
        %This conditions will determine the face based on RGB colour value
        if (105<Chrom(i,j,1)<117 && 110<Chrom(i,j,2)<113 && Chrom(i,j,3)>128)%why i can't extract blue color properly?
            copy(i,j,1)=0;                                                   %is my condition have any mistakes?
            copy(i,j,2)=0;
            copy(i,j,3)=255;                                                 %i get my pixel value by pixel region tool/
        
        %If above conditions is not meet, other colour values will be set to 255 (white)    
        else
            copy(i,j,1)=255;
            copy(i,j,2)=255;
            copy(i,j,3)=255;
            
        end
    end
end

 h = fspecial('prewitt');
 filteredRGB = imfilter(copy, h);
figure(3);
 imshow(filteredRGB);
 figure(4);
 imshow(copy);


%imtool(copy);
%imtool(Chrom);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?