標(biāo)題: MATLAB仿真人臉識別程序 [打印本頁]

作者: sundaykiller    時間: 2017-7-3 10:32
標(biāo)題: MATLAB仿真人臉識別程序
本人本科設(shè)計的人臉識別。有MATLAB仿真。

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);  %轉(zhuǎn)成灰度圖像
  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);  %轉(zhuǎn)成灰度圖像
  18. imhist(x);
  19. xlabel('(b)');%直方圖


  20. newI=im2bw(x,128/255);%根據(jù)上面直方圖選擇閾值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]);%自適應(yīng)濾波
  61. % subplot(3,2,3);
  62. % imshow(g1);
  63. % title('自適應(yīng)濾波')
  64. % subplot(3,2,4);
  65. % imhist(g1);
  66. % title('自適應(yīng)濾波');
  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);%根據(jù)上面直方圖選擇閾值,劃分圖像的前景和背景
  82. % figure;
  83. % imshow(newI);
  84. % % title('adapthisteq均衡后圖');
  85. % newI1=im2bw(g1,110/255);%根據(jù)上面直方圖選擇閾值劃分圖像的前景和背景
  86. % figure;
  87. % imshow(newI1);
  88. % %title('histeq均衡后圖');
  89. % newI1=im2bw(g2,20);%根據(jù)上面直方圖選擇閾值,劃分圖像的前景和背景
  90. % figure;
  91. % imshow(newI2);

  92. …………限于本文篇幅 余下代碼請從51黑下載附件…………
復(fù)制代碼

所有資料51hei提供下載:
chengxu.rar (472.66 KB, 下載次數(shù): 113)









歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1