找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3681|回复: 0
收起左侧

MATLAB仿真人脸识别程序

[复制链接]
ID:215255 发表于 2017-7-3 10:32 | 显示全部楼层 |阅读模式
本人本科设计的人脸识别。有MATLAB仿真。
0.png
MATLAB源程序如下:
  1. % b=imread('r.jpg');
  2. % figure(1),imshow(b);
  3. % x=rgb2gray% g=medfilt2(x,[5 5]);figure(2);%中值滤波
  4. % imshow(g);


  5. % clear all;
  6. % b=imread('r.jpg');
  7. % x=rgb2gray(b);  %转成灰度图像
  8. % H=adapthisteq(x);%直方图均衡化
  9. % figure(1),imshow(b);
  10. % xlabel('原始图像');
  11. % figure(2),imshow(H);
  12. % xlabel('adapthisteq均衡化');


  13. clear all;
  14. b=imread('ri.jpg');
  15. figure(1);
  16. imshow(b);
  17. x=rgb2gray(b);  %转成灰度图像
  18. imhist(x);
  19. xlabel('(b)');%直方图


  20. newI=im2bw(x,128/255);%根据上面直方图选择阈值125,划分图像的前景和背景?
  21. figure(3);
  22. subplot(1,2,1);
  23. imshow(b);
  24. xlabel('(a) 原始图像');
  25. subplot(1,2,2);
  26. imshow(newI);
  27. xlabel('(b)分割后图像');

  28. % F=rgb2gray(imread('r.jpg'));
  29. % subplot(3,2,1);
  30. % imshow(F);
  31. % title('原图');
  32. % subplot(3,2,2);
  33. % imhist(F);
  34. % title('原图直方图');
  35. % subplot(3,2,3);
  36. % f=adapthisteq(F);
  37. % imshow(f);
  38. % title('adapthisteq均衡后图');
  39. % subplot(3,2,4);
  40. % imhist(f);
  41. % title('adapthisteq均衡后直方图');
  42. % subplot(3,2,5);
  43. % H2=histeq(F);
  44. % imshow(H2);
  45. % title('histeq均衡后图');
  46. % subplot(3,2,6);
  47. % imhist(f);
  48. % title('histeq均衡后直方图');
  49. %
  50. % clear all;
  51. % F=rgb2gray(imread('r.jpg'));
  52. % g=medfilt2(F,[5 5]);%中值滤波
  53. % figure;
  54. % subplot(3,2,1);
  55. % imshow(g);
  56. % title('中值滤波')
  57. % subplot(3,2,2);
  58. % imhist(g);
  59. % title('中值滤波直方图');

  60. % g1=wiener2(F,[5 5]);%自适应滤波
  61. % subplot(3,2,3);
  62. % imshow(g1);
  63. % title('自适应滤波')
  64. % subplot(3,2,4);
  65. % imhist(g1);
  66. % title('自适应滤波');
  67. % g2=filter2(fspecial('average',3),F)/255;%均值滤波
  68. % subplot(3,2,5);
  69. % imshow(g2);
  70. % title('均值滤波')
  71. % subplot(3,2,6);
  72. % imhist(g2);
  73. % title('均值滤波');

  74. % subplot(3,2,3);
  75. % f=adapthisteq(g);
  76. % imshow(f);
  77. % title('中值滤波adapthisteq均衡后图');
  78. % subplot(3,2,4);
  79. % imhist(f);
  80. % title('中值滤波adapthisteq均衡后直方图');

  81. % newI=im2bw(g,115/255);%根据上面直方图选择阈值,划分图像的前景和背景
  82. % figure;
  83. % imshow(newI);
  84. % % title('adapthisteq均衡后图');
  85. % newI1=im2bw(g1,110/255);%根据上面直方图选择阈值划分图像的前景和背景
  86. % figure;
  87. % imshow(newI1);
  88. % %title('histeq均衡后图');
  89. % newI1=im2bw(g2,20);%根据上面直方图选择阈值,划分图像的前景和背景
  90. % figure;
  91. % imshow(newI2);

  92. …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码

所有资料51hei提供下载:
chengxu.rar (472.66 KB, 下载次数: 112)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表