Guest User

Untitled

a guest
Dec 7th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. % load floating and fix image
  2.  
  3. %% image segmentation using k-mean clustring.
  4. idx_fix = kmeans(double(fix(:)),4);
  5. idx_float = kmeans(double(float(:)),4);
  6.  
  7. %% display image segmentation
  8. mat1 = reshape(idx_fix,[],500);%besed on your image size
  9. mat2 = reshape(idx_float,[],500);
  10. imshow(mat1/max(mat1(:))); title('Fix image class');
  11. figure;
  12. imshow(mat2/max(mat2(:))); title('Float image class');
  13.  
  14. %% Joint class histogram
  15. joint = zeros(5,5);%besed on number of class
  16. for i=1:length(idx_fix)
  17. c1 = idx_fix(i) + 1;%offset matrix by 1 because index start by 1
  18. c2 = idx_float(i) + 1;
  19. joint(c1, c2) = joint(c1,c2) + 1;
  20. end
Add Comment
Please, Sign In to add comment