Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.74 KB | None | 0 0
  1. imgGray = read_as_grayscale('bloodcells/test_images/092.png');
  2. imgGray = padarray(imgGray,[50 50],'s');                % Mirror image to find edge/corner-cells
  3.  
  4. cells = cell_detector(imgGray);
  5.  
  6. imagesc(imgGray), colormap gray
  7. hold on
  8. plot(cells(1,:),cells(2,:),'y*')
  9. hold on
  10. rectangle('Position',[50 50 388 260])
  11.  
  12. function centres = cell_detector(img)
  13.    
  14.     load linearClassifier.mat;
  15.     result = imfilter(img,w);                           % Filter with linear classifier
  16.     centres = strict_local_maxima(result);
  17.    
  18.  
  19. end
  20.  
  21. function maxima = strict_local_maxima(image)
  22.  
  23.     max = ordfilt2(image, 9, ones(3,3));
  24.     indicator = (image==max);
  25.     [row, col] = find(indicator);
  26.     maxima = [col row]';
  27.    
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement