ov2640: support sharpness control

This commit is contained in:
Joo Aun Saw
2024-01-30 17:27:57 +11:00
committed by CaCO3
parent a8fb88a35d
commit 69f1a99b55
10 changed files with 276 additions and 49 deletions

View File

@@ -84,6 +84,7 @@ bool ClassFlowTakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
int _brightness = -100;
int _contrast = -100;
int _saturation = -100;
int _sharpness = 0;
int _autoExposureLevel = 0;
if (aktparamgraph.size() == 0)
@@ -178,6 +179,11 @@ bool ClassFlowTakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
_saturation = stoi(splitted[1]);
}
if ((toUpper(splitted[0]) == "SHARPNESS") && (splitted.size() > 1))
{
_sharpness = stoi(splitted[1]);
}
if ((toUpper(splitted[0]) == "FIXEDEXPOSURE") && (splitted.size() > 1))
{
if (toUpper(splitted[1]) == "TRUE")
@@ -199,7 +205,7 @@ bool ClassFlowTakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
}
}
Camera.SetBrightnessContrastSaturation(_brightness, _contrast, _saturation, _autoExposureLevel, ImageGrayscale, ImageNegative, ImageAec2);
Camera.SetBrightnessContrastSaturation(_brightness, _contrast, _saturation, _autoExposureLevel, ImageGrayscale, ImageNegative, ImageAec2, _sharpness);
Camera.SetQualitySize(ImageQuality, ImageSize, ZoomEnabled, ZoomMode, zoomOffsetX, zoomOffsetY);
image_width = Camera.image_width;

View File

@@ -703,6 +703,7 @@ esp_err_t handler_editflow(httpd_req_t *req)
bool zoom = false;
bool negative = false;
bool aec2 = false;
int sharpnessLevel = 0;
#ifdef GRAYSCALE_AS_DEFAULT
bool grayscale = true;
#else
@@ -732,6 +733,10 @@ esp_err_t handler_editflow(httpd_req_t *req)
std::string _ae = std::string(_valuechar);
aelevel = stoi(_ae);
}
if (httpd_query_key_value(_query, "sh", _valuechar, 30) == ESP_OK) {
std::string _sh = std::string(_valuechar);
sharpnessLevel = stoi(_sh);
}
if (httpd_query_key_value(_query, "gs", _valuechar, 30) == ESP_OK) {
std::string _gr = std::string(_valuechar);
if (stoi(_gr) != 0)
@@ -776,7 +781,7 @@ esp_err_t handler_editflow(httpd_req_t *req)
// ESP_LOGD(TAG, "Parameter host: %s", _host.c_str());
// string zwzw = "Do " + _task + " start\n"; ESP_LOGD(TAG, zwzw.c_str());
Camera.SetZoom(zoom, zoommode, zoomoffsetx, zoomoffsety);
Camera.SetBrightnessContrastSaturation(bri, con, sat, aelevel, grayscale, negative, aec2);
Camera.SetBrightnessContrastSaturation(bri, con, sat, aelevel, grayscale, negative, aec2, sharpnessLevel);
Camera.SetLEDIntensity(intens);
ESP_LOGD(TAG, "test_take - vor TakeImage");
std::string zw = flowctrl.doSingleStep("[TakeImage]", _host);