Support crop image on sensor, grayscale, auto exposure level

This commit is contained in:
Joo Aun Saw
2024-01-08 16:37:20 +11:00
committed by CaCO3
parent 444dc0fa39
commit ac4f823cbf
12 changed files with 525 additions and 88 deletions

View File

@@ -50,6 +50,15 @@ void ClassFlowTakeImage::SetInitialParameter(void)
ImageQuality = 5;
rawImage = NULL;
ImageSize = FRAMESIZE_VGA;
ZoomEnabled = false;
ZoomMode = 0;
zoomOffsetX = 0;
zoomOffsetY = 0;
#ifdef GRAYSCALE_AS_DEFAULT
ImageGrayscale = true;
#else
ImageGrayscale = false;
#endif
SaveAllFiles = false;
disabled = false;
FixedExposure = false;
@@ -73,6 +82,7 @@ bool ClassFlowTakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
int _brightness = -100;
int _contrast = -100;
int _saturation = -100;
int _autoExposureLevel = 0;
if (aktparamgraph.size() == 0)
if (!this->GetNextParagraph(pfile, aktparamgraph))
@@ -92,6 +102,29 @@ bool ClassFlowTakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
if ((toUpper(splitted[0]) == "IMAGEQUALITY") && (splitted.size() > 1))
ImageQuality = std::stod(splitted[1]);
if ((toUpper(splitted[0]) == "ZOOM") && (splitted.size() > 1))
{
if (toUpper(splitted[1]) == "TRUE")
ZoomEnabled = true;
else if (toUpper(splitted[1]) == "FALSE")
ZoomEnabled = false;
}
if ((toUpper(splitted[0]) == "ZOOMMODE") && (splitted.size() > 1))
ZoomMode = std::stod(splitted[1]);
if ((toUpper(splitted[0]) == "ZOOMOFFSETX") && (splitted.size() > 1))
zoomOffsetX = std::stod(splitted[1]);
if ((toUpper(splitted[0]) == "ZOOMOFFSETY") && (splitted.size() > 1))
zoomOffsetY = std::stod(splitted[1]);
if ((toUpper(splitted[0]) == "GRAYSCALE") && (splitted.size() > 1))
{
if (toUpper(splitted[1]) == "TRUE")
ImageGrayscale = true;
else if (toUpper(splitted[1]) == "FALSE")
ImageGrayscale = false;
}
if ((toUpper(splitted[0]) == "AUTOEXPOSURELEVEL") && (splitted.size() > 1))
_autoExposureLevel = std::stod(splitted[1]);
if ((toUpper(splitted[0]) == "IMAGESIZE") && (splitted.size() > 1))
{
ImageSize = Camera.TextToFramesize(splitted[1].c_str());
@@ -150,8 +183,8 @@ bool ClassFlowTakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
}
}
Camera.SetBrightnessContrastSaturation(_brightness, _contrast, _saturation);
Camera.SetQualitySize(ImageQuality, ImageSize);
Camera.SetBrightnessContrastSaturation(_brightness, _contrast, _saturation, _autoExposureLevel, ImageGrayscale);
Camera.SetQualitySize(ImageQuality, ImageSize, ZoomEnabled, ZoomMode, zoomOffsetX, zoomOffsetY);
image_width = Camera.image_width;
image_height = Camera.image_height;