Closed lpatiny closed 1 year ago
Currently the method histogram has always the number of slots corresponding the the maxValue.
https://github.com/image-js/image-js-typescript/blob/main/src/compute/histogram.ts#L34
This is often not what we would like and I would like we add a new options 'maxSlots' that has as default value 256.
https://github.com/image-js/image-js/blob/8700b2598c396cb5bc89a602926eb4aaceea525d/src/image/compute/histogram.js#LL9C1-L9C1
maxSlots must be a power of 2 and we should throw if it is not the case. To check if it is power of two we should use the package is-power-of-two (very elegant you should check the code).
is-power-of-two
To put many intensities in the same slot the key line is:
https://github.com/image-js/image-js/blob/8700b2598c396cb5bc89a602926eb4aaceea525d/src/image/compute/histogram.js#L106
We will currently not deal with alpha channel.
Currently the method histogram has always the number of slots corresponding the the maxValue.
https://github.com/image-js/image-js-typescript/blob/main/src/compute/histogram.ts#L34
This is often not what we would like and I would like we add a new options 'maxSlots' that has as default value 256.
https://github.com/image-js/image-js/blob/8700b2598c396cb5bc89a602926eb4aaceea525d/src/image/compute/histogram.js#LL9C1-L9C1
maxSlots must be a power of 2 and we should throw if it is not the case. To check if it is power of two we should use the package
is-power-of-two
(very elegant you should check the code).To put many intensities in the same slot the key line is:
https://github.com/image-js/image-js/blob/8700b2598c396cb5bc89a602926eb4aaceea525d/src/image/compute/histogram.js#L106
We will currently not deal with alpha channel.