Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. xray=imread('x-ray_angiogram.jpg');
  2. xray=rgb2gray(xray);
  3. [M,N] = size(xray);
  4. %find original rmin
  5. MAX=xray(1,1);
  6. for i=1:M
  7. for j=1:N
  8. if MAX <= xray(i,j);
  9. MAX=xray(i,j);
  10. end
  11. end
  12. end
  13. %find original rmax
  14. MIN=xray(1,1);
  15. for i=1:M
  16. for j=1:N
  17. if MIN >= xray(i,j);
  18. MIN=xray(i,j);
  19. end
  20. end
  21. end
  22.  
  23. %apply contrast stretching
  24. slope = 255/(MAX-MIN);
  25. intercept = 255 - slope*MAX;
  26. xraystretched = slope.*xray + intercept;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement