main.m 873 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. clear all;
  2. close all;
  3. clc;
  4. path = '낚�暠獗/헌九/8.jpg';
  5. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  6. % path = '낚�暠獗/꼇헌九/3.jpg';
  7. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  8. % path = '낚�暠獗/꼇헌九2/11.jpg';
  9. % path = '뿍�.jpg';
  10. Img = imread(path);
  11. if size(Img,3) == 3
  12. Img = rgb2gray(Img);
  13. end
  14. [h,w]=size(Img);
  15. if h<64
  16. Img = imresize(Img, [64, w], 'bilinear');
  17. h=64;
  18. end
  19. if w<64
  20. Img = imresize(Img, [h, 64], 'bilinear');
  21. w=64;
  22. end
  23. figure;
  24. subplot(2,2,1);
  25. imshow(Img);
  26. title('Original Image');
  27. sigma = 2.0;
  28. K=fspecial('gaussian',15,sigma); % 15 Caussian kernel
  29. gausImg = conv2(double(Img),double(K),'same');
  30. % gausImg = conv2(Img, K,'same');
  31. gausImg8 = uint8(gausImg);
  32. subplot(2,2,2);
  33. title('Smoothed image');
  34. % imshow(gausImg,[0, 255]);
  35. imshow(gausImg8);
  36. val1 = CPBD_compute(Img);
  37. val2 = CPBD_compute(gausImg8);
  38. val = val1 - val2;