Skip to content
Advertisement

Unformatted histogram values

I am trying to find the histogram values of an image by using my own function but when i run my code it prints the histogram values like [1.000e+00 4.000e+00 1.000e+00 8.000e+00 8.000e+00 2.500e+01 2.100e+01 4.500e+01 5.500e+01 8.800e+01 1.110e+02 1.220e+02 1.280e+02 1.370e+02 Is it normal or is there any other method that i can display histogram values in an understandable way? Here is my function;

JavaScript

Advertisement

Answer

Where you initialize your histogram, set its type to np.uint32 or similar since you can only ever have a whole, non-negative number of pixels of a given colour:

JavaScript

Check the type of your current array and find it is float64 with:

JavaScript

Hint: See also here.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement