49 void RGBtoHSV(
double& fR,
double& fG,
double fB,
double& fH,
double& fS,
double& fV) {
50 double fCMax = std::max(std::max(fR, fG), fB);
51 double fCMin = std::min(std::min(fR, fG), fB);
52 double fDelta = fCMax - fCMin;
56 fH = 60 * (std::fmod(((fG - fB) / fDelta), 6));
57 }
else if(fCMax == fG) {
58 fH = 60 * (((fB - fR) / fDelta) + 2);
59 }
else if(fCMax == fB) {
60 fH = 60 * (((fR - fG) / fDelta) + 4);
96 void HSVtoRGB(
double& fR,
double& fG,
double& fB,
double& fH,
double& fS,
double& fV) {
98 double fHPrime = std::fmod(fH / 60.0, 6);
99 double fX = fC * (1 - std::fabs(std::fmod(fHPrime, 2) - 1));
102 if(0 <= fHPrime && fHPrime < 1) {
106 }
else if(1 <= fHPrime && fHPrime < 2) {
110 }
else if(2 <= fHPrime && fHPrime < 3) {
114 }
else if(3 <= fHPrime && fHPrime < 4) {
118 }
else if(4 <= fHPrime && fHPrime < 5) {
122 }
else if(5 <= fHPrime && fHPrime < 6) {
void RGBtoHSV(double &fR, double &fG, double fB, double &fH, double &fS, double &fV)
Convert RGB to HSV color space.
void HSVtoRGB(double &fR, double &fG, double &fB, double &fH, double &fS, double &fV)
Convert HSV to RGB color space.