java rgb转hsv

public static double[] toHSV(int r, int g, int b) {
        Color color = new Color(r, g, b);
        float[] hsv = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);
        return new double[]{hsv[0] * 360, hsv[1] * 100, hsv[2] * 100};
 }

 

posted @ 2023-03-23 13:40  天葬  阅读(108)  评论(0编辑  收藏  举报