I am very confused about the way ImageJ incorporates the HSB color model into the color threshold tool (Image -> Adjust). In this tool, if the HSB model is selected, it is represented in a scale of H (0-225), S (0-225) and B (0-225), while it should be H (0-360), S (0-100), B (0-100). I want to select a H threshold of 80, what is the value I choose in this scale?
I assume you are talking about
T = 80 in the range of
[0, 360]? If that’s the case:
(T/360)*255. In your case, that’s ~
ImageJ represents a coordinate with 8-bit in each dimension, i.e., H, S, and B. That’s where the ranges
[0, 255] stem from. You can convert an RGB image to an HSB stack via Image > Type > HSB Stack and inspect the pixel intensities in each dimension of the colorspace.
Thank you for the answer. I feel kind of odd about this though. I worked with the same 8-bit file in Photoshop and it still presented the HSB scale as 360,100,100. Can’t understand the difference in ImageJ. Also as you say, to generate the HSB histogram it also cannot work directly with the file but has to have the file converted to HSB stack. And when it is, the image becomes grayscale (?) so I can’t see the colors to work with anymore. Also, I kind of worry about this conversion process. Is it really correct and maintaining the same color info of the image?
You could take a look at the manual to get further information on color images in ImageJ: https://imagej.nih.gov/ij/docs/guide/146-9.html
If you want to take a look at the code of the color conversion: see ColorProcessor.getHSB(). This method uses Java’s built-in conversion method, as implemented in
Color.RGBtoHSB(). This returns values for all three components in the range
[0.0, 1.0] (floating point precision) that are converted to
[0, 255] in the ImageJ implementation. This conversion will be lossy, meaning that if you go from RGB to HSB to RGB, the two RGB images will not have exactly the same colors per pixel.