Published: 05 Aug 2018 › Updated: 05 Aug 2018![[메모]색상의 주파수를 rgb값으로 변환해주는 프로그램 코드에 대하여......](/nhc-explorer-cover.webp)
![[메모]색상의 주파수를 rgb값으로 변환해주는 프로그램 코드에 대하여......](/nhc-explorer-cover.webp)
[메모]색상의 주파수를 rgb값으로 변환해주는 프로그램 코드에 대하여......
구글에서 검색어 'color freqency to rgb color' 에서 두번쨰 검색결과 치니 매우 만족할 만한 검색 결과가 나왔습니다.
나중에 써먹기 위해 메모해놉니다.
제가 찾은 링크는
https://stackoverflow.com/questions/1472514/convert-light-frequency-to-rgb
입니다.
위 링크에서 얻은 다음 소스는 너무 간략하게 잘되있어서 나중에 원하는 프로그램코드로 변환하면 될듯이요.
또 위 링크에서 원리를 설명한 링크된 사이트도 참잘되있군요
http://www.fourmilab.ch/documents/specrend/
영어라서 아쉽지만 'CIE 색상' 이라고 검색해서 한국위키보면 한국위키도 잘 설명되어있습니다만 왠지 5%정도부족한듯이요....소스코드도 없고, 변환행렬에 사용된 값도 달랑하나인데 출처가 불명확해보입니다.
static private double Gamma = 0.80;
static private double IntensityMax = 255;
/** Taken from Earl F. Glynn's web page:
* Spectra Lab Report
* */
public static int[] waveLengthToRGB(double Wavelength){
double factor;
double Red,Green,Blue;
if((Wavelength >= 380) && (Wavelength<440)){
Red = -(Wavelength - 440) / (440 - 380);
Green = 0.0;
Blue = 1.0;
}else if((Wavelength >= 440) && (Wavelength<490)){
Red = 0.0;
Green = (Wavelength - 440) / (490 - 440);
Blue = 1.0;
}else if((Wavelength >= 490) && (Wavelength<510)){
Red = 0.0;
Green = 1.0;
Blue = -(Wavelength - 510) / (510 - 490);
}else if((Wavelength >= 510) && (Wavelength<580)){
Red = (Wavelength - 510) / (580 - 510);
Green = 1.0;
Blue = 0.0;
}else if((Wavelength >= 580) && (Wavelength<645)){
Red = 1.0;
Green = -(Wavelength - 645) / (645 - 580);
Blue = 0.0;
}else if((Wavelength >= 645) && (Wavelength<781)){
Red = 1.0;
Green = 0.0;
Blue = 0.0;
}else{
Red = 0.0;
Green = 0.0;
Blue = 0.0;
};
// Let the intensity fall off near the vision limits
if((Wavelength >= 380) && (Wavelength<420)){
factor = 0.3 + 0.7*(Wavelength - 380) / (420 - 380);
}else if((Wavelength >= 420) && (Wavelength<701)){
factor = 1.0;
}else if((Wavelength >= 701) && (Wavelength<781)){
factor = 0.3 + 0.7*(780 - Wavelength) / (780 - 700);
}else{
factor = 0.0;
};
int[] rgb = new int[3];
// Don't want 0^x = 1 for x <> 0
rgb[0] = Red==0.0 ? 0 : (int) Math.round(IntensityMax * Math.pow(Red * factor, Gamma));
rgb[1] = Green==0.0 ? 0 : (int) Math.round(IntensityMax * Math.pow(Green * factor, Gamma));
rgb[2] = Blue==0.0 ? 0 : (int) Math.round(IntensityMax * Math.pow(Blue * factor, Gamma));
return rgb;
}
Leave [메모]색상의 주파수를 rgb값으로 변환해주는 프로그램 코드에 대하여...... to:
Read more #kr-dev posts
Best Posts From donworry8
We have not curated any of donworry8's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From donworry8
- [2편] 100년 전 한국어?_1920년대 우리말 발음은 지금과 얼마나 달랐을까?
- [천가지감 감상평 릴레이] 바가바드기타(BHAGAVADGITA) 9장
- [천가지감 감상평 릴레이] 바가바드기타(BHAGAVADGITA) 8장
- 암호화화폐 결제를 이용한 유료 웹컨텐츠 개발 구상 및 계획
- this is my creation muiscvideo art by programming
- [메모]색상의 주파수를 rgb값으로 변환해주는 프로그램 코드에 대하여......
- [ 432hz vs 440hz ]thinking about musical base tone as watching video 432hz vs 440hz
- 사람의 청각인지 특성은 3500hz에서 가장 잘 듣게 된다.
- 지구 자전과 공전에 공명하는 빛의 주파수(색상)을 계산해보자
- 자신의 키에 공명하는 주파수를 계산해보자.