function RLE = mComputeZeroRLE( image ) [ row_max, col_max ] = size( image ); RLE = zeros( 1, row_max*col_max ); RLE_index = 0; zero_count = 0; for row = 1:row_max for col = 1:col_max if image( row, col ) == 0 zero_count = zero_count + 1; else RLE_index = RLE_index + 1; RLE( RLE_index ) = image( row, col ) + i*zero_count; zero_count = 0; end end end RLE = RLE( 1:RLE_index );