本人本科设计的人脸识别。有MATLAB仿真。
MATLAB源程序如下:
- % b=imread('r.jpg');
- % figure(1),imshow(b);
- % x=rgb2gray% g=medfilt2(x,[5 5]);figure(2);%中值滤波
- % imshow(g);
- % clear all;
- % b=imread('r.jpg');
- % x=rgb2gray(b); %转成灰度图像
- % H=adapthisteq(x);%直方图均衡化
- % figure(1),imshow(b);
- % xlabel('原始图像');
- % figure(2),imshow(H);
- % xlabel('adapthisteq均衡化');
- clear all;
- b=imread('ri.jpg');
- figure(1);
- imshow(b);
- x=rgb2gray(b); %转成灰度图像
- imhist(x);
- xlabel('(b)');%直方图
- newI=im2bw(x,128/255);%根据上面直方图选择阈值125,划分图像的前景和背景?
- figure(3);
- subplot(1,2,1);
- imshow(b);
- xlabel('(a) 原始图像');
- subplot(1,2,2);
- imshow(newI);
- xlabel('(b)分割后图像');
- % F=rgb2gray(imread('r.jpg'));
- % subplot(3,2,1);
- % imshow(F);
- % title('原图');
- % subplot(3,2,2);
- % imhist(F);
- % title('原图直方图');
- % subplot(3,2,3);
- % f=adapthisteq(F);
- % imshow(f);
- % title('adapthisteq均衡后图');
- % subplot(3,2,4);
- % imhist(f);
- % title('adapthisteq均衡后直方图');
- % subplot(3,2,5);
- % H2=histeq(F);
- % imshow(H2);
- % title('histeq均衡后图');
- % subplot(3,2,6);
- % imhist(f);
- % title('histeq均衡后直方图');
- %
- % clear all;
- % F=rgb2gray(imread('r.jpg'));
- % g=medfilt2(F,[5 5]);%中值滤波
- % figure;
- % subplot(3,2,1);
- % imshow(g);
- % title('中值滤波')
- % subplot(3,2,2);
- % imhist(g);
- % title('中值滤波直方图');
- % g1=wiener2(F,[5 5]);%自适应滤波
- % subplot(3,2,3);
- % imshow(g1);
- % title('自适应滤波')
- % subplot(3,2,4);
- % imhist(g1);
- % title('自适应滤波');
- % g2=filter2(fspecial('average',3),F)/255;%均值滤波
- % subplot(3,2,5);
- % imshow(g2);
- % title('均值滤波')
- % subplot(3,2,6);
- % imhist(g2);
- % title('均值滤波');
- % subplot(3,2,3);
- % f=adapthisteq(g);
- % imshow(f);
- % title('中值滤波adapthisteq均衡后图');
- % subplot(3,2,4);
- % imhist(f);
- % title('中值滤波adapthisteq均衡后直方图');
- % newI=im2bw(g,115/255);%根据上面直方图选择阈值,划分图像的前景和背景
- % figure;
- % imshow(newI);
- % % title('adapthisteq均衡后图');
- % newI1=im2bw(g1,110/255);%根据上面直方图选择阈值划分图像的前景和背景
- % figure;
- % imshow(newI1);
- % %title('histeq均衡后图');
- % newI1=im2bw(g2,20);%根据上面直方图选择阈值,划分图像的前景和背景
- % figure;
- % imshow(newI2);
- …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
所有资料51hei提供下载:
chengxu.rar
(472.66 KB, 下载次数: 113)
|