안드로이드 개발 질문/답변
(글 수 45,052)
RGB를 HSL로 바꿔주는 소스 있으신 분 계신가요 ㅠㅠ
int [][] mapSrcColor = new int [width][height];
int [][] mapHue = new int [width][height];
int [][] mapSat = new int [width][height];
int [][] mapVal = new int [width][height];
float[] pixelHSV = new float[3];
Bitmap tmpBmp = captureBmp.copy(Bitmap.Config.ARGB_8888, true);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
Color.colorToHSV(mapSrcColor[x][y], pixelHSV);
mapHue[x][y] = Color.rgb((int)(pixelHSV[0]*255/360), 0, 0);
mapSat[x][y] = Color.rgb(0, (int)(pixelHSV[1]*255), 0);
mapVal[x][y] = Color.rgb(0, 0, (int)(pixelHSV[2]*255));
h = mapHue[x][y];
s = mapSat[x][y];
v = mapVal[x][y];
}
}
구글링해서 이런 식으로 하긴 했는데 hue값이 이상하게 나오더군요 ㅠㅠ
제가 올린 소스의 문제점이나 혹은 RGB를 HSV로 바꿔주는 소스 있으신 분 부탁드려요 ㅠ