I'm trying to check the color of the RGB in the specified HSB range and I can not find it.
Сам диапазон: Hue = 0 //оттенок saturation1 > 94% & saturation1 < 97% //насыщенность brightness1 > 0.55 & brightness1 < 0.6 //яркость //Color c = new Color(BufferedImage1.getRGB(col, row)); Color c = new Color(149, 5, 5); //для примера возьмём значение заданное вручную int red1 = c.getRed(); int green1 = c.getGreen(); int blue1 = c.getBlue(); float[] hsb = new float[3]; int r = (red1 >> 16) & 0xFF; int g = (green1 >> 8) & 0xFF; int b = (blue1 ) & 0xFF; Color.RGBtoHSB(r, g, b, hsb); float hue1 = hsb[0]; float saturation1 = hsb[1]; float brightness1 = hsb[2]; System.out.println("Color hsb " + hue1 + ", "+ saturation1 +", "+ brightness1 + " "); if ((hue1 == 0) & (saturation1 > 0.94 & saturation1 < 0.97 ) & (brightness1 > 0.55 & brightness1 < 0.6) ) { System.out.println("Color " + hue1 + ", "+ saturation1 +", "+ brightness1 + " входит в диапазон"); } HSB values get some wrong (0.6666667, 1.0, 0.019607844) although the site for RGB colors (149,5,5) HSB, respectively, must be equal (0,96.64,58.43)