------------------------------------------------------------------------
I want to modify that code to make it work on grayscale image not binary image can anyone help me
———————————————————————————-
function out=rle(image)%
% RLE(IMAGE) produces a vector containing the run-length encoding of
% IMAGE, which should be a binary image. The image is set out as a long
% row, and the conde contains the number of zeros, followed by the number
% of ones, alternating.
%% Example:
%% rle([1 1 1 0 0;0 0 1 1 1;1 1 0 0 0])
%% ans =
%% 03453
%level = graythresh(image);BW = im2bw(image, level);L=prod(size(BW));im=reshape(BW',1,L);x=1;out=[];while L ~= 0,temp=min(find(im == x));if isempty(temp),out=[out L];breakend;out=[out temp-1];x=1-x;im=im(temp:L);L=L-temp+1;end;
————————————————————————
Please I want to modify that code to make it work on grayscale image not binary image can anyone help me
Best Answer