Histogram Equalization

So here, cdf is not an in-built function. Cdf is actually from my code as follows:

cum = cumsum(histogram)
cdf = cum ./ sum(cum) 

Oh right! If I change my code like,

m, n = size(image)
for i in 1-m
      for j in 1-n
            out[i,j] = cdf [round(UInt8, image[i,j]) + 1]
      end
end

So image[i,j] is Already a type of UInt8. I don’t think it’s okay to use round(UInt8, image[i,j) because it will throw an TypeError.