Utilities for UnitColor.
More...
#include "unit_color_utility.hpp"
#include <M5Utility.hpp>
#include <limits>
|
namespace | m5 |
| Top level namespace of M5stack.
|
|
|
std::tuple< uint8_t, bool > | m5::unit::tcs3472x::ms_to_wtime (const float ms) |
| ms to WTIME and WLONG
|
|
float | m5::unit::tcs3472x::calculateLux (const uint16_t rawR, const uint16_t rawG, const uint16_t rawB, const uint16_t rawC, const float atime_ms, const Gain gc, const float dgf=DGF, const float coefR=R_Coef, const float coefG=G_Coef, const float coefB=B_Coef) |
| Calculate Lux.
|
|
float | m5::unit::tcs3472x::calculateColorTemperature (const uint16_t rawR, const uint16_t rawG, const uint16_t rawB, const uint16_t rawC, const float coefCT=CT_Coef, const float offsetCT=CT_Offset) |
| Calculate color temperature(degrees Kelvin)
|
|
uint16_t | m5::unit::tcs3472x::calculateSaturation (const uint8_t atime) |
| Calculate Saturation.
|
|
float | m5::unit::tcs3472x::calculateCRATIO (const uint16_t rawR, const uint16_t rawG, const uint16_t rawB, const uint16_t rawC) |
| Calculate CRATIO.
|
|
float | m5::unit::tcs3472x::calculateCPL (const float atime_ms, const Gain gc, const float dgf=DGF) |
| Calculate Counts per Lux (CPL)
|
|
◆ calculateColorTemperature()
float m5::unit::tcs3472x::calculateColorTemperature |
( |
const uint16_t | rawR, |
|
|
const uint16_t | rawG, |
|
|
const uint16_t | rawB, |
|
|
const uint16_t | rawC, |
|
|
const float | coefCT = CT_Coef, |
|
|
const float | offsetCT = CT_Offset ) |
Calculate color temperature(degrees Kelvin)
- Parameters
-
rawR | Raw red value |
rawG | Raw green value |
rawB | Raw blue value |
rawC | Raw clear value |
coefCT | Coefficient for the color temperature |
offsetCT | Offset for the the color temperature |
- Returns
- Color temperature(degrees Kelvin)
◆ calculateCPL()
float m5::unit::tcs3472x::calculateCPL |
( |
const float | atime_ms, |
|
|
const Gain | gc, |
|
|
const float | dgf = DGF ) |
Calculate Counts per Lux (CPL)
- Parameters
-
atime_ms | integtation time(ms) |
gc | Gain |
dgf | Device and Glass Factor |
- Returns
- CPL
◆ calculateCRATIO()
float m5::unit::tcs3472x::calculateCRATIO |
( |
const uint16_t | rawR, |
|
|
const uint16_t | rawG, |
|
|
const uint16_t | rawB, |
|
|
const uint16_t | rawC ) |
Calculate CRATIO.
- Parameters
-
rawR | raw red value |
rawG | raw green value |
rawB | raw blue value |
rawC | raw clear value |
- Returns
- CRATIO (0.0f - 1.0f) Guidelines for CRATIO and Light Source Correspondence
Compare | Description |
CRATIO < 0.1 | LED or fluorescent light |
0.1 <= CRATIO < 0.25 | Sunlight |
0.25 <0 CRATIO | Incandescent light |
◆ calculateLux()
float m5::unit::tcs3472x::calculateLux |
( |
const uint16_t | rawR, |
|
|
const uint16_t | rawG, |
|
|
const uint16_t | rawB, |
|
|
const uint16_t | rawC, |
|
|
const float | atime_ms, |
|
|
const Gain | gc, |
|
|
const float | dgf = DGF, |
|
|
const float | coefR = R_Coef, |
|
|
const float | coefG = G_Coef, |
|
|
const float | coefB = B_Coef ) |
Calculate Lux.
- Parameters
-
rawR | Raw red value |
rawG | Raw green value |
rawB | Raw blue value |
rawC | Raw clear value |
atime_ms | Integtation time(ms) |
gc | Gain |
dgf | Device and Glass Factor |
coefR | Coefficient for the R channel |
coefG | Coefficient for the G channel |
coefB | Coefficient for the B channel |
- Returns
- Lux (lx)
◆ calculateSaturation()
uint16_t m5::unit::tcs3472x::calculateSaturation |
( |
const uint8_t | atime | ) |
|
Calculate Saturation.
- Parameters
-
- Returns
- Saturation value
- Note
- Ripple saturation is also considered (in Analog)