face_test_luminance.m

来自「一个复杂背景下的人脸识别程序」· M 代码 · 共 30 行

M
30
字号
Ori_Face=imread('E:\程序1\Face_Detection_In_RGB_Model\Face\sub6.1.jpg');
copy=Ori_Face;

Chrom=rgb2ycbcr(copy);

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);
% imshow(filteredRGB);


imtool(copy);
imtool(Chrom);

⌨️ 快捷键说明

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