document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. %{
  2. FIND THE NEGATIVE IMAGE
  3. %}
  4.  
  5. real = imread(\'z.jpg\');
  6. real1=real;
  7. %%showing the image
  8. figure(1)
  9. subplot(2,2,[1 2]),imshow(real),title(\'Original Image\');
  10. %%getting the gray image
  11. gray=rgb2gray(real1);
  12. [m,n]=size(gray);
  13. %now converting to get a negative image i.e 255-pixel value
  14. for i=1:m
  15.     for j=1:n
  16.         val=255-gray(i,j);
  17.         gray(i,j)=val;
  18.     end
  19. end
  20. subplot(2,2,[3 4]),imshow(uint8(gray)),title(\'Negative Image\');
');