I have read that. But couldn't understand how to do that. I have a question if someone can answer.
Write a MATLAB function called countGrayLevels that accepts as input an image matrix called I, and v, a 1xN row vector of strictly increasing gray-level values. This function should return as output a 1x(N-1) row vector, y, where: y(i) is the total number of pixels in I that satisfy: v (i )≤I