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:
redPanther 2016-07-30 13:07:53 +02:00 committed by GitHub
parent f1a4672a93
commit 04ab2f05f7
6 changed files with 111 additions and 85 deletions

View File

@ -28,18 +28,21 @@
/// Color manipulation configuration used to tune the output colors to specific surroundings.
/// The configuration contains a list of color-transforms. Each transform contains the
/// following fields:
/// * 'channelAdjustment_enable' : true/false enables/disables this channelAdjustment section
/// * 'channelAdjustment'
/// * '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
/// (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
/// following tuning parameters for each channel:
/// * 'temperature_enable' : true/false enables/disables this temperature section
/// * 'temperature'
/// * 'id' : The unique identifier of the temperature (eg 'device_1')
/// * '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.
/// * 'red'/'green'/'blue' : The temperature manipulation in the Red-Green-Blue color domain with the
/// following tuning parameters for each channel:
/// * 'transform_enable' : true/false enables/disables this transform section
/// * 'transform'
/// * '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
@ -54,18 +57,9 @@
/// - 'threshold' The minimum required input value for the channel to be on
/// (else zero)
/// - '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" :
{
"channelAdjustment_enable" : true,
"channelAdjustment" :
[
{
@ -91,6 +85,7 @@
}
}
],
"temperature_enable" : true,
"temperature" :
[
{
@ -104,6 +99,7 @@
}
}
],
"transform_enable" : true,
"transform" :
[
{
@ -131,17 +127,26 @@
"gamma" : 2.5000
}
}
],
]
},
"smoothing" :
{
"enable" : true,
"type" : "linear",
"time_ms" : 200,
"updateFrequency" : 25.0000,
"updateDelay" : 0,
"continuousOutput" : true
}
/// 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" :
{
"enable" : true,
"type" : "linear",
"time_ms" : 200,
"updateFrequency" : 25.0000,
"updateDelay" : 0,
"continuousOutput" : true
},
/// Configuration for the embedded V4L2 grabber

View File

@ -15,6 +15,7 @@
"color" :
{
"channelAdjustment_enable" : true,
"channelAdjustment" :
[
{
@ -40,6 +41,7 @@
}
}
],
"temperature_enable" : true,
"temperature" :
[
{
@ -53,6 +55,7 @@
}
}
],
"transform_enable" : true,
"transform" :
[
{
@ -80,18 +83,19 @@
"gamma" : 2.5000
}
}
],
"smoothing" :
{
"enable" : true,
"type" : "linear",
"time_ms" : 200,
"updateFrequency" : 25.0000,
"updateDelay" : 0,
"continuousOutput" : false
}
]
},
"smoothing" :
{
"enable" : true,
"type" : "linear",
"time_ms" : 200,
"updateFrequency" : 25.0000,
"updateDelay" : 0,
"continuousOutput" : true
},
"grabber-v4l2" :
{
"enable" : false,

@ -1 +1 @@
Subproject commit ec0114231786a7e4ab819e66c826425b0bd2f8d0
Subproject commit efb59b79e5a8f26eae4d15f38bbfb5667e23df60

View File

@ -313,16 +313,20 @@ private:
/// The timer for handling priority channel timeouts
QTimer _timer;
/// buffer for leds
std::vector<ColorRgb> _ledBuffer;
/// Logger instance
Logger * _log;
/// count of hardware leds
unsigned _hwLedCount;
/// register of input sources and it's prio channel
PriorityRegister _priorityRegister;
bool _transformEnabled;
bool _adjustmentEnabled;
bool _temperatureEnabled;
};

View File

@ -501,7 +501,7 @@ LedDevice * Hyperion::createColorSmoothing(const Json::Value & smoothingConfig,
smoothingConfig.get("updateFrequency", 25.0).asDouble(),
smoothingConfig.get("time_ms", 200).asInt(),
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");
}
// 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
ImageProcessorFactory::getInstance().init(
_ledString,
@ -575,7 +584,8 @@ Hyperion::Hyperion(const Json::Value &jsonConfig, const std::string configFile)
);
// initialize the color smoothing filter
_device = createColorSmoothing(jsonConfig["color"]["smoothing"], _device);
_device = createColorSmoothing(jsonConfig["smoothing"], _device);
// setup the timer
_timer.setSingleShot(true);
@ -796,9 +806,9 @@ void Hyperion::update()
// Apply the correction and the transform to each led and color-channel
// Avoid applying correction, the same task is performed by adjustment
_raw2ledTransform->applyTransform(_ledBuffer);
_raw2ledAdjustment->applyAdjustment(_ledBuffer);
_raw2ledTemperature->applyCorrection(_ledBuffer);
if (_transformEnabled) _raw2ledTransform->applyTransform(_ledBuffer);
if (_adjustmentEnabled) _raw2ledAdjustment->applyAdjustment(_ledBuffer);
if (_temperatureEnabled) _raw2ledTemperature->applyCorrection(_ledBuffer);
const std::vector<Led>& leds = _ledString.leds();

View File

@ -58,6 +58,7 @@
"required" : true,
"properties":
{
"channelAdjustment_enable" : "boolean",
"channelAdjustment" :
{
"type" : "array",
@ -172,6 +173,7 @@
"additionalProperties" : false
}
},
"temperature_enable" : "boolean",
"temperature" :
{
"type" : "array",
@ -226,6 +228,7 @@
"additionalProperties" : false
}
},
"transform_enable" : "boolean",
"transform" :
{
"type" : "array",
@ -345,51 +348,51 @@
},
"additionalProperties" : false
}
}
},
"additionalProperties" : false
},
"smoothing":
{
"type" : "object",
"required" : true,
"properties" :
{
"enable" :
{
"type" : "boolean",
"required" : true
},
"smoothing":
{
"type" : "object",
"required" : true,
"properties" :
{
"enable" :
{
"type" : "boolean",
"required" : true
},
"type" :
{
"enum" : ["none", "linear"],
"required" : true
},
"time_ms" :
{
"type" : "integer",
"required" : false,
"minimum" : 25,
"maximum": 600
},
"updateFrequency" :
{
"type" : "number",
"required" : false,
"minimum" : 1.000,
"maximum": 100.000
},
"updateDelay" :
{
"type" : "integer",
"required" : false,
"minimum" : 0,
"maximum": 2048
},
"continuousOutput" :
{
"type" : "boolean",
"required" : false
}
},
"additionalProperties" : false
"type" :
{
"enum" : ["none", "linear"],
"required" : true
},
"time_ms" :
{
"type" : "integer",
"required" : false,
"minimum" : 25,
"maximum": 600
},
"updateFrequency" :
{
"type" : "number",
"required" : false,
"minimum" : 1.000,
"maximum": 100.000
},
"updateDelay" :
{
"type" : "integer",
"required" : false,
"minimum" : 0,
"maximum": 2048
},
"continuousOutput" :
{
"type" : "boolean",
"required" : false
}
},
"additionalProperties" : false