MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB图像处理] 求人解释下程序,急~~ (https://www.labfans.com/bbs/showthread.php?t=11812)

a55473262 2010-06-30 13:45

求人解释下程序,急~~
 
小弟初学MATLAB图像处理,有一段程序不太懂,求大大给解释下一下,最好能逐行解释,非常感谢!(这段程序是基于肤色进行人脸识别的)

clear all;
close all;
clc
I=imread('1.jpg');
imshow(I)
cform = makecform('srgb2lab');
J = applycform(I,cform);
figure;imshow(J);
K=J(:,:,2);
figure;imshow(K);
L=graythresh(J(:,:,2));
BW1=im2bw(J(:,:,2),L);
figure;imshow(BW1);
M=graythresh(J(:,:,3));
figure;imshow(J(:,:,3));
BW2=im2bw(J(:,:,3),M);
figure;imshow(BW2);
O=BW1.*BW2;
% Bounding box
P=bwlabel(O,8);
BB=regionprops(P,'Boundingbox');
BB1=struct2cell(BB);
BB2=cell2mat(BB1);

[s1 s2]=size(BB2);
mx=0;
for k=3:4:s2-1
p=BB2(1,k)*BB2(1,k+1);
if p>mx & (BB2(1,k)/BB2(1,k+1))<1.8
mx=p;
j=k;
end
end
figure,imshow(I);
hold on;
rectangle('Position',[BB2(1,j-2),BB2(1,j-1),BB2(1,j),BB2(1,j+1)],'EdgeColor','r' )


所有时间均为北京时间。现在的时间是 12:30

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.