mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-07 20:16:55 +03:00
Camera settings (#3029)
* Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -15,66 +15,100 @@
|
|||||||
#include "CImageBasis.h"
|
#include "CImageBasis.h"
|
||||||
#include "../../include/defines.h"
|
#include "../../include/defines.h"
|
||||||
|
|
||||||
class CCamera {
|
typedef enum
|
||||||
protected:
|
{
|
||||||
int ActualQuality;
|
OV2640_MODE_UXGA,
|
||||||
framesize_t ActualResolution;
|
OV2640_MODE_SVGA,
|
||||||
int brightness, contrast, saturation, autoExposureLevel;
|
OV2640_MODE_CIF
|
||||||
bool isFixedExposure;
|
} ov2640_sensor_mode_t;
|
||||||
int waitbeforepicture_org;
|
|
||||||
int led_intensity = 4095;
|
|
||||||
|
|
||||||
void ledc_init(void);
|
typedef struct
|
||||||
bool CameraInitSuccessful = false;
|
{
|
||||||
bool demoMode = false;
|
framesize_t ImageFrameSize = FRAMESIZE_VGA; // 0 - 10
|
||||||
|
gainceiling_t ImageGainceiling; // Image gain (GAINCEILING_x2, x4, x8, x16, x32, x64 or x128)
|
||||||
|
|
||||||
bool loadNextDemoImage(camera_fb_t *fb);
|
int ImageQuality; // 0 - 63
|
||||||
long GetFileSize(std::string filename);
|
int ImageBrightness; // (-2 to 2) - set brightness
|
||||||
|
int ImageContrast; //-2 - 2
|
||||||
|
int ImageSaturation; //-2 - 2
|
||||||
|
int ImageSharpness; //-2 - 2
|
||||||
|
bool ImageAutoSharpness;
|
||||||
|
int ImageSpecialEffect; // 0 - 6
|
||||||
|
int ImageWbMode; // 0 to 4 - if awb_gain enabled (0 - Auto, 1 - Sunny, 2 - Cloudy, 3 - Office, 4 - Home)
|
||||||
|
int ImageAwb; // white balance enable (0 or 1)
|
||||||
|
int ImageAwbGain; // Auto White Balance enable (0 or 1)
|
||||||
|
int ImageAec; // auto exposure off (1 or 0)
|
||||||
|
int ImageAec2; // automatic exposure sensor (0 or 1)
|
||||||
|
int ImageAeLevel; // auto exposure levels (-2 to 2)
|
||||||
|
int ImageAecValue; // set exposure manually (0-1200)
|
||||||
|
int ImageAgc; // auto gain off (1 or 0)
|
||||||
|
int ImageAgcGain; // set gain manually (0 - 30)
|
||||||
|
int ImageBpc; // black pixel correction
|
||||||
|
int ImageWpc; // white pixel correction
|
||||||
|
int ImageRawGma; // (1 or 0)
|
||||||
|
int ImageLenc; // lens correction (1 or 0)
|
||||||
|
int ImageHmirror; // (0 or 1) flip horizontally
|
||||||
|
int ImageVflip; // Invert image (0 or 1)
|
||||||
|
int ImageDcw; // downsize enable (1 or 0)
|
||||||
|
|
||||||
void SetCamWindow(sensor_t *s, int resolution, int xOffset, int yOffset, int xLength, int yLength);
|
int ImageWidth;
|
||||||
void SetImageWidthHeightFromResolution(framesize_t resol);
|
int ImageHeight;
|
||||||
|
|
||||||
public:
|
int ImageLedIntensity;
|
||||||
int image_height, image_width;
|
|
||||||
bool imageZoomEnabled = false;
|
|
||||||
int imageZoomMode = 0;
|
|
||||||
int imageZoomOffsetX = 0;
|
|
||||||
int imageZoomOffsetY = 0;
|
|
||||||
bool imageNegative = false;
|
|
||||||
bool imageAec2 = false;
|
|
||||||
bool imageAutoSharpness = false;
|
|
||||||
int imageSharpnessLevel = 0;
|
|
||||||
#ifdef GRAYSCALE_AS_DEFAULT
|
|
||||||
bool imageGrayscale = true;
|
|
||||||
#else
|
|
||||||
bool imageGrayscale = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CCamera();
|
|
||||||
esp_err_t InitCam();
|
|
||||||
|
|
||||||
void LightOnOff(bool status);
|
bool ImageZoomEnabled;
|
||||||
void LEDOnOff(bool status);
|
int ImageZoomMode;
|
||||||
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
|
int ImageZoomOffsetX;
|
||||||
esp_err_t CaptureToStream(httpd_req_t *req, bool FlashlightOn);
|
int ImageZoomOffsetY;
|
||||||
void SetQualitySize(int qual, framesize_t resol, bool zoomEnabled, int zoomMode, int zoomOffsetX, int zoomOffsetY);
|
int ImageZoomSize;
|
||||||
bool SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation, int _autoExposureLevel, bool _grayscale, bool _negative, bool _aec2, int _sharpnessLevel);
|
|
||||||
void SetZoom(bool zoomEnabled, int zoomMode, int zoomOffsetX, int zoomOffsetY);
|
|
||||||
void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol, bool &zoomEnabled, int &zoomMode, int &zoomOffsetX, int &zoomOffsetY);
|
|
||||||
void SetLEDIntensity(float _intrel);
|
|
||||||
bool testCamera(void);
|
|
||||||
void EnableAutoExposure(int flash_duration);
|
|
||||||
bool getCameraInitSuccessful();
|
|
||||||
void useDemoMode(void);
|
|
||||||
|
|
||||||
|
|
||||||
framesize_t TextToFramesize(const char * text);
|
int WaitBeforePicture;
|
||||||
|
bool isImageSize;
|
||||||
|
|
||||||
esp_err_t CaptureToFile(std::string nm, int delay = 0);
|
bool CameraInitSuccessful;
|
||||||
esp_err_t CaptureToBasisImage(CImageBasis *_Image, int delay = 0);
|
bool changedCameraSettings;
|
||||||
|
bool DemoMode;
|
||||||
|
bool SaveAllFiles;
|
||||||
|
} camera_controll_config_temp_t;
|
||||||
|
|
||||||
|
extern camera_controll_config_temp_t CCstatus;
|
||||||
|
|
||||||
|
class CCamera
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
void ledc_init(void);
|
||||||
|
bool loadNextDemoImage(camera_fb_t *fb);
|
||||||
|
long GetFileSize(std::string filename);
|
||||||
|
void SetCamWindow(sensor_t *s, int resolution, int xOffset, int yOffset, int xTotal, int yTotal, int xOutput, int yOutput);
|
||||||
|
void SetImageWidthHeightFromResolution(framesize_t resol);
|
||||||
|
|
||||||
|
public:
|
||||||
|
CCamera(void);
|
||||||
|
esp_err_t InitCam(void);
|
||||||
|
|
||||||
|
void LightOnOff(bool status);
|
||||||
|
void LEDOnOff(bool status);
|
||||||
|
|
||||||
|
esp_err_t setSensorDatenFromCCstatus(void);
|
||||||
|
esp_err_t getSensorDatenToCCstatus(void);
|
||||||
|
|
||||||
|
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
|
||||||
|
esp_err_t CaptureToStream(httpd_req_t *req, bool FlashlightOn);
|
||||||
|
|
||||||
|
void SetQualityZoomSize(int qual, framesize_t resol, bool zoomEnabled, int zoomOffsetX, int zoomOffsetY, int imageSize);
|
||||||
|
void SetZoomSize(bool zoomEnabled, int zoomOffsetX, int zoomOffsetY, int imageSize);
|
||||||
|
void SetCamSharpness(bool _autoSharpnessEnabled, int _sharpnessLevel);
|
||||||
|
|
||||||
|
void SetLEDIntensity(float _intrel);
|
||||||
|
bool testCamera(void);
|
||||||
|
bool getCameraInitSuccessful(void);
|
||||||
|
void useDemoMode(void);
|
||||||
|
|
||||||
|
framesize_t TextToFramesize(const char *text);
|
||||||
|
|
||||||
|
esp_err_t CaptureToFile(std::string nm, int delay = 0);
|
||||||
|
esp_err_t CaptureToBasisImage(CImageBasis *_Image, int delay = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern CCamera Camera;
|
extern CCamera Camera;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -3,71 +3,78 @@
|
|||||||
#include "ov2640_sharpness.h"
|
#include "ov2640_sharpness.h"
|
||||||
|
|
||||||
|
|
||||||
#define OV2640_MAXLEVEL_SHARPNESS 6
|
|
||||||
|
|
||||||
const static uint8_t OV2640_SHARPNESS_AUTO[]=
|
const static uint8_t OV2640_SHARPNESS_AUTO[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
|
0x92, 0x01, 0xFF,
|
||||||
0x93, 0x20, 0x20,
|
0x93, 0x20, 0x20,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
const static uint8_t OV2640_SHARPNESS_MANUAL[]=
|
const static uint8_t OV2640_SHARPNESS_MANUAL[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
|
0x92, 0x01, 0xFF,
|
||||||
0x93, 0x00, 0x20,
|
0x93, 0x00, 0x20,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL0[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL0[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xc0, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xC0, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL1[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL1[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xc1, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xC1, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL2[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL2[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xc2, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xC2, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL3[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL3[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xc4, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xC4, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL4[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL4[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xc8, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xC8, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL5[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL5[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xd0, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xD0, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
const static uint8_t OV2640_SHARPNESS_LEVEL6[]=
|
const static uint8_t OV2640_SHARPNESS_LEVEL6[]=
|
||||||
{
|
{
|
||||||
0xFF, 0x00, 0xff,
|
//reg, val, mask
|
||||||
0x92, 0x01, 0xff,
|
0xFF, 0x00, 0xFF,
|
||||||
0x93, 0xdf, 0x1f,
|
0x92, 0x01, 0xFF,
|
||||||
|
0x93, 0xDF, 0x1F,
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -82,6 +89,9 @@ const static uint8_t *OV2640_SETTING_SHARPNESS[]=
|
|||||||
OV2640_SHARPNESS_LEVEL6 // +3 sharpness
|
OV2640_SHARPNESS_LEVEL6 // +3 sharpness
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define OV2640_MAXLEVEL_SHARPNESS 6
|
||||||
|
|
||||||
|
|
||||||
static int table_mask_write(sensor_t *sensor, const uint8_t* ptab)
|
static int table_mask_write(sensor_t *sensor, const uint8_t* ptab)
|
||||||
{
|
{
|
||||||
uint8_t address;
|
uint8_t address;
|
||||||
@@ -91,34 +101,52 @@ static int table_mask_write(sensor_t *sensor, const uint8_t* ptab)
|
|||||||
const uint8_t *pdata = ptab;
|
const uint8_t *pdata = ptab;
|
||||||
|
|
||||||
if (pdata == NULL)
|
if (pdata == NULL)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
address = *pdata++;
|
address = *pdata++;
|
||||||
value = *pdata++;
|
value = *pdata++;
|
||||||
mask = *pdata++;
|
mask = *pdata++;
|
||||||
|
|
||||||
if ((address == 0) && (value == 0) && (mask == 0))
|
if ((address == 0) && (value == 0) && (mask == 0))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
sensor->set_reg(sensor, address, mask, value);
|
sensor->set_reg(sensor, address, mask, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ov2640_enable_auto_sharpness(sensor_t *sensor)
|
int ov2640_enable_auto_sharpness(sensor_t *sensor)
|
||||||
{
|
{
|
||||||
table_mask_write(sensor, OV2640_SHARPNESS_AUTO);
|
table_mask_write(sensor, OV2640_SHARPNESS_AUTO);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ov2640_set_sharpness(sensor_t *sensor, int sharpness)
|
int ov2640_set_sharpness(sensor_t *sensor, int sharpness)
|
||||||
{
|
{
|
||||||
if ((sharpness < -3) || (sharpness > OV2640_MAXLEVEL_SHARPNESS - 3))
|
int sharpness_temp = 0;
|
||||||
return -1;
|
|
||||||
|
if (sharpness < -3)
|
||||||
|
{
|
||||||
|
sharpness_temp = -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sharpness > OV2640_MAXLEVEL_SHARPNESS - 3)
|
||||||
|
{
|
||||||
|
sharpness_temp = OV2640_MAXLEVEL_SHARPNESS - 3;
|
||||||
|
}
|
||||||
|
|
||||||
table_mask_write(sensor, OV2640_SHARPNESS_MANUAL);
|
table_mask_write(sensor, OV2640_SHARPNESS_MANUAL);
|
||||||
table_mask_write(sensor, OV2640_SETTING_SHARPNESS[sharpness + 3]);
|
table_mask_write(sensor, OV2640_SETTING_SHARPNESS[sharpness_temp + 3]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "esp_camera.h"
|
#include "esp_camera.h"
|
||||||
#include "ClassControllCamera.h"
|
#include "ClassControllCamera.h"
|
||||||
|
#include "MainFlowControl.h"
|
||||||
|
|
||||||
#include "ClassLogFile.h"
|
#include "ClassLogFile.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
@@ -13,191 +14,183 @@
|
|||||||
|
|
||||||
static const char *TAG = "server_cam";
|
static const char *TAG = "server_cam";
|
||||||
|
|
||||||
|
void PowerResetCamera()
|
||||||
|
{
|
||||||
|
ESP_LOGD(TAG, "Resetting camera by power down line");
|
||||||
|
gpio_config_t conf;
|
||||||
|
conf.intr_type = GPIO_INTR_DISABLE;
|
||||||
|
conf.pin_bit_mask = 1LL << GPIO_NUM_32;
|
||||||
|
conf.mode = GPIO_MODE_OUTPUT;
|
||||||
|
conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
||||||
|
conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
||||||
|
gpio_config(&conf);
|
||||||
|
|
||||||
void PowerResetCamera(){
|
// carefull, logic is inverted compared to reset pin
|
||||||
|
gpio_set_level(GPIO_NUM_32, 1);
|
||||||
ESP_LOGD(TAG, "Resetting camera by power down line");
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
gpio_config_t conf;
|
gpio_set_level(GPIO_NUM_32, 0);
|
||||||
conf.intr_type = GPIO_INTR_DISABLE;
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
conf.pin_bit_mask = 1LL << GPIO_NUM_32;
|
|
||||||
conf.mode = GPIO_MODE_OUTPUT;
|
|
||||||
conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
|
|
||||||
conf.pull_up_en = GPIO_PULLUP_DISABLE;
|
|
||||||
gpio_config(&conf);
|
|
||||||
|
|
||||||
// carefull, logic is inverted compared to reset pin
|
|
||||||
gpio_set_level(GPIO_NUM_32, 1);
|
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
||||||
gpio_set_level(GPIO_NUM_32, 0);
|
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t handler_lightOn(httpd_req_t *req)
|
esp_err_t handler_lightOn(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_lightOn - Start");
|
LogFile.WriteHeapInfo("handler_lightOn - Start");
|
||||||
ESP_LOGD(TAG, "handler_lightOn uri: %s", req->uri);
|
ESP_LOGD(TAG, "handler_lightOn uri: %s", req->uri);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Camera.getCameraInitSuccessful())
|
if (Camera.getCameraInitSuccessful())
|
||||||
{
|
{
|
||||||
Camera.LightOnOff(true);
|
Camera.LightOnOff(true);
|
||||||
const char* resp_str = (const char*) req->user_ctx;
|
const char *resp_str = (const char *)req->user_ctx;
|
||||||
httpd_resp_send(req, resp_str, strlen(resp_str));
|
httpd_resp_send(req, resp_str, strlen(resp_str));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /lighton not available!");
|
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /lighton not available!");
|
||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_lightOn - Done");
|
LogFile.WriteHeapInfo("handler_lightOn - Done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t handler_lightOff(httpd_req_t *req)
|
esp_err_t handler_lightOff(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_lightOff - Start");
|
LogFile.WriteHeapInfo("handler_lightOff - Start");
|
||||||
ESP_LOGD(TAG, "handler_lightOff uri: %s", req->uri);
|
ESP_LOGD(TAG, "handler_lightOff uri: %s", req->uri);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Camera.getCameraInitSuccessful())
|
if (Camera.getCameraInitSuccessful())
|
||||||
{
|
{
|
||||||
Camera.LightOnOff(false);
|
Camera.LightOnOff(false);
|
||||||
const char* resp_str = (const char*) req->user_ctx;
|
const char *resp_str = (const char *)req->user_ctx;
|
||||||
httpd_resp_send(req, resp_str, strlen(resp_str));
|
httpd_resp_send(req, resp_str, strlen(resp_str));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /lightoff not available!");
|
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /lightoff not available!");
|
||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_lightOff - Done");
|
LogFile.WriteHeapInfo("handler_lightOff - Done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t handler_capture(httpd_req_t *req)
|
esp_err_t handler_capture(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture - Start");
|
LogFile.WriteHeapInfo("handler_capture - Start");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Camera.getCameraInitSuccessful())
|
if (Camera.getCameraInitSuccessful())
|
||||||
{
|
{
|
||||||
int quality;
|
#ifdef DEBUG_DETAIL_ON
|
||||||
framesize_t res;
|
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
||||||
bool zoomEnabled;
|
#endif
|
||||||
int zoomMode;
|
|
||||||
int zoomOffsetX;
|
|
||||||
int zoomOffsetY;
|
|
||||||
|
|
||||||
Camera.GetCameraParameter(req, quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
// wenn die Kameraeinstellungen durch Erstellen eines neuen Referenzbildes verändert wurden, müssen sie neu gesetzt werden
|
||||||
|
if (CFstatus.changedCameraSettings)
|
||||||
#ifdef DEBUG_DETAIL_ON
|
{
|
||||||
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
Camera.setSensorDatenFromCCstatus(); // CCstatus >>> Kamera
|
||||||
#endif
|
Camera.SetQualityZoomSize(CCstatus.ImageQuality, CCstatus.ImageFrameSize, CCstatus.ImageZoomEnabled, CCstatus.ImageZoomOffsetX, CCstatus.ImageZoomOffsetY, CCstatus.ImageZoomSize);
|
||||||
|
CFstatus.changedCameraSettings = false;
|
||||||
Camera.SetQualitySize(quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
}
|
||||||
|
|
||||||
esp_err_t result;
|
esp_err_t result;
|
||||||
result = Camera.CaptureToHTTP(req);
|
result = Camera.CaptureToHTTP(req);
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture - Done");
|
LogFile.WriteHeapInfo("handler_capture - Done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /capture not available!");
|
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /capture not available!");
|
||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t handler_capture_with_light(httpd_req_t *req)
|
esp_err_t handler_capture_with_light(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture_with_light - Start");
|
LogFile.WriteHeapInfo("handler_capture_with_light - Start");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Camera.getCameraInitSuccessful())
|
if (Camera.getCameraInitSuccessful())
|
||||||
{
|
{
|
||||||
char _query[100];
|
char _query[100];
|
||||||
char _delay[10];
|
char _delay[10];
|
||||||
|
|
||||||
int quality;
|
|
||||||
framesize_t res;
|
|
||||||
bool zoomEnabled;
|
|
||||||
int zoomMode;
|
|
||||||
int zoomOffsetX;
|
|
||||||
int zoomOffsetY;
|
|
||||||
int delay = 2500;
|
int delay = 2500;
|
||||||
|
|
||||||
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "Query: %s", _query);
|
ESP_LOGD(TAG, "Query: %s", _query);
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
|
if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
ESP_LOGD(TAG, "Delay: %s", _delay);
|
ESP_LOGD(TAG, "Delay: %s", _delay);
|
||||||
#endif
|
#endif
|
||||||
delay = atoi(_delay);
|
delay = atoi(_delay);
|
||||||
|
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
|
{
|
||||||
delay = 0;
|
delay = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Camera.GetCameraParameter(req, quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
#ifdef DEBUG_DETAIL_ON
|
||||||
|
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
// wenn die Kameraeinstellungen durch Erstellen eines neuen Referenzbildes verändert wurden, müssen sie neu gesetzt werden
|
||||||
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
if (CFstatus.changedCameraSettings)
|
||||||
#endif
|
{
|
||||||
|
Camera.setSensorDatenFromCCstatus(); // CCstatus >>> Kamera
|
||||||
|
Camera.SetQualityZoomSize(CCstatus.ImageQuality, CCstatus.ImageFrameSize, CCstatus.ImageZoomEnabled, CCstatus.ImageZoomOffsetX, CCstatus.ImageZoomOffsetY, CCstatus.ImageZoomSize);
|
||||||
|
CFstatus.changedCameraSettings = false;
|
||||||
|
}
|
||||||
|
|
||||||
Camera.SetQualitySize(quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
|
||||||
Camera.LightOnOff(true);
|
Camera.LightOnOff(true);
|
||||||
const TickType_t xDelay = delay / portTICK_PERIOD_MS;
|
const TickType_t xDelay = delay / portTICK_PERIOD_MS;
|
||||||
vTaskDelay( xDelay );
|
vTaskDelay(xDelay);
|
||||||
|
|
||||||
esp_err_t result;
|
esp_err_t result;
|
||||||
result = Camera.CaptureToHTTP(req);
|
result = Camera.CaptureToHTTP(req);
|
||||||
|
|
||||||
Camera.LightOnOff(false);
|
Camera.LightOnOff(false);
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture_with_light - Done");
|
LogFile.WriteHeapInfo("handler_capture_with_light - Done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /capture_with_flashlight not available!");
|
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /capture_with_flashlight not available!");
|
||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t handler_capture_save_to_file(httpd_req_t *req)
|
esp_err_t handler_capture_save_to_file(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture_save_to_file - Start");
|
LogFile.WriteHeapInfo("handler_capture_save_to_file - Start");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Camera.getCameraInitSuccessful())
|
if (Camera.getCameraInitSuccessful())
|
||||||
{
|
{
|
||||||
char _query[100];
|
char _query[100];
|
||||||
char _delay[10];
|
char _delay[10];
|
||||||
@@ -205,98 +198,102 @@ esp_err_t handler_capture_save_to_file(httpd_req_t *req)
|
|||||||
char filename[100];
|
char filename[100];
|
||||||
std::string fn = "/sdcard/";
|
std::string fn = "/sdcard/";
|
||||||
|
|
||||||
|
|
||||||
int quality;
|
|
||||||
framesize_t res;
|
|
||||||
bool zoomEnabled;
|
|
||||||
int zoomMode;
|
|
||||||
int zoomOffsetX;
|
|
||||||
int zoomOffsetY;
|
|
||||||
|
|
||||||
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
if (httpd_req_get_url_query_str(req, _query, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "Query: %s", _query);
|
ESP_LOGD(TAG, "Query: %s", _query);
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "filename", filename, 100) == ESP_OK)
|
if (httpd_query_key_value(_query, "filename", filename, 100) == ESP_OK)
|
||||||
{
|
{
|
||||||
fn.append(filename);
|
fn.append(filename);
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
ESP_LOGD(TAG, "Filename: %s", fn.c_str());
|
ESP_LOGD(TAG, "Filename: %s", fn.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fn.append("noname.jpg");
|
fn.append("noname.jpg");
|
||||||
|
}
|
||||||
|
|
||||||
if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
|
if (httpd_query_key_value(_query, "delay", _delay, 10) == ESP_OK)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
ESP_LOGD(TAG, "Delay: %s", _delay);
|
ESP_LOGD(TAG, "Delay: %s", _delay);
|
||||||
#endif
|
#endif
|
||||||
delay = atoi(_delay);
|
delay = atoi(_delay);
|
||||||
|
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
|
{
|
||||||
delay = 0;
|
delay = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fn.append("noname.jpg");
|
fn.append("noname.jpg");
|
||||||
|
}
|
||||||
|
|
||||||
Camera.GetCameraParameter(req, quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
#ifdef DEBUG_DETAIL_ON
|
||||||
#ifdef DEBUG_DETAIL_ON
|
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
||||||
ESP_LOGD(TAG, "Size: %d, Quality: %d", res, quality);
|
#endif
|
||||||
#endif
|
|
||||||
Camera.SetQualitySize(quality, res, zoomEnabled, zoomMode, zoomOffsetX, zoomOffsetY);
|
// wenn die Kameraeinstellungen durch Erstellen eines neuen Referenzbildes verändert wurden, müssen sie neu gesetzt werden
|
||||||
|
if (CFstatus.changedCameraSettings)
|
||||||
|
{
|
||||||
|
Camera.setSensorDatenFromCCstatus(); // CCstatus >>> Kamera
|
||||||
|
Camera.SetQualityZoomSize(CCstatus.ImageQuality, CCstatus.ImageFrameSize, CCstatus.ImageZoomEnabled, CCstatus.ImageZoomOffsetX, CCstatus.ImageZoomOffsetY, CCstatus.ImageZoomSize);
|
||||||
|
CFstatus.changedCameraSettings = false;
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t result;
|
esp_err_t result;
|
||||||
result = Camera.CaptureToFile(fn, delay);
|
result = Camera.CaptureToFile(fn, delay);
|
||||||
|
|
||||||
const char* resp_str = (const char*) fn.c_str();
|
const char *resp_str = (const char *)fn.c_str();
|
||||||
httpd_resp_send(req, resp_str, strlen(resp_str));
|
httpd_resp_send(req, resp_str, strlen(resp_str));
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("handler_capture_save_to_file - Done");
|
LogFile.WriteHeapInfo("handler_capture_save_to_file - Done");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /save not available!");
|
httpd_resp_send_err(req, HTTPD_403_FORBIDDEN, "Camera not initialized: REST API /save not available!");
|
||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void register_server_camera_uri(httpd_handle_t server)
|
void register_server_camera_uri(httpd_handle_t server)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
ESP_LOGI(TAG, "server_part_camera - Registering URI handlers");
|
ESP_LOGI(TAG, "server_part_camera - Registering URI handlers");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
httpd_uri_t camuri = { };
|
httpd_uri_t camuri = {};
|
||||||
camuri.method = HTTP_GET;
|
camuri.method = HTTP_GET;
|
||||||
|
|
||||||
camuri.uri = "/lighton";
|
camuri.uri = "/lighton";
|
||||||
camuri.handler = handler_lightOn;
|
camuri.handler = handler_lightOn;
|
||||||
camuri.user_ctx = (void*) "Light On";
|
camuri.user_ctx = (void *)"Light On";
|
||||||
httpd_register_uri_handler(server, &camuri);
|
httpd_register_uri_handler(server, &camuri);
|
||||||
|
|
||||||
camuri.uri = "/lightoff";
|
camuri.uri = "/lightoff";
|
||||||
camuri.handler = handler_lightOff;
|
camuri.handler = handler_lightOff;
|
||||||
camuri.user_ctx = (void*) "Light Off";
|
camuri.user_ctx = (void *)"Light Off";
|
||||||
httpd_register_uri_handler(server, &camuri);
|
httpd_register_uri_handler(server, &camuri);
|
||||||
|
|
||||||
camuri.uri = "/capture";
|
camuri.uri = "/capture";
|
||||||
camuri.handler = handler_capture;
|
camuri.handler = handler_capture;
|
||||||
camuri.user_ctx = NULL;
|
camuri.user_ctx = NULL;
|
||||||
httpd_register_uri_handler(server, &camuri);
|
httpd_register_uri_handler(server, &camuri);
|
||||||
|
|
||||||
camuri.uri = "/capture_with_flashlight";
|
camuri.uri = "/capture_with_flashlight";
|
||||||
camuri.handler = handler_capture_with_light;
|
camuri.handler = handler_capture_with_light;
|
||||||
camuri.user_ctx = NULL;
|
camuri.user_ctx = NULL;
|
||||||
httpd_register_uri_handler(server, &camuri);
|
httpd_register_uri_handler(server, &camuri);
|
||||||
|
|
||||||
camuri.uri = "/save";
|
camuri.uri = "/save";
|
||||||
camuri.handler = handler_capture_save_to_file;
|
camuri.handler = handler_capture_save_to_file;
|
||||||
camuri.user_ctx = NULL;
|
camuri.user_ctx = NULL;
|
||||||
httpd_register_uri_handler(server, &camuri);
|
httpd_register_uri_handler(server, &camuri);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
//#include "ClassControllCamera.h"
|
//#include "ClassControllCamera.h"
|
||||||
|
|
||||||
void register_server_camera_uri(httpd_handle_t server);
|
void register_server_camera_uri(httpd_handle_t server);
|
||||||
|
|
||||||
void PowerResetCamera();
|
void PowerResetCamera();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,393 +1,402 @@
|
|||||||
#include "ClassFlowAlignment.h"
|
#include "ClassFlowAlignment.h"
|
||||||
#include "ClassFlowTakeImage.h"
|
#include "ClassFlowTakeImage.h"
|
||||||
#include "ClassFlow.h"
|
#include "ClassFlow.h"
|
||||||
#include "MainFlowControl.h"
|
#include "MainFlowControl.h"
|
||||||
|
|
||||||
#include "CRotateImage.h"
|
#include "CRotateImage.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
|
||||||
|
#include "ClassLogFile.h"
|
||||||
#include "ClassLogFile.h"
|
#include "psram.h"
|
||||||
#include "psram.h"
|
#include "../../include/defines.h"
|
||||||
#include "../../include/defines.h"
|
|
||||||
|
static const char *TAG = "ALIGN";
|
||||||
|
|
||||||
static const char *TAG = "ALIGN";
|
// #define DEBUG_DETAIL_ON
|
||||||
|
|
||||||
// #define DEBUG_DETAIL_ON
|
void ClassFlowAlignment::SetInitialParameter(void)
|
||||||
|
{
|
||||||
|
initialrotate = 0;
|
||||||
void ClassFlowAlignment::SetInitialParameter(void)
|
anz_ref = 0;
|
||||||
{
|
use_antialiasing = false;
|
||||||
initialrotate = 0;
|
initialflip = false;
|
||||||
anz_ref = 0;
|
SaveAllFiles = false;
|
||||||
initialmirror = false;
|
namerawimage = "/sdcard/img_tmp/raw.jpg";
|
||||||
use_antialiasing = false;
|
FileStoreRefAlignment = "/sdcard/config/align.txt";
|
||||||
initialflip = false;
|
ListFlowControll = NULL;
|
||||||
SaveAllFiles = false;
|
AlignAndCutImage = NULL;
|
||||||
namerawimage = "/sdcard/img_tmp/raw.jpg";
|
ImageBasis = NULL;
|
||||||
FileStoreRefAlignment = "/sdcard/config/align.txt";
|
ImageTMP = NULL;
|
||||||
ListFlowControll = NULL;
|
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
||||||
AlignAndCutImage = NULL;
|
AlgROI = (ImageData *)malloc_psram_heap(std::string(TAG) + "->AlgROI", sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
||||||
ImageBasis = NULL;
|
#endif
|
||||||
ImageTMP = NULL;
|
previousElement = NULL;
|
||||||
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
disabled = false;
|
||||||
AlgROI = (ImageData*)malloc_psram_heap(std::string(TAG) + "->AlgROI", sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
SAD_criteria = 0.05;
|
||||||
#endif
|
}
|
||||||
previousElement = NULL;
|
|
||||||
disabled = false;
|
ClassFlowAlignment::ClassFlowAlignment(std::vector<ClassFlow *> *lfc)
|
||||||
SAD_criteria = 0.05;
|
{
|
||||||
}
|
SetInitialParameter();
|
||||||
|
ListFlowControll = lfc;
|
||||||
|
|
||||||
ClassFlowAlignment::ClassFlowAlignment(std::vector<ClassFlow*>* lfc)
|
for (int i = 0; i < ListFlowControll->size(); ++i)
|
||||||
{
|
{
|
||||||
SetInitialParameter();
|
if (((*ListFlowControll)[i])->name().compare("ClassFlowTakeImage") == 0)
|
||||||
ListFlowControll = lfc;
|
{
|
||||||
|
ImageBasis = ((ClassFlowTakeImage *)(*ListFlowControll)[i])->rawImage;
|
||||||
for (int i = 0; i < ListFlowControll->size(); ++i)
|
}
|
||||||
{
|
}
|
||||||
if (((*ListFlowControll)[i])->name().compare("ClassFlowTakeImage") == 0)
|
|
||||||
{
|
if (!ImageBasis) // the function take pictures does not exist --> must be created first ONLY FOR TEST PURPOSES
|
||||||
ImageBasis = ((ClassFlowTakeImage*) (*ListFlowControll)[i])->rawImage;
|
{
|
||||||
}
|
ESP_LOGD(TAG, "CImageBasis had to be created");
|
||||||
}
|
ImageBasis = new CImageBasis("ImageBasis", namerawimage);
|
||||||
|
}
|
||||||
if (!ImageBasis) // the function take pictures does not exist --> must be created first ONLY FOR TEST PURPOSES
|
}
|
||||||
{
|
|
||||||
ESP_LOGD(TAG, "CImageBasis had to be created");
|
bool ClassFlowAlignment::ReadParameter(FILE *pfile, string &aktparamgraph)
|
||||||
ImageBasis = new CImageBasis("ImageBasis", namerawimage);
|
{
|
||||||
}
|
std::vector<string> splitted;
|
||||||
}
|
int suchex = 40;
|
||||||
|
int suchey = 40;
|
||||||
|
int alg_algo = 0; // default=0; 1 =HIGHACCURACY; 2= FAST; 3= OFF //add disable aligment algo |01.2023
|
||||||
bool ClassFlowAlignment::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|
||||||
{
|
aktparamgraph = trim(aktparamgraph);
|
||||||
std::vector<string> splitted;
|
|
||||||
int suchex = 40;
|
if (aktparamgraph.size() == 0)
|
||||||
int suchey = 40;
|
{
|
||||||
int alg_algo = 0; //default=0; 1 =HIGHACCURACY; 2= FAST; 3= OFF //add disable aligment algo |01.2023
|
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
aktparamgraph = trim(aktparamgraph);
|
}
|
||||||
|
}
|
||||||
if (aktparamgraph.size() == 0)
|
|
||||||
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
if (aktparamgraph.compare("[Alignment]") != 0)
|
||||||
return false;
|
{
|
||||||
|
// Paragraph does not fit Alignment
|
||||||
if (aktparamgraph.compare("[Alignment]") != 0) //Paragraph does not fit Alignment
|
return false;
|
||||||
return false;
|
}
|
||||||
|
|
||||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
||||||
{
|
{
|
||||||
splitted = ZerlegeZeile(aktparamgraph);
|
splitted = ZerlegeZeile(aktparamgraph);
|
||||||
if ((toUpper(splitted[0]) == "FLIPIMAGESIZE") && (splitted.size() > 1))
|
|
||||||
{
|
if ((toUpper(splitted[0]) == "FLIPIMAGESIZE") && (splitted.size() > 1))
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
{
|
||||||
initialflip = true;
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
}
|
{
|
||||||
if ((toUpper(splitted[0]) == "INITIALMIRROR") && (splitted.size() > 1))
|
initialflip = true;
|
||||||
{
|
}
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
}
|
||||||
initialmirror = true;
|
else if (((toUpper(splitted[0]) == "initialrotate") || (toUpper(splitted[0]) == "INITIALROTATE")) && (splitted.size() > 1))
|
||||||
}
|
{
|
||||||
if (((toUpper(splitted[0]) == "initialrotate") || (toUpper(splitted[0]) == "INITIALROTATE")) && (splitted.size() > 1))
|
this->initialrotate = std::stod(splitted[1]);
|
||||||
{
|
}
|
||||||
this->initialrotate = std::stod(splitted[1]);
|
else if ((toUpper(splitted[0]) == "SEARCHFIELDX") && (splitted.size() > 1))
|
||||||
}
|
{
|
||||||
if ((toUpper(splitted[0]) == "SEARCHFIELDX") && (splitted.size() > 1))
|
suchex = std::stod(splitted[1]);
|
||||||
{
|
}
|
||||||
suchex = std::stod(splitted[1]);
|
else if ((toUpper(splitted[0]) == "SEARCHFIELDY") && (splitted.size() > 1))
|
||||||
}
|
{
|
||||||
if ((toUpper(splitted[0]) == "SEARCHFIELDY") && (splitted.size() > 1))
|
suchey = std::stod(splitted[1]);
|
||||||
{
|
}
|
||||||
suchey = std::stod(splitted[1]);
|
else if ((toUpper(splitted[0]) == "ANTIALIASING") && (splitted.size() > 1))
|
||||||
}
|
{
|
||||||
if ((toUpper(splitted[0]) == "ANTIALIASING") && (splitted.size() > 1))
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
{
|
{
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
use_antialiasing = true;
|
||||||
use_antialiasing = true;
|
}
|
||||||
}
|
}
|
||||||
if ((splitted.size() == 3) && (anz_ref < 2))
|
else if ((splitted.size() == 3) && (anz_ref < 2))
|
||||||
{
|
{
|
||||||
References[anz_ref].image_file = FormatFileName("/sdcard" + splitted[0]);
|
References[anz_ref].image_file = FormatFileName("/sdcard" + splitted[0]);
|
||||||
References[anz_ref].target_x = std::stod(splitted[1]);
|
References[anz_ref].target_x = std::stod(splitted[1]);
|
||||||
References[anz_ref].target_y = std::stod(splitted[2]);
|
References[anz_ref].target_y = std::stod(splitted[2]);
|
||||||
anz_ref++;
|
anz_ref++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1))
|
else if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1))
|
||||||
{
|
{
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
SaveAllFiles = true;
|
{
|
||||||
}
|
SaveAllFiles = true;
|
||||||
if ((toUpper(splitted[0]) == "ALIGNMENTALGO") && (splitted.size() > 1))
|
}
|
||||||
{
|
}
|
||||||
#ifdef DEBUG_DETAIL_ON
|
else if ((toUpper(splitted[0]) == "ALIGNMENTALGO") && (splitted.size() > 1))
|
||||||
std::string zw2 = "Alignment mode selected: " + splitted[1];
|
{
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
|
#ifdef DEBUG_DETAIL_ON
|
||||||
#endif
|
std::string zw2 = "Alignment mode selected: " + splitted[1];
|
||||||
if (toUpper(splitted[1]) == "HIGHACCURACY")
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
|
||||||
alg_algo = 1;
|
#endif
|
||||||
if (toUpper(splitted[1]) == "FAST")
|
if (toUpper(splitted[1]) == "HIGHACCURACY")
|
||||||
alg_algo = 2;
|
{
|
||||||
if (toUpper(splitted[1]) == "OFF") //no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
alg_algo = 1;
|
||||||
alg_algo = 3;
|
}
|
||||||
}
|
if (toUpper(splitted[1]) == "FAST")
|
||||||
}
|
{
|
||||||
|
alg_algo = 2;
|
||||||
for (int i = 0; i < anz_ref; ++i)
|
}
|
||||||
{
|
if (toUpper(splitted[1]) == "OFF")
|
||||||
References[i].search_x = suchex;
|
{
|
||||||
References[i].search_y = suchey;
|
// no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
||||||
References[i].fastalg_SAD_criteria = SAD_criteria;
|
alg_algo = 3;
|
||||||
References[i].alignment_algo = alg_algo;
|
}
|
||||||
#ifdef DEBUG_DETAIL_ON
|
}
|
||||||
std::string zw2 = "Alignment mode written: " + std::to_string(alg_algo);
|
}
|
||||||
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
|
|
||||||
#endif
|
for (int i = 0; i < anz_ref; ++i)
|
||||||
}
|
{
|
||||||
|
References[i].search_x = suchex;
|
||||||
//no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
References[i].search_y = suchey;
|
||||||
if(References[0].alignment_algo != 3){
|
References[i].fastalg_SAD_criteria = SAD_criteria;
|
||||||
LoadReferenceAlignmentValues();
|
References[i].alignment_algo = alg_algo;
|
||||||
}
|
#ifdef DEBUG_DETAIL_ON
|
||||||
|
std::string zw2 = "Alignment mode written: " + std::to_string(alg_algo);
|
||||||
return true;
|
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, zw2);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
||||||
string ClassFlowAlignment::getHTMLSingleStep(string host)
|
if (References[0].alignment_algo != 3)
|
||||||
{
|
{
|
||||||
string result;
|
LoadReferenceAlignmentValues();
|
||||||
|
}
|
||||||
result = "<p>Rotated Image: </p> <p><img src=\"" + host + "/img_tmp/rot.jpg\"></p>\n";
|
|
||||||
result = result + "<p>Found Alignment: </p> <p><img src=\"" + host + "/img_tmp/rot_roi.jpg\"></p>\n";
|
return true;
|
||||||
result = result + "<p>Aligned Image: </p> <p><img src=\"" + host + "/img_tmp/alg.jpg\"></p>\n";
|
}
|
||||||
return result;
|
|
||||||
}
|
string ClassFlowAlignment::getHTMLSingleStep(string host)
|
||||||
|
{
|
||||||
|
string result;
|
||||||
bool ClassFlowAlignment::doFlow(string time)
|
|
||||||
{
|
result = "<p>Rotated Image: </p> <p><img src=\"" + host + "/img_tmp/rot.jpg\"></p>\n";
|
||||||
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
result = result + "<p>Found Alignment: </p> <p><img src=\"" + host + "/img_tmp/rot_roi.jpg\"></p>\n";
|
||||||
if (!AlgROI) // AlgROI needs to be allocated before ImageTMP to avoid heap fragmentation
|
result = result + "<p>Aligned Image: </p> <p><img src=\"" + host + "/img_tmp/alg.jpg\"></p>\n";
|
||||||
{
|
return result;
|
||||||
AlgROI = (ImageData*)heap_caps_realloc(AlgROI, sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
}
|
||||||
if (!AlgROI)
|
|
||||||
{
|
bool ClassFlowAlignment::doFlow(string time)
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlgROI");
|
{
|
||||||
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
||||||
}
|
if (!AlgROI) // AlgROI needs to be allocated before ImageTMP to avoid heap fragmentation
|
||||||
}
|
{
|
||||||
|
AlgROI = (ImageData *)heap_caps_realloc(AlgROI, sizeof(ImageData), MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
||||||
if (AlgROI)
|
|
||||||
{
|
if (!AlgROI)
|
||||||
ImageBasis->writeToMemoryAsJPG((ImageData*)AlgROI, 90);
|
{
|
||||||
}
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlgROI");
|
||||||
#endif
|
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
||||||
|
}
|
||||||
if (!ImageTMP)
|
}
|
||||||
{
|
|
||||||
ImageTMP = new CImageBasis("tmpImage", ImageBasis); // Make sure the name does not get change, it is relevant for the PSRAM allocation!
|
if (AlgROI)
|
||||||
if (!ImageTMP)
|
{
|
||||||
{
|
ImageBasis->writeToMemoryAsJPG((ImageData *)AlgROI, 90);
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate tmpImage -> Exec this round aborted!");
|
}
|
||||||
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
#endif
|
||||||
return false;
|
|
||||||
}
|
if (!ImageTMP)
|
||||||
}
|
{
|
||||||
|
ImageTMP = new CImageBasis("tmpImage", ImageBasis); // Make sure the name does not get change, it is relevant for the PSRAM allocation!
|
||||||
delete AlignAndCutImage;
|
|
||||||
AlignAndCutImage = new CAlignAndCutImage("AlignAndCutImage", ImageBasis, ImageTMP);
|
if (!ImageTMP)
|
||||||
if (!AlignAndCutImage)
|
{
|
||||||
{
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate tmpImage -> Exec this round aborted!");
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlignAndCutImage -> Exec this round aborted!");
|
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
||||||
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CRotateImage rt("rawImage", AlignAndCutImage, ImageTMP, initialflip);
|
delete AlignAndCutImage;
|
||||||
if (initialflip)
|
AlignAndCutImage = new CAlignAndCutImage("AlignAndCutImage", ImageBasis, ImageTMP);
|
||||||
{
|
|
||||||
int _zw = ImageBasis->height;
|
if (!AlignAndCutImage)
|
||||||
ImageBasis->height = ImageBasis->width;
|
{
|
||||||
ImageBasis->width = _zw;
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Can't allocate AlignAndCutImage -> Exec this round aborted!");
|
||||||
|
LogFile.WriteHeapInfo("ClassFlowAlignment-doFlow");
|
||||||
_zw = ImageTMP->width;
|
return false;
|
||||||
ImageTMP->width = ImageTMP->height;
|
}
|
||||||
ImageTMP->height = _zw;
|
|
||||||
}
|
CRotateImage rt("rawImage", AlignAndCutImage, ImageTMP, initialflip);
|
||||||
|
|
||||||
if (initialmirror)
|
if (initialflip)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "do mirror");
|
int _zw = ImageBasis->height;
|
||||||
rt.Mirror();
|
ImageBasis->height = ImageBasis->width;
|
||||||
|
ImageBasis->width = _zw;
|
||||||
if (SaveAllFiles)
|
|
||||||
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/mirror.jpg"));
|
_zw = ImageTMP->width;
|
||||||
}
|
ImageTMP->width = ImageTMP->height;
|
||||||
|
ImageTMP->height = _zw;
|
||||||
if ((initialrotate != 0) || initialflip)
|
}
|
||||||
{
|
|
||||||
if (use_antialiasing)
|
if ((initialrotate != 0) || initialflip)
|
||||||
rt.RotateAntiAliasing(initialrotate);
|
{
|
||||||
else
|
if (use_antialiasing)
|
||||||
rt.Rotate(initialrotate);
|
{
|
||||||
|
rt.RotateAntiAliasing(initialrotate);
|
||||||
if (SaveAllFiles)
|
}
|
||||||
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/rot.jpg"));
|
else
|
||||||
}
|
{
|
||||||
|
rt.Rotate(initialrotate);
|
||||||
|
}
|
||||||
//no align algo if set to 3 = off //add disable aligment algo |01.2023
|
|
||||||
if(References[0].alignment_algo != 3){
|
if (SaveAllFiles)
|
||||||
if (!AlignAndCutImage->Align(&References[0], &References[1]))
|
{
|
||||||
{
|
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/rot.jpg"));
|
||||||
SaveReferenceAlignmentValues();
|
}
|
||||||
}
|
}
|
||||||
}// no align
|
|
||||||
|
// no align algo if set to 3 = off //add disable aligment algo |01.2023
|
||||||
|
if (References[0].alignment_algo != 3)
|
||||||
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
{
|
||||||
if (AlgROI) {
|
if (!AlignAndCutImage->Align(&References[0], &References[1]))
|
||||||
//no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
{
|
||||||
if(References[0].alignment_algo != 3){
|
SaveReferenceAlignmentValues();
|
||||||
DrawRef(ImageTMP);
|
}
|
||||||
}
|
} // no align
|
||||||
flowctrl.DigitalDrawROI(ImageTMP);
|
|
||||||
flowctrl.AnalogDrawROI(ImageTMP);
|
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
||||||
ImageTMP->writeToMemoryAsJPG((ImageData*)AlgROI, 90);
|
if (AlgROI)
|
||||||
}
|
{
|
||||||
#endif
|
// no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
||||||
|
if (References[0].alignment_algo != 3)
|
||||||
if (SaveAllFiles)
|
{
|
||||||
{
|
DrawRef(ImageTMP);
|
||||||
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/alg.jpg"));
|
}
|
||||||
ImageTMP->SaveToFile(FormatFileName("/sdcard/img_tmp/alg_roi.jpg"));
|
|
||||||
}
|
flowctrl.DigitalDrawROI(ImageTMP);
|
||||||
|
flowctrl.AnalogDrawROI(ImageTMP);
|
||||||
// must be deleted to have memory space for loading tflite
|
ImageTMP->writeToMemoryAsJPG((ImageData *)AlgROI, 90);
|
||||||
delete ImageTMP;
|
}
|
||||||
ImageTMP = NULL;
|
#endif
|
||||||
|
|
||||||
//no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
if (SaveAllFiles)
|
||||||
if(References[0].alignment_algo != 3){
|
{
|
||||||
LoadReferenceAlignmentValues();
|
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/alg.jpg"));
|
||||||
}
|
ImageTMP->SaveToFile(FormatFileName("/sdcard/img_tmp/alg_roi.jpg"));
|
||||||
|
}
|
||||||
return true;
|
|
||||||
}
|
// must be deleted to have memory space for loading tflite
|
||||||
|
delete ImageTMP;
|
||||||
|
ImageTMP = NULL;
|
||||||
void ClassFlowAlignment::SaveReferenceAlignmentValues()
|
|
||||||
{
|
// no align algo if set to 3 = off => no draw ref //add disable aligment algo |01.2023
|
||||||
FILE* pFile;
|
if (References[0].alignment_algo != 3)
|
||||||
std::string zwtime, zwvalue;
|
{
|
||||||
|
LoadReferenceAlignmentValues();
|
||||||
pFile = fopen(FileStoreRefAlignment.c_str(), "w");
|
}
|
||||||
|
|
||||||
if (strlen(zwtime.c_str()) == 0)
|
return true;
|
||||||
{
|
}
|
||||||
time_t rawtime;
|
|
||||||
struct tm* timeinfo;
|
void ClassFlowAlignment::SaveReferenceAlignmentValues()
|
||||||
char buffer[80];
|
{
|
||||||
|
FILE *pFile;
|
||||||
time(&rawtime);
|
std::string zwtime, zwvalue;
|
||||||
timeinfo = localtime(&rawtime);
|
|
||||||
|
pFile = fopen(FileStoreRefAlignment.c_str(), "w");
|
||||||
strftime(buffer, 80, "%Y-%m-%dT%H:%M:%S", timeinfo);
|
|
||||||
zwtime = std::string(buffer);
|
if (strlen(zwtime.c_str()) == 0)
|
||||||
}
|
{
|
||||||
|
time_t rawtime;
|
||||||
fputs(zwtime.c_str(), pFile);
|
struct tm *timeinfo;
|
||||||
fputs("\n", pFile);
|
char buffer[80];
|
||||||
|
|
||||||
zwvalue = std::to_string(References[0].fastalg_x) + "\t" + std::to_string(References[0].fastalg_y);
|
time(&rawtime);
|
||||||
zwvalue = zwvalue + "\t" +std::to_string(References[0].fastalg_SAD)+ "\t" +std::to_string(References[0].fastalg_min);
|
timeinfo = localtime(&rawtime);
|
||||||
zwvalue = zwvalue + "\t" +std::to_string(References[0].fastalg_max)+ "\t" +std::to_string(References[0].fastalg_avg);
|
|
||||||
fputs(zwvalue.c_str(), pFile);
|
strftime(buffer, 80, "%Y-%m-%dT%H:%M:%S", timeinfo);
|
||||||
fputs("\n", pFile);
|
zwtime = std::string(buffer);
|
||||||
|
}
|
||||||
zwvalue = std::to_string(References[1].fastalg_x) + "\t" + std::to_string(References[1].fastalg_y);
|
|
||||||
zwvalue = zwvalue + "\t" +std::to_string(References[1].fastalg_SAD)+ "\t" +std::to_string(References[1].fastalg_min);
|
fputs(zwtime.c_str(), pFile);
|
||||||
zwvalue = zwvalue + "\t" +std::to_string(References[1].fastalg_max)+ "\t" +std::to_string(References[1].fastalg_avg);
|
fputs("\n", pFile);
|
||||||
fputs(zwvalue.c_str(), pFile);
|
|
||||||
fputs("\n", pFile);
|
zwvalue = std::to_string(References[0].fastalg_x) + "\t" + std::to_string(References[0].fastalg_y);
|
||||||
|
zwvalue = zwvalue + "\t" + std::to_string(References[0].fastalg_SAD) + "\t" + std::to_string(References[0].fastalg_min);
|
||||||
fclose(pFile);
|
zwvalue = zwvalue + "\t" + std::to_string(References[0].fastalg_max) + "\t" + std::to_string(References[0].fastalg_avg);
|
||||||
}
|
fputs(zwvalue.c_str(), pFile);
|
||||||
|
fputs("\n", pFile);
|
||||||
|
|
||||||
bool ClassFlowAlignment::LoadReferenceAlignmentValues(void)
|
zwvalue = std::to_string(References[1].fastalg_x) + "\t" + std::to_string(References[1].fastalg_y);
|
||||||
{
|
zwvalue = zwvalue + "\t" + std::to_string(References[1].fastalg_SAD) + "\t" + std::to_string(References[1].fastalg_min);
|
||||||
FILE* pFile;
|
zwvalue = zwvalue + "\t" + std::to_string(References[1].fastalg_max) + "\t" + std::to_string(References[1].fastalg_avg);
|
||||||
char zw[1024];
|
fputs(zwvalue.c_str(), pFile);
|
||||||
string zwvalue;
|
fputs("\n", pFile);
|
||||||
std::vector<string> splitted;
|
|
||||||
|
fclose(pFile);
|
||||||
|
}
|
||||||
pFile = fopen(FileStoreRefAlignment.c_str(), "r");
|
|
||||||
if (pFile == NULL)
|
bool ClassFlowAlignment::LoadReferenceAlignmentValues(void)
|
||||||
return false;
|
{
|
||||||
|
FILE *pFile;
|
||||||
fgets(zw, 1024, pFile);
|
char zw[1024];
|
||||||
ESP_LOGD(TAG, "%s", zw);
|
string zwvalue;
|
||||||
|
std::vector<string> splitted;
|
||||||
fgets(zw, 1024, pFile);
|
|
||||||
splitted = ZerlegeZeile(std::string(zw), " \t");
|
pFile = fopen(FileStoreRefAlignment.c_str(), "r");
|
||||||
if (splitted.size() < 6)
|
|
||||||
{
|
if (pFile == NULL)
|
||||||
fclose(pFile);
|
return false;
|
||||||
return false;
|
|
||||||
}
|
fgets(zw, 1024, pFile);
|
||||||
|
ESP_LOGD(TAG, "%s", zw);
|
||||||
References[0].fastalg_x = stoi(splitted[0]);
|
|
||||||
References[0].fastalg_y = stoi(splitted[1]);
|
fgets(zw, 1024, pFile);
|
||||||
References[0].fastalg_SAD = stof(splitted[2]);
|
splitted = ZerlegeZeile(std::string(zw), " \t");
|
||||||
References[0].fastalg_min = stoi(splitted[3]);
|
|
||||||
References[0].fastalg_max = stoi(splitted[4]);
|
if (splitted.size() < 6)
|
||||||
References[0].fastalg_avg = stof(splitted[5]);
|
{
|
||||||
|
fclose(pFile);
|
||||||
fgets(zw, 1024, pFile);
|
return false;
|
||||||
splitted = ZerlegeZeile(std::string(zw));
|
}
|
||||||
if (splitted.size() < 6)
|
|
||||||
{
|
References[0].fastalg_x = stoi(splitted[0]);
|
||||||
fclose(pFile);
|
References[0].fastalg_y = stoi(splitted[1]);
|
||||||
return false;
|
References[0].fastalg_SAD = stof(splitted[2]);
|
||||||
}
|
References[0].fastalg_min = stoi(splitted[3]);
|
||||||
|
References[0].fastalg_max = stoi(splitted[4]);
|
||||||
References[1].fastalg_x = stoi(splitted[0]);
|
References[0].fastalg_avg = stof(splitted[5]);
|
||||||
References[1].fastalg_y = stoi(splitted[1]);
|
|
||||||
References[1].fastalg_SAD = stof(splitted[2]);
|
fgets(zw, 1024, pFile);
|
||||||
References[1].fastalg_min = stoi(splitted[3]);
|
splitted = ZerlegeZeile(std::string(zw));
|
||||||
References[1].fastalg_max = stoi(splitted[4]);
|
|
||||||
References[1].fastalg_avg = stof(splitted[5]);
|
if (splitted.size() < 6)
|
||||||
|
{
|
||||||
fclose(pFile);
|
fclose(pFile);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
/*#ifdef DEBUG_DETAIL_ON
|
|
||||||
std::string _zw = "\tLoadReferences[0]\tx,y:\t" + std::to_string(References[0].fastalg_x) + "\t" + std::to_string(References[0].fastalg_x);
|
References[1].fastalg_x = stoi(splitted[0]);
|
||||||
_zw = _zw + "\tSAD, min, max, avg:\t" + std::to_string(References[0].fastalg_SAD) + "\t" + std::to_string(References[0].fastalg_min);
|
References[1].fastalg_y = stoi(splitted[1]);
|
||||||
_zw = _zw + "\t" + std::to_string(References[0].fastalg_max) + "\t" + std::to_string(References[0].fastalg_avg);
|
References[1].fastalg_SAD = stof(splitted[2]);
|
||||||
LogFile.WriteToDedicatedFile("/sdcard/alignment.txt", _zw);
|
References[1].fastalg_min = stoi(splitted[3]);
|
||||||
_zw = "\tLoadReferences[1]\tx,y:\t" + std::to_string(References[1].fastalg_x) + "\t" + std::to_string(References[1].fastalg_x);
|
References[1].fastalg_max = stoi(splitted[4]);
|
||||||
_zw = _zw + "\tSAD, min, max, avg:\t" + std::to_string(References[1].fastalg_SAD) + "\t" + std::to_string(References[1].fastalg_min);
|
References[1].fastalg_avg = stof(splitted[5]);
|
||||||
_zw = _zw + "\t" + std::to_string(References[1].fastalg_max) + "\t" + std::to_string(References[1].fastalg_avg);
|
|
||||||
LogFile.WriteToDedicatedFile("/sdcard/alignment.txt", _zw);
|
fclose(pFile);
|
||||||
#endif*/
|
|
||||||
|
/*#ifdef DEBUG_DETAIL_ON
|
||||||
return true;
|
std::string _zw = "\tLoadReferences[0]\tx,y:\t" + std::to_string(References[0].fastalg_x) + "\t" + std::to_string(References[0].fastalg_x);
|
||||||
}
|
_zw = _zw + "\tSAD, min, max, avg:\t" + std::to_string(References[0].fastalg_SAD) + "\t" + std::to_string(References[0].fastalg_min);
|
||||||
|
_zw = _zw + "\t" + std::to_string(References[0].fastalg_max) + "\t" + std::to_string(References[0].fastalg_avg);
|
||||||
|
LogFile.WriteToDedicatedFile("/sdcard/alignment.txt", _zw);
|
||||||
void ClassFlowAlignment::DrawRef(CImageBasis *_zw)
|
_zw = "\tLoadReferences[1]\tx,y:\t" + std::to_string(References[1].fastalg_x) + "\t" + std::to_string(References[1].fastalg_x);
|
||||||
{
|
_zw = _zw + "\tSAD, min, max, avg:\t" + std::to_string(References[1].fastalg_SAD) + "\t" + std::to_string(References[1].fastalg_min);
|
||||||
if (_zw->ImageOkay())
|
_zw = _zw + "\t" + std::to_string(References[1].fastalg_max) + "\t" + std::to_string(References[1].fastalg_avg);
|
||||||
{
|
LogFile.WriteToDedicatedFile("/sdcard/alignment.txt", _zw);
|
||||||
_zw->drawRect(References[0].target_x, References[0].target_y, References[0].width, References[0].height, 255, 0, 0, 2);
|
#endif*/
|
||||||
_zw->drawRect(References[1].target_x, References[1].target_y, References[1].width, References[1].height, 255, 0, 0, 2);
|
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClassFlowAlignment::DrawRef(CImageBasis *_zw)
|
||||||
|
{
|
||||||
|
if (_zw->ImageOkay())
|
||||||
|
{
|
||||||
|
_zw->drawRect(References[0].target_x, References[0].target_y, References[0].width, References[0].height, 255, 0, 0, 2);
|
||||||
|
_zw->drawRect(References[1].target_x, References[1].target_y, References[1].width, References[1].height, 255, 0, 0, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,54 +1,51 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef CLASSFLOWALIGNMENT_H
|
#ifndef CLASSFLOWALIGNMENT_H
|
||||||
#define CLASSFLOWALIGNMENT_H
|
#define CLASSFLOWALIGNMENT_H
|
||||||
|
|
||||||
#include "ClassFlow.h"
|
#include "ClassFlow.h"
|
||||||
#include "Helper.h"
|
#include "Helper.h"
|
||||||
#include "CAlignAndCutImage.h"
|
#include "CAlignAndCutImage.h"
|
||||||
#include "CFindTemplate.h"
|
#include "CFindTemplate.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class ClassFlowAlignment :
|
class ClassFlowAlignment : public ClassFlow
|
||||||
public ClassFlow
|
{
|
||||||
{
|
protected:
|
||||||
protected:
|
float initialrotate;
|
||||||
float initialrotate;
|
bool initialflip;
|
||||||
bool initialmirror;
|
bool use_antialiasing;
|
||||||
bool initialflip;
|
RefInfo References[2];
|
||||||
bool use_antialiasing;
|
int anz_ref;
|
||||||
RefInfo References[2];
|
string namerawimage;
|
||||||
int anz_ref;
|
bool SaveAllFiles;
|
||||||
string namerawimage;
|
CAlignAndCutImage *AlignAndCutImage;
|
||||||
bool SaveAllFiles;
|
std::string FileStoreRefAlignment;
|
||||||
CAlignAndCutImage *AlignAndCutImage;
|
float SAD_criteria;
|
||||||
std::string FileStoreRefAlignment;
|
|
||||||
float SAD_criteria;
|
void SetInitialParameter(void);
|
||||||
|
bool LoadReferenceAlignmentValues(void);
|
||||||
void SetInitialParameter(void);
|
void SaveReferenceAlignmentValues();
|
||||||
bool LoadReferenceAlignmentValues(void);
|
|
||||||
void SaveReferenceAlignmentValues();
|
public:
|
||||||
|
CImageBasis *ImageBasis, *ImageTMP;
|
||||||
public:
|
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
||||||
CImageBasis *ImageBasis, *ImageTMP;
|
ImageData *AlgROI;
|
||||||
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
|
#endif
|
||||||
ImageData *AlgROI;
|
|
||||||
#endif
|
ClassFlowAlignment(std::vector<ClassFlow *> *lfc);
|
||||||
|
|
||||||
ClassFlowAlignment(std::vector<ClassFlow*>* lfc);
|
CAlignAndCutImage *GetAlignAndCutImage() { return AlignAndCutImage; };
|
||||||
|
|
||||||
CAlignAndCutImage* GetAlignAndCutImage(){return AlignAndCutImage;};
|
void DrawRef(CImageBasis *_zw);
|
||||||
|
|
||||||
void DrawRef(CImageBasis *_zw);
|
bool ReadParameter(FILE *pfile, string &aktparamgraph);
|
||||||
|
bool doFlow(string time);
|
||||||
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
string getHTMLSingleStep(string host);
|
||||||
bool doFlow(string time);
|
string name() { return "ClassFlowAlignment"; };
|
||||||
string getHTMLSingleStep(string host);
|
};
|
||||||
string name(){return "ClassFlowAlignment";};
|
|
||||||
};
|
#endif // CLASSFLOWALIGNMENT_H
|
||||||
|
|
||||||
|
|
||||||
#endif //CLASSFLOWALIGNMENT_H
|
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <regex>
|
||||||
|
|
||||||
#include "ClassFlowTakeImage.h"
|
#include "ClassFlowTakeImage.h"
|
||||||
#include "Helper.h"
|
#include "Helper.h"
|
||||||
#include "ClassLogFile.h"
|
#include "ClassLogFile.h"
|
||||||
|
|
||||||
#include "CImageBasis.h"
|
#include "CImageBasis.h"
|
||||||
#include "ClassControllCamera.h"
|
#include "ClassControllCamera.h"
|
||||||
|
#include "MainFlowControl.h"
|
||||||
|
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
@@ -12,14 +18,14 @@
|
|||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
// #define DEBUG_DETAIL_ON
|
// #define DEBUG_DETAIL_ON
|
||||||
|
|
||||||
// #define WIFITURNOFF
|
// #define WIFITURNOFF
|
||||||
|
|
||||||
static const char* TAG = "TAKEIMAGE";
|
static const char *TAG = "TAKEIMAGE";
|
||||||
|
|
||||||
esp_err_t ClassFlowTakeImage::camera_capture(){
|
esp_err_t ClassFlowTakeImage::camera_capture(void)
|
||||||
string nm = namerawimage;
|
{
|
||||||
|
string nm = namerawimage;
|
||||||
Camera.CaptureToFile(nm);
|
Camera.CaptureToFile(nm);
|
||||||
time(&TimeImageTaken);
|
time(&TimeImageTaken);
|
||||||
localtime(&TimeImageTaken);
|
localtime(&TimeImageTaken);
|
||||||
@@ -30,205 +36,480 @@ esp_err_t ClassFlowTakeImage::camera_capture(){
|
|||||||
void ClassFlowTakeImage::takePictureWithFlash(int flash_duration)
|
void ClassFlowTakeImage::takePictureWithFlash(int flash_duration)
|
||||||
{
|
{
|
||||||
// in case the image is flipped, it must be reset here //
|
// in case the image is flipped, it must be reset here //
|
||||||
rawImage->width = image_width;
|
rawImage->width = CCstatus.ImageWidth;
|
||||||
rawImage->height = image_height;
|
rawImage->height = CCstatus.ImageHeight;
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
ESP_LOGD(TAG, "flash_duration: %d", flash_duration);
|
ESP_LOGD(TAG, "flash_duration: %d", flash_duration);
|
||||||
|
|
||||||
Camera.CaptureToBasisImage(rawImage, flash_duration);
|
Camera.CaptureToBasisImage(rawImage, flash_duration);
|
||||||
|
|
||||||
time(&TimeImageTaken);
|
time(&TimeImageTaken);
|
||||||
localtime(&TimeImageTaken);
|
localtime(&TimeImageTaken);
|
||||||
|
|
||||||
if (SaveAllFiles) rawImage->SaveToFile(namerawimage);
|
if (CCstatus.SaveAllFiles)
|
||||||
|
{
|
||||||
|
rawImage->SaveToFile(namerawimage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassFlowTakeImage::SetInitialParameter(void)
|
void ClassFlowTakeImage::SetInitialParameter(void)
|
||||||
{
|
{
|
||||||
waitbeforepicture = 5;
|
|
||||||
isImageSize = false;
|
|
||||||
ImageQuality = -1;
|
|
||||||
TimeImageTaken = 0;
|
TimeImageTaken = 0;
|
||||||
ImageQuality = 5;
|
|
||||||
rawImage = NULL;
|
rawImage = NULL;
|
||||||
ImageSize = FRAMESIZE_VGA;
|
|
||||||
ZoomEnabled = false;
|
|
||||||
ZoomMode = 0;
|
|
||||||
zoomOffsetX = 0;
|
|
||||||
zoomOffsetY = 0;
|
|
||||||
ImageNegative = false;
|
|
||||||
ImageAec2 = false;
|
|
||||||
#ifdef GRAYSCALE_AS_DEFAULT
|
|
||||||
ImageGrayscale = true;
|
|
||||||
#else
|
|
||||||
ImageGrayscale = false;
|
|
||||||
#endif
|
|
||||||
SaveAllFiles = false;
|
|
||||||
disabled = false;
|
disabled = false;
|
||||||
FixedExposure = false;
|
|
||||||
namerawimage = "/sdcard/img_tmp/raw.jpg";
|
namerawimage = "/sdcard/img_tmp/raw.jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// auslesen der Kameraeinstellungen aus der config.ini
|
||||||
|
// wird beim Start aufgerufen
|
||||||
|
bool ClassFlowTakeImage::ReadParameter(FILE *pfile, string &aktparamgraph)
|
||||||
|
{
|
||||||
|
Camera.getSensorDatenToCCstatus(); // Kamera >>> CCstatus
|
||||||
|
|
||||||
ClassFlowTakeImage::ClassFlowTakeImage(std::vector<ClassFlow*>* lfc) : ClassFlowImage(lfc, TAG)
|
std::vector<string> splitted;
|
||||||
|
|
||||||
|
aktparamgraph = trim(aktparamgraph);
|
||||||
|
|
||||||
|
if (aktparamgraph.size() == 0)
|
||||||
|
{
|
||||||
|
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aktparamgraph.compare("[TakeImage]") != 0)
|
||||||
|
{
|
||||||
|
// Paragraph does not fit TakeImage
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
||||||
|
{
|
||||||
|
splitted = ZerlegeZeile(aktparamgraph);
|
||||||
|
|
||||||
|
if ((toUpper(splitted[0]) == "RAWIMAGESLOCATION") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
imagesLocation = "/sdcard" + splitted[1];
|
||||||
|
isLogImage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "RAWIMAGESRETENTION") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
this->imagesRetention = std::stod(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.SaveAllFiles = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.SaveAllFiles = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "WAITBEFORETAKINGPICTURE") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
int _WaitBeforePicture = std::stoi(splitted[1]);
|
||||||
|
if (_WaitBeforePicture != 0)
|
||||||
|
{
|
||||||
|
CCstatus.WaitBeforePicture = _WaitBeforePicture;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.WaitBeforePicture = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMGAINCEILING") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
std::string _ImageGainceiling = toUpper(splitted[1]);
|
||||||
|
if (_ImageGainceiling == "X4")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_4X;
|
||||||
|
}
|
||||||
|
else if (_ImageGainceiling == "X8")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_8X;
|
||||||
|
}
|
||||||
|
else if (_ImageGainceiling == "X16")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_16X;
|
||||||
|
}
|
||||||
|
else if (_ImageGainceiling == "X32")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_32X;
|
||||||
|
}
|
||||||
|
else if (_ImageGainceiling == "X64")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_64X;
|
||||||
|
}
|
||||||
|
else if (_ImageGainceiling == "X128")
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_128X;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageGainceiling = GAINCEILING_2X;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMQUALITY") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
int _ImageQuality = std::stoi(splitted[1]);
|
||||||
|
if ((_ImageQuality >= 0) && (_ImageQuality <= 63))
|
||||||
|
{
|
||||||
|
CCstatus.ImageQuality = _ImageQuality;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMBRIGHTNESS") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
int _ImageBrightness = std::stoi(splitted[1]);
|
||||||
|
if ((_ImageBrightness >= -2) && (_ImageBrightness <= 2))
|
||||||
|
{
|
||||||
|
CCstatus.ImageBrightness = _ImageBrightness;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMCONTRAST") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
int _ImageContrast = std::stoi(splitted[1]);
|
||||||
|
if ((_ImageContrast >= -2) && (_ImageContrast <= 2))
|
||||||
|
{
|
||||||
|
CCstatus.ImageContrast = _ImageContrast;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMSATURATION") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
int _ImageSaturation = std::stoi(splitted[1]);
|
||||||
|
if ((_ImageSaturation >= -2) && (_ImageSaturation <= 2))
|
||||||
|
{
|
||||||
|
CCstatus.ImageSaturation = _ImageSaturation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMSHARPNESS") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
int _ImageSharpness = std::stoi(splitted[1]);
|
||||||
|
if ((_ImageSharpness >= -2) && (_ImageSharpness <= 2))
|
||||||
|
{
|
||||||
|
CCstatus.ImageSharpness = _ImageSharpness;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAUTOSHARPNESS") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageAutoSharpness = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageAutoSharpness = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMSPECIALEFFECT") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
std::string _ImageSpecialEffect = toUpper(splitted[1]);
|
||||||
|
if (_ImageSpecialEffect == "NEGATIVE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 1;
|
||||||
|
}
|
||||||
|
else if (_ImageSpecialEffect == "GRAYSCALE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 2;
|
||||||
|
}
|
||||||
|
else if (_ImageSpecialEffect == "RED")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 3;
|
||||||
|
}
|
||||||
|
else if (_ImageSpecialEffect == "GREEN")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 4;
|
||||||
|
}
|
||||||
|
else if (_ImageSpecialEffect == "BLUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 5;
|
||||||
|
}
|
||||||
|
else if (_ImageSpecialEffect == "RETRO")
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 6;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageSpecialEffect = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMWBMODE") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
std::string _ImageWbMode = toUpper(splitted[1]);
|
||||||
|
if (_ImageWbMode == "SUNNY")
|
||||||
|
{
|
||||||
|
CCstatus.ImageWbMode = 1;
|
||||||
|
}
|
||||||
|
else if (_ImageWbMode == "CLOUDY")
|
||||||
|
{
|
||||||
|
CCstatus.ImageWbMode = 2;
|
||||||
|
}
|
||||||
|
else if (_ImageWbMode == "OFFICE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageWbMode = 3;
|
||||||
|
}
|
||||||
|
else if (_ImageWbMode == "HOME")
|
||||||
|
{
|
||||||
|
CCstatus.ImageWbMode = 4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageWbMode = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAWB") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageAwb = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageAwb = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAWBGAIN") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageAwbGain = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageAwbGain = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAEC") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageAec = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageAec = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAEC2") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageAec2 = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageAec2 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAELEVEL") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
int _ImageAeLevel = std::stoi(splitted[1]);
|
||||||
|
if ((_ImageAeLevel >= -2) && (_ImageAeLevel <= 2))
|
||||||
|
{
|
||||||
|
CCstatus.ImageAeLevel = _ImageAeLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAECVALUE") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
int _ImageAecValue = std::stoi(splitted[1]);
|
||||||
|
if ((_ImageAecValue >= 0) && (_ImageAecValue <= 1200))
|
||||||
|
{
|
||||||
|
CCstatus.ImageAecValue = _ImageAecValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAGC") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageAgc = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageAgc = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMAGCGAIN") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
int _ImageAgcGain = std::stoi(splitted[1]);
|
||||||
|
if ((_ImageAgcGain >= 0) && (_ImageAgcGain <= 30))
|
||||||
|
{
|
||||||
|
CCstatus.ImageAgcGain = _ImageAgcGain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMBPC") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageBpc = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageBpc = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMWPC") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageWpc = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageWpc = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMRAWGMA") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageRawGma = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageRawGma = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMLENC") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageLenc = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageLenc = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMHMIRROR") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageHmirror = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageHmirror = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMVFLIP") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageVflip = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageVflip = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMDCW") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageDcw = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageDcw = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMZOOM") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomEnabled = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomEnabled = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMZOOMOFFSETX") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomOffsetX = std::stoi(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMZOOMOFFSETY") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomOffsetY = std::stoi(splitted[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "CAMZOOMSIZE") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
int _ImageZoomSize = std::stoi(splitted[1]);
|
||||||
|
if (_ImageZoomSize >= 0)
|
||||||
|
{
|
||||||
|
CCstatus.ImageZoomSize = _ImageZoomSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "LEDINTENSITY") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
float ledintensity = std::stof(splitted[1]);
|
||||||
|
Camera.SetLEDIntensity(ledintensity);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((toUpper(splitted[0]) == "DEMO") && (splitted.size() > 1))
|
||||||
|
{
|
||||||
|
if (toUpper(splitted[1]) == "TRUE")
|
||||||
|
{
|
||||||
|
CCstatus.DemoMode = true;
|
||||||
|
Camera.useDemoMode();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CCstatus.DemoMode = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Camera.setSensorDatenFromCCstatus(); // CCstatus >>> Kamera
|
||||||
|
Camera.SetQualityZoomSize(CCstatus.ImageQuality, CCstatus.ImageFrameSize, CCstatus.ImageZoomEnabled, CCstatus.ImageZoomOffsetX, CCstatus.ImageZoomOffsetY, CCstatus.ImageZoomSize);
|
||||||
|
|
||||||
|
rawImage = new CImageBasis("rawImage");
|
||||||
|
rawImage->CreateEmptyImage(CCstatus.ImageWidth, CCstatus.ImageHeight, 3);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassFlowTakeImage::ClassFlowTakeImage(std::vector<ClassFlow *> *lfc) : ClassFlowImage(lfc, TAG)
|
||||||
{
|
{
|
||||||
imagesLocation = "/log/source";
|
imagesLocation = "/log/source";
|
||||||
imagesRetention = 5;
|
imagesRetention = 5;
|
||||||
SetInitialParameter();
|
SetInitialParameter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ClassFlowTakeImage::ReadParameter(FILE* pfile, string& aktparamgraph)
|
|
||||||
{
|
|
||||||
std::vector<string> splitted;
|
|
||||||
|
|
||||||
aktparamgraph = trim(aktparamgraph);
|
|
||||||
int _brightness = 0;
|
|
||||||
int _contrast = 0;
|
|
||||||
int _saturation = 0;
|
|
||||||
int _sharpness = 0;
|
|
||||||
int _autoExposureLevel = 0;
|
|
||||||
|
|
||||||
if (aktparamgraph.size() == 0)
|
|
||||||
if (!this->GetNextParagraph(pfile, aktparamgraph))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (aktparamgraph.compare("[TakeImage]") != 0) // Paragraph does not fit TakeImage
|
|
||||||
return false;
|
|
||||||
|
|
||||||
while (this->getNextLine(pfile, &aktparamgraph) && !this->isNewParagraph(aktparamgraph))
|
|
||||||
{
|
|
||||||
splitted = ZerlegeZeile(aktparamgraph);
|
|
||||||
if ((toUpper(splitted[0]) == "RAWIMAGESLOCATION") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
imagesLocation = "/sdcard" + splitted[1];
|
|
||||||
isLogImage = true;
|
|
||||||
}
|
|
||||||
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]) == "NEGATIVE") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
ImageNegative = true;
|
|
||||||
else if (toUpper(splitted[1]) == "FALSE")
|
|
||||||
ImageNegative = false;
|
|
||||||
}
|
|
||||||
if ((toUpper(splitted[0]) == "AEC2") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
ImageAec2 = true;
|
|
||||||
else if (toUpper(splitted[1]) == "FALSE")
|
|
||||||
ImageAec2 = 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());
|
|
||||||
isImageSize = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "SAVEALLFILES") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
SaveAllFiles = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "WAITBEFORETAKINGPICTURE") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
waitbeforepicture = stoi(splitted[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "RAWIMAGESRETENTION") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
this->imagesRetention = std::stoi(splitted[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "BRIGHTNESS") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
_brightness = stoi(splitted[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "CONTRAST") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
_contrast = stoi(splitted[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "SATURATION") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
_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")
|
|
||||||
FixedExposure = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "LEDINTENSITY") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
float ledintensity = stof(splitted[1]);
|
|
||||||
ledintensity = min((float) 100, ledintensity);
|
|
||||||
ledintensity = max((float) 0, ledintensity);
|
|
||||||
Camera.SetLEDIntensity(ledintensity);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((toUpper(splitted[0]) == "DEMO") && (splitted.size() > 1))
|
|
||||||
{
|
|
||||||
if (toUpper(splitted[1]) == "TRUE")
|
|
||||||
Camera.useDemoMode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Camera.SetBrightnessContrastSaturation(_brightness, _contrast, _saturation, _autoExposureLevel, ImageGrayscale, ImageNegative, ImageAec2, _sharpness);
|
|
||||||
Camera.SetQualitySize(ImageQuality, ImageSize, ZoomEnabled, ZoomMode, zoomOffsetX, zoomOffsetY);
|
|
||||||
|
|
||||||
image_width = Camera.image_width;
|
|
||||||
image_height = Camera.image_height;
|
|
||||||
rawImage = new CImageBasis("rawImage");
|
|
||||||
rawImage->CreateEmptyImage(image_width, image_height, 3);
|
|
||||||
|
|
||||||
waitbeforepicture_store = waitbeforepicture;
|
|
||||||
if (FixedExposure && (waitbeforepicture > 0))
|
|
||||||
{
|
|
||||||
// ESP_LOGD(TAG, "Fixed Exposure enabled!");
|
|
||||||
int flash_duration = (int) (waitbeforepicture * 1000);
|
|
||||||
Camera.EnableAutoExposure(flash_duration);
|
|
||||||
waitbeforepicture = 0.2;
|
|
||||||
// flash_duration = (int) (waitbeforepicture * 1000);
|
|
||||||
// takePictureWithFlash(flash_duration);
|
|
||||||
// rawImage->SaveToFile("/sdcard/init2.jpg");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
string ClassFlowTakeImage::getHTMLSingleStep(string host)
|
string ClassFlowTakeImage::getHTMLSingleStep(string host)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
@@ -236,74 +517,78 @@ string ClassFlowTakeImage::getHTMLSingleStep(string host)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// wird bei jeder Auswertrunde aufgerufen
|
||||||
bool ClassFlowTakeImage::doFlow(string zwtime)
|
bool ClassFlowTakeImage::doFlow(string zwtime)
|
||||||
{
|
{
|
||||||
psram_init_shared_memory_for_take_image_step();
|
psram_init_shared_memory_for_take_image_step();
|
||||||
|
|
||||||
string logPath = CreateLogFolder(zwtime);
|
string logPath = CreateLogFolder(zwtime);
|
||||||
|
|
||||||
int flash_duration = (int) (waitbeforepicture * 1000);
|
int flash_duration = (int)(CCstatus.WaitBeforePicture * 1000);
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
|
||||||
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - Before takePictureWithFlash");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#ifdef DEBUG_DETAIL_ON
|
||||||
|
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - Before takePictureWithFlash");
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIFITURNOFF
|
#ifdef WIFITURNOFF
|
||||||
esp_wifi_stop(); // to save power usage and
|
esp_wifi_stop(); // to save power usage and
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// wenn die Kameraeinstellungen durch Erstellen eines neuen Referenzbildes verändert wurden, müssen sie neu gesetzt werden
|
||||||
|
if (CFstatus.changedCameraSettings)
|
||||||
|
{
|
||||||
|
Camera.setSensorDatenFromCCstatus(); // CCstatus >>> Kamera
|
||||||
|
Camera.SetQualityZoomSize(CCstatus.ImageQuality, CCstatus.ImageFrameSize, CCstatus.ImageZoomEnabled, CCstatus.ImageZoomOffsetX, CCstatus.ImageZoomOffsetY, CCstatus.ImageZoomSize);
|
||||||
|
CFstatus.changedCameraSettings = false;
|
||||||
|
}
|
||||||
|
|
||||||
takePictureWithFlash(flash_duration);
|
takePictureWithFlash(flash_duration);
|
||||||
|
|
||||||
#ifdef WIFITURNOFF
|
#ifdef WIFITURNOFF
|
||||||
esp_wifi_start();
|
esp_wifi_start();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG_DETAIL_ON
|
||||||
#ifdef DEBUG_DETAIL_ON
|
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After takePictureWithFlash");
|
||||||
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After takePictureWithFlash");
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
LogImage(logPath, "raw", NULL, NULL, zwtime, rawImage);
|
LogImage(logPath, "raw", NULL, NULL, zwtime, rawImage);
|
||||||
|
|
||||||
RemoveOldLogs();
|
RemoveOldLogs();
|
||||||
|
|
||||||
#ifdef DEBUG_DETAIL_ON
|
#ifdef DEBUG_DETAIL_ON
|
||||||
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After RemoveOldLogs");
|
LogFile.WriteHeapInfo("ClassFlowTakeImage::doFlow - After RemoveOldLogs");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
psram_deinit_shared_memory_for_take_image_step();
|
psram_deinit_shared_memory_for_take_image_step();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
esp_err_t ClassFlowTakeImage::SendRawJPG(httpd_req_t *req)
|
esp_err_t ClassFlowTakeImage::SendRawJPG(httpd_req_t *req)
|
||||||
{
|
{
|
||||||
int flash_duration = (int) (waitbeforepicture * 1000);
|
int flash_duration = (int)(CCstatus.WaitBeforePicture * 1000);
|
||||||
time(&TimeImageTaken);
|
time(&TimeImageTaken);
|
||||||
localtime(&TimeImageTaken);
|
localtime(&TimeImageTaken);
|
||||||
|
|
||||||
return Camera.CaptureToHTTP(req, flash_duration);
|
return Camera.CaptureToHTTP(req, flash_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImageData *ClassFlowTakeImage::SendRawImage(void)
|
||||||
ImageData* ClassFlowTakeImage::SendRawImage()
|
|
||||||
{
|
{
|
||||||
CImageBasis *zw = new CImageBasis("SendRawImage", rawImage);
|
CImageBasis *zw = new CImageBasis("SendRawImage", rawImage);
|
||||||
ImageData *id;
|
ImageData *id;
|
||||||
int flash_duration = (int) (waitbeforepicture * 1000);
|
int flash_duration = (int)(CCstatus.WaitBeforePicture * 1000);
|
||||||
Camera.CaptureToBasisImage(zw, flash_duration);
|
Camera.CaptureToBasisImage(zw, flash_duration);
|
||||||
time(&TimeImageTaken);
|
time(&TimeImageTaken);
|
||||||
localtime(&TimeImageTaken);
|
localtime(&TimeImageTaken);
|
||||||
|
|
||||||
id = zw->writeToMemoryAsJPG();
|
id = zw->writeToMemoryAsJPG();
|
||||||
delete zw;
|
delete zw;
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t ClassFlowTakeImage::getTimeImageTaken()
|
time_t ClassFlowTakeImage::getTimeImageTaken(void)
|
||||||
{
|
{
|
||||||
return TimeImageTaken;
|
return TimeImageTaken;
|
||||||
}
|
}
|
||||||
@@ -312,4 +597,3 @@ ClassFlowTakeImage::~ClassFlowTakeImage(void)
|
|||||||
{
|
{
|
||||||
delete rawImage;
|
delete rawImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,54 +9,32 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class ClassFlowTakeImage :
|
class ClassFlowTakeImage : public ClassFlowImage
|
||||||
public ClassFlowImage
|
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
float waitbeforepicture;
|
|
||||||
float waitbeforepicture_store;
|
|
||||||
framesize_t ImageSize;
|
|
||||||
bool isImageSize;
|
|
||||||
bool ZoomEnabled = false;
|
|
||||||
int ZoomMode = 0;
|
|
||||||
int zoomOffsetX = 0;
|
|
||||||
int zoomOffsetY = 0;
|
|
||||||
bool ImageGrayscale;
|
|
||||||
bool ImageNegative;
|
|
||||||
bool ImageAec2;
|
|
||||||
int ImageQuality;
|
|
||||||
time_t TimeImageTaken;
|
time_t TimeImageTaken;
|
||||||
string namerawimage;
|
string namerawimage;
|
||||||
int image_height, image_width;
|
|
||||||
bool SaveAllFiles;
|
|
||||||
bool FixedExposure;
|
|
||||||
|
|
||||||
|
esp_err_t camera_capture(void);
|
||||||
|
|
||||||
void CopyFile(string input, string output);
|
|
||||||
|
|
||||||
esp_err_t camera_capture();
|
|
||||||
void takePictureWithFlash(int flash_duration);
|
void takePictureWithFlash(int flash_duration);
|
||||||
|
|
||||||
|
void SetInitialParameter(void);
|
||||||
void SetInitialParameter(void);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CImageBasis *rawImage;
|
CImageBasis *rawImage;
|
||||||
|
|
||||||
ClassFlowTakeImage(std::vector<ClassFlow*>* lfc);
|
ClassFlowTakeImage(std::vector<ClassFlow *> *lfc);
|
||||||
|
|
||||||
bool ReadParameter(FILE* pfile, string& aktparamgraph);
|
bool ReadParameter(FILE *pfile, string &aktparamgraph);
|
||||||
bool doFlow(string time);
|
bool doFlow(string time);
|
||||||
string getHTMLSingleStep(string host);
|
string getHTMLSingleStep(string host);
|
||||||
time_t getTimeImageTaken();
|
time_t getTimeImageTaken(void);
|
||||||
string name(){return "ClassFlowTakeImage";};
|
string name() { return "ClassFlowTakeImage"; };
|
||||||
|
|
||||||
ImageData* SendRawImage();
|
ImageData *SendRawImage(void);
|
||||||
esp_err_t SendRawJPG(httpd_req_t *req);
|
esp_err_t SendRawJPG(httpd_req_t *req);
|
||||||
|
|
||||||
~ClassFlowTakeImage(void);
|
~ClassFlowTakeImage(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // CLASSFFLOWTAKEIMAGE_H
|
||||||
#endif //CLASSFFLOWTAKEIMAGE_H
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -10,25 +10,78 @@
|
|||||||
#include "CImageBasis.h"
|
#include "CImageBasis.h"
|
||||||
#include "ClassFlowControll.h"
|
#include "ClassFlowControll.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
framesize_t ImageFrameSize = FRAMESIZE_VGA; // 0 - 10
|
||||||
|
gainceiling_t ImageGainceiling; // Image gain (GAINCEILING_x2, x4, x8, x16, x32, x64 or x128)
|
||||||
|
|
||||||
|
int ImageQuality; // 0 - 63
|
||||||
|
int ImageBrightness; // (-2 to 2) - set brightness
|
||||||
|
int ImageContrast; //-2 - 2
|
||||||
|
int ImageSaturation; //-2 - 2
|
||||||
|
int ImageSharpness; //-2 - 2
|
||||||
|
bool ImageAutoSharpness;
|
||||||
|
int ImageSpecialEffect; // 0 - 6
|
||||||
|
int ImageWbMode; // 0 to 4 - if awb_gain enabled (0 - Auto, 1 - Sunny, 2 - Cloudy, 3 - Office, 4 - Home)
|
||||||
|
int ImageAwb; // white balance enable (0 or 1)
|
||||||
|
int ImageAwbGain; // Auto White Balance enable (0 or 1)
|
||||||
|
int ImageAec; // auto exposure off (1 or 0)
|
||||||
|
int ImageAec2; // automatic exposure sensor (0 or 1)
|
||||||
|
int ImageAeLevel; // auto exposure levels (-2 to 2)
|
||||||
|
int ImageAecValue; // set exposure manually (0-1200)
|
||||||
|
int ImageAgc; // auto gain off (1 or 0)
|
||||||
|
int ImageAgcGain; // set gain manually (0 - 30)
|
||||||
|
int ImageBpc; // black pixel correction
|
||||||
|
int ImageWpc; // white pixel correction
|
||||||
|
int ImageRawGma; // (1 or 0)
|
||||||
|
int ImageLenc; // lens correction (1 or 0)
|
||||||
|
int ImageHmirror; // (0 or 1) flip horizontally
|
||||||
|
int ImageVflip; // Invert image (0 or 1)
|
||||||
|
int ImageDcw; // downsize enable (1 or 0)
|
||||||
|
|
||||||
|
int ImageWidth;
|
||||||
|
int ImageHeight;
|
||||||
|
|
||||||
|
int ImageLedIntensity;
|
||||||
|
|
||||||
|
bool ImageZoomEnabled;
|
||||||
|
int ImageZoomMode;
|
||||||
|
int ImageZoomOffsetX;
|
||||||
|
int ImageZoomOffsetY;
|
||||||
|
int ImageZoomSize;
|
||||||
|
|
||||||
|
int WaitBeforePicture;
|
||||||
|
bool isImageSize;
|
||||||
|
|
||||||
|
bool CameraInitSuccessful;
|
||||||
|
bool changedCameraSettings;
|
||||||
|
bool DemoMode;
|
||||||
|
bool SaveAllFiles;
|
||||||
|
} camera_flow_config_temp_t;
|
||||||
|
|
||||||
|
extern camera_flow_config_temp_t CFstatus;
|
||||||
extern ClassFlowControll flowctrl;
|
extern ClassFlowControll flowctrl;
|
||||||
|
|
||||||
|
esp_err_t setCCstatusToCFstatus(void); // CCstatus >>> CFstatus
|
||||||
|
esp_err_t setCFstatusToCCstatus(void); // CFstatus >>> CCstatus
|
||||||
|
esp_err_t setCFstatusToCam(void); // CFstatus >>> Kamera
|
||||||
|
|
||||||
void register_server_main_flow_task_uri(httpd_handle_t server);
|
void register_server_main_flow_task_uri(httpd_handle_t server);
|
||||||
|
|
||||||
void CheckIsPlannedReboot();
|
void CheckIsPlannedReboot(void);
|
||||||
bool getIsPlannedReboot();
|
bool getIsPlannedReboot(void);
|
||||||
|
|
||||||
void InitializeFlowTask();
|
void InitializeFlowTask(void);
|
||||||
void DeleteMainFlowTask();
|
void DeleteMainFlowTask(void);
|
||||||
bool isSetupModusActive();
|
bool isSetupModusActive(void);
|
||||||
|
|
||||||
int getCountFlowRounds();
|
int getCountFlowRounds(void);
|
||||||
|
|
||||||
#ifdef ENABLE_MQTT
|
#ifdef ENABLE_MQTT
|
||||||
esp_err_t MQTTCtrlFlowStart(std::string _topic);
|
esp_err_t MQTTCtrlFlowStart(std::string _topic);
|
||||||
#endif //ENABLE_MQTT
|
#endif // ENABLE_MQTT
|
||||||
|
|
||||||
esp_err_t GetRawJPG(httpd_req_t *req);
|
esp_err_t GetRawJPG(httpd_req_t *req);
|
||||||
esp_err_t GetJPG(std::string _filename, httpd_req_t *req);
|
esp_err_t GetJPG(std::string _filename, httpd_req_t *req);
|
||||||
|
|
||||||
#endif //MAINFLOWCONTROL_H
|
#endif // MAINFLOWCONTROL_H
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,353 +1,309 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "CRotateImage.h"
|
#include "CRotateImage.h"
|
||||||
#include "psram.h"
|
#include "psram.h"
|
||||||
|
|
||||||
static const char *TAG = "C ROTATE IMG";
|
static const char *TAG = "C ROTATE IMG";
|
||||||
|
|
||||||
CRotateImage::CRotateImage(std::string _name, CImageBasis *_org, CImageBasis *_temp, bool _flip) : CImageBasis(_name)
|
CRotateImage::CRotateImage(std::string _name, CImageBasis *_org, CImageBasis *_temp, bool _flip) : CImageBasis(_name)
|
||||||
{
|
{
|
||||||
rgb_image = _org->rgb_image;
|
rgb_image = _org->rgb_image;
|
||||||
channels = _org->channels;
|
channels = _org->channels;
|
||||||
width = _org->width;
|
width = _org->width;
|
||||||
height = _org->height;
|
height = _org->height;
|
||||||
bpp = _org->bpp;
|
bpp = _org->bpp;
|
||||||
externalImage = true;
|
externalImage = true;
|
||||||
ImageTMP = _temp;
|
ImageTMP = _temp;
|
||||||
ImageOrg = _org;
|
ImageOrg = _org;
|
||||||
islocked = false;
|
islocked = false;
|
||||||
doflip = _flip;
|
doflip = _flip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CRotateImage::Rotate(float _angle, int _centerx, int _centery)
|
||||||
void CRotateImage::Mirror(){
|
{
|
||||||
int memsize = width * height * channels;
|
int org_width, org_height;
|
||||||
uint8_t* odata;
|
float m[2][3];
|
||||||
if (ImageTMP)
|
|
||||||
{
|
float x_center = _centerx;
|
||||||
odata = ImageTMP->RGBImageLock();
|
float y_center = _centery;
|
||||||
}
|
_angle = _angle / 180 * M_PI;
|
||||||
else
|
|
||||||
{
|
if (doflip)
|
||||||
odata = (unsigned char*)malloc_psram_heap(std::string(TAG) + "->odata", memsize, MALLOC_CAP_SPIRAM);
|
{
|
||||||
}
|
org_width = width;
|
||||||
|
org_height = height;
|
||||||
|
height = org_width;
|
||||||
int x_source, y_source;
|
width = org_height;
|
||||||
stbi_uc* p_target;
|
x_center = x_center - (org_width/2) + (org_height/2);
|
||||||
stbi_uc* p_source;
|
y_center = y_center + (org_width/2) - (org_height/2);
|
||||||
|
if (ImageOrg)
|
||||||
RGBImageLock();
|
{
|
||||||
|
ImageOrg->height = height;
|
||||||
for (int x = 0; x < width; ++x)
|
ImageOrg->width = width;
|
||||||
for (int y = 0; y < height; ++y)
|
}
|
||||||
{
|
}
|
||||||
p_target = odata + (channels * (y * width + x));
|
else
|
||||||
|
{
|
||||||
x_source = width - x;
|
org_width = width;
|
||||||
y_source = y;
|
org_height = height;
|
||||||
|
}
|
||||||
p_source = rgb_image + (channels * (y_source * width + x_source));
|
|
||||||
for (int _channels = 0; _channels < channels; ++_channels)
|
m[0][0] = cos(_angle);
|
||||||
p_target[_channels] = p_source[_channels];
|
m[0][1] = sin(_angle);
|
||||||
}
|
m[0][2] = (1 - m[0][0]) * x_center - m[0][1] * y_center;
|
||||||
|
|
||||||
// memcpy(rgb_image, odata, memsize);
|
m[1][0] = -m[0][1];
|
||||||
memCopy(odata, rgb_image, memsize);
|
m[1][1] = m[0][0];
|
||||||
if (!ImageTMP)
|
m[1][2] = m[0][1] * x_center + (1 - m[0][0]) * y_center;
|
||||||
free_psram_heap(std::string(TAG) + "->odata", odata);
|
|
||||||
|
if (doflip)
|
||||||
if (ImageTMP)
|
{
|
||||||
ImageTMP->RGBImageRelease();
|
m[0][2] = m[0][2] + (org_width/2) - (org_height/2);
|
||||||
|
m[1][2] = m[1][2] - (org_width/2) + (org_height/2);
|
||||||
RGBImageRelease();
|
}
|
||||||
}
|
|
||||||
|
int memsize = width * height * channels;
|
||||||
void CRotateImage::Rotate(float _angle, int _centerx, int _centery)
|
uint8_t* odata;
|
||||||
{
|
if (ImageTMP)
|
||||||
int org_width, org_height;
|
{
|
||||||
float m[2][3];
|
odata = ImageTMP->RGBImageLock();
|
||||||
|
}
|
||||||
float x_center = _centerx;
|
else
|
||||||
float y_center = _centery;
|
{
|
||||||
_angle = _angle / 180 * M_PI;
|
odata = (unsigned char*)malloc_psram_heap(std::string(TAG) + "->odata", memsize, MALLOC_CAP_SPIRAM);
|
||||||
|
}
|
||||||
if (doflip)
|
|
||||||
{
|
|
||||||
org_width = width;
|
int x_source, y_source;
|
||||||
org_height = height;
|
stbi_uc* p_target;
|
||||||
height = org_width;
|
stbi_uc* p_source;
|
||||||
width = org_height;
|
|
||||||
x_center = x_center - (org_width/2) + (org_height/2);
|
RGBImageLock();
|
||||||
y_center = y_center + (org_width/2) - (org_height/2);
|
|
||||||
if (ImageOrg)
|
for (int x = 0; x < width; ++x)
|
||||||
{
|
for (int y = 0; y < height; ++y)
|
||||||
ImageOrg->height = height;
|
{
|
||||||
ImageOrg->width = width;
|
p_target = odata + (channels * (y * width + x));
|
||||||
}
|
|
||||||
}
|
x_source = int(m[0][0] * x + m[0][1] * y);
|
||||||
else
|
y_source = int(m[1][0] * x + m[1][1] * y);
|
||||||
{
|
|
||||||
org_width = width;
|
x_source += int(m[0][2]);
|
||||||
org_height = height;
|
y_source += int(m[1][2]);
|
||||||
}
|
|
||||||
|
if ((x_source >= 0) && (x_source < org_width) && (y_source >= 0) && (y_source < org_height))
|
||||||
m[0][0] = cos(_angle);
|
{
|
||||||
m[0][1] = sin(_angle);
|
p_source = rgb_image + (channels * (y_source * org_width + x_source));
|
||||||
m[0][2] = (1 - m[0][0]) * x_center - m[0][1] * y_center;
|
for (int _channels = 0; _channels < channels; ++_channels)
|
||||||
|
p_target[_channels] = p_source[_channels];
|
||||||
m[1][0] = -m[0][1];
|
}
|
||||||
m[1][1] = m[0][0];
|
else
|
||||||
m[1][2] = m[0][1] * x_center + (1 - m[0][0]) * y_center;
|
{
|
||||||
|
for (int _channels = 0; _channels < channels; ++_channels)
|
||||||
if (doflip)
|
p_target[_channels] = 255;
|
||||||
{
|
}
|
||||||
m[0][2] = m[0][2] + (org_width/2) - (org_height/2);
|
}
|
||||||
m[1][2] = m[1][2] - (org_width/2) + (org_height/2);
|
|
||||||
}
|
// memcpy(rgb_image, odata, memsize);
|
||||||
|
memCopy(odata, rgb_image, memsize);
|
||||||
int memsize = width * height * channels;
|
|
||||||
uint8_t* odata;
|
if (!ImageTMP)
|
||||||
if (ImageTMP)
|
{
|
||||||
{
|
free_psram_heap(std::string(TAG) + "->odata", odata);
|
||||||
odata = ImageTMP->RGBImageLock();
|
}
|
||||||
}
|
if (ImageTMP)
|
||||||
else
|
ImageTMP->RGBImageRelease();
|
||||||
{
|
|
||||||
odata = (unsigned char*)malloc_psram_heap(std::string(TAG) + "->odata", memsize, MALLOC_CAP_SPIRAM);
|
RGBImageRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int x_source, y_source;
|
|
||||||
stbi_uc* p_target;
|
void CRotateImage::RotateAntiAliasing(float _angle, int _centerx, int _centery)
|
||||||
stbi_uc* p_source;
|
{
|
||||||
|
int org_width, org_height;
|
||||||
RGBImageLock();
|
float m[2][3];
|
||||||
|
|
||||||
for (int x = 0; x < width; ++x)
|
float x_center = _centerx;
|
||||||
for (int y = 0; y < height; ++y)
|
float y_center = _centery;
|
||||||
{
|
_angle = _angle / 180 * M_PI;
|
||||||
p_target = odata + (channels * (y * width + x));
|
|
||||||
|
if (doflip)
|
||||||
x_source = int(m[0][0] * x + m[0][1] * y);
|
{
|
||||||
y_source = int(m[1][0] * x + m[1][1] * y);
|
org_width = width;
|
||||||
|
org_height = height;
|
||||||
x_source += int(m[0][2]);
|
height = org_width;
|
||||||
y_source += int(m[1][2]);
|
width = org_height;
|
||||||
|
x_center = x_center - (org_width/2) + (org_height/2);
|
||||||
if ((x_source >= 0) && (x_source < org_width) && (y_source >= 0) && (y_source < org_height))
|
y_center = y_center + (org_width/2) - (org_height/2);
|
||||||
{
|
if (ImageOrg)
|
||||||
p_source = rgb_image + (channels * (y_source * org_width + x_source));
|
{
|
||||||
for (int _channels = 0; _channels < channels; ++_channels)
|
ImageOrg->height = height;
|
||||||
p_target[_channels] = p_source[_channels];
|
ImageOrg->width = width;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
for (int _channels = 0; _channels < channels; ++_channels)
|
{
|
||||||
p_target[_channels] = 255;
|
org_width = width;
|
||||||
}
|
org_height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
// memcpy(rgb_image, odata, memsize);
|
m[0][0] = cos(_angle);
|
||||||
memCopy(odata, rgb_image, memsize);
|
m[0][1] = sin(_angle);
|
||||||
|
m[0][2] = (1 - m[0][0]) * x_center - m[0][1] * y_center;
|
||||||
if (!ImageTMP)
|
|
||||||
{
|
m[1][0] = -m[0][1];
|
||||||
free_psram_heap(std::string(TAG) + "->odata", odata);
|
m[1][1] = m[0][0];
|
||||||
}
|
m[1][2] = m[0][1] * x_center + (1 - m[0][0]) * y_center;
|
||||||
if (ImageTMP)
|
|
||||||
ImageTMP->RGBImageRelease();
|
if (doflip)
|
||||||
|
{
|
||||||
RGBImageRelease();
|
m[0][2] = m[0][2] + (org_width/2) - (org_height/2);
|
||||||
}
|
m[1][2] = m[1][2] - (org_width/2) + (org_height/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int memsize = width * height * channels;
|
||||||
void CRotateImage::RotateAntiAliasing(float _angle, int _centerx, int _centery)
|
uint8_t* odata;
|
||||||
{
|
if (ImageTMP)
|
||||||
int org_width, org_height;
|
{
|
||||||
float m[2][3];
|
odata = ImageTMP->RGBImageLock();
|
||||||
|
}
|
||||||
float x_center = _centerx;
|
else
|
||||||
float y_center = _centery;
|
{
|
||||||
_angle = _angle / 180 * M_PI;
|
odata = (unsigned char*)malloc_psram_heap(std::string(TAG) + "->odata", memsize, MALLOC_CAP_SPIRAM);
|
||||||
|
}
|
||||||
if (doflip)
|
|
||||||
{
|
|
||||||
org_width = width;
|
int x_source_1, y_source_1, x_source_2, y_source_2;
|
||||||
org_height = height;
|
float x_source, y_source;
|
||||||
height = org_width;
|
float quad_ul, quad_ur, quad_ol, quad_or;
|
||||||
width = org_height;
|
stbi_uc* p_target;
|
||||||
x_center = x_center - (org_width/2) + (org_height/2);
|
stbi_uc *p_source_ul, *p_source_ur, *p_source_ol, *p_source_or;
|
||||||
y_center = y_center + (org_width/2) - (org_height/2);
|
|
||||||
if (ImageOrg)
|
RGBImageLock();
|
||||||
{
|
|
||||||
ImageOrg->height = height;
|
for (int x = 0; x < width; ++x)
|
||||||
ImageOrg->width = width;
|
for (int y = 0; y < height; ++y)
|
||||||
}
|
{
|
||||||
}
|
p_target = odata + (channels * (y * width + x));
|
||||||
else
|
|
||||||
{
|
x_source = (m[0][0] * x + m[0][1] * y);
|
||||||
org_width = width;
|
y_source = (m[1][0] * x + m[1][1] * y);
|
||||||
org_height = height;
|
|
||||||
}
|
x_source += (m[0][2]);
|
||||||
|
y_source += (m[1][2]);
|
||||||
m[0][0] = cos(_angle);
|
|
||||||
m[0][1] = sin(_angle);
|
x_source_1 = (int)x_source;
|
||||||
m[0][2] = (1 - m[0][0]) * x_center - m[0][1] * y_center;
|
x_source_2 = x_source_1 + 1;
|
||||||
|
y_source_1 = (int)y_source;
|
||||||
m[1][0] = -m[0][1];
|
y_source_2 = y_source_1 + 1;
|
||||||
m[1][1] = m[0][0];
|
|
||||||
m[1][2] = m[0][1] * x_center + (1 - m[0][0]) * y_center;
|
quad_ul = (x_source_2 - x_source) * (y_source_2 - y_source);
|
||||||
|
quad_ur = (1- (x_source_2 - x_source)) * (y_source_2 - y_source);
|
||||||
if (doflip)
|
quad_or = (x_source_2 - x_source) * (1-(y_source_2 - y_source));
|
||||||
{
|
quad_ol = (1- (x_source_2 - x_source)) * (1-(y_source_2 - y_source));
|
||||||
m[0][2] = m[0][2] + (org_width/2) - (org_height/2);
|
|
||||||
m[1][2] = m[1][2] - (org_width/2) + (org_height/2);
|
|
||||||
}
|
if ((x_source_1 >= 0) && (x_source_2 < org_width) && (y_source_1 >= 0) && (y_source_2 < org_height))
|
||||||
|
{
|
||||||
int memsize = width * height * channels;
|
p_source_ul = rgb_image + (channels * (y_source_1 * org_width + x_source_1));
|
||||||
uint8_t* odata;
|
p_source_ur = rgb_image + (channels * (y_source_1 * org_width + x_source_2));
|
||||||
if (ImageTMP)
|
p_source_or = rgb_image + (channels * (y_source_2 * org_width + x_source_1));
|
||||||
{
|
p_source_ol = rgb_image + (channels * (y_source_2 * org_width + x_source_2));
|
||||||
odata = ImageTMP->RGBImageLock();
|
for (int _channels = 0; _channels < channels; ++_channels)
|
||||||
}
|
{
|
||||||
else
|
p_target[_channels] = (int)((float)p_source_ul[_channels] * quad_ul
|
||||||
{
|
+ (float)p_source_ur[_channels] * quad_ur
|
||||||
odata = (unsigned char*)malloc_psram_heap(std::string(TAG) + "->odata", memsize, MALLOC_CAP_SPIRAM);
|
+ (float)p_source_or[_channels] * quad_or
|
||||||
}
|
+ (float)p_source_ol[_channels] * quad_ol);
|
||||||
|
}
|
||||||
|
}
|
||||||
int x_source_1, y_source_1, x_source_2, y_source_2;
|
else
|
||||||
float x_source, y_source;
|
{
|
||||||
float quad_ul, quad_ur, quad_ol, quad_or;
|
for (int _channels = 0; _channels < channels; ++_channels)
|
||||||
stbi_uc* p_target;
|
p_target[_channels] = 255;
|
||||||
stbi_uc *p_source_ul, *p_source_ur, *p_source_ol, *p_source_or;
|
}
|
||||||
|
}
|
||||||
RGBImageLock();
|
|
||||||
|
// memcpy(rgb_image, odata, memsize);
|
||||||
for (int x = 0; x < width; ++x)
|
memCopy(odata, rgb_image, memsize);
|
||||||
for (int y = 0; y < height; ++y)
|
|
||||||
{
|
if (!ImageTMP)
|
||||||
p_target = odata + (channels * (y * width + x));
|
{
|
||||||
|
free_psram_heap(std::string(TAG) + "->odata", odata);
|
||||||
x_source = (m[0][0] * x + m[0][1] * y);
|
}
|
||||||
y_source = (m[1][0] * x + m[1][1] * y);
|
if (ImageTMP)
|
||||||
|
ImageTMP->RGBImageRelease();
|
||||||
x_source += (m[0][2]);
|
|
||||||
y_source += (m[1][2]);
|
RGBImageRelease();
|
||||||
|
}
|
||||||
x_source_1 = (int)x_source;
|
|
||||||
x_source_2 = x_source_1 + 1;
|
|
||||||
y_source_1 = (int)y_source;
|
void CRotateImage::Rotate(float _angle)
|
||||||
y_source_2 = y_source_1 + 1;
|
{
|
||||||
|
// ESP_LOGD(TAG, "width %d, height %d", width, height);
|
||||||
quad_ul = (x_source_2 - x_source) * (y_source_2 - y_source);
|
Rotate(_angle, width / 2, height / 2);
|
||||||
quad_ur = (1- (x_source_2 - x_source)) * (y_source_2 - y_source);
|
}
|
||||||
quad_or = (x_source_2 - x_source) * (1-(y_source_2 - y_source));
|
|
||||||
quad_ol = (1- (x_source_2 - x_source)) * (1-(y_source_2 - y_source));
|
void CRotateImage::RotateAntiAliasing(float _angle)
|
||||||
|
{
|
||||||
|
// ESP_LOGD(TAG, "width %d, height %d", width, height);
|
||||||
if ((x_source_1 >= 0) && (x_source_2 < org_width) && (y_source_1 >= 0) && (y_source_2 < org_height))
|
RotateAntiAliasing(_angle, width / 2, height / 2);
|
||||||
{
|
}
|
||||||
p_source_ul = rgb_image + (channels * (y_source_1 * org_width + x_source_1));
|
|
||||||
p_source_ur = rgb_image + (channels * (y_source_1 * org_width + x_source_2));
|
void CRotateImage::Translate(int _dx, int _dy)
|
||||||
p_source_or = rgb_image + (channels * (y_source_2 * org_width + x_source_1));
|
{
|
||||||
p_source_ol = rgb_image + (channels * (y_source_2 * org_width + x_source_2));
|
int memsize = width * height * channels;
|
||||||
for (int _channels = 0; _channels < channels; ++_channels)
|
uint8_t* odata;
|
||||||
{
|
if (ImageTMP)
|
||||||
p_target[_channels] = (int)((float)p_source_ul[_channels] * quad_ul
|
{
|
||||||
+ (float)p_source_ur[_channels] * quad_ur
|
odata = ImageTMP->RGBImageLock();
|
||||||
+ (float)p_source_or[_channels] * quad_or
|
}
|
||||||
+ (float)p_source_ol[_channels] * quad_ol);
|
else
|
||||||
}
|
{
|
||||||
}
|
odata = (unsigned char*)malloc_psram_heap(std::string(TAG) + "->odata", memsize, MALLOC_CAP_SPIRAM);
|
||||||
else
|
}
|
||||||
{
|
|
||||||
for (int _channels = 0; _channels < channels; ++_channels)
|
|
||||||
p_target[_channels] = 255;
|
|
||||||
}
|
int x_source, y_source;
|
||||||
}
|
stbi_uc* p_target;
|
||||||
|
stbi_uc* p_source;
|
||||||
// memcpy(rgb_image, odata, memsize);
|
|
||||||
memCopy(odata, rgb_image, memsize);
|
RGBImageLock();
|
||||||
|
|
||||||
if (!ImageTMP)
|
for (int x = 0; x < width; ++x)
|
||||||
{
|
for (int y = 0; y < height; ++y)
|
||||||
free_psram_heap(std::string(TAG) + "->odata", odata);
|
{
|
||||||
}
|
p_target = odata + (channels * (y * width + x));
|
||||||
if (ImageTMP)
|
|
||||||
ImageTMP->RGBImageRelease();
|
x_source = x - _dx;
|
||||||
|
y_source = y - _dy;
|
||||||
RGBImageRelease();
|
|
||||||
}
|
if ((x_source >= 0) && (x_source < width) && (y_source >= 0) && (y_source < height))
|
||||||
|
{
|
||||||
|
p_source = rgb_image + (channels * (y_source * width + x_source));
|
||||||
void CRotateImage::Rotate(float _angle)
|
for (int _channels = 0; _channels < channels; ++_channels)
|
||||||
{
|
p_target[_channels] = p_source[_channels];
|
||||||
// ESP_LOGD(TAG, "width %d, height %d", width, height);
|
}
|
||||||
Rotate(_angle, width / 2, height / 2);
|
else
|
||||||
}
|
{
|
||||||
|
for (int _channels = 0; _channels < channels; ++_channels)
|
||||||
void CRotateImage::RotateAntiAliasing(float _angle)
|
p_target[_channels] = 255;
|
||||||
{
|
}
|
||||||
// ESP_LOGD(TAG, "width %d, height %d", width, height);
|
}
|
||||||
RotateAntiAliasing(_angle, width / 2, height / 2);
|
|
||||||
}
|
// memcpy(rgb_image, odata, memsize);
|
||||||
|
memCopy(odata, rgb_image, memsize);
|
||||||
void CRotateImage::Translate(int _dx, int _dy)
|
if (!ImageTMP)
|
||||||
{
|
{
|
||||||
int memsize = width * height * channels;
|
free_psram_heap(std::string(TAG) + "->odata", odata);
|
||||||
uint8_t* odata;
|
}
|
||||||
if (ImageTMP)
|
|
||||||
{
|
if (ImageTMP)
|
||||||
odata = ImageTMP->RGBImageLock();
|
{
|
||||||
}
|
ImageTMP->RGBImageRelease();
|
||||||
else
|
}
|
||||||
{
|
RGBImageRelease();
|
||||||
odata = (unsigned char*)malloc_psram_heap(std::string(TAG) + "->odata", memsize, MALLOC_CAP_SPIRAM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int x_source, y_source;
|
|
||||||
stbi_uc* p_target;
|
|
||||||
stbi_uc* p_source;
|
|
||||||
|
|
||||||
RGBImageLock();
|
|
||||||
|
|
||||||
for (int x = 0; x < width; ++x)
|
|
||||||
for (int y = 0; y < height; ++y)
|
|
||||||
{
|
|
||||||
p_target = odata + (channels * (y * width + x));
|
|
||||||
|
|
||||||
x_source = x - _dx;
|
|
||||||
y_source = y - _dy;
|
|
||||||
|
|
||||||
if ((x_source >= 0) && (x_source < width) && (y_source >= 0) && (y_source < height))
|
|
||||||
{
|
|
||||||
p_source = rgb_image + (channels * (y_source * width + x_source));
|
|
||||||
for (int _channels = 0; _channels < channels; ++_channels)
|
|
||||||
p_target[_channels] = p_source[_channels];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int _channels = 0; _channels < channels; ++_channels)
|
|
||||||
p_target[_channels] = 255;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// memcpy(rgb_image, odata, memsize);
|
|
||||||
memCopy(odata, rgb_image, memsize);
|
|
||||||
if (!ImageTMP)
|
|
||||||
{
|
|
||||||
free_psram_heap(std::string(TAG) + "->odata", odata);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImageTMP)
|
|
||||||
{
|
|
||||||
ImageTMP->RGBImageRelease();
|
|
||||||
}
|
|
||||||
RGBImageRelease();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,28 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef CROTATEIMAGE_H
|
#ifndef CROTATEIMAGE_H
|
||||||
#define CROTATEIMAGE_H
|
#define CROTATEIMAGE_H
|
||||||
|
|
||||||
#include "CImageBasis.h"
|
#include "CImageBasis.h"
|
||||||
|
|
||||||
|
|
||||||
class CRotateImage: public CImageBasis
|
class CRotateImage: public CImageBasis
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CImageBasis *ImageTMP, *ImageOrg;
|
CImageBasis *ImageTMP, *ImageOrg;
|
||||||
bool doflip;
|
bool doflip;
|
||||||
CRotateImage(std::string name, std::string _image, bool _flip = false) : CImageBasis(name, _image) {ImageTMP = NULL; ImageOrg = NULL; doflip = _flip;};
|
CRotateImage(std::string name, std::string _image, bool _flip = false) : CImageBasis(name, _image) {ImageTMP = NULL; ImageOrg = NULL; doflip = _flip;};
|
||||||
CRotateImage(std::string name, uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp, bool _flip = false) : CImageBasis(name, _rgb_image, _channels, _width, _height, _bpp) {ImageTMP = NULL; ImageOrg = NULL; doflip = _flip;};
|
CRotateImage(std::string name, uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp, bool _flip = false) : CImageBasis(name, _rgb_image, _channels, _width, _height, _bpp) {ImageTMP = NULL; ImageOrg = NULL; doflip = _flip;};
|
||||||
CRotateImage(std::string name, CImageBasis *_org, CImageBasis *_temp, bool _flip = false);
|
CRotateImage(std::string name, CImageBasis *_org, CImageBasis *_temp, bool _flip = false);
|
||||||
|
|
||||||
void Rotate(float _angle);
|
void Rotate(float _angle);
|
||||||
void RotateAntiAliasing(float _angle);
|
void RotateAntiAliasing(float _angle);
|
||||||
|
|
||||||
void Rotate(float _angle, int _centerx, int _centery);
|
void Rotate(float _angle, int _centerx, int _centery);
|
||||||
void RotateAntiAliasing(float _angle, int _centerx, int _centery);
|
void RotateAntiAliasing(float _angle, int _centerx, int _centery);
|
||||||
|
|
||||||
void Translate(int _dx, int _dy);
|
void Translate(int _dx, int _dy);
|
||||||
void Mirror();
|
};
|
||||||
};
|
|
||||||
|
|
||||||
#endif //CROTATEIMAGE_H
|
#endif //CROTATEIMAGE_H
|
||||||
@@ -1,8 +1,29 @@
|
|||||||
demo
|
|
||||||
WaitBeforeTakingPicture
|
WaitBeforeTakingPicture
|
||||||
ImageQuality
|
CamFrameSize
|
||||||
ImageSize
|
CamGainceiling
|
||||||
FixedExposure
|
CamQuality
|
||||||
|
CamAutoSharpness
|
||||||
|
CamSharpness
|
||||||
|
CamSpecialEffect
|
||||||
|
CamWbMode
|
||||||
|
CamAwb
|
||||||
|
CamAwbGain
|
||||||
|
CamAec
|
||||||
|
CamAec2
|
||||||
|
CamAeLevel
|
||||||
|
CamAecValue
|
||||||
|
CamAgc
|
||||||
|
CamAgcGain
|
||||||
|
CamBpc
|
||||||
|
CamWpc
|
||||||
|
CamRawGma
|
||||||
|
CamLenc
|
||||||
|
CamDcw
|
||||||
|
CamZoom
|
||||||
|
CamZoomSize
|
||||||
|
CamZoomOffsetX
|
||||||
|
CamZoomOffsetY
|
||||||
|
demo
|
||||||
SearchFieldX
|
SearchFieldX
|
||||||
SearchFieldY
|
SearchFieldY
|
||||||
AlignmentAlgo
|
AlignmentAlgo
|
||||||
|
|||||||
15
param-docs/parameter-pages/TakeImage/CamAeLevel.md
Normal file
15
param-docs/parameter-pages/TakeImage/CamAeLevel.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Parameter `CamAeLevel`
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Auto-Exposure Compensation. Lower values produce darker image.
|
||||||
|
|
||||||
|
Range (`-2` .. `2`)
|
||||||
13
param-docs/parameter-pages/TakeImage/CamAec.md
Normal file
13
param-docs/parameter-pages/TakeImage/CamAec.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Parameter `CamAec`
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Auto-Exposure Control Algorithm
|
||||||
13
param-docs/parameter-pages/TakeImage/CamAec2.md
Normal file
13
param-docs/parameter-pages/TakeImage/CamAec2.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Parameter `CamAec2`
|
||||||
|
Default Value: `false`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Switch to "Auto-Exposure Control 2" Algorithm. This may resolve some over-exposure and under-exposure issues.
|
||||||
15
param-docs/parameter-pages/TakeImage/CamAecValue.md
Normal file
15
param-docs/parameter-pages/TakeImage/CamAecValue.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Parameter `CamAecValue`
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
set Manuall-Exposure Control Value
|
||||||
|
|
||||||
|
Range (`0` .. `1200`)
|
||||||
10
param-docs/parameter-pages/TakeImage/CamAgc.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamAgc.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamAgc`
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
This sets the Automatic Gain Control, how the camera responds to the overall level of light in the image.
|
||||||
13
param-docs/parameter-pages/TakeImage/CamAgcGain.md
Normal file
13
param-docs/parameter-pages/TakeImage/CamAgcGain.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Parameter `CamAgcGain`
|
||||||
|
Default Value: ` `
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This is visible when AGC is off. Gain is an amplification of the values read from the image sensor.
|
||||||
|
|
||||||
|
Range (`0` .. `30`)
|
||||||
13
param-docs/parameter-pages/TakeImage/CamAutoSharpness.md
Normal file
13
param-docs/parameter-pages/TakeImage/CamAutoSharpness.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Parameter `CamAutoSharpness`
|
||||||
|
Default Value: `false`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
AutoSharpness
|
||||||
10
param-docs/parameter-pages/TakeImage/CamAwb.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamAwb.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamAwb`
|
||||||
|
Default Value: ` `
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Auto White Balance
|
||||||
10
param-docs/parameter-pages/TakeImage/CamAwbGain.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamAwbGain.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamAwbGain`
|
||||||
|
Default Value: ` `
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Auto White Balance Gain
|
||||||
10
param-docs/parameter-pages/TakeImage/CamBpc.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamBpc.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamBpc`
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Black Pixel Correction
|
||||||
10
param-docs/parameter-pages/TakeImage/CamBrightness.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamBrightness.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamBrightness`
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Image Brightness (`-2` .. `2`)
|
||||||
5
param-docs/parameter-pages/TakeImage/CamColorbar.md
Normal file
5
param-docs/parameter-pages/TakeImage/CamColorbar.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Parameter `CamColorbar`
|
||||||
|
Default Value: `false`
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
11
param-docs/parameter-pages/TakeImage/CamContrast.md
Normal file
11
param-docs/parameter-pages/TakeImage/CamContrast.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Parameter `CamContrast`
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Image Contrast (`-2` .. `2`)
|
||||||
|
|
||||||
13
param-docs/parameter-pages/TakeImage/CamDcw.md
Normal file
13
param-docs/parameter-pages/TakeImage/CamDcw.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Parameter `CamDcw`
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
When DCW is on, the image that you receive will be the size that you requested (VGA, QQVGA, etc).
|
||||||
|
When DCW is off, the image that you receive will be one of UXGA, SVGA, or CIF. In other words, literally the actual image size as read from the sensor without any scaling.
|
||||||
|
Note that if DCW is off, and you pick a different image size, this implicitly turns DCW back on again (although this isn't reflected in the options).
|
||||||
10
param-docs/parameter-pages/TakeImage/CamDenoise.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamDenoise.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamDenoise`
|
||||||
|
Default Value: ` `
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Denoise Image (not supported)
|
||||||
21
param-docs/parameter-pages/TakeImage/CamGainceiling.md
Normal file
21
param-docs/parameter-pages/TakeImage/CamGainceiling.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Parameter `CamGainceiling`
|
||||||
|
Default Value: `x2`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This is visible when AGC is on.
|
||||||
|
|
||||||
|
Available options:
|
||||||
|
|
||||||
|
- `x2`
|
||||||
|
- `x4`
|
||||||
|
- `x8`
|
||||||
|
- `x16`
|
||||||
|
- `x32`
|
||||||
|
- `x64`
|
||||||
|
- `x128`
|
||||||
10
param-docs/parameter-pages/TakeImage/CamHmirror.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamHmirror.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamHmirror`
|
||||||
|
Default Value: `false`
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Option for initially mirroring the image on the original x-axis.
|
||||||
10
param-docs/parameter-pages/TakeImage/CamLenc.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamLenc.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamLenc`
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Lens Correction
|
||||||
10
param-docs/parameter-pages/TakeImage/CamQuality.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamQuality.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamQuality`
|
||||||
|
Default Value: `12`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
Quality index for pictures: `8` (highest quality) ... `63` (lowest quality)
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
Value below 12 could result in system instabilities!
|
||||||
10
param-docs/parameter-pages/TakeImage/CamRawGma.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamRawGma.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamRawGma`
|
||||||
|
Default Value: ` `
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
RawGma
|
||||||
11
param-docs/parameter-pages/TakeImage/CamSaturation.md
Normal file
11
param-docs/parameter-pages/TakeImage/CamSaturation.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Parameter `CamSaturation`
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Image Saturation (`-2` .. `2`)
|
||||||
|
|
||||||
13
param-docs/parameter-pages/TakeImage/CamSharpness.md
Normal file
13
param-docs/parameter-pages/TakeImage/CamSharpness.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Parameter `CamSharpness`
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Range (`-2` .. `2`)
|
||||||
21
param-docs/parameter-pages/TakeImage/CamSpecialEffect.md
Normal file
21
param-docs/parameter-pages/TakeImage/CamSpecialEffect.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Parameter `CamSpecialEffect`
|
||||||
|
Default Value: `no_effect`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Available options:
|
||||||
|
|
||||||
|
- `no_effect`
|
||||||
|
- `negative`
|
||||||
|
- `grayscale`
|
||||||
|
- `red`
|
||||||
|
- `green`
|
||||||
|
- `blue`
|
||||||
|
- `retro`
|
||||||
10
param-docs/parameter-pages/TakeImage/CamVflip.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamVflip.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamVflip`
|
||||||
|
Default Value: `false`
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Option for initially flip the image on the original y-axis.
|
||||||
18
param-docs/parameter-pages/TakeImage/CamWbMode.md
Normal file
18
param-docs/parameter-pages/TakeImage/CamWbMode.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Parameter `CamWbMode`
|
||||||
|
Default Value: `auto`
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
White Balance Mode
|
||||||
|
|
||||||
|
Available options:
|
||||||
|
|
||||||
|
- `auto`
|
||||||
|
- `sunny`
|
||||||
|
- `cloudy`
|
||||||
|
- `office`
|
||||||
|
- `home`
|
||||||
10
param-docs/parameter-pages/TakeImage/CamWpc.md
Normal file
10
param-docs/parameter-pages/TakeImage/CamWpc.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Parameter `CamWpc`
|
||||||
|
Default Value: `true`
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
White Pixel Correction
|
||||||
13
param-docs/parameter-pages/TakeImage/CamZoom.md
Normal file
13
param-docs/parameter-pages/TakeImage/CamZoom.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Parameter `CamZoom`
|
||||||
|
Default Value: `false`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
Crop the camera sensor frame to `ImageSize` resolution instead of scaling it down.
|
||||||
14
param-docs/parameter-pages/TakeImage/CamZoomOffsetX.md
Normal file
14
param-docs/parameter-pages/TakeImage/CamZoomOffsetX.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Parameter `CamZoomOffsetX`
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
`ZoomOffsetX` only applies when `Zoom` is enabled.
|
||||||
|
X coordinate of the crop location within the camera sensor frame.
|
||||||
14
param-docs/parameter-pages/TakeImage/CamZoomOffsetY.md
Normal file
14
param-docs/parameter-pages/TakeImage/CamZoomOffsetY.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Parameter `CamZoomOffsetY`
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
`ZoomOffsetY` only applies when `Zoom` is enabled.
|
||||||
|
Y coordinate of the crop location within the camera sensor frame.
|
||||||
13
param-docs/parameter-pages/TakeImage/CamZoomSize.md
Normal file
13
param-docs/parameter-pages/TakeImage/CamZoomSize.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Parameter `CamZoomSize`
|
||||||
|
Default Value: `0`
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
This is an **Expert Parameter**! Only change it if you understand what it does!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
This parameter can also be set on the Reference Image configuration page!
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
After changing this parameter you need to update your reference image and alignment markers!
|
||||||
|
|
||||||
|
`CamZoomSize` only applies when `Zoom` is enabled.
|
||||||
@@ -1,123 +1,136 @@
|
|||||||
[TakeImage]
|
[TakeImage]
|
||||||
;RawImagesLocation = /log/source
|
;RawImagesLocation = /log/source
|
||||||
WaitBeforeTakingPicture = 5
|
;RawImagesRetention = 15
|
||||||
;RawImagesRetention = 15
|
WaitBeforeTakingPicture = 2
|
||||||
Brightness = 0
|
CamGainceiling = x4
|
||||||
Contrast = 0
|
CamQuality = 8
|
||||||
Saturation = 0
|
CamBrightness = 0
|
||||||
Sharpness = 0
|
CamContrast = 0
|
||||||
LEDIntensity = 50
|
CamSaturation = 0
|
||||||
ImageQuality = 12
|
CamSharpness = 1
|
||||||
ImageSize = VGA
|
CamAutoSharpness = false
|
||||||
Zoom = false
|
CamSpecialEffect = no_effect
|
||||||
ZoomMode = 0
|
CamWbMode = auto
|
||||||
ZoomOffsetX = 0
|
CamAwb = true
|
||||||
ZoomOffsetY = 0
|
CamAwbGain = true
|
||||||
Grayscale = false
|
CamAec = true
|
||||||
Negative = false
|
CamAec2 = true
|
||||||
Aec2 = false
|
CamAeLevel = 2
|
||||||
AutoExposureLevel = 0
|
CamAecValue = 500
|
||||||
FixedExposure = false
|
CamAgc = true
|
||||||
Demo = false
|
CamAgcGain = 0
|
||||||
|
CamBpc = true
|
||||||
[Alignment]
|
CamWpc = true
|
||||||
InitialRotate = 0.0
|
CamRawGma = true
|
||||||
InitialMirror = false
|
CamLenc = true
|
||||||
SearchFieldX = 20
|
CamHmirror = false
|
||||||
SearchFieldY = 20
|
CamVflip = false
|
||||||
AlignmentAlgo = Default
|
CamDcw = true
|
||||||
FlipImageSize = false
|
CamZoom = false
|
||||||
/config/ref0.jpg 103 271
|
CamZoomOffsetX = 0
|
||||||
/config/ref1.jpg 442 142
|
CamZoomOffsetY = 0
|
||||||
|
CamZoomSize = 0
|
||||||
[Digits]
|
LEDIntensity = 50
|
||||||
Model = /config/dig-cont_0700_s3_q.tflite
|
Demo = false
|
||||||
CNNGoodThreshold = 0.5
|
|
||||||
;ROIImagesLocation = /log/digit
|
[Alignment]
|
||||||
;ROIImagesRetention = 3
|
InitialRotate = 0.0
|
||||||
main.dig1 294 126 30 54 false
|
InitialMirror = false
|
||||||
main.dig2 343 126 30 54 false
|
SearchFieldX = 20
|
||||||
main.dig3 391 126 30 54 false
|
SearchFieldY = 20
|
||||||
|
AlignmentAlgo = Default
|
||||||
[Analog]
|
FlipImageSize = false
|
||||||
Model = /config/ana-cont_1300_s2.tflite
|
/config/ref0.jpg 103 271
|
||||||
CNNGoodThreshold = 0.5
|
/config/ref1.jpg 442 142
|
||||||
;ROIImagesLocation = /log/analog
|
|
||||||
;ROIImagesRetention = 3
|
[Digits]
|
||||||
main.ana1 432 230 92 92 false
|
Model = /config/dig-cont_0700_s3_q.tflite
|
||||||
main.ana2 379 332 92 92 false
|
CNNGoodThreshold = 0.5
|
||||||
main.ana3 283 374 92 92 false
|
;ROIImagesLocation = /log/digit
|
||||||
main.ana4 155 328 92 92 false
|
;ROIImagesRetention = 3
|
||||||
|
main.dig1 294 126 30 54 false
|
||||||
[PostProcessing]
|
main.dig2 343 126 30 54 false
|
||||||
main.DecimalShift = 0
|
main.dig3 391 126 30 54 false
|
||||||
main.AnalogDigitalTransitionStart = 9.2
|
|
||||||
PreValueUse = true
|
[Analog]
|
||||||
PreValueAgeStartup = 720
|
Model = /config/ana-cont_1300_s2.tflite
|
||||||
main.AllowNegativeRates = false
|
CNNGoodThreshold = 0.5
|
||||||
main.MaxRateValue = 0.05
|
;ROIImagesLocation = /log/analog
|
||||||
;main.MaxRateType = AbsoluteChange
|
;ROIImagesRetention = 3
|
||||||
main.ExtendedResolution = false
|
main.ana1 432 230 92 92 false
|
||||||
main.IgnoreLeadingNaN = false
|
main.ana2 379 332 92 92 false
|
||||||
ErrorMessage = true
|
main.ana3 283 374 92 92 false
|
||||||
CheckDigitIncreaseConsistency = false
|
main.ana4 155 328 92 92 false
|
||||||
|
|
||||||
;[MQTT]
|
[PostProcessing]
|
||||||
;Uri = mqtt://IP-ADRESS:1883
|
main.DecimalShift = 0
|
||||||
;MainTopic = watermeter
|
main.AnalogDigitalTransitionStart = 9.2
|
||||||
;ClientID = watermeter
|
PreValueUse = true
|
||||||
;user = USERNAME
|
PreValueAgeStartup = 720
|
||||||
;password = PASSWORD
|
main.AllowNegativeRates = false
|
||||||
RetainMessages = false
|
main.MaxRateValue = 0.05
|
||||||
HomeassistantDiscovery = false
|
;main.MaxRateType = AbsoluteChange
|
||||||
;MeterType = other
|
main.ExtendedResolution = false
|
||||||
;CACert = /config/certs/RootCA.pem
|
main.IgnoreLeadingNaN = false
|
||||||
;ClientCert = /config/certs/client.pem.crt
|
ErrorMessage = true
|
||||||
;ClientKey = /config/certs/client.pem.key
|
CheckDigitIncreaseConsistency = false
|
||||||
|
|
||||||
;[InfluxDB]
|
;[MQTT]
|
||||||
;Uri = undefined
|
;Uri = mqtt://IP-ADRESS:1883
|
||||||
;Database = undefined
|
;MainTopic = watermeter
|
||||||
;Measurement = undefined
|
;ClientID = watermeter
|
||||||
;user = undefined
|
;user = USERNAME
|
||||||
;password = undefined
|
;password = PASSWORD
|
||||||
|
RetainMessages = false
|
||||||
;[InfluxDBv2]
|
HomeassistantDiscovery = false
|
||||||
;Uri = undefined
|
;MeterType = other
|
||||||
;Bucket = undefined
|
;CACert = /config/certs/RootCA.pem
|
||||||
;Measurement = undefined
|
;ClientCert = /config/certs/client.pem.crt
|
||||||
;Org = undefined
|
;ClientKey = /config/certs/client.pem.key
|
||||||
;Token = undefined
|
|
||||||
;main.Fieldname = undefined
|
;[InfluxDB]
|
||||||
|
;Uri = undefined
|
||||||
;[GPIO]
|
;Database = undefined
|
||||||
;MainTopicMQTT = wasserzaehler/GPIO
|
;Measurement = undefined
|
||||||
;IO0 = input disabled 10 false false
|
;user = undefined
|
||||||
;IO1 = input disabled 10 false false
|
;password = undefined
|
||||||
;IO3 = input disabled 10 false false
|
|
||||||
;IO4 = built-in-led disabled 10 false false
|
;[InfluxDBv2]
|
||||||
;IO12 = input-pullup disabled 10 false false
|
;Uri = undefined
|
||||||
;IO13 = input-pullup disabled 10 false false
|
;Bucket = undefined
|
||||||
LEDType = WS2812
|
;Measurement = undefined
|
||||||
LEDNumbers = 2
|
;Org = undefined
|
||||||
LEDColor = 150 150 150
|
;Token = undefined
|
||||||
|
;main.Fieldname = undefined
|
||||||
[AutoTimer]
|
|
||||||
AutoStart = true
|
;[GPIO]
|
||||||
Interval = 5
|
;MainTopicMQTT = wasserzaehler/GPIO
|
||||||
|
;IO0 = input disabled 10 false false
|
||||||
[DataLogging]
|
;IO1 = input disabled 10 false false
|
||||||
DataLogActive = true
|
;IO3 = input disabled 10 false false
|
||||||
DataFilesRetention = 3
|
;IO4 = built-in-led disabled 10 false false
|
||||||
|
;IO12 = input-pullup disabled 10 false false
|
||||||
[Debug]
|
;IO13 = input-pullup disabled 10 false false
|
||||||
LogLevel = 1
|
LEDType = WS2812
|
||||||
LogfilesRetention = 3
|
LEDNumbers = 2
|
||||||
|
LEDColor = 150 150 150
|
||||||
[System]
|
|
||||||
TimeZone = CET-1CEST,M3.5.0,M10.5.0/3
|
[AutoTimer]
|
||||||
;TimeServer = pool.ntp.org
|
AutoStart = true
|
||||||
;Hostname = undefined
|
Interval = 5
|
||||||
RSSIThreshold = -75
|
|
||||||
CPUFrequency = 160
|
[DataLogging]
|
||||||
SetupMode = true
|
DataLogActive = true
|
||||||
|
DataFilesRetention = 3
|
||||||
|
|
||||||
|
[Debug]
|
||||||
|
LogLevel = 1
|
||||||
|
LogfilesRetention = 3
|
||||||
|
|
||||||
|
[System]
|
||||||
|
TimeZone = CET-1CEST,M3.5.0,M10.5.0/3
|
||||||
|
;TimeServer = pool.ntp.org
|
||||||
|
;Hostname = undefined
|
||||||
|
RSSIThreshold = -75
|
||||||
|
CPUFrequency = 160
|
||||||
|
SetupMode = true
|
||||||
|
|||||||
@@ -113,49 +113,56 @@
|
|||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col span="1" style="width: 33.3%;">
|
<col span="1" style="width: 33.3%;">
|
||||||
<col span="1" style="width: 33.3%;">
|
<col span="1" style="width: 33.3%;">
|
||||||
<col span="1" style="width: 33.3%;">
|
<col span="1" style="width: 33.3%;">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr>
|
|
||||||
<td>Marker:
|
<tr>
|
||||||
<select id="index" name="reference" onchange="ChangeSelection()">
|
<td>Marker:
|
||||||
<option value="0" selected>Marker 1</option>
|
<select id="index" name="reference" onchange="ChangeSelection()">
|
||||||
<option value="1" >Marker 2</option>
|
<option value="0" selected>Marker 1</option>
|
||||||
</select>
|
<option value="1" >Marker 2</option>
|
||||||
</td>
|
</select>
|
||||||
<td colspan="2" style="padding-left: 22px; color: grey;">Filename: <output type="text" name="name" id="name" onchange="namechanged()"></td>
|
</td>
|
||||||
</tr>
|
<td colspan="2" style="padding-left: 22px; color: grey;">Filename: <output type="text" name="name" id="name" onchange="namechanged()"></td>
|
||||||
<tr>
|
</tr>
|
||||||
<td style="padding-top: 10px">x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()"></td>
|
|
||||||
<td style="padding-top: 10px">dx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchanged()"></td>
|
<tr>
|
||||||
<td rowspan="2" style="padding-top: 10px;"><input class="button" type="button" value="Update Marker" onclick="CutOutReference()"></td>
|
<td style="padding-top: 10px">x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()"></td>
|
||||||
</tr>
|
<td style="padding-top: 10px">dx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchanged()"></td>
|
||||||
<tr>
|
<td rowspan="2" style="padding-top: 10px;"><input class="button" type="button" value="Update Marker" onclick="CutOutReference()"></td>
|
||||||
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()"></td>
|
</tr>
|
||||||
<td>dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()"></td>
|
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()"></td>
|
||||||
<td style="vertical-align: bottom;">Selected Image Area:</td>
|
<td>dy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()"></td>
|
||||||
<td style="vertical-align: bottom;">Resulting Marker:</td>
|
</tr>
|
||||||
<td><input class="button" type="button" id="enhancecontrast" value="Enhance Image Contrast" onclick="EnhanceContrast()"></td>
|
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<td style="vertical-align: bottom;">Selected Image Area:</td>
|
||||||
<td style="height:70px; vertical-align: top;"><img id="img_ref_org" src = ""></td> <!--/img_tmp/ref_zw_org.jpg-->
|
<td style="vertical-align: bottom;">Resulting Marker:</td>
|
||||||
<td style="height:70px; vertical-align: top;"><img id="img_ref" src = ""></td> <!--/img_tmp/ref_zw.jpg-->
|
<td><input class="button" type="button" id="enhancecontrast" value="Enhance Image Contrast" onclick="EnhanceContrast()"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td style="vertical-align:bottom;"><b>Reference Image:</b></td>
|
<tr>
|
||||||
<td></td>
|
<td style="height:70px; vertical-align: top;"><img id="img_ref_org" src = ""></td> <!--/img_tmp/ref_zw_org.jpg-->
|
||||||
<td><input style="font-weight:bold;" class="button" type="submit" name="saveroi" id="savemarker" onclick="SaveToConfig()" value="Save New Marker">
|
<td style="height:70px; vertical-align: top;"><img id="img_ref" src = ""></td> <!--/img_tmp/ref_zw.jpg-->
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3"><canvas id="canvas" crossorigin></canvas></td>
|
<td style="vertical-align:bottom;"><b>Reference Image:</b></td>
|
||||||
</tr>
|
<td></td>
|
||||||
</table>
|
<td>
|
||||||
|
<input style="font-weight:bold;" class="button" type="submit" name="saveroi" id="savemarker" onclick="SaveToConfig()" value="Save New Marker">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="3"><canvas id="canvas" crossorigin></canvas></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
|
<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
|
||||||
<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
|
<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
|
||||||
@@ -173,6 +180,7 @@ var canvas = document.getElementById('canvas'),
|
|||||||
domainname = getDomainname(),
|
domainname = getDomainname(),
|
||||||
neueref1,
|
neueref1,
|
||||||
neueref2,
|
neueref2,
|
||||||
|
cofcat,
|
||||||
param;
|
param;
|
||||||
|
|
||||||
function doReboot() {
|
function doReboot() {
|
||||||
@@ -290,8 +298,7 @@ function UpdateReference(){
|
|||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
_filenameurl = refInfo[aktindex]["name"].replace("/config/", "/img_tmp/");
|
var _filenameurl = refInfo[aktindex]["name"].replace("/config/", "/img_tmp/");
|
||||||
|
|
||||||
var url = domainname + "/fileserver" + _filenameurl + "?" + Date.now();
|
var url = domainname + "/fileserver" + _filenameurl + "?" + Date.now();
|
||||||
document.getElementById("img_ref").src = url;
|
document.getElementById("img_ref").src = url;
|
||||||
|
|
||||||
@@ -352,7 +359,7 @@ function openDescription() {
|
|||||||
if(window.location.hash) {
|
if(window.location.hash) {
|
||||||
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
|
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
|
||||||
if(hash == 'description') {
|
if(hash == 'description') {
|
||||||
document.getElementById("desc_details").open = true;
|
document.getElementById("desc_details").open = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -368,7 +375,7 @@ function LoadReference(){
|
|||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
_filenameurl = refInfo[aktindex]["name"];
|
var _filenameurl = refInfo[aktindex]["name"];
|
||||||
var url = domainname + "/fileserver" + _filenameurl + "?" + Date.now();
|
var url = domainname + "/fileserver" + _filenameurl + "?" + Date.now();
|
||||||
document.getElementById("img_ref").src = url;
|
document.getElementById("img_ref").src = url;
|
||||||
|
|
||||||
@@ -387,17 +394,23 @@ function LoadReference(){
|
|||||||
function init() {
|
function init() {
|
||||||
openDescription();
|
openDescription();
|
||||||
domainname = getDomainname();
|
domainname = getDomainname();
|
||||||
loadConfig(domainname);
|
|
||||||
|
if (!loadConfig(domainname)) {
|
||||||
|
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ParseConfig();
|
ParseConfig();
|
||||||
param = getConfigParameters();
|
param = getConfigParameters();
|
||||||
|
cofcat = getConfigCategory();
|
||||||
|
|
||||||
document.getElementById("savemarker").disabled = true;
|
document.getElementById("savemarker").disabled = true;
|
||||||
document.getElementById("enhancecontrast").disabled = true;
|
document.getElementById("enhancecontrast").disabled = true;
|
||||||
|
|
||||||
canvas.addEventListener('mousedown', mouseDown, false);
|
canvas.addEventListener('mousedown', mouseDown, false);
|
||||||
canvas.addEventListener('mouseup', mouseUp, false);
|
canvas.addEventListener('mouseup', mouseUp, false);
|
||||||
canvas.addEventListener('mousemove', mouseMove, false);
|
canvas.addEventListener('mousemove', mouseMove, false);
|
||||||
loadCanvas(domainname + "/fileserver/config/reference.jpg");
|
loadCanvas(domainname + "/fileserver/config/reference.jpg");
|
||||||
|
|
||||||
//CopyReferenceToImgTmp(domainname);
|
//CopyReferenceToImgTmp(domainname);
|
||||||
refInfo = GetReferencesInfo();
|
refInfo = GetReferencesInfo();
|
||||||
@@ -405,6 +418,7 @@ function init() {
|
|||||||
//UpdateReference();
|
//UpdateReference();
|
||||||
LoadReference();
|
LoadReference();
|
||||||
drawImage();
|
drawImage();
|
||||||
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawImage(){
|
function drawImage(){
|
||||||
|
|||||||
@@ -125,7 +125,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<div id="div1">
|
<div id="div1">
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col span="1" style="width: 22%;">
|
<col span="1" style="width: 22%;">
|
||||||
@@ -133,9 +132,11 @@
|
|||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4" style="padding: 0px"><class id="Numbers_text" style="color:black;">Number Sequence:</class></td>
|
<td colspan="4" style="padding: 0px"><class id="Numbers_text" style="color:black;">Number Sequence:</class></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<select id="Numbers_value1" onchange="numberChanged()">
|
<select id="Numbers_value1" onchange="numberChanged()">
|
||||||
@@ -156,15 +157,18 @@
|
|||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding: 0px">ROI:</td>
|
<td style="padding: 0px">ROI:</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><select id="index" name="index" onchange="ChangeSelection()" tabindex=1></select></td>
|
<td><select id="index" name="index" onchange="ChangeSelection()" tabindex=1></select></td>
|
||||||
<td><input class="button" type="submit" id="newROI" name="newROI" onclick="newROI()" value="New ROI"></td>
|
<td><input class="button" type="submit" id="newROI" name="newROI" onclick="newROI()" value="New ROI"></td>
|
||||||
<td><input class="button" type="submit" id="renameROI" name="renameROI" onclick="renameROI()" value="Rename ROI"></td>
|
<td><input class="button" type="submit" id="renameROI" name="renameROI" onclick="renameROI()" value="Rename ROI"></td>
|
||||||
<td><input class="button" type="submit" id="deleteROI" name="deleteROI" onclick="deleteROI()" value="Delete ROI"></td>
|
<td><input class="button" type="submit" id="deleteROI" name="deleteROI" onclick="deleteROI()" value="Delete ROI"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="multiplier">Multiplier: <output type="text" id="multiplier" name="multiplier"></output><br>
|
<td class="multiplier">Multiplier: <output type="text" id="multiplier" name="multiplier"></output><br>
|
||||||
(only based on order)
|
(only based on order)
|
||||||
@@ -183,14 +187,17 @@
|
|||||||
<col span="1" style="width: 18%;">
|
<col span="1" style="width: 18%;">
|
||||||
<col span="1" style="width: 64%;">
|
<col span="1" style="width: 64%;">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()" tabindex=2></td>
|
<td>x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()" tabindex=2></td>
|
||||||
<td>Δx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()" tabindex=4></td>
|
<td>Δx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()" tabindex=4></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()" tabindex=3></td>
|
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()" tabindex=3></td>
|
||||||
<td>Δy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()" tabindex=5></td>
|
<td>Δy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()" tabindex=5></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3"><input type="checkbox" id="CCW" name="CCW" value="0" onclick="changeCCW()" unchecked tabindex=8><label for="CCW">Counter clockwise rotation (CCW)</label></td>
|
<td colspan="3"><input type="checkbox" id="CCW" name="CCW" value="0" onclick="changeCCW()" unchecked tabindex=8><label for="CCW">Counter clockwise rotation (CCW)</label></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -202,7 +209,6 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
<input type="checkbox" id="showall" name="showall" value="1" onclick="draw()" checked tabindex=9><label for="showall">Show all ROIs</label><br>
|
<input type="checkbox" id="showall" name="showall" value="1" onclick="draw()" checked tabindex=9><label for="showall">Show all ROIs</label><br>
|
||||||
<input type="checkbox" id="lockAspectRatio" name="lockAspectRatio" value="1" onclick="changelockAspectRatio()" checked tabindex=6><label for="lockAspectRatio"> Lock aspect ratio </label><br>
|
<input type="checkbox" id="lockAspectRatio" name="lockAspectRatio" value="1" onclick="changelockAspectRatio()" checked tabindex=6><label for="lockAspectRatio"> Lock aspect ratio </label><br>
|
||||||
<input type="checkbox" id="lockSizes" name="lockSizes" value="1" onclick="changelockSizes()" checked tabindex=7><label for="lockSizes"> Synchronize y, Δx and Δy between ROIs</label><br>
|
<input type="checkbox" id="lockSizes" name="lockSizes" value="1" onclick="changelockSizes()" checked tabindex=7><label for="lockSizes"> Synchronize y, Δx and Δy between ROIs</label><br>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
@@ -212,20 +218,23 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" style="vertical-align: bottom;"><b>Reference Image:</b></td>
|
<td colspan="3" style="vertical-align: bottom;"><b>Reference Image:</b></td>
|
||||||
<!---<td><button class="button" id="reboot" type="button" onclick="doReboot()">Reboot device</button></td>-->
|
<td>
|
||||||
<td><input style="font-weight:bold;" class="button" type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save Config" tabindex=10></td>
|
<input style="font-weight:bold;" class="button" type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save Config" tabindex=10>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4"><canvas id="canvas" crossorigin></canvas></td>
|
<td colspan="4"><canvas id="canvas" crossorigin></canvas></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
|
<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
|
||||||
<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
|
<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
|
||||||
<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
|
<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
|
||||||
|
<script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
|
||||||
|
|
||||||
<script language="JavaScript">
|
<script language="JavaScript">
|
||||||
var canvas = document.getElementById('canvas'),
|
var canvas = document.getElementById('canvas'),
|
||||||
@@ -595,7 +604,7 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
if(window.location.hash) {
|
if(window.location.hash) {
|
||||||
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
|
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
|
||||||
if(hash == 'description') {
|
if(hash == 'description') {
|
||||||
document.getElementById("desc_details").open = true;
|
document.getElementById("desc_details").open = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -603,18 +612,26 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
function init() {
|
function init() {
|
||||||
openDescription();
|
openDescription();
|
||||||
domainname = getDomainname();
|
domainname = getDomainname();
|
||||||
canvas.addEventListener('mousedown', mouseDown, false);
|
|
||||||
canvas.addEventListener('mouseup', mouseUp, false);
|
if (!loadConfig(domainname)) {
|
||||||
canvas.addEventListener('mousemove', mouseMove, false);
|
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
|
||||||
loadCanvas(domainname + "/fileserver/config/reference.jpg");
|
return;
|
||||||
loadConfig(domainname);
|
}
|
||||||
|
|
||||||
ParseConfig();
|
ParseConfig();
|
||||||
param = getConfigParameters();
|
param = getConfigParameters();
|
||||||
cofcat = getConfigCategory();
|
cofcat = getConfigCategory();
|
||||||
|
|
||||||
|
canvas.addEventListener('mousedown', mouseDown, false);
|
||||||
|
canvas.addEventListener('mouseup', mouseUp, false);
|
||||||
|
canvas.addEventListener('mousemove', mouseMove, false);
|
||||||
|
loadCanvas(domainname + "/fileserver/config/reference.jpg");
|
||||||
|
|
||||||
UpdateNUMBERS();
|
UpdateNUMBERS();
|
||||||
|
|
||||||
/* Check if the ROIs have same dy and dx. If so, tick the sync checkbox */
|
/* Check if the ROIs have same dy and dx. If so, tick the sync checkbox */
|
||||||
var all_dx_dy_Identical = true;
|
var all_dx_dy_Identical = true;
|
||||||
|
|
||||||
if (ROIInfo.length > 1) {
|
if (ROIInfo.length > 1) {
|
||||||
for (var i = 1; i < (ROIInfo.length); ++i) { // 2nd .. last ROI
|
for (var i = 1; i < (ROIInfo.length); ++i) { // 2nd .. last ROI
|
||||||
if (parseInt(ROIInfo[i].dx) != parseInt(ROIInfo[0].dx) || parseInt(ROIInfo[i].dy) != parseInt(ROIInfo[0].dy)) {
|
if (parseInt(ROIInfo[i].dx) != parseInt(ROIInfo[0].dx) || parseInt(ROIInfo[i].dy) != parseInt(ROIInfo[0].dy)) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@
|
|||||||
p {font-size: 1em;}
|
p {font-size: 1em;}
|
||||||
|
|
||||||
input[type=number] {
|
input[type=number] {
|
||||||
width: 40px;
|
width: 60px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
padding: 3px 5px;
|
padding: 3px 5px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -123,17 +123,25 @@
|
|||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4" style="padding: 0px"><class id="Numbers_text" style="color:black;">Number Sequence:</class></td>
|
<td colspan="4" style="padding: 0px"><class id="Numbers_text" style="color:black;">Number Sequence:</class></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<select id="Numbers_value1" onchange="numberChanged()">
|
<select id="Numbers_value1" onchange="numberChanged()">
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td><input class="button" type="submit" id="newNumber" name="newNumber" onclick="newNumber()" value="New Sequence"></td>
|
<td>
|
||||||
<td><input class="button" type="submit" id="renameNumber" name="renameNumber" onclick="renameNumber()" value="Rename Sequence"></td>
|
<input class="button" type="submit" id="newNumber" name="newNumber" onclick="newNumber()" value="New Sequence">
|
||||||
<td><input class="button" type="submit" id="removeNumber" name="removeNumber" onclick="removeNumber()" value="Delete Sequence"></td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="button" type="submit" id="renameNumber" name="renameNumber" onclick="renameNumber()" value="Rename Sequence">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="button" type="submit" id="removeNumber" name="removeNumber" onclick="removeNumber()" value="Delete Sequence">
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@@ -146,15 +154,26 @@
|
|||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding: 0px">ROI:</td>
|
<td style="padding: 0px">ROI:</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><select id="index" name="index" onchange="ChangeSelection()" tabindex=1></select></td>
|
<td>
|
||||||
<td><input class="button" type="submit" id="newROI" name="newROI" onclick="newROI()" value="New ROI"></td>
|
<select id="index" name="index" onchange="ChangeSelection()" tabindex=1></select>
|
||||||
<td><input class="button" type="submit" id="renameROI" name="renameROI" onclick="renameROI()" value="Rename ROI"></td>
|
</td>
|
||||||
<td><input class="button" type="submit" id="deleteROI" name="deleteROI" onclick="deleteROI()" value="Delete ROI"></td>
|
<td>
|
||||||
|
<input class="button" type="submit" id="newROI" name="newROI" onclick="newROI()" value="New ROI">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="button" type="submit" id="renameROI" name="renameROI" onclick="renameROI()" value="Rename ROI">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="button" type="submit" id="deleteROI" name="deleteROI" onclick="deleteROI()" value="Delete ROI">
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="multiplier">Multiplier: <output type="text" id="multiplier" name="multiplier"></output><br>
|
<td class="multiplier">Multiplier: <output type="text" id="multiplier" name="multiplier"></output><br>
|
||||||
(only based on order)
|
(only based on order)
|
||||||
@@ -162,8 +181,12 @@
|
|||||||
<td class="multiplier">Multiplier: <output type="text" id="multiplier_decshift" name="multiplier_decshift"></output><br>
|
<td class="multiplier">Multiplier: <output type="text" id="multiplier_decshift" name="multiplier_decshift"></output><br>
|
||||||
(order + decimal shift: <output type="text" id="decimalShift" name="decimalShift"></output>)
|
(order + decimal shift: <output type="text" id="decimalShift" name="decimalShift"></output>)
|
||||||
</td>
|
</td>
|
||||||
<td><input class="button" type="submit" id="movePrevious" onclick="movePrevious()" value="Move ROI Higher"></td>
|
<td>
|
||||||
<td><input class="button" type="submit" id="moveNext" onclick="moveNext()" value="Move ROI Lower"></td>
|
<input class="button" type="submit" id="movePrevious" onclick="movePrevious()" value="Move ROI Higher">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input class="button" type="submit" id="moveNext" onclick="moveNext()" value="Move ROI Lower">
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@@ -173,10 +196,12 @@
|
|||||||
<col span="1" style="width: 18%;">
|
<col span="1" style="width: 18%;">
|
||||||
<col span="1" style="width: 64%;">
|
<col span="1" style="width: 64%;">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()" tabindex=2></td>
|
<td>x: <input type="number" name="refx" id="refx" step=1 onchange="valuemanualchanged()" tabindex=2></td>
|
||||||
<td>Δx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()" tabindex=4></td>
|
<td>Δx: <input type="number" name="refdx" id="refdx" step=1 onchange="valuemanualchangeddx()" tabindex=4></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()" tabindex=3></td>
|
<td>y: <input type="number" name="refy" id="refy" step=1 onchange="valuemanualchanged()" tabindex=3></td>
|
||||||
<td>Δy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()" tabindex=5></td>
|
<td>Δy: <input type="number" name="refdy" id="refdy" step=1 onchange="valuemanualchanged()" tabindex=5></td>
|
||||||
@@ -186,11 +211,11 @@
|
|||||||
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
The following settings are only used for easier setup, they are <b>not</b> persisted on the device:<br>
|
The following settings are only used for easier setup, they are <b>not</b> persisted on the device:<br>
|
||||||
<input type="checkbox" id="showall" name="showall" value="1" onclick="draw()" checked tabindex=10><label for="showall">Show all ROIs</label><br>
|
<input type="checkbox" id="showall" name="showall" value="1" onclick="draw()" checked tabindex=10><label for="showall">Show all ROIs</label><br>
|
||||||
<input type="checkbox" id="lockAspectRatio" name="lockAspectRatio" value="1" onclick="changelockAspectRatio()" checked tabindex=6><label for="lockAspectRatio"> Lock aspect ratio </label><br>
|
<input type="checkbox" id="lockAspectRatio" name="lockAspectRatio" value="1" onclick="changelockAspectRatio()" checked tabindex=6><label for="lockAspectRatio"> Lock aspect ratio </label><br>
|
||||||
<input type="checkbox" id="lockSizes" name="lockSizes" value="1" onclick="changelockSizes()" checked tabindex=7><label for="lockSizes"> Synchronize y, Δx and Δy between ROIs</label><br>
|
<input type="checkbox" id="lockSizes" name="lockSizes" value="1" onclick="changelockSizes()" checked tabindex=7><label for="lockSizes"> Synchronize y, Δx and Δy between ROIs</label><br>
|
||||||
<input type="checkbox" id="lockSpaceEquidistant" name="lockSpaceEquidistant" value="1" onclick="changeLockSpaceEquidistant()" checked tabindex=8>
|
<input type="checkbox" id="lockSpaceEquidistant" name="lockSpaceEquidistant" value="1" onclick="changeLockSpaceEquidistant()" checked tabindex=8>
|
||||||
<label for="lockSpaceEquidistant">Keep equidistance of <input type="number" name="space" id="space" maxlength="2" max=99 step=1 onchange="valuemanualchangedspace()" tabindex=9> between all ROIs</label><br>
|
<label for="lockSpaceEquidistant">Keep equidistance of <input type="number" name="space" id="space" maxlength="2" max=99 step=1 onchange="valuemanualchangedspace()" tabindex=9> between all ROIs</label><br>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@@ -201,10 +226,14 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
<col span="1" style="width: 26%;">
|
<col span="1" style="width: 26%;">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" style="vertical-align: bottom;"><b>Reference Image:</b></td>
|
<td colspan="3" style="vertical-align: bottom;"><b>Reference Image:</b></td>
|
||||||
<td><input style="font-weight:bold;" class="button" type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save Config" tabindex=11></td>
|
<td>
|
||||||
</tr>
|
<input style="font-weight:bold;" class="button" type="submit" id="saveroi" name="saveroi" onclick="SaveToConfig()" value="Save Config" tabindex=11>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4"><canvas id="canvas" crossorigin></canvas></td>
|
<td colspan="4"><canvas id="canvas" crossorigin></canvas></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -491,6 +520,7 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
}
|
}
|
||||||
|
|
||||||
var _index = document.getElementById("index");
|
var _index = document.getElementById("index");
|
||||||
|
|
||||||
while (_index.length){
|
while (_index.length){
|
||||||
_index.remove(0);
|
_index.remove(0);
|
||||||
}
|
}
|
||||||
@@ -582,7 +612,7 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
if(window.location.hash) {
|
if(window.location.hash) {
|
||||||
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
|
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
|
||||||
if(hash == 'description') {
|
if(hash == 'description') {
|
||||||
document.getElementById("desc_details").open = true;
|
document.getElementById("desc_details").open = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -590,14 +620,21 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
function init() {
|
function init() {
|
||||||
openDescription();
|
openDescription();
|
||||||
domainname = getDomainname();
|
domainname = getDomainname();
|
||||||
canvas.addEventListener('mousedown', mouseDown, false);
|
|
||||||
canvas.addEventListener('mouseup', mouseUp, false);
|
if (!loadConfig(domainname)) {
|
||||||
canvas.addEventListener('mousemove', mouseMove, false);
|
firework.launch('Configuration could not be loaded! Please reload the page!', 'danger', 30000);
|
||||||
loadCanvas(domainname + "/fileserver/config/reference.jpg");
|
return;
|
||||||
loadConfig(domainname);
|
}
|
||||||
|
|
||||||
ParseConfig();
|
ParseConfig();
|
||||||
param = getConfigParameters();
|
param = getConfigParameters();
|
||||||
cofcat = getConfigCategory();
|
cofcat = getConfigCategory();
|
||||||
|
|
||||||
|
canvas.addEventListener('mousedown', mouseDown, false);
|
||||||
|
canvas.addEventListener('mouseup', mouseUp, false);
|
||||||
|
canvas.addEventListener('mousemove', mouseMove, false);
|
||||||
|
loadCanvas(domainname + "/fileserver/config/reference.jpg");
|
||||||
|
|
||||||
UpdateNUMBERS();
|
UpdateNUMBERS();
|
||||||
|
|
||||||
/* Check if the ROIs are equidistant. Only if not, untick the checkbox */
|
/* Check if the ROIs are equidistant. Only if not, untick the checkbox */
|
||||||
@@ -717,6 +754,7 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
}
|
}
|
||||||
|
|
||||||
erg = CreateNUMBER(_numbernew);
|
erg = CreateNUMBER(_numbernew);
|
||||||
|
|
||||||
if (erg != "") {
|
if (erg != "") {
|
||||||
firework.launch(erg, 'danger', 30000);
|
firework.launch(erg, 'danger', 30000);
|
||||||
}
|
}
|
||||||
@@ -844,14 +882,17 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
|
|
||||||
function mouseUp() {
|
function mouseUp() {
|
||||||
drag = false;
|
drag = false;
|
||||||
|
|
||||||
if (rect.w < 0) {
|
if (rect.w < 0) {
|
||||||
rect.w = -rect.w
|
rect.w = -rect.w
|
||||||
rect.startX-=rect.w
|
rect.startX-=rect.w
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rect.h < 0) {
|
if (rect.h < 0) {
|
||||||
rect.h = -rect.h
|
rect.h = -rect.h
|
||||||
rect.startY-=rect.h
|
rect.startY-=rect.h
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById("refdx").value = rect.w;
|
document.getElementById("refdx").value = rect.w;
|
||||||
document.getElementById("refdy").value = rect.h;
|
document.getElementById("refdy").value = rect.h;
|
||||||
document.getElementById("refx").value = rect.startX;
|
document.getElementById("refx").value = rect.startX;
|
||||||
@@ -876,10 +917,12 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
}
|
}
|
||||||
document.getElementById("refdx").value = rect.w;
|
document.getElementById("refdx").value = rect.w;
|
||||||
document.getElementById("refdy").value = rect.h;
|
document.getElementById("refdy").value = rect.h;
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
draw();
|
draw();
|
||||||
|
|
||||||
var canvas = document.getElementById('canvas');
|
var canvas = document.getElementById('canvas');
|
||||||
var context = canvas.getContext('2d');
|
var context = canvas.getContext('2d');
|
||||||
|
|
||||||
@@ -915,10 +958,10 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
rect.startX = document.getElementById("refx").value;
|
rect.startX = document.getElementById("refx").value;
|
||||||
rect.startY = document.getElementById("refy").value;
|
rect.startY = document.getElementById("refy").value;
|
||||||
|
|
||||||
draw();
|
|
||||||
if (lockSpaceEquidistant) {
|
if (lockSpaceEquidistant) {
|
||||||
makeX_SpaceEquidistant();
|
makeX_SpaceEquidistant();
|
||||||
}
|
}
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
document.getElementById("saveroi").disabled = false;
|
document.getElementById("saveroi").disabled = false;
|
||||||
@@ -990,11 +1033,13 @@ The following settings are only used for easier setup, they are <b>not</b> persi
|
|||||||
_roialt= sel.options[sel.selectedIndex].text;
|
_roialt= sel.options[sel.selectedIndex].text;
|
||||||
|
|
||||||
var _roinew = prompt("Please enter a new name for the selected ROI", _roialt);
|
var _roinew = prompt("Please enter a new name for the selected ROI", _roialt);
|
||||||
|
|
||||||
if (_roinew === null) {
|
if (_roinew === null) {
|
||||||
return; //break out of the function early because prompt was aborted
|
return; //break out of the function early because prompt was aborted
|
||||||
}
|
}
|
||||||
|
|
||||||
erg = RenameROI(_number, "digit", _roialt, _roinew);
|
erg = RenameROI(_number, "digit", _roialt, _roinew);
|
||||||
|
|
||||||
if (erg != "") {
|
if (erg != "") {
|
||||||
firework.launch(erg, 'danger', 30000);
|
firework.launch(erg, 'danger', 30000);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -21,21 +21,21 @@
|
|||||||
var streamPopup;
|
var streamPopup;
|
||||||
var streamFlashlight = false;
|
var streamFlashlight = false;
|
||||||
var streamWindowFeatures =
|
var streamWindowFeatures =
|
||||||
'channelmode=no,directories=no,fullscreen=no,' +
|
'channelmode=no,directories=no,fullscreen=no,' +
|
||||||
'location=no,dependent=yes,menubar=no,resizable=no,scrollbars=no,' +
|
'location=no,dependent=yes,menubar=no,resizable=no,scrollbars=no,' +
|
||||||
'status=no,toolbar=no,titlebar=no,' +
|
'status=no,toolbar=no,titlebar=no,' +
|
||||||
'left=10,top=260,width=640px,height=480px';
|
'left=10,top=260,width=640px,height=480px';
|
||||||
|
|
||||||
function loadPage(page) {
|
function loadPage(page) {
|
||||||
console.log("loadPage( " + page + " )");
|
console.log("loadPage( " + page + " )");
|
||||||
|
|
||||||
if (streamPopup) // Ensure that stream popup is closed because it's blocking web interface
|
if (streamPopup) { // Ensure that stream popup is closed because it's blocking web interface
|
||||||
streamPopup.close();
|
streamPopup.close();
|
||||||
|
}
|
||||||
|
|
||||||
asyncPageLoad(page);
|
asyncPageLoad(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function asyncPageLoad(page ) {
|
async function asyncPageLoad(page ) {
|
||||||
console.log(" loading " + page + " ...");
|
console.log(" loading " + page + " ...");
|
||||||
document.cookie = "page="+page + "; path=/";
|
document.cookie = "page="+page + "; path=/";
|
||||||
@@ -46,7 +46,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function resetMenu() {
|
function resetMenu() {
|
||||||
[].forEach.call(document.querySelectorAll('.submenu'), function (el) {
|
[].forEach.call(document.querySelectorAll('.submenu'), function (el) {
|
||||||
el.style.visibility = 'visible';
|
el.style.visibility = 'visible';
|
||||||
@@ -54,18 +53,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getCookie(cname) {
|
function getCookie(cname) {
|
||||||
let name = cname + "=";
|
let name = cname + "=";
|
||||||
let decodedCookie = decodeURIComponent(document.cookie);
|
let decodedCookie = decodeURIComponent(document.cookie);
|
||||||
let ca = decodedCookie.split(';');
|
let ca = decodedCookie.split(';');
|
||||||
for(let i = 0; i <ca.length; i++) {
|
for(let i = 0; i <ca.length; i++) {
|
||||||
let c = ca[i];
|
let c = ca[i];
|
||||||
while (c.charAt(0) == ' ') {
|
|
||||||
c = c.substring(1);
|
while (c.charAt(0) == ' ') {
|
||||||
}
|
c = c.substring(1);
|
||||||
if (c.indexOf(name) == 0) {
|
}
|
||||||
return c.substring(name.length, c.length);
|
|
||||||
}
|
if (c.indexOf(name) == 0) {
|
||||||
}
|
return c.substring(name.length, c.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -153,7 +154,7 @@
|
|||||||
HA_send_discovery_visibility();
|
HA_send_discovery_visibility();
|
||||||
|
|
||||||
if (getCookie("page") == "" || getCookie("page") == "reboot_page.html?v=$COMMIT_HASH") {
|
if (getCookie("page") == "" || getCookie("page") == "reboot_page.html?v=$COMMIT_HASH") {
|
||||||
document.cookie = "page=overview.html?v=$COMMIT_HASH" + "; path=/";
|
document.cookie = "page=overview.html?v=$COMMIT_HASH" + "; path=/";
|
||||||
}
|
}
|
||||||
console.log("Loading page: " + getCookie("page"));
|
console.log("Loading page: " + getCookie("page"));
|
||||||
document.getElementById('maincontent').src = getCookie("page");
|
document.getElementById('maincontent').src = getCookie("page");
|
||||||
@@ -181,19 +182,18 @@
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
function HA_send_discovery_visibility() {
|
function HA_send_discovery_visibility() {
|
||||||
loadConfig(domainname);
|
loadConfig(domainname);
|
||||||
ParseConfig();
|
ParseConfig();
|
||||||
category = getConfigCategory();
|
category = getConfigCategory();
|
||||||
param = getConfigParameters();
|
param = getConfigParameters();
|
||||||
if (category["MQTT"]["enabled"] && param["MQTT"]["HomeassistantDiscovery"]["value1"] == "true") {
|
|
||||||
|
if (category["MQTT"]["enabled"] && param["MQTT"]["HomeassistantDiscovery"].value == "true") {
|
||||||
document.getElementById("ManualControl").style.display="";
|
document.getElementById("ManualControl").style.display="";
|
||||||
document.getElementById("HASendDiscovery").style.display="";
|
document.getElementById("HASendDiscovery").style.display="";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function HA_send_discovery() {
|
function HA_send_discovery() {
|
||||||
console.log("HA Discovery scheduled");
|
console.log("HA Discovery scheduled");
|
||||||
var url = getDomainname() + '/mqtt_publish_discovery';
|
var url = getDomainname() + '/mqtt_publish_discovery';
|
||||||
@@ -207,15 +207,17 @@
|
|||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function start_livestream(streamFlashlight) {
|
function start_livestream(streamFlashlight) {
|
||||||
if (streamPopup)
|
if (streamPopup) {
|
||||||
streamPopup.close();
|
streamPopup.close();
|
||||||
|
}
|
||||||
|
|
||||||
if (streamFlashlight)
|
if (streamFlashlight) {
|
||||||
streamPopup = window.open(getDomainname() + '/stream?flashlight=true','LivestreamWithlight',streamWindowFeatures);
|
streamPopup = window.open(getDomainname() + '/stream?flashlight=true','LivestreamWithlight',streamWindowFeatures);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
streamPopup = window.open(getDomainname() + '/stream','Livestream',streamWindowFeatures);
|
streamPopup = window.open(getDomainname() + '/stream','Livestream',streamWindowFeatures);
|
||||||
|
}
|
||||||
|
|
||||||
streamPopup.focus();
|
streamPopup.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,64 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.tg {border-collapse:collapse;border-spacing:0;width:100%;min-width:600px;height:100%;color:darkslategray;}
|
.tg {
|
||||||
.tg th{min-width:325px;width:325px;height:20px;font-size:18px;text-align:left;font-weight:bold;padding:5px 10px 5px 10px;;overflow:hidden;word-break:normal;background-color:lightgrey;}
|
border-collapse:collapse;
|
||||||
.tg td{font-size:15px;padding:5px 10px 5px 10px;overflow:hidden;word-break:normal;}
|
border-spacing:0;
|
||||||
.tg .tg-1{font-size:15px;vertical-align: top; font-family:Arial, Helvetica, sans-serif !important;}
|
width:100%;
|
||||||
.tg .tg-2{height:52px;font-size:15px;padding:3px 0px 3px 10px;vertical-align:middle;font-family:Arial, Helvetica, sans-serif !important;}
|
min-width:600px;
|
||||||
.tg .tg-3{height:45px;font-size:15px;padding:3px 10px 3px 10px;vertical-align:middle;font-family:Arial, Helvetica, sans-serif !important;}
|
height:100%;
|
||||||
.tg .tg-4{height:fit-content;font-size:15px;padding:5px 10px 5px 10px;vertical-align:text-top;font-family:Arial, Helvetica, sans-serif !important;}
|
color:darkslategray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tg th{
|
||||||
|
min-width:325px;
|
||||||
|
width:325px;
|
||||||
|
height:20px;
|
||||||
|
font-size:18px;
|
||||||
|
text-align:left;
|
||||||
|
font-weight:bold;
|
||||||
|
padding:5px 10px 5px 10px;
|
||||||
|
overflow:hidden;
|
||||||
|
word-break:normal;
|
||||||
|
background-color:lightgrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tg td{
|
||||||
|
font-size:15px;
|
||||||
|
padding:5px 10px 5px 10px;
|
||||||
|
overflow:hidden;
|
||||||
|
word-break:normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tg .tg-1{
|
||||||
|
font-size:15px;
|
||||||
|
vertical-align: top;
|
||||||
|
font-family:Arial, Helvetica, sans-serif !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tg .tg-2{
|
||||||
|
height:52px;
|
||||||
|
font-size:15px;
|
||||||
|
padding:3px 0px 3px 10px;
|
||||||
|
vertical-align:middle;
|
||||||
|
font-family:Arial, Helvetica, sans-serif !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tg .tg-3{
|
||||||
|
height:45px;
|
||||||
|
font-size:15px;
|
||||||
|
padding:3px 10px 3px 10px;
|
||||||
|
vertical-align:middle;
|
||||||
|
font-family:Arial, Helvetica, sans-serif !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tg .tg-4{
|
||||||
|
height:fit-content;
|
||||||
|
font-size:15px;
|
||||||
|
padding:5px 10px 5px 10px;
|
||||||
|
vertical-align:text-top;
|
||||||
|
font-family:Arial, Helvetica, sans-serif !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
@@ -78,221 +129,208 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
|
<script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
|
||||||
<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
|
<script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
|
||||||
<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
|
<script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
|
||||||
<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
|
<script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
function addZero(i) {
|
||||||
|
if (i < 10) {
|
||||||
|
i = "0" + i;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
function addZero(i) {
|
$(document).ready(function() {
|
||||||
if (i < 10) {
|
|
||||||
i = "0" + i;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
LoadData();
|
|
||||||
LoadROIImage();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function LoadData(){
|
|
||||||
loadValue("value", "value", "border-collapse: collapse; width: 100%");
|
|
||||||
loadValue("raw", "raw", "border-collapse: collapse; width: 100%");
|
|
||||||
loadValue("prevalue", "prevalue", "border-collapse: collapse; width: 100%");
|
|
||||||
loadValue("error", "error", "border-collapse: collapse; width: 100%");
|
|
||||||
loadStatus();
|
|
||||||
loadCPUTemp();
|
|
||||||
loadRSSI();
|
|
||||||
loadUptime();
|
|
||||||
loadRoundCounter();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function LoadROIImage(){
|
|
||||||
var d = new Date();
|
|
||||||
var timestamp = d.getTime();
|
|
||||||
var h = addZero(d.getHours());
|
|
||||||
var m = addZero(d.getMinutes());
|
|
||||||
var s = addZero(d.getSeconds());
|
|
||||||
document.getElementById("img").src = getDomainname() + '/img_tmp/alg_roi.jpg?timestamp=' + timestamp;
|
|
||||||
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function Refresh() {
|
|
||||||
setTimeout (function() {
|
|
||||||
LoadData();
|
LoadData();
|
||||||
LoadROIImage();
|
LoadROIImage();
|
||||||
Refresh();
|
});
|
||||||
}, 300000);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function LoadData(){
|
||||||
function loadStatus() {
|
loadValue("value", "value", "border-collapse: collapse; width: 100%");
|
||||||
url = domainname + '/statusflow';
|
loadValue("raw", "raw", "border-collapse: collapse; width: 100%");
|
||||||
var xhttp = new XMLHttpRequest();
|
loadValue("prevalue", "prevalue", "border-collapse: collapse; width: 100%");
|
||||||
xhttp.onreadystatechange = function() {
|
loadValue("error", "error", "border-collapse: collapse; width: 100%");
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
loadStatus();
|
||||||
var _rsp = xhttp.responseText;
|
loadCPUTemp();
|
||||||
$('#statusflow').html(_rsp);
|
loadRSSI();
|
||||||
}
|
loadUptime();
|
||||||
|
loadRoundCounter();
|
||||||
}
|
}
|
||||||
xhttp.open("GET", url, true);
|
|
||||||
xhttp.send();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function LoadROIImage(){
|
||||||
function loadCPUTemp() {
|
var d = new Date();
|
||||||
url = domainname + '/cpu_temperature';
|
var timestamp = d.getTime();
|
||||||
var xhttp = new XMLHttpRequest();
|
var h = addZero(d.getHours());
|
||||||
xhttp.onreadystatechange = function() {
|
var m = addZero(d.getMinutes());
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
var s = addZero(d.getSeconds());
|
||||||
var _rsp = xhttp.responseText;
|
document.getElementById("img").src = getDomainname() + '/img_tmp/alg_roi.jpg?timestamp=' + timestamp;
|
||||||
$('#cputemp').html("CPU Temperature: " +_rsp + "°C");
|
$('#timestamp').html("Last Page Refresh:" + (h + ":" + m + ":" + s));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
xhttp.open("GET", url, true);
|
|
||||||
xhttp.send();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function Refresh() {
|
||||||
|
setTimeout (function() {
|
||||||
|
LoadData();
|
||||||
|
LoadROIImage();
|
||||||
|
Refresh();
|
||||||
|
}, 300000);
|
||||||
|
}
|
||||||
|
|
||||||
function loadRSSI() {
|
function loadStatus() {
|
||||||
url = domainname + '/rssi';
|
url = domainname + '/statusflow';
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
var _rsp = xhttp.responseText;
|
var _rsp = xhttp.responseText;
|
||||||
|
$('#statusflow').html(_rsp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xhttp.open("GET", url, true);
|
||||||
|
xhttp.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadCPUTemp() {
|
||||||
|
url = domainname + '/cpu_temperature';
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
xhttp.onreadystatechange = function() {
|
||||||
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
|
var _rsp = xhttp.responseText;
|
||||||
|
$('#cputemp').html("CPU Temperature: " +_rsp + "°C");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xhttp.open("GET", url, true);
|
||||||
|
xhttp.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadRSSI() {
|
||||||
|
url = domainname + '/rssi';
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
xhttp.onreadystatechange = function() {
|
||||||
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
|
var _rsp = xhttp.responseText;
|
||||||
|
|
||||||
if (_rsp >= -55) {
|
if (_rsp >= -55) {
|
||||||
$('#rssi').html("WIFI Signal: Excellent (" + _rsp + "dBm)");
|
$('#rssi').html("WIFI Signal: Excellent (" + _rsp + "dBm)");
|
||||||
}
|
}
|
||||||
else if (_rsp < -55 && _rsp >= -67) {
|
else if (_rsp < -55 && _rsp >= -67) {
|
||||||
$('#rssi').html("WIFI Signal: Good (" + _rsp + "dBm)");
|
$('#rssi').html("WIFI Signal: Good (" + _rsp + "dBm)");
|
||||||
}
|
}
|
||||||
else if (_rsp < -67 && _rsp >= -78) {
|
else if (_rsp < -67 && _rsp >= -78) {
|
||||||
$('#rssi').html("WIFI Signal: Fair (" + _rsp + "dBm)");
|
$('#rssi').html("WIFI Signal: Fair (" + _rsp + "dBm)");
|
||||||
}
|
}
|
||||||
else if (_rsp < -78 && _rsp >= -85) {
|
else if (_rsp < -78 && _rsp >= -85) {
|
||||||
$('#rssi').html("WIFI Signal: Weak (" + _rsp + "dBm)");
|
$('#rssi').html("WIFI Signal: Weak (" + _rsp + "dBm)");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('#rssi').html("WIFI Signal: Unreliable (" + _rsp + "dBm)");
|
$('#rssi').html("WIFI Signal: Unreliable (" + _rsp + "dBm)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xhttp.open("GET", url, true);
|
||||||
|
xhttp.send();
|
||||||
}
|
}
|
||||||
xhttp.open("GET", url, true);
|
|
||||||
xhttp.send();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function loadUptime() {
|
||||||
function loadUptime() {
|
url = domainname + '/uptime';
|
||||||
url = domainname + '/uptime';
|
var xhttp = new XMLHttpRequest();
|
||||||
var xhttp = new XMLHttpRequest();
|
xhttp.onreadystatechange = function() {
|
||||||
xhttp.onreadystatechange = function() {
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
var _rsp = xhttp.responseText;
|
||||||
var _rsp = xhttp.responseText;
|
$('#uptime').html("Uptime: " + _rsp);
|
||||||
$('#uptime').html("Uptime: " + _rsp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xhttp.open("GET", url, true);
|
|
||||||
xhttp.send();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function loadRoundCounter() {
|
|
||||||
url = domainname + '/info?type=Round';
|
|
||||||
var xhttp = new XMLHttpRequest();
|
|
||||||
xhttp.onreadystatechange = function() {
|
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
|
||||||
var _rsp = xhttp.responseText;
|
|
||||||
$('#round').html("(Round: " + _rsp + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xhttp.open("GET", url, true);
|
|
||||||
xhttp.send();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function loadValue(_type, _div, _style) {
|
|
||||||
url = domainname + '/value?all=true&type=' + _type;
|
|
||||||
var xhttp = new XMLHttpRequest();
|
|
||||||
xhttp.onreadystatechange = function() {
|
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
|
||||||
var _rsp = xhttp.responseText;
|
|
||||||
var _split = _rsp.split("\r");
|
|
||||||
if (typeof _style == undefined)
|
|
||||||
out = "<table>";
|
|
||||||
else
|
|
||||||
out = "<table style=\"" + _style + "\">";
|
|
||||||
|
|
||||||
if (_split.length == 1)
|
|
||||||
{
|
|
||||||
var _zer = ZerlegeZeile(_split[0], "\t")
|
|
||||||
if (_zer.length > 1)
|
|
||||||
out = _zer[1];
|
|
||||||
else
|
|
||||||
out = "";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (var j = 0; j < _split.length; ++j)
|
|
||||||
{
|
|
||||||
var _zer = ZerlegeZeile(_split[j], "\t")
|
|
||||||
if (_zer.length == 1)
|
|
||||||
out = out + "<tr><td style=\"width: 22%; padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\">" +
|
|
||||||
_zer[0] + "</td><td style=\"padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\"> </td></tr>";
|
|
||||||
else
|
|
||||||
out = out + "<tr><td style=\"width: 22%; padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\">" +
|
|
||||||
_zer[0] + "</td><td style=\"padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\" >" + _zer[1] + "</td></tr>";
|
|
||||||
}
|
}
|
||||||
out = out + "</table>"
|
|
||||||
|
|
||||||
}
|
|
||||||
document.getElementById(_div).innerHTML = out;
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
xhttp.open("GET", url, true);
|
xhttp.open("GET", url, true);
|
||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadRoundCounter() {
|
||||||
|
url = domainname + '/info?type=Round';
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
xhttp.onreadystatechange = function() {
|
||||||
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
|
var _rsp = xhttp.responseText;
|
||||||
|
$('#round').html("(Round: " + _rsp + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xhttp.open("GET", url, true);
|
||||||
|
xhttp.send();
|
||||||
|
}
|
||||||
|
|
||||||
function setImageMaxWidth()
|
function loadValue(_type, _div, _style) {
|
||||||
{
|
url = domainname + '/value?all=true&type=' + _type;
|
||||||
loadConfig(domainname);
|
var xhttp = new XMLHttpRequest();
|
||||||
ParseConfig();
|
xhttp.onreadystatechange = function() {
|
||||||
param = getConfigParameters();
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
if(param["TakeImage"]["ImageSize"]["value1"] == "QVGA") {
|
var _rsp = xhttp.responseText;
|
||||||
if (param["Alignment"]["FlipImageSize"]["value1"] == "false") {
|
var _split = _rsp.split("\r");
|
||||||
|
|
||||||
|
if (typeof _style == undefined) {
|
||||||
|
out = "<table>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out = "<table style=\"" + _style + "\">";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_split.length == 1) {
|
||||||
|
var _zer = ZerlegeZeile(_split[0], "\t")
|
||||||
|
|
||||||
|
if (_zer.length > 1) {
|
||||||
|
out = _zer[1];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var j = 0; j < _split.length; ++j) {
|
||||||
|
var _zer = ZerlegeZeile(_split[j], "\t")
|
||||||
|
|
||||||
|
if (_zer.length == 1) {
|
||||||
|
out = out + "<tr><td style=\"width: 22%; padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\">" +
|
||||||
|
_zer[0] + "</td><td style=\"padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\"> </td></tr>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
out = out + "<tr><td style=\"width: 22%; padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\">" +
|
||||||
|
_zer[0] + "</td><td style=\"padding: 3px 5px; text-align: left; vertical-align:middle; border: 1px solid lightgrey\" >" + _zer[1] + "</td></tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out = out + "</table>"
|
||||||
|
}
|
||||||
|
document.getElementById(_div).innerHTML = out;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
xhttp.open("GET", url, true);
|
||||||
|
xhttp.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setImageMaxWidth() {
|
||||||
|
loadConfig(domainname);
|
||||||
|
ParseConfig();
|
||||||
|
param = getConfigParameters();
|
||||||
|
|
||||||
|
if(param["TakeImage"]["CamFrameSize"].value == "QVGA") {
|
||||||
document.getElementById("img").style.maxWidth = "320px";
|
document.getElementById("img").style.maxWidth = "320px";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
document.getElementById("img").style.maxWidth = "240px";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (param["Alignment"]["FlipImageSize"]["value1"] == "false") {
|
|
||||||
document.getElementById("img").style.maxWidth = "640px";
|
document.getElementById("img").style.maxWidth = "640px";
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
document.getElementById("img").style.maxWidth = "480px";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
function init(){
|
||||||
|
domainname = getDomainname();
|
||||||
|
setImageMaxWidth();
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
function init(){
|
init();
|
||||||
domainname = getDomainname();
|
|
||||||
setImageMaxWidth();
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
</script>
|
||||||
init();
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
function SaveConfigToServer(_domainname){
|
function SaveConfigToServer(_domainname){
|
||||||
// leere Zeilen am Ende löschen
|
// leere Zeilen am Ende löschen
|
||||||
var zw = config_split.length - 1;
|
var zw = config_split.length - 1;
|
||||||
|
|
||||||
while (config_split[zw] == "") {
|
while (config_split[zw] == "") {
|
||||||
config_split.pop();
|
config_split.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
var config_gesamt = "";
|
var config_gesamt = "";
|
||||||
|
|
||||||
for (var i = 0; i < config_split.length; ++i)
|
for (var i = 0; i < config_split.length; ++i)
|
||||||
{
|
{
|
||||||
config_gesamt = config_gesamt + config_split[i] + "\n";
|
config_gesamt = config_gesamt + config_split[i] + "\n";
|
||||||
@@ -26,231 +28,227 @@ function UpdateConfig(zw, _index, _enhance, _domainname){
|
|||||||
|
|
||||||
function createReader(file) {
|
function createReader(file) {
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
|
|
||||||
reader.onload = function(evt) {
|
reader.onload = function(evt) {
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
|
|
||||||
image.onload = function(evt) {
|
image.onload = function(evt) {
|
||||||
var width = this.width;
|
var width = this.width;
|
||||||
var height = this.height;
|
var height = this.height;
|
||||||
//alert (width); // will produce something like 198
|
|
||||||
};
|
};
|
||||||
|
|
||||||
image.src = evt.target.result;
|
image.src = evt.target.result;
|
||||||
};
|
};
|
||||||
|
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function ZerlegeZeile(input, delimiter = " =\t\r")
|
function ZerlegeZeile(input, delimiter = " =\t\r") {
|
||||||
{
|
var Output = Array(0);
|
||||||
var Output = Array(0);
|
|
||||||
// delimiter = " =,\t";
|
// delimiter = " =,\t";
|
||||||
|
|
||||||
/* The input can have multiple formats:
|
/* The input can have multiple formats:
|
||||||
* - key = value
|
* - key = value
|
||||||
* - key = value1 value2 value3 ...
|
* - key = value1 value2 value3 ...
|
||||||
* - key value1 value2 value3 ...
|
* - key value1 value2 value3 ...
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* - ImageSize = VGA
|
* - ImageSize = VGA
|
||||||
* - IO0 = input disabled 10 false false
|
* - IO0 = input disabled 10 false false
|
||||||
* - main.dig1 28 144 55 100 false
|
* - main.dig1 28 144 55 100 false
|
||||||
*
|
*
|
||||||
* This causes issues eg. if a password key has a whitespace or equal sign in its value.
|
* This causes issues eg. if a password key has a whitespace or equal sign in its value.
|
||||||
* As a workaround and to not break any legacy usage, we enforce to only use the
|
* As a workaround and to not break any legacy usage, we enforce to only use the
|
||||||
* equal sign, if the key is "password"
|
* equal sign, if the key is "password"
|
||||||
*/
|
*/
|
||||||
if (input.includes("password") || input.includes("Token")) { // Line contains a password, use the equal sign as the only delimiter and only split on first occurrence
|
if (input.includes("password") || input.includes("Token")) { // Line contains a password, use the equal sign as the only delimiter and only split on first occurrence
|
||||||
var pos = input.indexOf("=");
|
var pos = input.indexOf("=");
|
||||||
delimiter = " \t\r"
|
delimiter = " \t\r"
|
||||||
Output.push(trim(input.substr(0, pos), delimiter));
|
Output.push(trim(input.substr(0, pos), delimiter));
|
||||||
Output.push(trim(input.substr(pos +1, input.length), delimiter));
|
Output.push(trim(input.substr(pos +1, input.length), delimiter));
|
||||||
}
|
}
|
||||||
else { // Legacy Mode
|
else { // Legacy Mode
|
||||||
input = trim(input, delimiter);
|
input = trim(input, delimiter);
|
||||||
var pos = findDelimiterPos(input, delimiter);
|
var pos = findDelimiterPos(input, delimiter);
|
||||||
var token;
|
var token;
|
||||||
while (pos > -1) {
|
|
||||||
token = input.substr(0, pos);
|
while (pos > -1) {
|
||||||
token = trim(token, delimiter);
|
token = input.substr(0, pos);
|
||||||
Output.push(token);
|
token = trim(token, delimiter);
|
||||||
input = input.substr(pos+1, input.length);
|
Output.push(token);
|
||||||
input = trim(input, delimiter);
|
input = input.substr(pos+1, input.length);
|
||||||
pos = findDelimiterPos(input, delimiter);
|
input = trim(input, delimiter);
|
||||||
}
|
pos = findDelimiterPos(input, delimiter);
|
||||||
Output.push(input);
|
}
|
||||||
}
|
|
||||||
|
Output.push(input);
|
||||||
|
}
|
||||||
|
|
||||||
return Output;
|
return Output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function findDelimiterPos(input, delimiter)
|
function findDelimiterPos(input, delimiter) {
|
||||||
{
|
var pos = -1;
|
||||||
var pos = -1;
|
var zw;
|
||||||
var zw;
|
var akt_del;
|
||||||
var akt_del;
|
|
||||||
|
|
||||||
for (var anz = 0; anz < delimiter.length; ++anz)
|
for (var anz = 0; anz < delimiter.length; ++anz) {
|
||||||
{
|
akt_del = delimiter[anz];
|
||||||
akt_del = delimiter[anz];
|
zw = input.indexOf(akt_del);
|
||||||
zw = input.indexOf(akt_del);
|
|
||||||
if (zw > -1)
|
if (zw > -1) {
|
||||||
{
|
if (pos > -1) {
|
||||||
if (pos > -1)
|
if (zw < pos) {
|
||||||
{
|
pos = zw;
|
||||||
if (zw < pos)
|
}
|
||||||
pos = zw;
|
}
|
||||||
}
|
else {
|
||||||
else
|
pos = zw;
|
||||||
pos = zw;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pos;
|
|
||||||
}
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function trim(istring, adddelimiter)
|
function trim(istring, adddelimiter) {
|
||||||
{
|
while ((istring.length > 0) && (adddelimiter.indexOf(istring[0]) >= 0)) {
|
||||||
while ((istring.length > 0) && (adddelimiter.indexOf(istring[0]) >= 0)){
|
istring = istring.substr(1, istring.length-1);
|
||||||
istring = istring.substr(1, istring.length-1);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
while ((istring.length > 0) && (adddelimiter.indexOf(istring[istring.length-1]) >= 0)){
|
while ((istring.length > 0) && (adddelimiter.indexOf(istring[istring.length-1]) >= 0)) {
|
||||||
istring = istring.substr(0, istring.length-1);
|
istring = istring.substr(0, istring.length-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return istring;
|
return istring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getConfig()
|
function getConfig() {
|
||||||
{
|
return config_gesamt;
|
||||||
return config_gesamt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function loadConfig(_domainname)
|
function loadConfig(_domainname) {
|
||||||
{
|
var xhttp = new XMLHttpRequest();
|
||||||
var xhttp = new XMLHttpRequest();
|
|
||||||
try {
|
try {
|
||||||
url = _domainname + '/fileserver/config/config.ini';
|
url = _domainname + '/fileserver/config/config.ini';
|
||||||
xhttp.open("GET", url, false);
|
xhttp.open("GET", url, false);
|
||||||
xhttp.send();
|
xhttp.send();
|
||||||
config_gesamt = xhttp.responseText;
|
config_gesamt = xhttp.responseText;
|
||||||
config_gesamt = config_gesamt.replace("InitalRotate", "InitialRotate"); // Korrigiere Schreibfehler in config.ini !!!!!
|
config_gesamt = config_gesamt.replace("InitalRotate", "InitialRotate"); // Korrigiere Schreibfehler in config.ini !!!!!
|
||||||
}
|
} catch (error) {}
|
||||||
catch (error)
|
|
||||||
{
|
return true;
|
||||||
// firework.launch('Deleting Config.ini failed!', 'danger', 30000);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function dataURLtoBlob(dataurl)
|
function dataURLtoBlob(dataurl) {
|
||||||
{
|
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
|
||||||
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
|
|
||||||
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
|
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
|
||||||
while(n--){
|
|
||||||
u8arr[n] = bstr.charCodeAt(n);
|
while(n--){
|
||||||
}
|
u8arr[n] = bstr.charCodeAt(n);
|
||||||
return new Blob([u8arr], {type:mime});
|
}
|
||||||
|
|
||||||
|
return new Blob([u8arr], {type:mime});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function FileCopyOnServer(_source, _target, _domainname = ""){
|
function FileCopyOnServer(_source, _target, _domainname = "") {
|
||||||
url = _domainname + "/editflow?task=copy&in=" + _source + "&out=" + _target;
|
url = _domainname + "/editflow?task=copy&in=" + _source + "&out=" + _target;
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
try {
|
|
||||||
xhttp.open("GET", url, false);
|
try {
|
||||||
xhttp.send(); }
|
xhttp.open("GET", url, false);
|
||||||
catch (error)
|
xhttp.send();
|
||||||
{
|
} catch (error) {}
|
||||||
// firework.launch('Deleting Config.ini failed!', 'danger', 30000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function FileDeleteOnServer(_filename, _domainname = ""){
|
function FileDeleteOnServer(_filename, _domainname = "") {
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
var okay = false;
|
var okay = false;
|
||||||
|
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
if (xhttp.readyState == 4) {
|
if (xhttp.readyState == 4) {
|
||||||
if (xhttp.status == 200) {
|
if (xhttp.status == 200) {
|
||||||
okay = true;
|
okay = true;
|
||||||
} else if (xhttp.status == 0) {
|
}
|
||||||
// firework.launch('Server closed the connection abruptly!', 'danger', 30000);
|
else if (xhttp.status == 0) {
|
||||||
// location.reload()
|
// firework.launch('Server closed the connection abruptly!', 'danger', 30000);
|
||||||
} else {
|
// location.reload()
|
||||||
// firework.launch('An error occured: ' + xhttp.responseText, 'danger', 30000);
|
}
|
||||||
// location.reload()
|
else {
|
||||||
}
|
// firework.launch('An error occured: ' + xhttp.responseText, 'danger', 30000);
|
||||||
}
|
// location.reload()
|
||||||
};
|
}
|
||||||
try {
|
}
|
||||||
var url = _domainname + "/delete" + _filename;
|
};
|
||||||
xhttp.open("POST", url, false);
|
|
||||||
xhttp.send();
|
try {
|
||||||
}
|
var url = _domainname + "/delete" + _filename;
|
||||||
catch (error)
|
xhttp.open("POST", url, false);
|
||||||
{
|
xhttp.send();
|
||||||
// firework.launch('Deleting Config.ini failed!', 'danger', 30000);
|
} catch (error) {}
|
||||||
}
|
|
||||||
|
|
||||||
return okay;
|
return okay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function FileSendContent(_content, _filename, _domainname = ""){
|
function FileSendContent(_content, _filename, _domainname = "") {
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
var okay = false;
|
var okay = false;
|
||||||
|
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
if (xhttp.readyState == 4) {
|
if (xhttp.readyState == 4) {
|
||||||
if (xhttp.status == 200) {
|
if (xhttp.status == 200) {
|
||||||
okay = true;
|
okay = true;
|
||||||
} else if (xhttp.status == 0) {
|
}
|
||||||
|
else if (xhttp.status == 0) {
|
||||||
firework.launch('Server closed the connection abruptly!', 'danger', 30000);
|
firework.launch('Server closed the connection abruptly!', 'danger', 30000);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
firework.launch('An error occured: ' + xhttp.responseText, 'danger', 30000);
|
firework.launch('An error occured: ' + xhttp.responseText, 'danger', 30000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
upload_path = _domainname + "/upload" + _filename;
|
upload_path = _domainname + "/upload" + _filename;
|
||||||
xhttp.open("POST", upload_path, false);
|
xhttp.open("POST", upload_path, false);
|
||||||
xhttp.send(_content);
|
xhttp.send(_content);
|
||||||
}
|
} catch (error) {}
|
||||||
catch (error)
|
|
||||||
{
|
|
||||||
// firework.launch('Deleting Config.ini failed!', 'danger', 30000);
|
|
||||||
}
|
|
||||||
return okay;
|
return okay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function MakeRefImageZW(zw, _enhance, _domainname){
|
function MakeRefImageZW(zw, _enhance, _domainname){
|
||||||
var _filename = zw["name"].replace("/config/", "/img_tmp/");
|
var _filename = zw["name"].replace("/config/", "/img_tmp/");
|
||||||
|
|
||||||
var url = _domainname + "/editflow?task=cutref&in=/config/reference.jpg&out=" + _filename + "&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
var url = _domainname + "/editflow?task=cutref&in=/config/reference.jpg&out=" + _filename + "&x=" + zw["x"] + "&y=" + zw["y"] + "&dx=" + zw["dx"] + "&dy=" + zw["dy"];
|
||||||
|
|
||||||
if (_enhance == true){
|
if (_enhance == true){
|
||||||
url = url + "&enhance=true";
|
url = url + "&enhance=true";
|
||||||
}
|
}
|
||||||
|
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
xhttp.open("GET", url, false);
|
xhttp.open("GET", url, false);
|
||||||
xhttp.send();
|
xhttp.send();
|
||||||
} catch (error){}
|
} catch (error){}
|
||||||
|
|
||||||
if (xhttp.responseText == "CutImage Done") {
|
if (xhttp.responseText == "CutImage Done") {
|
||||||
firework.launch('Image Contrast got enhanced', 'success', 5000);
|
firework.launch('Image Contrast got enhanced', 'success', 5000);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user