91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 8KB
    文件類型: .m
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-05
  • 語言: Matlab
  • 標簽: matlab??臉部識別??

資源簡介

數字圖像處理是計算機科學專業的一門基礎學科,而其中人臉識別及分割又是其中最為經典不可缺失的一部分。本文采用MATLAB- VISION包中強大的圖像識別功能,對目標圖像進行人臉識別。VISION中的級聯分類器具有識別人臉,嘴巴,鼻子,左右眼等功能。并且準確度高,能在較為復雜的環境下識別出目標。

資源截圖

代碼片段和文件信息

%分類器
clear?all??
clc??
close?all??
FDetect?=?vision.CascadeobjectDetector;?
%讀取照片??
image=?imread(‘tianyuhang.png‘);??
I=?rgb2gray(image);%二值化
face_dtect?=?step(FDetectI);??
%%%%%%%%%%%%%%%人臉識別%%%%%%%%%%%%%
figure(1);
imshow(I);hold?on??
for?i?=?1:size(face_dtect1)??
????rectangle(‘Position‘face_dtect(i:)‘LineWidth‘4‘Linestyle‘‘-‘‘EdgeColor‘‘r‘);??
end??
title(‘Face?Detection‘);??
hold?off;??
print(gcf‘-dpng‘‘shibielian.png‘);?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%識別鼻子%%%%%%%%%%%
NoseDetect?=?vision.CascadeobjectDetector(‘Nose‘‘MergeThreshold‘16);??
face_dtect=step(NoseDetectI);??
figure(2)??
imshow(I);?hold?on??
for?i?=?1:size(face_dtect1)??
????rectangle(‘Position‘face_dtect(i:)‘LineWidth‘4‘Linestyle‘‘-‘‘EdgeColor‘‘r‘);??
end??
hold?off;??
print(gcf‘-dpng‘‘shibiebizi.png‘);?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%識別嘴%%%%%%%%%%%%%%
mouth_detect?=?vision.CascadeobjectDetector(‘Mouth‘‘MergeThreshold‘150);????
face_dtect=step(mouth_detectI);???
figure(3)??
imshow(I);?hold?on??
for?i?=?1:size(face_dtect1)??
?rectangle(‘Position‘face_dtect(i:)‘LineWidth‘4‘Linestyle‘‘-‘‘EdgeColor‘‘r‘);??
end??
hold?off;??
print(gcf‘-dpng‘‘shibiezui.png‘);??%保存為png格式的圖片到當前路徑
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%識別眼%%%%%%%%%%%%
lefteye_detect?=?vision.CascadeobjectDetector(‘LeftEye‘‘MergeThreshold‘100);???
face_dtect=step(lefteye_detectI);?
figure(4)??
imshow(I);?hold?on??
for?i?=?1:size(face_dtect1)??
?rectangle(‘Position‘face_dtect(i:)‘LineWidth‘4‘Linestyle‘‘-‘‘EdgeColor‘‘r‘);??
end??
hold?off;
print(gcf‘-dpng‘‘shibieyan.png‘);???%保存為png格式的圖片到當前路徑
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



%%%%%%%%%%識別眼%%%%%%%%%%%%%%%%
%?righteye_detect?=?vision.CascadeobjectDetector(‘RightEye‘‘MergeThreshold‘50);???
%?face_dtect=step(righteye_detectI);?
%?figure(5)??
%?imshow(I);?hold?on??
%?for?i?=?1:size(face_dtect1)??
%??rectangle(‘Position‘face_dtect(i:)‘LineWidth‘4‘Linestyle‘‘-‘‘EdgeColor‘‘r‘);??
%?end??
%?hold?off;
%?print(gcf‘-dpng‘‘shibieyanright.png‘);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%?*******************************************************************************************************
%?***************************************識別臉部*********************************************************
%%%%%%%%%%%%%%%%%%%提取臉部的紅色分量%%%%%%%%%
shibie=imread(‘shibielian.png‘);
hsv=rgb2hsv(shibie);
s=hsv(::2);
bw=im2bw(sgraythresh(s));
se=strel(‘disk‘5);
bw2=imclose(bwse);
bw3=bwareaopen(bw2200);
figure(6);
imshow(bw3);
print(gcf‘-dpng‘‘tiquyan.png‘);???%保存為png格式的圖片到當前路徑
%%%%%%%%%%%%%%%%%填充眼%%%%%%%%%%%%%%%%%
tianchong?=?imread(‘tiquyan.png‘)
J=tianchong(::1);?

K=J>30;%閾值分割,30通過工作空間觀察得到

[Lnum]?=?bwlabel(K8);%連通塊標記?
F=L>1;%除去周邊區域?
F(339269)=1;%在工作空間中找到使最大目標不連通的點,賦值,使之連通
BW2?=?imfill(F‘holes‘);%填充區域?
imwrite(BW2‘tianchongyan.png‘‘png‘)%用imwrite寫沒有白邊

%%%%%%%%%%%

評論

共有 條評論