document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. %{
  2. Thresholding
  3. %}
  4. k=imread(\'white_bg.jpg\');
  5. x=rgb2gray(k);
  6. copy=x;
  7. imhist(x);
  8. [m,n]=size(x);
  9. for i=1:m
  10.     for j=1:n
  11.         if x(i,j)>=240
  12.            x(i,j)=0;
  13.         else
  14.             x(i,j)=255;
  15.         end
  16.     end
  17. end
  18. y=medfilt2(x);
  19. subplot(2,2,1),imshow(k),title(\'original image\');
  20. subplot(2,2,2),imshow(copy),title(\'Gray image\');
  21. subplot(2,2,3),imshow(uint8(x)),title(\'Output image\');
  22. subplot(2,2,4),imshow(uint8(y)),title(\'Filtered Output image\');
');