mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
color filter config additions (#142)
* add ability to disably specific color corrections update protobuf external move smoothing out of color section * update config * update schema * update schema
This commit is contained in:
parent
f1a4672a93
commit
04ab2f05f7
@ -28,18 +28,21 @@
|
|||||||
/// Color manipulation configuration used to tune the output colors to specific surroundings.
|
/// Color manipulation configuration used to tune the output colors to specific surroundings.
|
||||||
/// The configuration contains a list of color-transforms. Each transform contains the
|
/// The configuration contains a list of color-transforms. Each transform contains the
|
||||||
/// following fields:
|
/// following fields:
|
||||||
|
/// * 'channelAdjustment_enable' : true/false enables/disables this channelAdjustment section
|
||||||
/// * 'channelAdjustment'
|
/// * 'channelAdjustment'
|
||||||
/// * 'id' : The unique identifier of the channel adjustments (eg 'device_1')
|
/// * 'id' : The unique identifier of the channel adjustments (eg 'device_1')
|
||||||
/// * 'leds' : The indices (or index ranges) of the leds to which this channel adjustment applies
|
/// * 'leds' : The indices (or index ranges) of the leds to which this channel adjustment applies
|
||||||
/// (eg '0-5, 9, 11, 12-17'). The indices are zero based.
|
/// (eg '0-5, 9, 11, 12-17'). The indices are zero based.
|
||||||
/// * 'pureRed'/'pureGreen'/'pureBlue' : The manipulation in the Red-Green-Blue color domain with the
|
/// * 'pureRed'/'pureGreen'/'pureBlue' : The manipulation in the Red-Green-Blue color domain with the
|
||||||
/// following tuning parameters for each channel:
|
/// following tuning parameters for each channel:
|
||||||
|
/// * 'temperature_enable' : true/false enables/disables this temperature section
|
||||||
/// * 'temperature'
|
/// * 'temperature'
|
||||||
/// * 'id' : The unique identifier of the temperature (eg 'device_1')
|
/// * 'id' : The unique identifier of the temperature (eg 'device_1')
|
||||||
/// * 'leds' : The indices (or index ranges) of the leds to which this temperature applies
|
/// * 'leds' : The indices (or index ranges) of the leds to which this temperature applies
|
||||||
/// (eg '0-5, 9, 11, 12-17'). The indices are zero based.
|
/// (eg '0-5, 9, 11, 12-17'). The indices are zero based.
|
||||||
/// * 'red'/'green'/'blue' : The temperature manipulation in the Red-Green-Blue color domain with the
|
/// * 'red'/'green'/'blue' : The temperature manipulation in the Red-Green-Blue color domain with the
|
||||||
/// following tuning parameters for each channel:
|
/// following tuning parameters for each channel:
|
||||||
|
/// * 'transform_enable' : true/false enables/disables this transform section
|
||||||
/// * 'transform'
|
/// * 'transform'
|
||||||
/// * 'id' : The unique identifier of the color transformation (eg 'device_1')
|
/// * 'id' : The unique identifier of the color transformation (eg 'device_1')
|
||||||
/// * 'leds' : The indices (or index ranges) of the leds to which this color transform applies
|
/// * 'leds' : The indices (or index ranges) of the leds to which this color transform applies
|
||||||
@ -54,18 +57,9 @@
|
|||||||
/// - 'threshold' The minimum required input value for the channel to be on
|
/// - 'threshold' The minimum required input value for the channel to be on
|
||||||
/// (else zero)
|
/// (else zero)
|
||||||
/// - 'gamma' The gamma-curve correction factor
|
/// - 'gamma' The gamma-curve correction factor
|
||||||
///
|
|
||||||
/// Next to the list with color transforms there is also a smoothing option.
|
|
||||||
/// * 'smoothing' : Smoothing of the colors in the time-domain with the following tuning
|
|
||||||
/// parameters:
|
|
||||||
/// - 'enable' Enable or disable the smoothing (true/false)
|
|
||||||
/// - 'type' The type of smoothing algorithm ('linear' or 'none')
|
|
||||||
/// - 'time_ms' The time constant for smoothing algorithm in milliseconds
|
|
||||||
/// - 'updateFrequency' The update frequency of the leds in Hz
|
|
||||||
/// - 'updateDelay' The delay of the output to leds (in periods of smoothing)
|
|
||||||
/// - 'continuousOutput' Flag for enabling continuous output to Leds regardless of new input or not
|
|
||||||
"color" :
|
"color" :
|
||||||
{
|
{
|
||||||
|
"channelAdjustment_enable" : true,
|
||||||
"channelAdjustment" :
|
"channelAdjustment" :
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -91,6 +85,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"temperature_enable" : true,
|
||||||
"temperature" :
|
"temperature" :
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -104,6 +99,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"transform_enable" : true,
|
||||||
"transform" :
|
"transform" :
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -131,8 +127,18 @@
|
|||||||
"gamma" : 2.5000
|
"gamma" : 2.5000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
/// smoothing
|
||||||
|
/// * 'smoothing' : Smoothing of the colors in the time-domain with the following tuning
|
||||||
|
/// parameters:
|
||||||
|
/// - 'enable' Enable or disable the smoothing (true/false)
|
||||||
|
/// - 'type' The type of smoothing algorithm ('linear' or 'none')
|
||||||
|
/// - 'time_ms' The time constant for smoothing algorithm in milliseconds
|
||||||
|
/// - 'updateFrequency' The update frequency of the leds in Hz
|
||||||
|
/// - 'updateDelay' The delay of the output to leds (in periods of smoothing)
|
||||||
|
/// - 'continuousOutput' Flag for enabling continuous output to Leds regardless of new input or not
|
||||||
"smoothing" :
|
"smoothing" :
|
||||||
{
|
{
|
||||||
"enable" : true,
|
"enable" : true,
|
||||||
@ -141,7 +147,6 @@
|
|||||||
"updateFrequency" : 25.0000,
|
"updateFrequency" : 25.0000,
|
||||||
"updateDelay" : 0,
|
"updateDelay" : 0,
|
||||||
"continuousOutput" : true
|
"continuousOutput" : true
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/// Configuration for the embedded V4L2 grabber
|
/// Configuration for the embedded V4L2 grabber
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
"color" :
|
"color" :
|
||||||
{
|
{
|
||||||
|
"channelAdjustment_enable" : true,
|
||||||
"channelAdjustment" :
|
"channelAdjustment" :
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -40,6 +41,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"temperature_enable" : true,
|
||||||
"temperature" :
|
"temperature" :
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -53,6 +55,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"transform_enable" : true,
|
||||||
"transform" :
|
"transform" :
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -80,7 +83,9 @@
|
|||||||
"gamma" : 2.5000
|
"gamma" : 2.5000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
|
},
|
||||||
|
|
||||||
"smoothing" :
|
"smoothing" :
|
||||||
{
|
{
|
||||||
"enable" : true,
|
"enable" : true,
|
||||||
@ -88,8 +93,7 @@
|
|||||||
"time_ms" : 200,
|
"time_ms" : 200,
|
||||||
"updateFrequency" : 25.0000,
|
"updateFrequency" : 25.0000,
|
||||||
"updateDelay" : 0,
|
"updateDelay" : 0,
|
||||||
"continuousOutput" : false
|
"continuousOutput" : true
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"grabber-v4l2" :
|
"grabber-v4l2" :
|
||||||
|
2
dependencies/external/protobuf
vendored
2
dependencies/external/protobuf
vendored
@ -1 +1 @@
|
|||||||
Subproject commit ec0114231786a7e4ab819e66c826425b0bd2f8d0
|
Subproject commit efb59b79e5a8f26eae4d15f38bbfb5667e23df60
|
@ -325,4 +325,8 @@ private:
|
|||||||
|
|
||||||
/// register of input sources and it's prio channel
|
/// register of input sources and it's prio channel
|
||||||
PriorityRegister _priorityRegister;
|
PriorityRegister _priorityRegister;
|
||||||
|
|
||||||
|
bool _transformEnabled;
|
||||||
|
bool _adjustmentEnabled;
|
||||||
|
bool _temperatureEnabled;
|
||||||
};
|
};
|
||||||
|
@ -501,7 +501,7 @@ LedDevice * Hyperion::createColorSmoothing(const Json::Value & smoothingConfig,
|
|||||||
smoothingConfig.get("updateFrequency", 25.0).asDouble(),
|
smoothingConfig.get("updateFrequency", 25.0).asDouble(),
|
||||||
smoothingConfig.get("time_ms", 200).asInt(),
|
smoothingConfig.get("time_ms", 200).asInt(),
|
||||||
smoothingConfig.get("updateDelay", 0).asUInt(),
|
smoothingConfig.get("updateDelay", 0).asUInt(),
|
||||||
smoothingConfig.get("continuousOutput", false).asBool()
|
smoothingConfig.get("continuousOutput", true).asBool()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,6 +568,15 @@ Hyperion::Hyperion(const Json::Value &jsonConfig, const std::string configFile)
|
|||||||
{
|
{
|
||||||
throw std::runtime_error("Color transformation incorrectly set");
|
throw std::runtime_error("Color transformation incorrectly set");
|
||||||
}
|
}
|
||||||
|
// set color correction activity state
|
||||||
|
_transformEnabled = jsonConfig["color"].get("transform_enable",true).asBool();
|
||||||
|
_adjustmentEnabled = jsonConfig["color"].get("channelAdjustment_enable",true).asBool();
|
||||||
|
_temperatureEnabled = jsonConfig["color"].get("temperature_enable",true).asBool();
|
||||||
|
|
||||||
|
InfoIf(!_transformEnabled , _log, "Color transformation disabled" );
|
||||||
|
InfoIf(!_adjustmentEnabled , _log, "Color adjustment disabled" );
|
||||||
|
InfoIf(!_temperatureEnabled, _log, "Color temperature disabled" );
|
||||||
|
|
||||||
// initialize the image processor factory
|
// initialize the image processor factory
|
||||||
ImageProcessorFactory::getInstance().init(
|
ImageProcessorFactory::getInstance().init(
|
||||||
_ledString,
|
_ledString,
|
||||||
@ -575,7 +584,8 @@ Hyperion::Hyperion(const Json::Value &jsonConfig, const std::string configFile)
|
|||||||
);
|
);
|
||||||
|
|
||||||
// initialize the color smoothing filter
|
// initialize the color smoothing filter
|
||||||
_device = createColorSmoothing(jsonConfig["color"]["smoothing"], _device);
|
_device = createColorSmoothing(jsonConfig["smoothing"], _device);
|
||||||
|
|
||||||
|
|
||||||
// setup the timer
|
// setup the timer
|
||||||
_timer.setSingleShot(true);
|
_timer.setSingleShot(true);
|
||||||
@ -796,9 +806,9 @@ void Hyperion::update()
|
|||||||
|
|
||||||
// Apply the correction and the transform to each led and color-channel
|
// Apply the correction and the transform to each led and color-channel
|
||||||
// Avoid applying correction, the same task is performed by adjustment
|
// Avoid applying correction, the same task is performed by adjustment
|
||||||
_raw2ledTransform->applyTransform(_ledBuffer);
|
if (_transformEnabled) _raw2ledTransform->applyTransform(_ledBuffer);
|
||||||
_raw2ledAdjustment->applyAdjustment(_ledBuffer);
|
if (_adjustmentEnabled) _raw2ledAdjustment->applyAdjustment(_ledBuffer);
|
||||||
_raw2ledTemperature->applyCorrection(_ledBuffer);
|
if (_temperatureEnabled) _raw2ledTemperature->applyCorrection(_ledBuffer);
|
||||||
|
|
||||||
const std::vector<Led>& leds = _ledString.leds();
|
const std::vector<Led>& leds = _ledString.leds();
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"properties":
|
"properties":
|
||||||
{
|
{
|
||||||
|
"channelAdjustment_enable" : "boolean",
|
||||||
"channelAdjustment" :
|
"channelAdjustment" :
|
||||||
{
|
{
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
@ -172,6 +173,7 @@
|
|||||||
"additionalProperties" : false
|
"additionalProperties" : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"temperature_enable" : "boolean",
|
||||||
"temperature" :
|
"temperature" :
|
||||||
{
|
{
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
@ -226,6 +228,7 @@
|
|||||||
"additionalProperties" : false
|
"additionalProperties" : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"transform_enable" : "boolean",
|
||||||
"transform" :
|
"transform" :
|
||||||
{
|
{
|
||||||
"type" : "array",
|
"type" : "array",
|
||||||
@ -345,6 +348,9 @@
|
|||||||
},
|
},
|
||||||
"additionalProperties" : false
|
"additionalProperties" : false
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties" : false
|
||||||
},
|
},
|
||||||
"smoothing":
|
"smoothing":
|
||||||
{
|
{
|
||||||
@ -390,9 +396,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties" : false
|
"additionalProperties" : false
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties" : false
|
|
||||||
},
|
},
|
||||||
"grabber-v4l2" :
|
"grabber-v4l2" :
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user