mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 04:26:58 +03:00
Update Rolling
This commit is contained in:
@@ -39,7 +39,15 @@ If you would like to support the developer with a cup of coffee you can do that
|
|||||||
|
|
||||||
**General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
|
**General remark:** Beside the `firmware.bin`, typically also the content of `/html` needs to be updated!
|
||||||
|
|
||||||
|
##### Rolling (2021-01-23)
|
||||||
|
|
||||||
|
* Implementation of image brightness setting
|
||||||
|
|
||||||
|
* Bug fixing: minor topics in html, waiting time in doFlow
|
||||||
|
|
||||||
|
* based on Master v6.1.0 (2021-01-20)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##### 6.1.0 Image Processing in Memory - (2021-01-20)
|
##### 6.1.0 Image Processing in Memory - (2021-01-20)
|
||||||
|
|
||||||
|
|||||||
@@ -750,7 +750,7 @@ static void IRAM_ATTR dma_filter_buffer(size_t buf_idx)
|
|||||||
if(s_state->sensor.pixformat == PIXFORMAT_JPEG) {
|
if(s_state->sensor.pixformat == PIXFORMAT_JPEG) {
|
||||||
uint32_t sig = *((uint32_t *)s_state->fb->buf) & 0xFFFFFF;
|
uint32_t sig = *((uint32_t *)s_state->fb->buf) & 0xFFFFFF;
|
||||||
if(sig != 0xffd8ff) {
|
if(sig != 0xffd8ff) {
|
||||||
ets_printf("bh 0x%08x\n", sig);
|
ESP_LOGD(TAG,"unexpected JPEG signature 0x%08x\n", sig);
|
||||||
s_state->fb->bad = 1;
|
s_state->fb->bad = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/task.h>
|
#include <freertos/task.h>
|
||||||
#include "sccb.h"
|
#include "sccb.h"
|
||||||
@@ -42,6 +43,7 @@ int SCCB_Init(int pin_sda, int pin_scl)
|
|||||||
ESP_LOGI(TAG, "pin_sda %d pin_scl %d\n", pin_sda, pin_scl);
|
ESP_LOGI(TAG, "pin_sda %d pin_scl %d\n", pin_sda, pin_scl);
|
||||||
//log_i("SCCB_Init start");
|
//log_i("SCCB_Init start");
|
||||||
i2c_config_t conf;
|
i2c_config_t conf;
|
||||||
|
memset(&conf, 0, sizeof(i2c_config_t));
|
||||||
conf.mode = I2C_MODE_MASTER;
|
conf.mode = I2C_MODE_MASTER;
|
||||||
conf.sda_io_num = pin_sda;
|
conf.sda_io_num = pin_sda;
|
||||||
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
|
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// 1. Board setup (Uncomment):
|
// 1. Board setup (Uncomment):
|
||||||
// #define BOARD_WROVER_KIT
|
// #define BOARD_WROVER_KIT
|
||||||
#define BOARD_ESP32CAM_AITHINKER
|
// #define BOARD_ESP32CAM_AITHINKER
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2. Kconfig setup
|
* 2. Kconfig setup
|
||||||
|
|||||||
@@ -136,6 +136,19 @@ static size_t jpg_encode_stream(void * arg, size_t index, const void* data, size
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCamera::SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation)
|
||||||
|
{
|
||||||
|
sensor_t * s = esp_camera_sensor_get();
|
||||||
|
_brightness = min(2, max(-2, _brightness));
|
||||||
|
// _contrast = min(2, max(-2, _contrast));
|
||||||
|
// _saturation = min(2, max(-2, _saturation));
|
||||||
|
|
||||||
|
// s->set_saturation(s, _saturation);
|
||||||
|
// s->set_contrast(s, _contrast);
|
||||||
|
s->set_brightness(s, _brightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CCamera::SetQualitySize(int qual, framesize_t resol)
|
void CCamera::SetQualitySize(int qual, framesize_t resol)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class CCamera {
|
|||||||
void LEDOnOff(bool status);
|
void LEDOnOff(bool status);
|
||||||
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
|
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
|
||||||
void SetQualitySize(int qual, framesize_t resol);
|
void SetQualitySize(int qual, framesize_t resol);
|
||||||
|
void SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation);
|
||||||
void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol);
|
void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol);
|
||||||
|
|
||||||
framesize_t TextToFramesize(const char * text);
|
framesize_t TextToFramesize(const char * text);
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _
|
|||||||
|
|
||||||
for (int i = 0; i < FlowControll.size(); ++i)
|
for (int i = 0; i < FlowControll.size(); ++i)
|
||||||
if (FlowControll[i]->name().compare(_classname) == 0){
|
if (FlowControll[i]->name().compare(_classname) == 0){
|
||||||
FlowControll[i]->doFlow("");
|
if (!(FlowControll[i]->name().compare("ClassFlowMakeImage") == 0)) // falls es ein MakeImage ist, braucht das Bild nicht extra aufgenommen zu werden, dass passiert bei html-Abfrage automatisch
|
||||||
|
FlowControll[i]->doFlow("");
|
||||||
result = FlowControll[i]->getHTMLSingleStep(_host);
|
result = FlowControll[i]->getHTMLSingleStep(_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ bool ClassFlowMakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
std::vector<string> zerlegt;
|
std::vector<string> zerlegt;
|
||||||
|
|
||||||
aktparamgraph = trim(aktparamgraph);
|
aktparamgraph = trim(aktparamgraph);
|
||||||
|
int _brightness = 0;
|
||||||
|
int _contrast = 0;
|
||||||
|
int _saturation = 0;
|
||||||
|
|
||||||
if (aktparamgraph.size() == 0)
|
if (aktparamgraph.size() == 0)
|
||||||
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
||||||
@@ -79,9 +82,26 @@ bool ClassFlowMakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|||||||
SaveAllFiles = true;
|
SaveAllFiles = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((toUpper(zerlegt[0]) == "BRIGHTNESS") && (zerlegt.size() > 1))
|
||||||
|
{
|
||||||
|
_brightness = stoi(zerlegt[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((toUpper(zerlegt[0]) == "CONTRAST") && (zerlegt.size() > 1))
|
||||||
|
{
|
||||||
|
_contrast = stoi(zerlegt[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((toUpper(zerlegt[0]) == "SATURATION") && (zerlegt.size() > 1))
|
||||||
|
{
|
||||||
|
_saturation = stoi(zerlegt[1]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Camera.SetBrightnessContrastSaturation(_brightness, _contrast, _saturation);
|
||||||
Camera.SetQualitySize(ImageQuality, ImageSize);
|
Camera.SetQualitySize(ImageQuality, ImageSize);
|
||||||
|
|
||||||
image_width = Camera.image_width;
|
image_width = Camera.image_width;
|
||||||
image_height = Camera.image_height;
|
image_height = Camera.image_height;
|
||||||
rawImage = new CImageBasis();
|
rawImage = new CImageBasis();
|
||||||
|
|||||||
@@ -403,11 +403,33 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
|||||||
if (_task.compare("test_take") == 0)
|
if (_task.compare("test_take") == 0)
|
||||||
{
|
{
|
||||||
std::string _host = "";
|
std::string _host = "";
|
||||||
|
std::string _bri = "";
|
||||||
|
std::string _con = "";
|
||||||
|
std::string _sat = "";
|
||||||
|
int bri = 0;
|
||||||
|
int sat = 0;
|
||||||
|
int con = 0;
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "host", _valuechar, 30) == ESP_OK) {
|
if (httpd_query_key_value(_query, "host", _valuechar, 30) == ESP_OK) {
|
||||||
_host = std::string(_valuechar);
|
_host = std::string(_valuechar);
|
||||||
}
|
}
|
||||||
|
if (httpd_query_key_value(_query, "bri", _valuechar, 30) == ESP_OK) {
|
||||||
|
_bri = std::string(_valuechar);
|
||||||
|
bri = stoi(_bri);
|
||||||
|
}
|
||||||
|
if (httpd_query_key_value(_query, "con", _valuechar, 30) == ESP_OK) {
|
||||||
|
_con = std::string(_valuechar);
|
||||||
|
con = stoi(_con);
|
||||||
|
}
|
||||||
|
if (httpd_query_key_value(_query, "sat", _valuechar, 30) == ESP_OK) {
|
||||||
|
_sat = std::string(_valuechar);
|
||||||
|
sat = stoi(_sat);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// printf("Parameter host: "); printf(_host.c_str()); printf("\n");
|
// printf("Parameter host: "); printf(_host.c_str()); printf("\n");
|
||||||
// string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
|
// string zwzw = "Do " + _task + " start\n"; printf(zwzw.c_str());
|
||||||
|
Camera.SetBrightnessContrastSaturation(bri, con, sat);
|
||||||
std::string zw = tfliteflow.doSingleStep("[MakeImage]", _host);
|
std::string zw = tfliteflow.doSingleStep("[MakeImage]", _host);
|
||||||
httpd_resp_sendstr_chunk(req, zw.c_str());
|
httpd_resp_sendstr_chunk(req, zw.c_str());
|
||||||
}
|
}
|
||||||
@@ -559,9 +581,12 @@ void task_autodoFlow(void *pvParameter)
|
|||||||
LogFile.WriteToFile(zwtemp);
|
LogFile.WriteToFile(zwtemp);
|
||||||
printf("CPU Temperature: %.2f\n", cputmp);
|
printf("CPU Temperature: %.2f\n", cputmp);
|
||||||
fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000;
|
fr_delta_ms = (esp_timer_get_time() - fr_start) / 1000;
|
||||||
const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS;
|
if (auto_intervall > fr_delta_ms)
|
||||||
printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
|
{
|
||||||
vTaskDelay( xDelay );
|
const TickType_t xDelay = (auto_intervall - fr_delta_ms) / portTICK_PERIOD_MS;
|
||||||
|
printf("Autoflow: sleep for : %ldms\n", (long) xDelay);
|
||||||
|
vTaskDelay( xDelay );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
vTaskDelete(NULL); //Delete this task if it exits from the loop above
|
vTaskDelete(NULL); //Delete this task if it exits from the loop above
|
||||||
xHandletask_autodoFlow = NULL;
|
xHandletask_autodoFlow = NULL;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="46cfe45";
|
const char* GIT_REV="abc4cb4";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="master";
|
const char* GIT_BRANCH="rolling";
|
||||||
const char* BUILD_TIME="2021-01-20 19:47";
|
const char* BUILD_TIME="2021-01-23 22:04";
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
const char* GIT_REV="46cfe45";
|
const char* GIT_REV="abc4cb4";
|
||||||
const char* GIT_TAG="";
|
const char* GIT_TAG="";
|
||||||
const char* GIT_BRANCH="master";
|
const char* GIT_BRANCH="rolling";
|
||||||
const char* BUILD_TIME="2021-01-20 19:47";
|
const char* BUILD_TIME="2021-01-23 22:04";
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,6 +4,7 @@
|
|||||||
WaitBeforeTakingPicture = 5
|
WaitBeforeTakingPicture = 5
|
||||||
ImageQuality = 5
|
ImageQuality = 5
|
||||||
ImageSize = VGA
|
ImageSize = VGA
|
||||||
|
Brightness = 0
|
||||||
|
|
||||||
[Alignment]
|
[Alignment]
|
||||||
InitalRotate=180
|
InitalRotate=180
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
[1204/185120.033:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
|
[1204/185120.033:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
|
||||||
[0102/122131.430:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
|
[0102/122131.430:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
|
||||||
[0118/210038.095:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
|
[0118/210038.095:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
|
||||||
|
[0122/182642.937:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
|
||||||
|
[0122/191644.620:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
|
||||||
|
[0122/214224.255:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
|
||||||
|
[0123/204102.088:ERROR:directory_reader_win.cc(43)] FindFirstFile: Das System kann den angegebenen Pfad nicht finden. (0x3)
|
||||||
|
|||||||
@@ -130,6 +130,49 @@ textarea {
|
|||||||
Picture size camera (default = "VGA")
|
Picture size camera (default = "VGA")
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="expert" id="Brightness_ex3">
|
||||||
|
<td width="20px" style="padding-left: 40px;">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<class id="MakeImage_Brightness_text" style="color:black;">Brightness</class>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="number" id="MakeImage_Brightness_value1" size="13" min="-2" max="2">
|
||||||
|
</td>
|
||||||
|
<td style="font-size: 80%;">
|
||||||
|
Image Brightness (-2 .. 2 - default = "0")
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!--
|
||||||
|
<tr class="expert" id="Contrast_ex3">
|
||||||
|
<td width="20px" style="padding-left: 40px;">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<class id="MakeImage_Contrast_text" style="color:black;">Contrast</class>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="number" id="MakeImage_Contrast_value1" size="13" min="-2" max="2">
|
||||||
|
</td>
|
||||||
|
<td style="font-size: 80%;">
|
||||||
|
Image Contrast (-2 .. 2 - default = "0")
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="expert" id="Saturation_ex3">
|
||||||
|
<td width="20px" style="padding-left: 40px;">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<class id="MakeImage_Saturation_text" style="color:black;">Saturation</class>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="number" id="MakeImage_Saturation_value1" size="13" min="-2" max="2">
|
||||||
|
</td>
|
||||||
|
<td style="font-size: 80%;">
|
||||||
|
Image Saturation (-2 .. 2 - default = "0")
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
<tr class="expert" id="ex4">
|
<tr class="expert" id="ex4">
|
||||||
<td colspan="4" style="padding-left: 20px;"><h4>Alignment</h4></td>
|
<td colspan="4" style="padding-left: 20px;"><h4>Alignment</h4></td>
|
||||||
@@ -767,6 +810,9 @@ function UpdateInput() {
|
|||||||
WriteParameter(param, category, "MakeImage", "LogfileRetentionInDays", true);
|
WriteParameter(param, category, "MakeImage", "LogfileRetentionInDays", true);
|
||||||
WriteParameter(param, category, "MakeImage", "WaitBeforeTakingPicture", false);
|
WriteParameter(param, category, "MakeImage", "WaitBeforeTakingPicture", false);
|
||||||
WriteParameter(param, category, "MakeImage", "ImageQuality", false);
|
WriteParameter(param, category, "MakeImage", "ImageQuality", false);
|
||||||
|
WriteParameter(param, category, "MakeImage", "Brightness", false);
|
||||||
|
// WriteParameter(param, category, "MakeImage", "Contrast", false);
|
||||||
|
// WriteParameter(param, category, "MakeImage", "Saturation", false);
|
||||||
WriteParameter(param, category, "MakeImage", "ImageSize", false, true, true);
|
WriteParameter(param, category, "MakeImage", "ImageSize", false, true, true);
|
||||||
|
|
||||||
WriteParameter(param, category, "Alignment", "SearchFieldX", false);
|
WriteParameter(param, category, "Alignment", "SearchFieldX", false);
|
||||||
@@ -820,6 +866,9 @@ function ReadParameterAll()
|
|||||||
ReadParameter(param, "MakeImage", "LogfileRetentionInDays", true);
|
ReadParameter(param, "MakeImage", "LogfileRetentionInDays", true);
|
||||||
ReadParameter(param, "MakeImage", "WaitBeforeTakingPicture", false);
|
ReadParameter(param, "MakeImage", "WaitBeforeTakingPicture", false);
|
||||||
ReadParameter(param, "MakeImage", "ImageQuality", false);
|
ReadParameter(param, "MakeImage", "ImageQuality", false);
|
||||||
|
ReadParameter(param, "MakeImage", "Brightness", false);
|
||||||
|
// ReadParameter(param, "MakeImage", "Contrast", false);
|
||||||
|
// ReadParameter(param, "MakeImage", "Saturation", false);
|
||||||
ReadParameter(param, "MakeImage", "ImageSize", false, true);
|
ReadParameter(param, "MakeImage", "ImageSize", false, true);
|
||||||
|
|
||||||
ReadParameter(param, "Alignment", "SearchFieldX", false);
|
ReadParameter(param, "Alignment", "SearchFieldX", false);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ table {
|
|||||||
|
|
||||||
<body style="font-family: arial; padding: 0px 10px;">
|
<body style="font-family: arial; padding: 0px 10px;">
|
||||||
<h2>Create Reference out of Raw Image</h2>
|
<h2>Create Reference out of Raw Image</h2>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><input class="button" type="button" value="Show Actual Reference" onclick="showReference()"></td>
|
<td><input class="button" type="button" value="Show Actual Reference" onclick="showReference()"></td>
|
||||||
@@ -42,17 +42,32 @@ table {
|
|||||||
<td><input class="button" type="submit" id="take" onclick="doTake()" value="Take Image"></td>
|
<td><input class="button" type="submit" id="take" onclick="doTake()" value="Take Image"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-top: 10px"><label for="mirror">Mirror Image:</label></td>
|
<td style="padding-top: 10px"><label for="mirror" id="labelmirror">Mirror Image:</label></td>
|
||||||
<td style="padding-top: 10px"><input type="checkbox" id="mirror" name="mirror" value="1" onchange="drawRotated()"></td>
|
<td style="padding-top: 10px"><input type="checkbox" id="mirror" name="mirror" value="1" onchange="drawRotated()"></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><label for="mirror">Pre-rotate Angle:</label></td>
|
<td><label for="mirror">Pre-rotate Angle:</label></td>
|
||||||
<td><input type="number" id="prerotateangle" name="prerotateangle" value=0 min="-360" max="360" onchange="drawRotated()">Degrees</td>
|
<td><input type="number" id="prerotateangle" name="prerotateangle" value=0 min="-360" max="360" onchange="drawRotated()">Degrees</td>
|
||||||
|
<td>
|
||||||
|
<class id="MakeImage_Brightness_text" style="color:black;">Brightness: </class>
|
||||||
|
<input type="number" id="MakeImage_Brightness_value1" size="13" value=0 min="-2" max="2" style="float: right; clear: both;">
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><label for="mirror">Fine Alignment:</label></td>
|
<td><label for="mirror">Fine Alignment:</label></td>
|
||||||
<td><input type="number" id="finerotate" name="finerotate" value=0.0 min="-1" max="1" step="0.2" onchange="drawRotated()">Degrees</td>
|
<td><input type="number" id="finerotate" name="finerotate" value=0.0 min="-1" max="1" step="0.2" onchange="drawRotated()">Degrees</td>
|
||||||
</tr>
|
<!--
|
||||||
|
<td>
|
||||||
|
<class id="MakeImage_Contrast_text" style="color:black;">Contrast</class>
|
||||||
|
<input type="number" id="MakeImage_Contrast_value1" size="13" value=0 min="-2" max="2" style="float: right; clear: both;">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<class id="MakeImage_Saturation_text" style="color:black;">Saturation</class>
|
||||||
|
<input type="number" id="MakeImage_Saturation_value1" size="13" value=0 min="-2" max="2" style="float: right; clear: both;">
|
||||||
|
</td>
|
||||||
|
-->
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
@@ -68,6 +83,9 @@ table {
|
|||||||
<script type="text/javascript" src="./gethost.js"></script>
|
<script type="text/javascript" src="./gethost.js"></script>
|
||||||
<script type="text/javascript" src="./readconfig.js"></script>
|
<script type="text/javascript" src="./readconfig.js"></script>
|
||||||
<script type="text/javascript" src="./readconfigcommon.js"></script>
|
<script type="text/javascript" src="./readconfigcommon.js"></script>
|
||||||
|
<script type="text/javascript" src="./readconfigparam.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script language="JavaScript">
|
<script language="JavaScript">
|
||||||
var canvas = document.getElementById('canvas'),
|
var canvas = document.getElementById('canvas'),
|
||||||
@@ -75,10 +93,14 @@ table {
|
|||||||
imageObj = new Image()
|
imageObj = new Image()
|
||||||
basepath = "http://192.168.178.26";
|
basepath = "http://192.168.178.26";
|
||||||
isActReference = false;
|
isActReference = false;
|
||||||
|
param;
|
||||||
|
|
||||||
function doTake(){
|
function doTake(){
|
||||||
|
_brightness = document.getElementById("MakeImage_Brightness_value1").value;
|
||||||
|
// _contrast = document.getElementById("MakeImage_Contrast_value1").value;
|
||||||
|
// _saturation = document.getElementById("MakeImage_Saturation_value1").value;
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
url = basepath + "/editflow.html?task=test_take";
|
url = basepath + "/editflow.html?task=test_take&bri=" + _brightness;
|
||||||
if (basepath.length > 0){
|
if (basepath.length > 0){
|
||||||
url = url + "&host=" + basepath;
|
url = url + "&host=" + basepath;
|
||||||
}
|
}
|
||||||
@@ -89,35 +111,50 @@ table {
|
|||||||
|
|
||||||
function loadRawImage(){
|
function loadRawImage(){
|
||||||
url = basepath + "/img_tmp/raw.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);
|
url = basepath + "/img_tmp/raw.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);
|
||||||
document.getElementById("finerotate").value = 0;
|
// document.getElementById("finerotate").value = 0;
|
||||||
document.getElementById("prerotateangle").value = getPreRotate();
|
// document.getElementById("prerotateangle").value = getPreRotate();
|
||||||
document.getElementById("mirror").checked = getMirror();
|
// document.getElementById("mirror").checked = getMirror();
|
||||||
document.getElementById("finerotate").disabled = false;
|
document.getElementById("finerotate").disabled = false;
|
||||||
document.getElementById("prerotateangle").disabled = false;
|
document.getElementById("prerotateangle").disabled = false;
|
||||||
document.getElementById("updatereferenceimage").disabled = false;
|
document.getElementById("updatereferenceimage").disabled = false;
|
||||||
document.getElementById("take").disabled = false;
|
document.getElementById("take").disabled = false;
|
||||||
document.getElementById("mirror").disabled = false;
|
if (param["Alignment"]["InitialMirror"].found)
|
||||||
|
document.getElementById("mirror").disabled = false;
|
||||||
|
else
|
||||||
|
document.getElementById("labelmirror").style = "color:lightgrey;";
|
||||||
|
|
||||||
|
if (param["MakeImage"]["Brightness"].found)
|
||||||
|
document.getElementById("MakeImage_Brightness_value1").disabled = false;
|
||||||
|
// if (param["MakeImage"]["Saturation"].found)
|
||||||
|
// document.getElementById("MakeImage_Saturation_value1").disabled = false;
|
||||||
|
// if (param["MakeImage"]["Contrast"].found)
|
||||||
|
// document.getElementById("MakeImage_Contrast_value1").disabled = false;
|
||||||
|
|
||||||
// document.getElementById("ButtonRotate").disabled = false;
|
|
||||||
isActReference = false;
|
isActReference = false;
|
||||||
loadCanvas(url);
|
loadCanvas(url);
|
||||||
drawRotated();
|
drawRotated();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showReference(){
|
function showReference(_param){
|
||||||
url = basepath + "/fileserver/config/reference.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);;
|
url = basepath + "/fileserver/config/reference.jpg" + "?session=" + Math.floor((Math.random() * 1000000) + 1);;
|
||||||
document.getElementById("finerotate").value = 0;
|
document.getElementById("finerotate").value = 0;
|
||||||
document.getElementById("prerotateangle").value = 0;
|
document.getElementById("prerotateangle").value = _param["Alignment"]["InitialRotate"].value1;
|
||||||
|
|
||||||
|
if (_param["Alignment"]["InitialMirror"].found && (_param["Alignment"]["InitialMirror"].value1 == "true"))
|
||||||
|
document.getElementById("mirror").checked = true;
|
||||||
|
|
||||||
document.getElementById("finerotate").disabled = true;
|
document.getElementById("finerotate").disabled = true;
|
||||||
document.getElementById("prerotateangle").disabled = true;
|
document.getElementById("prerotateangle").disabled = true;
|
||||||
document.getElementById("updatereferenceimage").disabled = true;
|
document.getElementById("updatereferenceimage").disabled = true;
|
||||||
document.getElementById("take").disabled = true;
|
document.getElementById("take").disabled = true;
|
||||||
|
document.getElementById("MakeImage_Brightness_value1").disabled = true;
|
||||||
|
// document.getElementById("MakeImage_Saturation_value1").disabled = true;
|
||||||
|
// document.getElementById("MakeImage_Contrast_value1").disabled = true;
|
||||||
document.getElementById("mirror").disabled = true;
|
document.getElementById("mirror").disabled = true;
|
||||||
|
|
||||||
isActReference = true;
|
isActReference = true;
|
||||||
loadCanvas(url);
|
loadCanvas(url);
|
||||||
ParseConfig();
|
drawRotated(false, true);
|
||||||
drawRotated();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function dataURLtoBlob(dataurl) {
|
function dataURLtoBlob(dataurl) {
|
||||||
@@ -131,9 +168,21 @@ table {
|
|||||||
|
|
||||||
function SaveReference(){
|
function SaveReference(){
|
||||||
if (confirm("Are you sure you want to update the reference image?")) {
|
if (confirm("Are you sure you want to update the reference image?")) {
|
||||||
setPreRotate(document.getElementById("prerotateangle").value);
|
param["Alignment"]["InitialRotate"].value1 = document.getElementById("prerotateangle").value;
|
||||||
setMirror(document.getElementById("mirror").checked);
|
if ((param["Alignment"]["InitialMirror"].found == true) && (document.getElementById("mirror").checked))
|
||||||
UpdateConfigFileReferenceChange(basepath);
|
param["Alignment"]["InitialMirror"].value1 = "true";
|
||||||
|
else
|
||||||
|
param["Alignment"]["InitialMirror"].value1 = "false";
|
||||||
|
|
||||||
|
ReadParameter(param, "MakeImage", "Brightness", false);
|
||||||
|
// ReadParameter(param, "MakeImage", "Contrast", false);
|
||||||
|
// ReadParameter(param, "MakeImage", "Saturation", false);
|
||||||
|
|
||||||
|
|
||||||
|
var textToSave = setConfigParameters(param);
|
||||||
|
FileDeleteOnServer("/config/config.ini", basepath);
|
||||||
|
FileSendContent(textToSave, "/config/config.ini", basepath);
|
||||||
|
|
||||||
var canvas = document.getElementById("canvas");
|
var canvas = document.getElementById("canvas");
|
||||||
drawRotated(false);
|
drawRotated(false);
|
||||||
SaveCanvasToImage(canvas, "/config/reference.jpg", true, basepath);
|
SaveCanvasToImage(canvas, "/config/reference.jpg", true, basepath);
|
||||||
@@ -174,10 +223,75 @@ table {
|
|||||||
basepath = getbasepath();
|
basepath = getbasepath();
|
||||||
loadConfig(basepath);
|
loadConfig(basepath);
|
||||||
ParseConfig();
|
ParseConfig();
|
||||||
showReference();
|
param = getConfigParameters();
|
||||||
|
UpdateInput();
|
||||||
|
showReference(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawRotated(_grid = true){
|
function UpdateInput() {
|
||||||
|
WriteParameter(param, category, "MakeImage", "Brightness", false);
|
||||||
|
// WriteParameter(param, category, "MakeImage", "Contrast", false);
|
||||||
|
// WriteParameter(param, category, "MakeImage", "Saturation", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function ReadParameter(_param, _cat, _name, _optional, _select = false){
|
||||||
|
if (_param[_cat][_name]["found"]){
|
||||||
|
if (_optional) {
|
||||||
|
_param[_cat][_name]["enabled"] = document.getElementById(_cat+"_"+_name+"_enabled").checked;
|
||||||
|
}
|
||||||
|
if (_select) {
|
||||||
|
var sel = document.getElementById(_cat+"_"+_name+"_value1");
|
||||||
|
_param[_cat][_name]["value1"] = sel.options[sel.selectedIndex].text;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var j = 1; j <= _param[_cat][_name]["anzParam"]; ++j) {
|
||||||
|
_param[_cat][_name]["value"+j] = document.getElementById(_cat+"_"+_name+"_value"+j).value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function WriteParameter(_param, _category, _cat, _name, _optional, _select = false, _anzpara = 1){
|
||||||
|
if (_param[_cat][_name]["found"]){
|
||||||
|
if (_optional) {
|
||||||
|
document.getElementById(_cat+"_"+_name+"_enabled").checked = _param[_cat][_name]["enabled"];
|
||||||
|
for (var j = 1; j <= _anzpara; ++j) {
|
||||||
|
document.getElementById(_cat+"_"+_name+"_value"+j).disabled = !_param[_cat][_name]["enabled"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.getElementById(_cat+"_"+_name+"_text").style="color:black;"
|
||||||
|
if (_select) {
|
||||||
|
var textToFind = _param[_cat][_name]["value1"];
|
||||||
|
var dd = document.getElementById(_cat+"_"+_name+"_value1");
|
||||||
|
for (var i = 0; i < dd.options.length; i++) {
|
||||||
|
if (dd.options[i].text.toLowerCase() === textToFind.toLowerCase()) {
|
||||||
|
dd.selectedIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var j = 1; j <= _anzpara; ++j) {
|
||||||
|
document.getElementById(_cat+"_"+_name+"_value"+j).value = _param[_cat][_name]["value"+j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (_optional) {
|
||||||
|
document.getElementById(_cat+"_"+_name+"_enabled").disabled = true;
|
||||||
|
for (var j = 1; j <= _anzpara; ++j) {
|
||||||
|
document.getElementById(_cat+"_"+_name+"_value"+j).disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.getElementById(_cat+"_"+_name+"_text").style="color:lightgrey;"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function drawRotated(_grid = true, _isreference = false){
|
||||||
finerot= parseFloat(document.getElementById("finerotate").value);
|
finerot= parseFloat(document.getElementById("finerotate").value);
|
||||||
prerot = parseFloat(document.getElementById("prerotateangle").value);
|
prerot = parseFloat(document.getElementById("prerotateangle").value);
|
||||||
mirror = document.getElementById("mirror").checked;
|
mirror = document.getElementById("mirror").checked;
|
||||||
@@ -199,18 +313,26 @@ table {
|
|||||||
|
|
||||||
context.clearRect(0,0,imageObj.width,imageObj.height);
|
context.clearRect(0,0,imageObj.width,imageObj.height);
|
||||||
context.save();
|
context.save();
|
||||||
|
|
||||||
|
if (isActReference)
|
||||||
|
{
|
||||||
|
context.drawImage(imageObj,0,0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (mirror) {
|
||||||
|
context.scale(-1, 1);
|
||||||
|
context.translate(-imageObj.width/2,imageObj.height/2);
|
||||||
|
context.rotate(-degrees*Math.PI/180);
|
||||||
|
context.drawImage(imageObj, imageObj.width/2,-imageObj.height/2, -imageObj.width, imageObj.height);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
context.translate(imageObj.width/2,imageObj.height/2);
|
||||||
|
context.rotate(degrees*Math.PI/180);
|
||||||
|
context.drawImage(imageObj,-imageObj.width/2,-imageObj.height/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mirror) {
|
|
||||||
context.scale(-1, 1);
|
|
||||||
context.translate(-imageObj.width/2,imageObj.height/2);
|
|
||||||
context.rotate(-degrees*Math.PI/180);
|
|
||||||
context.drawImage(imageObj, imageObj.width/2,-imageObj.height/2, -imageObj.width, imageObj.height);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
context.translate(imageObj.width/2,imageObj.height/2);
|
|
||||||
context.rotate(degrees*Math.PI/180);
|
|
||||||
context.drawImage(imageObj,-imageObj.width/2,-imageObj.height/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
context.restore();
|
context.restore();
|
||||||
if (_grid == true && !isActReference){
|
if (_grid == true && !isActReference){
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ function getbasepath(){
|
|||||||
if ((host == "127.0.0.1") || (host == "localhost"))
|
if ((host == "127.0.0.1") || (host == "localhost"))
|
||||||
{
|
{
|
||||||
// host = "http://192.168.2.118"; // jomjol interner test
|
// host = "http://192.168.2.118"; // jomjol interner test
|
||||||
host = "http://192.168.178.26"; // jomjol interner test
|
// host = "http://192.168.178.26"; // jomjol interner test
|
||||||
// host = "http://192.168.178.22"; // jomjol interner Real
|
host = "http://192.168.178.22"; // jomjol interner Real
|
||||||
// host = "."; // jomjol interner localhost
|
// host = "."; // jomjol interner localhost
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ function ParseConfig() {
|
|||||||
ParamAddValue(param, catname, "LogImageLocation");
|
ParamAddValue(param, catname, "LogImageLocation");
|
||||||
ParamAddValue(param, catname, "WaitBeforeTakingPicture");
|
ParamAddValue(param, catname, "WaitBeforeTakingPicture");
|
||||||
ParamAddValue(param, catname, "LogfileRetentionInDays");
|
ParamAddValue(param, catname, "LogfileRetentionInDays");
|
||||||
|
ParamAddValue(param, catname, "Brightness");
|
||||||
|
ParamAddValue(param, catname, "Contrast");
|
||||||
|
ParamAddValue(param, catname, "Saturation");
|
||||||
ParamAddValue(param, catname, "ImageQuality");
|
ParamAddValue(param, catname, "ImageQuality");
|
||||||
ParamAddValue(param, catname, "ImageSize");
|
ParamAddValue(param, catname, "ImageSize");
|
||||||
|
|
||||||
@@ -31,6 +34,8 @@ function ParseConfig() {
|
|||||||
category[catname]["enabled"] = false;
|
category[catname]["enabled"] = false;
|
||||||
category[catname]["found"] = false;
|
category[catname]["found"] = false;
|
||||||
param[catname] = new Object();
|
param[catname] = new Object();
|
||||||
|
ParamAddValue(param, catname, "InitialRotate");
|
||||||
|
ParamAddValue(param, catname, "InitialMirror");
|
||||||
ParamAddValue(param, catname, "SearchFieldX");
|
ParamAddValue(param, catname, "SearchFieldX");
|
||||||
ParamAddValue(param, catname, "SearchFieldY");
|
ParamAddValue(param, catname, "SearchFieldY");
|
||||||
ParamAddValue(param, catname, "AlignmentAlgo");
|
ParamAddValue(param, catname, "AlignmentAlgo");
|
||||||
@@ -184,7 +189,7 @@ function getConfigParameters() {
|
|||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setConfigParameters(_param, _category) {
|
function setConfigParameters(_param, _category = "") {
|
||||||
for (var cat in _param) {
|
for (var cat in _param) {
|
||||||
for (var name in _param[cat]) {
|
for (var name in _param[cat]) {
|
||||||
param[cat][name]["found"] = _param[cat][name]["found"];
|
param[cat][name]["found"] = _param[cat][name]["found"];
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
5.1.0
|
5.2.0
|
||||||
|
|||||||
Reference in New Issue
Block a user