Advertisement
Guest User

Untitled

a guest
May 16th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.38 KB | None | 0 0
  1. image = imread('test.bmp');
  2. height = size(image)(1)
  3. width = size(image)(2)
  4.  
  5. data = [];
  6. counter = 1;
  7.  
  8. color = image(1)
  9.  
  10. for x = 1:height
  11.   for y = 1:width
  12.    
  13.     curentColor = image(x,y);
  14.    
  15.     if (curentColor == color)
  16.       counter ++;
  17.     else
  18.       d = [color,counter];
  19.       data = [data;d];
  20.       counter = 1;
  21.       color = curentColor;
  22.     end
  23.   end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement