Advertisement
makispaiktis

Image Processing Onramp - Course 2 - Image Segmentation

Aug 1st, 2023
1,085
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.31 KB | None | 0 0
  1. % 1. Load image, convert to grayscale, adjust
  2. img = imread("IMG_001.jpg");
  3. gs = im2gray(img);
  4. gsAdj = imadjust(gs);
  5. imshow(gsAdj)
  6.  
  7. % 2. Image Segmentation - Threshold = 128
  8. BW = gsAdj > 255/2;
  9. imshow(BW)
  10.  
  11. % 3. See the histogram
  12. imhist(gsAdj)
  13.  
  14. % 4. New image segmentation
  15. BW = gsAdj > 200;
  16. imshow(BW)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement