summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Klug <stefan.klug@ideasonboard.com>2025-01-23 12:41:04 +0100
committerStefan Klug <stefan.klug@ideasonboard.com>2025-02-21 17:51:10 +0100
commitce9d547aff826d46344fd9d5e0be33112e6faeff (patch)
tree670257ab2c77a66d2971bfa598150d19a28dc96f
parent92bb16b68edc820fde9a2f740f1ab14ed69b93d4 (diff)
libipa: lux: Normalize referenceY to 1
By normalizing the referenceY value to 1 (which is the usual range for Y) in the tuning file, the bins_ value is no longer needed. Remove it. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
-rw-r--r--src/ipa/libipa/lux.cpp20
-rw-r--r--src/ipa/libipa/lux.h3
-rw-r--r--src/ipa/rkisp1/algorithms/lux.cpp4
3 files changed, 7 insertions, 20 deletions
diff --git a/src/ipa/libipa/lux.cpp b/src/ipa/libipa/lux.cpp
index 61f8fea8..899e8824 100644
--- a/src/ipa/libipa/lux.cpp
+++ b/src/ipa/libipa/lux.cpp
@@ -44,11 +44,6 @@ namespace ipa {
*/
/**
- * \var Lux::binSize_
- * \brief The maximum count of each bin
- */
-
-/**
* \var Lux::referenceExposureTime_
* \brief The exposure time of the reference image, in microseconds
*/
@@ -65,9 +60,8 @@ namespace ipa {
/**
* \var Lux::referenceY_
- * \brief The measured luminance of the reference image, out of the bin size
+ * \brief The measured luminance of the reference image, normalized to 1
*
- * \sa binSize_
*/
/**
@@ -76,11 +70,9 @@ namespace ipa {
*/
/**
- * \brief Construct the Lux helper module
- * \param[in] binSize The maximum count of each bin
- */
-Lux::Lux(unsigned int binSize)
- : binSize_(binSize)
+ * \brief Construct the Lux helper module
+ */
+Lux::Lux()
{
}
@@ -97,7 +89,7 @@ Lux::Lux(unsigned int binSize)
* referenceExposureTime: 10000
* referenceAnalogueGain: 4.0
* referenceDigitalGain: 1.0
- * referenceY: 12000
+ * referenceY: 0.1831
* referenceLux: 1000
* \endcode
*
@@ -167,7 +159,7 @@ double Lux::estimateLux(utils::Duration exposureTime,
double exposureTimeRatio = referenceExposureTime_ / exposureTime;
double aGainRatio = referenceAnalogueGain_ / aGain;
double dGainRatio = referenceDigitalGain_ / dGain;
- double yRatio = currentY * (binSize_ / yHist.bins()) / referenceY_;
+ double yRatio = (currentY / yHist.bins()) / referenceY_;
double estimatedLux = exposureTimeRatio * aGainRatio * dGainRatio *
yRatio * referenceLux_;
diff --git a/src/ipa/libipa/lux.h b/src/ipa/libipa/lux.h
index 93ca6479..d95bcdaf 100644
--- a/src/ipa/libipa/lux.h
+++ b/src/ipa/libipa/lux.h
@@ -21,7 +21,7 @@ class Histogram;
class Lux
{
public:
- Lux(unsigned int binSize);
+ Lux();
int parseTuningData(const YamlObject &tuningData);
double estimateLux(utils::Duration exposureTime,
@@ -29,7 +29,6 @@ public:
const Histogram &yHist) const;
private:
- unsigned int binSize_;
utils::Duration referenceExposureTime_;
double referenceAnalogueGain_;
double referenceDigitalGain_;
diff --git a/src/ipa/rkisp1/algorithms/lux.cpp b/src/ipa/rkisp1/algorithms/lux.cpp
index b0f74963..a467767e 100644
--- a/src/ipa/rkisp1/algorithms/lux.cpp
+++ b/src/ipa/rkisp1/algorithms/lux.cpp
@@ -33,12 +33,8 @@ namespace ipa::rkisp1::algorithms {
/**
* \brief Construct an rkisp1 Lux algo module
- *
- * The Lux helper is initialized to 65535 as that is the max bin count on the
- * rkisp1.
*/
Lux::Lux()
- : lux_(65535)
{
}