optimize the GreyWorld
This commit is contained in:
@@ -38,6 +38,7 @@ struct color_gain {
|
||||
|
||||
static const double gamma_value = 2.2;
|
||||
static const double saturation_inc = 0.5;
|
||||
static const double contrast = 1.2;
|
||||
// static const double white_radio = 0.1;
|
||||
|
||||
using namespace sc_core;
|
||||
@@ -217,6 +218,12 @@ bool picProcess(uint32_t* image, uint16_t number) {
|
||||
// }
|
||||
// }
|
||||
|
||||
// Contrast enhancement
|
||||
// red = static_cast<uchar>(contrast * (red - 128) + 128);
|
||||
// green = static_cast<uchar>(contrast * (green - 128) + 128);
|
||||
// blue = static_cast<uchar>(contrast * (blue - 128) + 128);
|
||||
|
||||
|
||||
// save data
|
||||
data[index + 0] = red; // R
|
||||
data[index + 1] = green; // G
|
||||
@@ -379,16 +386,16 @@ int sc_main(int argc, char* argv[]) {
|
||||
isp->saturation_inc(saturation_increase);
|
||||
|
||||
blender_enable = true; // enable color correction
|
||||
gain_red = (uint32_t)(color_gain.red * std::pow(2, 8));
|
||||
gain_green = (uint32_t)(color_gain.green * std::pow(2, 8));
|
||||
gain_blue = (uint32_t)(color_gain.blue * std::pow(2, 8));
|
||||
gain_red = static_cast<uint32_t>(color_gain.red * std::pow(2, 8));
|
||||
gain_green = static_cast<uint32_t>(color_gain.green * std::pow(2, 8));
|
||||
gain_blue = static_cast<uint32_t>(color_gain.blue * std::pow(2, 8));
|
||||
|
||||
gamma_enable = true;
|
||||
gamma_inverse = (uint32_t)((1.0 / gamma_value) * std::pow(2, 8));
|
||||
gamma_inverse = static_cast<uint32_t>((1.0 / gamma_value) * std::pow(2, 8));
|
||||
for (int i = 0; i < 256; i++) {
|
||||
// calculate gamma table
|
||||
isp->gamma_table[i](gamma_table[i]);
|
||||
gamma_table[i] = (uint32_t)(255 * pow(i / 255.0, 1.0 / gamma_value));
|
||||
gamma_table[i] = static_cast<uint32_t>(255 * pow(i / 255.0, 1.0 / gamma_value));
|
||||
}
|
||||
|
||||
white_enable = true;
|
||||
|
||||
Reference in New Issue
Block a user