Restructure Image Processing

This commit is contained in:
jomjol
2020-12-23 08:00:11 +01:00
parent b418525b3b
commit 9971c82e99
34 changed files with 1013 additions and 892 deletions

View File

@@ -270,37 +270,6 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
} }
} }
/*
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "IP")){
_ip = zerlegt[1];
if ((_ip[0] == '"') && (_ip[_ip.length()-1] == '"')){
_ip = _ip.substr(1, _ip.length()-2);
}
}
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "GATEWAY")){
_gw = zerlegt[1];
if ((_gw[0] == '"') && (_gw[_gw.length()-1] == '"')){
_gw = _gw.substr(1, _gw.length()-2);
}
}
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "NETMASK")){
_netmask = zerlegt[1];
if ((_netmask[0] == '"') && (_netmask[_netmask.length()-1] == '"')){
_netmask = _netmask.substr(1, _netmask.length()-2);
}
}
if ((zerlegt.size() > 1) && (toUpper(zerlegt[0]) == "DNS")){
_dns = zerlegt[1];
if ((_dns[0] == '"') && (_dns[_dns.length()-1] == '"')){
_dns = _dns.substr(1, _dns.length()-2);
}
}
*/
if (fgets(zw, 1024, pFile) == NULL) if (fgets(zw, 1024, pFile) == NULL)
{ {
line = ""; line = "";

View File

@@ -6,7 +6,7 @@
#include "esp_log.h" #include "esp_log.h"
#include "Helper.h" #include "Helper.h"
#include "CFindTemplate.h" #include "CImageBasis.h"
#define BOARD_ESP32CAM_AITHINKER #define BOARD_ESP32CAM_AITHINKER

View File

@@ -10,7 +10,7 @@
#include "esp_camera.h" #include "esp_camera.h"
#include <string> #include <string>
#include <esp_http_server.h> #include <esp_http_server.h>
#include "CFindTemplate.h" #include "CImageBasis.h"
#define CAMERA_MODEL_AI_THINKER #define CAMERA_MODEL_AI_THINKER

View File

@@ -5,7 +5,7 @@
#include <vector> #include <vector>
#include "Helper.h" #include "Helper.h"
#include "CFindTemplate.h" #include "CImageBasis.h"
using namespace std; using namespace std;

View File

@@ -2,8 +2,12 @@
#include "ClassFlowMakeImage.h" #include "ClassFlowMakeImage.h"
#include "ClassFlow.h" #include "ClassFlow.h"
#include "CRotateImage.h"
#include "ClassLogFile.h" #include "ClassLogFile.h"
bool AlignmentExtendedDebugging = true; bool AlignmentExtendedDebugging = true;
@@ -118,7 +122,7 @@ bool ClassFlowAlignment::doFlow(string time)
delete AlignAndCutImage; delete AlignAndCutImage;
AlignAndCutImage = new CAlignAndCutImage(ImageBasis, ImageTMP); AlignAndCutImage = new CAlignAndCutImage(ImageBasis, ImageTMP);
CRotate rt(AlignAndCutImage, ImageTMP); CRotateImage rt(AlignAndCutImage, ImageTMP);
if (initialmirror){ if (initialmirror){
printf("do mirror\n"); printf("do mirror\n");

View File

@@ -2,6 +2,7 @@
#include "ClassFlow.h" #include "ClassFlow.h"
#include "Helper.h" #include "Helper.h"
#include "CAlignAndCutImage.h"
#include <string> #include <string>

View File

@@ -23,7 +23,7 @@ void ClassFlowAnalog::SetInitialParameter(void)
modelysize = 1; modelysize = 1;
ListFlowControll = NULL; ListFlowControll = NULL;
previousElement = NULL; previousElement = NULL;
SaveAllFiles = false; SaveAllFiles = true;
} }
ClassFlowAnalog::ClassFlowAnalog(std::vector<ClassFlow*>* lfc) : ClassFlowImage(lfc, TAG) ClassFlowAnalog::ClassFlowAnalog(std::vector<ClassFlow*>* lfc) : ClassFlowImage(lfc, TAG)
@@ -132,9 +132,14 @@ bool ClassFlowAnalog::ReadParameter(FILE* pfile, string& aktparamgraph)
if (toUpper(zerlegt[1]) == "TRUE") if (toUpper(zerlegt[1]) == "TRUE")
SaveAllFiles = true; SaveAllFiles = true;
} }
} }
for (int i = 0; i < ROI.size(); ++i)
{
ROI[i]->image = new CImageBasis(modelxsize, modelysize, 3);
ROI[i]->image_org = new CImageBasis(ROI[i]->deltax, ROI[i]->deltay, 3);
}
return true; return true;
} }
@@ -186,19 +191,12 @@ bool ClassFlowAnalog::doAlignAndCut(string time)
for (int i = 0; i < ROI.size(); ++i) for (int i = 0; i < ROI.size(); ++i)
{ {
printf("Analog %d - Align&Cut\n", i); printf("Analog %d - Align&Cut\n", i);
caic->CutAndSave(ROI[i]->posx, ROI[i]->posy, ROI[i]->deltax, ROI[i]->deltay, ROI[i]->image_org);
if (SaveAllFiles) ROI[i]->image_org->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".jpg"));
CResizeImage *rs = caic->CutAndSave(ROI[i]->posx, ROI[i]->posy, ROI[i]->deltax, ROI[i]->deltay); ROI[i]->image_org->Resize(modelxsize, modelysize, ROI[i]->image);
if (ROI[i]->image_org) if (SaveAllFiles) ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".bmp"));
delete ROI[i]->image_org;
ROI[i]->image_org = new CImageBasis((CImageBasis*) rs);
if (SaveAllFiles) rs->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".jpg"));
rs->Resize(modelxsize, modelysize);
if (SaveAllFiles) rs->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".bmp"));
if (ROI[i]->image)
delete ROI[i]->image;
ROI[i]->image = rs;
} }
return true; return true;

View File

@@ -9,6 +9,8 @@
#include "Helper.h" #include "Helper.h"
#include "server_ota.h" #include "server_ota.h"
#include "server_help.h"
static const char* TAG = "flow_controll"; static const char* TAG = "flow_controll";
bool flowcontrolldebugdetail = true; bool flowcontrolldebugdetail = true;
@@ -415,28 +417,31 @@ esp_err_t ClassFlowControll::SendRawJPG(httpd_req_t *req)
} }
ImageData* ClassFlowControll::GetJPGStream(std::string _fn) esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
{ {
printf("ClassFlowControll::GetJPGStream %s\n", _fn.c_str()); printf("ClassFlowControll::GetJPGStream %s\n", _fn.c_str());
ImageData* ret = NULL;
CImageBasis *_send = NULL;
esp_err_t result = ESP_FAIL;
bool Dodelete = false;
if (_fn == "alg.jpg") if (_fn == "alg.jpg")
{ {
return flowalignment->ImageBasis->writeToMemoryAsJPG(); _send = flowalignment->ImageBasis;
} }
if (_fn == "alg_roi.jpg") if (_fn == "alg_roi.jpg")
{ {
CImageBasis* _imgzw = new CImageBasis(flowalignment->ImageBasis); CImageBasis* _imgzw = new CImageBasis(flowalignment->ImageBasis);
flowalignment->DrawRef(_imgzw); flowalignment->DrawRef(_imgzw);
if (flowdigit) flowdigit->DrawROI(_imgzw); if (flowdigit) flowdigit->DrawROI(_imgzw);
if (flowanalog) flowanalog->DrawROI(_imgzw); if (flowanalog) flowanalog->DrawROI(_imgzw);
ret = _imgzw->writeToMemoryAsJPG(); _send = _imgzw;
delete _imgzw; Dodelete = true;
return ret;
} }
std::vector<HTMLInfo*> htmlinfo; std::vector<HTMLInfo*> htmlinfo;
htmlinfo = GetAllDigital(); htmlinfo = GetAllDigital();
for (int i = 0; i < htmlinfo.size(); ++i) for (int i = 0; i < htmlinfo.size(); ++i)
@@ -444,12 +449,12 @@ ImageData* ClassFlowControll::GetJPGStream(std::string _fn)
if (_fn == htmlinfo[i]->filename) if (_fn == htmlinfo[i]->filename)
{ {
if (htmlinfo[i]->image) if (htmlinfo[i]->image)
return htmlinfo[i]->image->writeToMemoryAsJPG(); _send = htmlinfo[i]->image;
} }
if (_fn == htmlinfo[i]->filename_org) if (_fn == htmlinfo[i]->filename_org)
{ {
if (htmlinfo[i]->image_org) if (htmlinfo[i]->image_org)
return htmlinfo[i]->image_org->writeToMemoryAsJPG(); _send = htmlinfo[i]->image_org;
} }
} }
@@ -459,15 +464,29 @@ ImageData* ClassFlowControll::GetJPGStream(std::string _fn)
if (_fn == htmlinfo[i]->filename) if (_fn == htmlinfo[i]->filename)
{ {
if (htmlinfo[i]->image) if (htmlinfo[i]->image)
return htmlinfo[i]->image->writeToMemoryAsJPG(); _send = htmlinfo[i]->image;
} }
if (_fn == htmlinfo[i]->filename_org) if (_fn == htmlinfo[i]->filename_org)
{ {
if (htmlinfo[i]->image_org) if (htmlinfo[i]->image_org)
return htmlinfo[i]->image_org->writeToMemoryAsJPG(); _send = htmlinfo[i]->image_org;
} }
} }
printf("Kein internes Bild gefunden - suche auf SD-Karte\n"); if (_send)
return NULL; {
ESP_LOGI(TAG, "Sending file : %s ...", _fn.c_str());
set_content_type_from_file(req, _fn.c_str());
result = _send->SendJPGtoHTTP(req);
ESP_LOGI(TAG, "File sending complete");
/* Respond with an empty chunk to signal HTTP response completion */
httpd_resp_send_chunk(req, NULL, 0);
}
if (Dodelete)
{
delete _send;
}
return result;
} }

View File

@@ -39,7 +39,7 @@ public:
string GetPrevalue(); string GetPrevalue();
bool ReadParameter(FILE* pfile, string& aktparamgraph); bool ReadParameter(FILE* pfile, string& aktparamgraph);
ImageData* GetJPGStream(std::string _fn); esp_err_t GetJPGStream(std::string _fn, httpd_req_t *req);
esp_err_t SendRawJPG(httpd_req_t *req); esp_err_t SendRawJPG(httpd_req_t *req);
std::string doSingleStep(std::string _stepname, std::string _host); std::string doSingleStep(std::string _stepname, std::string _host);

View File

@@ -24,7 +24,7 @@ void ClassFlowDigit::SetInitialParameter(void)
modelysize = 1; modelysize = 1;
ListFlowControll = NULL; ListFlowControll = NULL;
previousElement = NULL; previousElement = NULL;
SaveAllFiles = false; SaveAllFiles = true;
} }
ClassFlowDigit::ClassFlowDigit() : ClassFlowImage(TAG) ClassFlowDigit::ClassFlowDigit() : ClassFlowImage(TAG)
@@ -128,6 +128,13 @@ bool ClassFlowDigit::ReadParameter(FILE* pfile, string& aktparamgraph)
} }
} }
for (int i = 0; i < ROI.size(); ++i)
{
ROI[i]->image = new CImageBasis(modelxsize, modelysize, 3);
ROI[i]->image_org = new CImageBasis(ROI[i]->deltax, ROI[i]->deltay, 3);
}
return true; return true;
} }
@@ -178,19 +185,12 @@ bool ClassFlowDigit::doAlignAndCut(string time)
for (int i = 0; i < ROI.size(); ++i) for (int i = 0; i < ROI.size(); ++i)
{ {
printf("DigitalDigit %d - Align&Cut\n", i); printf("DigitalDigit %d - Align&Cut\n", i);
CResizeImage *rs = caic->CutAndSave(ROI[i]->posx, ROI[i]->posy, ROI[i]->deltax, ROI[i]->deltay);
caic->CutAndSave(ROI[i]->posx, ROI[i]->posy, ROI[i]->deltax, ROI[i]->deltay, ROI[i]->image_org);
if (SaveAllFiles) ROI[i]->image_org->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".jpg"));
if (ROI[i]->image_org) ROI[i]->image_org->Resize(modelxsize, modelysize, ROI[i]->image);
free(ROI[i]->image_org); if (SaveAllFiles) ROI[i]->image->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".bmp"));
ROI[i]->image_org = new CImageBasis((CImageBasis*) rs);
if (SaveAllFiles) rs->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".jpg"));
rs->Resize(modelxsize, modelysize);
if (SaveAllFiles) rs->SaveToFile(FormatFileName("/sdcard/img_tmp/" + ROI[i]->name + ".bmp"));
if (ROI[i]->image)
free(ROI[i]->image);
ROI[i]->image = rs;
} }
return true; return true;

View File

@@ -5,7 +5,7 @@
#include <dirent.h> #include <dirent.h>
#include "time_sntp.h" #include "time_sntp.h"
#include "ClassLogFile.h" #include "ClassLogFile.h"
#include "CFindTemplate.h" #include "CImageBasis.h"
ClassFlowImage::ClassFlowImage(const char* logTag) ClassFlowImage::ClassFlowImage(const char* logTag)
{ {

View File

@@ -1,7 +1,7 @@
#include "ClassFlowMakeImage.h" #include "ClassFlowMakeImage.h"
#include "Helper.h" #include "Helper.h"
#include "CFindTemplate.h" #include "CImageBasis.h"
#include "ClassControllCamera.h" #include "ClassControllCamera.h"
#include <time.h> #include <time.h>

View File

@@ -0,0 +1,192 @@
#include "CAlignAndCutImage.h"
#include "CRotateImage.h"
#include "CFindTemplate.h"
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
//#define GET_MEMORY malloc
#define GET_MEMORY(X) heap_caps_malloc(X, MALLOC_CAP_SPIRAM)
CAlignAndCutImage::CAlignAndCutImage(CImageBasis *_org, CImageBasis *_temp)
{
rgb_image = _org->rgb_image;
channels = _org->channels;
width = _org->width;
height = _org->height;
bpp = _org->bpp;
externalImage = true;
ImageTMP = _temp;
}
void CAlignAndCutImage::GetRefSize(int *ref_dx, int *ref_dy)
{
ref_dx[0] = t0_dx;
ref_dy[0] = t0_dy;
ref_dx[1] = t1_dx;
ref_dy[1] = t1_dy;
}
void CAlignAndCutImage::Align(std::string _template0, int ref0_x, int ref0_y, std::string _template1, int ref1_x, int ref1_y, int deltax, int deltay, std::string imageROI)
{
int dx, dy;
int r0_x, r0_y, r1_x, r1_y;
// CFindTemplate* ft = new CFindTemplate(filename);
CFindTemplate* ft = new CFindTemplate(rgb_image, channels, width, height, bpp);
r0_x = ref0_x;
r0_y = ref0_y;
ft->FindTemplate(_template0, &r0_x, &r0_y, deltax, deltay);
t0_dx = ft->tpl_width;
t0_dy = ft->tpl_height;
r1_x = ref1_x;
r1_y = ref1_y;
ft->FindTemplate(_template1, &r1_x, &r1_y, deltax, deltay);
t1_dx = ft->tpl_width;
t1_dy = ft->tpl_height;
delete ft;
dx = ref0_x - r0_x;
dy = ref0_y - r0_y;
r0_x += dx;
r0_y += dy;
r1_x += dx;
r1_y += dy;
float w_org, w_ist, d_winkel;
w_org = atan2(ref1_y - ref0_y, ref1_x - ref0_x);
w_ist = atan2(r1_y - r0_y, r1_x - r0_x);
d_winkel = (w_org - w_ist) * 180 / M_PI;
if (imageROI.length() > 0)
{
CImageBasis* imgzw = new CImageBasis(this);
imgzw->drawRect(r0_x, r0_y, t0_dx, t0_dy, 255, 0, 0, 2);
imgzw->drawRect(r1_x, r1_y, t1_dx, t1_dy, 255, 0, 0, 2);
imgzw->SaveToFile(imageROI);
printf("Alignment: alignment ROI created: %s\n", imageROI.c_str());
delete imgzw;
}
std::string zw = "\tdx:\t" + std::to_string(dx) + "\tdy:\t" + std::to_string(dy) + "\td_winkel:\t" + std::to_string(d_winkel);
// LogFile.WriteToDedicatedFile("/sdcard/alignment.txt", zw);
CRotateImage rt(this, ImageTMP);
rt.Translate(dx, dy);
rt.Rotate(d_winkel, ref0_x, ref0_y);
printf("Alignment: dx %d - dy %d - rot %f\n", dx, dy, d_winkel);
}
void CAlignAndCutImage::CutAndSave(std::string _template1, int x1, int y1, int dx, int dy)
{
int x2, y2;
x2 = x1 + dx;
y2 = y1 + dy;
x2 = std::min(x2, width - 1);
y2 = std::min(y2, height - 1);
dx = x2 - x1;
dy = y2 - y1;
int memsize = dx * dy * channels;
uint8_t* odata = (unsigned char*) GET_MEMORY(memsize);
stbi_uc* p_target;
stbi_uc* p_source;
for (int x = x1; x < x2; ++x)
for (int y = y1; y < y2; ++y)
{
p_target = odata + (channels * ((y - y1) * dx + (x - x1)));
p_source = rgb_image + (channels * (y * width + x));
for (int _channels = 0; _channels < channels; ++_channels)
p_target[_channels] = p_source[_channels];
}
// stbi_write_jpg(_template1.c_str(), dx, dy, channels, odata, 0);
stbi_write_bmp(_template1.c_str(), dx, dy, channels, odata);
stbi_image_free(odata);
}
void CAlignAndCutImage::CutAndSave(int x1, int y1, int dx, int dy, CImageBasis *_target)
{
int x2, y2;
x2 = x1 + dx;
y2 = y1 + dy;
x2 = std::min(x2, width - 1);
y2 = std::min(y2, height - 1);
dx = x2 - x1;
dy = y2 - y1;
if ((_target->height != dy) || (_target->width != dx) || (_target->channels != channels))
{
printf("CAlignAndCutImage::CutAndSave - Bildgröße passt nicht !!!!!!!!!");
return;
}
uint8_t* odata = _target->rgb_image;
stbi_uc* p_target;
stbi_uc* p_source;
for (int x = x1; x < x2; ++x)
for (int y = y1; y < y2; ++y)
{
p_target = odata + (channels * ((y - y1) * dx + (x - x1)));
p_source = rgb_image + (channels * (y * width + x));
for (int _channels = 0; _channels < channels; ++_channels)
p_target[_channels] = p_source[_channels];
}
}
CImageBasis* CAlignAndCutImage::CutAndSave(int x1, int y1, int dx, int dy)
{
int x2, y2;
x2 = x1 + dx;
y2 = y1 + dy;
x2 = std::min(x2, width - 1);
y2 = std::min(y2, height - 1);
dx = x2 - x1;
dy = y2 - y1;
int memsize = dx * dy * channels;
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
stbi_uc* p_target;
stbi_uc* p_source;
for (int x = x1; x < x2; ++x)
for (int y = y1; y < y2; ++y)
{
p_target = odata + (channels * ((y - y1) * dx + (x - x1)));
p_source = rgb_image + (channels * (y * width + x));
for (int _channels = 0; _channels < channels; ++_channels)
p_target[_channels] = p_source[_channels];
}
CImageBasis* rs = new CImageBasis(odata, channels, dx, dy, bpp);
rs->SetIndepended();
return rs;
}

View File

@@ -0,0 +1,18 @@
#include "CImageBasis.h"
class CAlignAndCutImage : public CImageBasis
{
public:
int t0_dx, t0_dy, t1_dx, t1_dy;
CImageBasis *ImageTMP;
CAlignAndCutImage(std::string _image) : CImageBasis(_image) {ImageTMP = NULL;};
CAlignAndCutImage(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(_rgb_image, _channels, _width, _height, _bpp) {ImageTMP = NULL;};
CAlignAndCutImage(CImageBasis *_org, CImageBasis *_temp);
void Align(std::string _template1, int x1, int y1, std::string _template2, int x2, int y2, int deltax = 40, int deltay = 40, std::string imageROI = "");
void CutAndSave(std::string _template1, int x1, int y1, int dx, int dy);
CImageBasis* CutAndSave(int x1, int y1, int dx, int dy);
void CutAndSave(int x1, int y1, int dx, int dy, CImageBasis *_target);
void GetRefSize(int *ref_dx, int *ref_dy);
};

View File

@@ -1,256 +1,4 @@
#include "CFindTemplate.h" #include "CFindTemplate.h"
#include "Helper.h"
#include "ClassLogFile.h"
#include "esp_system.h"
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define _ESP32_PSRAM
using namespace std;
#define GET_MEMORY malloc
void writejpghelp(void *context, void *data, int size)
{
// printf("Size all: %d, size %d\n", ((ImageData*)context)->size, size);
ImageData* _zw = (ImageData*) context;
uint8_t *voidstart = _zw->data;
uint8_t *datastart = (uint8_t*) data;
voidstart += _zw->size;
for (int i = 0; i < size; ++i)
*(voidstart + i) = *(datastart + i);
_zw->size += size;
}
ImageData* CImageBasis::writeToMemoryAsJPG(const int quality)
{
ImageData* ii = new ImageData;
auto rv2 = stbi_write_jpg_to_func(writejpghelp, ii, width, height, channels, rgb_image, quality);
return ii;
}
bool CImageBasis::CopyFromMemory(uint8_t* _source, int _size)
{
int gr = height * width * channels;
if (gr != _size) // Größe passt nicht
{
printf("Kann Bild nicht von Speicher kopierte - Größen passen nicht zusammen: soll %d, ist %d\n", _size, gr);
return false;
}
memCopy(_source, rgb_image, _size);
return true;
}
uint8_t CImageBasis::GetPixelColor(int x, int y, int ch)
{
stbi_uc* p_source;
p_source = rgb_image + (channels * (y * width + x));
return p_source[ch];
}
void CResizeImage::Resize(int _new_dx, int _new_dy)
{
int memsize = _new_dx * _new_dy * channels;
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
stbir_resize_uint8(rgb_image, width, height, 0, odata, _new_dx, _new_dy, 0, channels);
stbi_image_free(rgb_image);
rgb_image = (unsigned char*)GET_MEMORY(memsize);
memCopy(odata, rgb_image, memsize);
width = _new_dx;
height = _new_dy;
stbi_image_free(odata);
}
CRotate::CRotate(CImageBasis *_org, CImageBasis *_temp)
{
rgb_image = _org->rgb_image;
channels = _org->channels;
width = _org->width;
height = _org->height;
bpp = _org->bpp;
externalImage = true;
ImageTMP = _temp;
}
void CRotate::Mirror(){
int memsize = width * height * channels;
uint8_t* odata;
if (ImageTMP)
{
odata = ImageTMP->rgb_image;
}
else
{
odata = (unsigned char*)GET_MEMORY(memsize);
}
int x_source, y_source;
stbi_uc* p_target;
stbi_uc* p_source;
for (int x = 0; x < width; ++x)
for (int y = 0; y < height; ++y)
{
p_target = odata + (channels * (y * width + x));
x_source = width - x;
y_source = y;
p_source = rgb_image + (channels * (y_source * width + x_source));
for (int _channels = 0; _channels < channels; ++_channels)
p_target[_channels] = p_source[_channels];
}
// memcpy(rgb_image, odata, memsize);
memCopy(odata, rgb_image, memsize);
if (!ImageTMP)
{
stbi_image_free(odata);
}
}
void CRotate::Rotate(float _angle, int _centerx, int _centery)
{
float m[2][3];
float x_center = _centerx;
float y_center = _centery;
_angle = _angle / 180 * M_PI;
m[0][0] = cos(_angle);
m[0][1] = sin(_angle);
m[0][2] = (1 - m[0][0]) * x_center - m[0][1] * y_center;
m[1][0] = -m[0][1];
m[1][1] = m[0][0];
m[1][2] = m[0][1] * x_center + (1 - m[0][0]) * y_center;
int memsize = width * height * channels;
uint8_t* odata;
if (ImageTMP)
{
odata = ImageTMP->rgb_image;
}
else
{
odata = (unsigned char*)GET_MEMORY(memsize);
}
int x_source, y_source;
stbi_uc* p_target;
stbi_uc* p_source;
for (int x = 0; x < width; ++x)
for (int y = 0; y < height; ++y)
{
p_target = odata + (channels * (y * width + x));
x_source = int(m[0][0] * x + m[0][1] * y);
y_source = int(m[1][0] * x + m[1][1] * y);
x_source += int(m[0][2]);
y_source += int(m[1][2]);
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)
{
stbi_image_free(odata);
}
}
void CRotate::Rotate(float _angle)
{
// printf("width %d, height %d\n", width, height);
Rotate(_angle, width / 2, height / 2);
}
void CRotate::Translate(int _dx, int _dy)
{
int memsize = width * height * channels;
uint8_t* odata;
if (ImageTMP)
{
odata = ImageTMP->rgb_image;
}
else
{
odata = (unsigned char*)GET_MEMORY(memsize);
}
int x_source, y_source;
stbi_uc* p_target;
stbi_uc* p_source;
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)
{
stbi_image_free(odata);
}
}
/*
CFindTemplate::CFindTemplate(std::string _image)
{
channels = 1;
rgb_image = stbi_load(_image.c_str(), &(width), &(height), &(bpp), channels);
}
*/
void CFindTemplate::FindTemplate(std::string _template, int* found_x, int* found_y) void CFindTemplate::FindTemplate(std::string _template, int* found_x, int* found_y)
{ {
@@ -337,405 +85,3 @@ void CFindTemplate::FindTemplate(std::string _template, int* found_x, int* found
} }
void CImageBasis::memCopy(uint8_t* _source, uint8_t* _target, int _size)
{
#ifdef _ESP32_PSRAM
for (int i = 0; i < _size; ++i)
*(_target + i) = *(_source + i);
#else
memcpy(_target, _source, _size);
#endif
}
bool CImageBasis::isInImage(int x, int y)
{
if ((x < 0) || (x > width - 1))
return false;
if ((y < 0) || (y > height- 1))
return false;
return true;
}
void CImageBasis::setPixelColor(int x, int y, int r, int g, int b)
{
stbi_uc* p_source;
p_source = rgb_image + (channels * (y * width + x));
p_source[0] = r;
if ( channels > 2)
{
p_source[1] = g;
p_source[2] = b;
}
}
void CImageBasis::drawRect(int x, int y, int dx, int dy, int r, int g, int b, int thickness)
{
int zwx1, zwx2, zwy1, zwy2;
int _x, _y, _thick;
zwx1 = x - thickness + 1;
zwx2 = x + dx + thickness - 1;
zwy1 = y;
zwy2 = y;
for (_thick = 0; _thick < thickness; _thick++)
for (_x = zwx1; _x <= zwx2; ++_x)
for (_y = zwy1; _y <= zwy2; _y++)
if (isInImage(_x, _y))
setPixelColor(_x, _y - _thick, r, g, b);
zwx1 = x - thickness + 1;
zwx2 = x + dx + thickness - 1;
zwy1 = y + dy;
zwy2 = y + dy;
for (_thick = 0; _thick < thickness; _thick++)
for (_x = zwx1; _x <= zwx2; ++_x)
for (_y = zwy1; _y <= zwy2; _y++)
if (isInImage(_x, _y))
setPixelColor(_x, _y + _thick, r, g, b);
zwx1 = x;
zwx2 = x;
zwy1 = y;
zwy2 = y + dy;
for (_thick = 0; _thick < thickness; _thick++)
for (_x = zwx1; _x <= zwx2; ++_x)
for (_y = zwy1; _y <= zwy2; _y++)
if (isInImage(_x, _y))
setPixelColor(_x - _thick, _y, r, g, b);
zwx1 = x + dx;
zwx2 = x + dx;
zwy1 = y;
zwy2 = y + dy;
for (_thick = 0; _thick < thickness; _thick++)
for (_x = zwx1; _x <= zwx2; ++_x)
for (_y = zwy1; _y <= zwy2; _y++)
if (isInImage(_x, _y))
setPixelColor(_x + _thick, _y, r, g, b);
}
void CImageBasis::drawLine(int x1, int y1, int x2, int y2, int r, int g, int b, int thickness)
{
int _x, _y, _thick;
int _zwy1, _zwy2;
thickness = (thickness-1) / 2;
for (_thick = 0; _thick <= thickness; ++_thick)
for (_x = x1 - _thick; _x <= x2 + _thick; ++_x)
{
if (x2 == x1)
{
_zwy1 = y1;
_zwy2 = y2;
}
else
{
_zwy1 = (y2 - y1) * (float)(_x - x1) / (float)(x2 - x1) + y1;
_zwy2 = (y2 - y1) * (float)(_x + 1 - x1) / (float)(x2 - x1) + y1;
}
for (_y = _zwy1 - _thick; _y <= _zwy2 + _thick; _y++)
if (isInImage(_x, _y))
setPixelColor(_x, _y, r, g, b);
}
}
void CImageBasis::drawCircle(int x1, int y1, int rad, int r, int g, int b, int thickness)
{
float deltarad, aktrad;
int _thick, _x, _y;
deltarad = 1 / (4 * M_PI * (rad + thickness - 1));
for (aktrad = 0; aktrad <= (2 * M_PI); aktrad += deltarad)
for (_thick = 0; _thick < thickness; ++_thick)
{
_x = sin(aktrad) * (rad + _thick) + x1;
_y = cos(aktrad) * (rad + _thick) + y1;
if (isInImage(_x, _y))
setPixelColor(_x, _y, r, g, b);
}
}
CImageBasis::CImageBasis()
{
externalImage = false;
}
void CImageBasis::CreateEmptyImage(int _width, int _height, int _channels)
{
bpp = _channels;
width = _width;
height = _height;
channels = _channels;
int memsize = width * height * channels;
rgb_image = (unsigned char*)GET_MEMORY(memsize);
stbi_uc* p_source;
for (int x = 0; x < width; ++x)
for (int y = 0; y < height; ++y)
{
p_source = rgb_image + (channels * (y * width + x));
for (int _channels = 0; _channels < channels; ++_channels)
p_source[_channels] = (uint8_t) 0;
}
}
void CImageBasis::LoadFromMemory(stbi_uc *_buffer, int len)
{
// if (rgb_image)
// free(rgb_image);
rgb_image = stbi_load_from_memory(_buffer, len, &width, &height, &channels, 3);
bpp = channels;
// STBIDEF stbi_uc *stbi_load_from_memory (stbi_uc const *buffer, int len , int *x, int *y, int *channels_in_file, int desired_channels);
}
CImageBasis::CImageBasis(CImageBasis *_copyfrom)
{
externalImage = false;
channels = _copyfrom->channels;
width = _copyfrom->width;
height = _copyfrom->height;
bpp = _copyfrom->bpp;
int memsize = width * height * channels;
rgb_image = (unsigned char*)GET_MEMORY(memsize);
if (!rgb_image)
{
printf(getESPHeapInfo().c_str());
printf("\nKein freier Speicher mehr!!!! Benötigt: %d %d %d %d\n", width, height, channels, memsize);
return;
}
memCopy(_copyfrom->rgb_image, rgb_image, memsize);
}
CImageBasis::CImageBasis(std::string _image)
{
channels = 3;
externalImage = false;
filename = _image;
long zwld = esp_get_free_heap_size();
printf("freeheapsize before: %ld\n", zwld);
rgb_image = stbi_load(_image.c_str(), &width, &height, &bpp, channels);
zwld = esp_get_free_heap_size();
printf("freeheapsize after : %ld\n", zwld);
std::string zw = "Image Load failed:" + _image + "\n";
if (rgb_image == NULL)
printf(zw.c_str());
zw = "CImageBasis after load " + _image + "\n";
printf(zw.c_str());
printf("w %d, h %d, b %d, c %d\n", width, height, bpp, channels);
}
bool CImageBasis::ImageOkay(){
return rgb_image != NULL;
}
CImageBasis::CImageBasis(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp)
{
rgb_image = _rgb_image;
channels = _channels;
width = _width;
height = _height;
bpp = _bpp;
externalImage = true;
}
void CImageBasis::Contrast(float _contrast) //input range [-100..100]
{
stbi_uc* p_source;
float contrast = (_contrast/100) + 1; //convert to decimal & shift range: [0..2]
float intercept = 128 * (1 - contrast);
for (int x = 0; x < width; ++x)
for (int y = 0; y < height; ++y)
{
p_source = rgb_image + (channels * (y * width + x));
for (int _channels = 0; _channels < channels; ++_channels)
p_source[_channels] = (uint8_t) std::min(255, std::max(0, (int) (p_source[_channels] * contrast + intercept)));
}
}
CImageBasis::~CImageBasis()
{
if (!externalImage)
stbi_image_free(rgb_image);
}
void CImageBasis::SaveToFile(std::string _imageout)
{
string typ = getFileType(_imageout);
if ((typ == "jpg") || (typ == "JPG")) // ACHTUNG PROBLEMATISCH IM ESP32
{
stbi_write_jpg(_imageout.c_str(), width, height, channels, rgb_image, 0);
}
if ((typ == "bmp") || (typ == "BMP"))
{
stbi_write_bmp(_imageout.c_str(), width, height, channels, rgb_image);
}
}
CAlignAndCutImage::CAlignAndCutImage(CImageBasis *_org, CImageBasis *_temp)
{
rgb_image = _org->rgb_image;
channels = _org->channels;
width = _org->width;
height = _org->height;
bpp = _org->bpp;
externalImage = true;
ImageTMP = _temp;
}
void CAlignAndCutImage::GetRefSize(int *ref_dx, int *ref_dy)
{
ref_dx[0] = t0_dx;
ref_dy[0] = t0_dy;
ref_dx[1] = t1_dx;
ref_dy[1] = t1_dy;
}
void CAlignAndCutImage::Align(std::string _template0, int ref0_x, int ref0_y, std::string _template1, int ref1_x, int ref1_y, int deltax, int deltay, std::string imageROI)
{
int dx, dy;
int r0_x, r0_y, r1_x, r1_y;
// CFindTemplate* ft = new CFindTemplate(filename);
CFindTemplate* ft = new CFindTemplate(rgb_image, channels, width, height, bpp);
r0_x = ref0_x;
r0_y = ref0_y;
ft->FindTemplate(_template0, &r0_x, &r0_y, deltax, deltay);
t0_dx = ft->tpl_width;
t0_dy = ft->tpl_height;
r1_x = ref1_x;
r1_y = ref1_y;
ft->FindTemplate(_template1, &r1_x, &r1_y, deltax, deltay);
t1_dx = ft->tpl_width;
t1_dy = ft->tpl_height;
delete ft;
dx = ref0_x - r0_x;
dy = ref0_y - r0_y;
r0_x += dx;
r0_y += dy;
r1_x += dx;
r1_y += dy;
float w_org, w_ist, d_winkel;
w_org = atan2(ref1_y - ref0_y, ref1_x - ref0_x);
w_ist = atan2(r1_y - r0_y, r1_x - r0_x);
d_winkel = (w_org - w_ist) * 180 / M_PI;
if (imageROI.length() > 0)
{
CImageBasis* imgzw = new CImageBasis(this);
imgzw->drawRect(r0_x, r0_y, t0_dx, t0_dy, 255, 0, 0, 2);
imgzw->drawRect(r1_x, r1_y, t1_dx, t1_dy, 255, 0, 0, 2);
imgzw->SaveToFile(imageROI);
printf("Alignment: alignment ROI created: %s\n", imageROI.c_str());
delete imgzw;
}
string zw = "\tdx:\t" + to_string(dx) + "\tdy:\t" + to_string(dy) + "\td_winkel:\t" + to_string(d_winkel);
// LogFile.WriteToDedicatedFile("/sdcard/alignment.txt", zw);
CRotate rt(this, ImageTMP);
rt.Translate(dx, dy);
rt.Rotate(d_winkel, ref0_x, ref0_y);
printf("Alignment: dx %d - dy %d - rot %f\n", dx, dy, d_winkel);
}
void CAlignAndCutImage::CutAndSave(std::string _template1, int x1, int y1, int dx, int dy)
{
int x2, y2;
x2 = x1 + dx;
y2 = y1 + dy;
x2 = min(x2, width - 1);
y2 = min(y2, height - 1);
dx = x2 - x1;
dy = y2 - y1;
int memsize = dx * dy * channels;
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
stbi_uc* p_target;
stbi_uc* p_source;
for (int x = x1; x < x2; ++x)
for (int y = y1; y < y2; ++y)
{
p_target = odata + (channels * ((y - y1) * dx + (x - x1)));
p_source = rgb_image + (channels * (y * width + x));
for (int _channels = 0; _channels < channels; ++_channels)
p_target[_channels] = p_source[_channels];
}
// stbi_write_jpg(_template1.c_str(), dx, dy, channels, odata, 0);
stbi_write_bmp(_template1.c_str(), dx, dy, channels, odata);
stbi_image_free(odata);
}
CResizeImage* CAlignAndCutImage::CutAndSave(int x1, int y1, int dx, int dy)
{
int x2, y2;
x2 = x1 + dx;
y2 = y1 + dy;
x2 = min(x2, width - 1);
y2 = min(y2, height - 1);
dx = x2 - x1;
dy = y2 - y1;
int memsize = dx * dy * channels;
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
stbi_uc* p_target;
stbi_uc* p_source;
for (int x = x1; x < x2; ++x)
for (int y = y1; y < y2; ++y)
{
p_target = odata + (channels * ((y - y1) * dx + (x - x1)));
p_source = rgb_image + (channels * (y * width + x));
for (int _channels = 0; _channels < channels; ++_channels)
p_target[_channels] = p_source[_channels];
}
CResizeImage* rs = new CResizeImage(odata, channels, dx, dy, bpp);
rs->SetIndepended();
return rs;
}

View File

@@ -1,75 +1,6 @@
#pragma once #include "CImageBasis.h"
#ifndef __CFINDTEMPLATE
#define __CFINGTEMPLATE
#include <stdint.h>
#include <string>
#define _USE_MATH_DEFINES
#include <math.h>
#include "stb_image.h"
#include "stb_image_write.h"
#include "stb_image_resize.h"
#define MAX_JPG_SIZE 128000
struct ImageData
{
uint8_t data[MAX_JPG_SIZE];
size_t size = 0;
};
class CImageBasis
{
protected:
bool externalImage;
std::string filename;
void memCopy(uint8_t* _source, uint8_t* _target, int _size);
bool isInImage(int x, int y);
public:
uint8_t* rgb_image;
int channels;
int width, height, bpp;
int getWidth(){return this->width;};
int getHeight(){return this->height;};
int getChannels(){return this->channels;};
void drawRect(int x, int y, int dx, int dy, int r = 255, int g = 255, int b = 255, int thickness = 1);
void drawLine(int x1, int y1, int x2, int y2, int r, int g, int b, int thickness = 1);
void drawCircle(int x1, int y1, int rad, int r, int g, int b, int thickness = 1);
void setPixelColor(int x, int y, int r, int g, int b);
void Contrast(float _contrast);
bool ImageOkay();
bool CopyFromMemory(uint8_t* _source, int _size);
void SetIndepended(){externalImage = false;};
void CreateEmptyImage(int _width, int _height, int _channels);
CImageBasis();
CImageBasis(std::string _image);
CImageBasis(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp);
CImageBasis(CImageBasis *_copyfrom);
void LoadFromMemory(stbi_uc *_buffer, int len);
ImageData* writeToMemoryAsJPG(const int quality = 90);
uint8_t GetPixelColor(int x, int y, int ch);
~CImageBasis();
void SaveToFile(std::string _imageout);
};
class CFindTemplate : public CImageBasis class CFindTemplate : public CImageBasis
{ {
public: public:
@@ -82,50 +13,4 @@ class CFindTemplate : public CImageBasis
void FindTemplate(std::string _template, int* found_x, int* found_y, int _dx, int _dy, std::string _imageout); void FindTemplate(std::string _template, int* found_x, int* found_y, int _dx, int _dy, std::string _imageout);
void FindTemplate(std::string _template, int* found_x, int* found_y); void FindTemplate(std::string _template, int* found_x, int* found_y);
void FindTemplate(std::string _template, int* found_x, int* found_y, int _dx, int _dy); void FindTemplate(std::string _template, int* found_x, int* found_y, int _dx, int _dy);
}; };
class CRotate: public CImageBasis
{
public:
CImageBasis *ImageTMP;
CRotate(std::string _image) : CImageBasis(_image) {ImageTMP = NULL;};
CRotate(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(_rgb_image, _channels, _width, _height, _bpp) {ImageTMP = NULL;};
CRotate(CImageBasis *_org, CImageBasis *_temp);
void Rotate(float _angle);
void Rotate(float _angle, int _centerx, int _centery);
void Translate(int _dx, int _dy);
void Mirror();
};
class CResizeImage : public CImageBasis
{
public:
CResizeImage(std::string _image) : CImageBasis(_image) {};
CResizeImage(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(_rgb_image, _channels, _width, _height, _bpp) {};
// CResizeImage(std::string _image, int _new_dx, int _new_dy);
void Resize(int _new_dx, int _new_dy);
};
class CAlignAndCutImage : public CImageBasis
{
public:
int t0_dx, t0_dy, t1_dx, t1_dy;
CImageBasis *ImageTMP;
CAlignAndCutImage(std::string _image) : CImageBasis(_image) {ImageTMP = NULL;};
CAlignAndCutImage(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(_rgb_image, _channels, _width, _height, _bpp) {ImageTMP = NULL;};
CAlignAndCutImage(CImageBasis *_org, CImageBasis *_temp);
void Align(std::string _template1, int x1, int y1, std::string _template2, int x2, int y2, int deltax = 40, int deltay = 40, std::string imageROI = "");
void CutAndSave(std::string _template1, int x1, int y1, int dx, int dy);
CResizeImage* CutAndSave(int x1, int y1, int dx, int dy);
void GetRefSize(int *ref_dx, int *ref_dy);
};
#endif

View File

@@ -0,0 +1,424 @@
#include "CImageBasis.h"
#include "Helper.h"
#include "ClassLogFile.h"
#include <esp_log.h>
#include "esp_system.h"
#include <cstring>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define _ESP32_PSRAM
using namespace std;
static const char *TAG = "CImageBasis";
void writejpghelp(void *context, void *data, int size)
{
// printf("Size all: %d, size %d\n", ((ImageData*)context)->size, size);
ImageData* _zw = (ImageData*) context;
uint8_t *voidstart = _zw->data;
uint8_t *datastart = (uint8_t*) data;
voidstart += _zw->size;
for (int i = 0; i < size; ++i)
*(voidstart + i) = *(datastart + i);
_zw->size += size;
}
ImageData* CImageBasis::writeToMemoryAsJPG(const int quality)
{
ImageData* ii = new ImageData;
stbi_write_jpg_to_func(writejpghelp, ii, width, height, channels, rgb_image, quality);
return ii;
}
#define HTTP_BUFFER_SENT 1024
struct SendJPGHTTP
{
httpd_req_t *req;
esp_err_t res;
char buf[HTTP_BUFFER_SENT];
int size = 0;
};
inline void writejpgtohttphelp(void *context, void *data, int size)
{
SendJPGHTTP* _send = (SendJPGHTTP*) context;
if ((_send->size + size) >= HTTP_BUFFER_SENT) // data passt nich mehr in buffer
{
httpd_req_t *_req = _send->req;
if (httpd_resp_send_chunk(_req, _send->buf, _send->size) != ESP_OK)
{
ESP_LOGE(TAG, "File sending failed!");
_send->res = ESP_FAIL;
}
_send->size = 0;
}
std::memcpy((void*) (&(_send->buf[0]) + _send->size), data, size);
_send->size+= size;
}
esp_err_t CImageBasis::SendJPGtoHTTP(httpd_req_t *_req, const int quality)
{
SendJPGHTTP ii;
ii.req = _req;
ii.res = ESP_OK;
ii.size = 0;
stbi_write_jpg_to_func(writejpgtohttphelp, &ii, width, height, channels, rgb_image, quality);
if (ii.size > 0)
{
if (httpd_resp_send_chunk(_req, (char*) ii.buf, ii.size) != ESP_OK) // verschicke noch den Rest
{
ESP_LOGE(TAG, "File sending failed!");
ii.res = ESP_FAIL;
}
}
return ii.res;
}
bool CImageBasis::CopyFromMemory(uint8_t* _source, int _size)
{
int gr = height * width * channels;
if (gr != _size) // Größe passt nicht
{
printf("Kann Bild nicht von Speicher kopierte - Größen passen nicht zusammen: soll %d, ist %d\n", _size, gr);
return false;
}
memCopy(_source, rgb_image, _size);
return true;
}
uint8_t CImageBasis::GetPixelColor(int x, int y, int ch)
{
stbi_uc* p_source;
p_source = rgb_image + (channels * (y * width + x));
return p_source[ch];
}
void CImageBasis::memCopy(uint8_t* _source, uint8_t* _target, int _size)
{
#ifdef _ESP32_PSRAM
for (int i = 0; i < _size; ++i)
*(_target + i) = *(_source + i);
#else
memcpy(_target, _source, _size);
#endif
}
bool CImageBasis::isInImage(int x, int y)
{
if ((x < 0) || (x > width - 1))
return false;
if ((y < 0) || (y > height- 1))
return false;
return true;
}
void CImageBasis::setPixelColor(int x, int y, int r, int g, int b)
{
stbi_uc* p_source;
p_source = rgb_image + (channels * (y * width + x));
p_source[0] = r;
if ( channels > 2)
{
p_source[1] = g;
p_source[2] = b;
}
}
void CImageBasis::drawRect(int x, int y, int dx, int dy, int r, int g, int b, int thickness)
{
int zwx1, zwx2, zwy1, zwy2;
int _x, _y, _thick;
zwx1 = x - thickness + 1;
zwx2 = x + dx + thickness - 1;
zwy1 = y;
zwy2 = y;
for (_thick = 0; _thick < thickness; _thick++)
for (_x = zwx1; _x <= zwx2; ++_x)
for (_y = zwy1; _y <= zwy2; _y++)
if (isInImage(_x, _y))
setPixelColor(_x, _y - _thick, r, g, b);
zwx1 = x - thickness + 1;
zwx2 = x + dx + thickness - 1;
zwy1 = y + dy;
zwy2 = y + dy;
for (_thick = 0; _thick < thickness; _thick++)
for (_x = zwx1; _x <= zwx2; ++_x)
for (_y = zwy1; _y <= zwy2; _y++)
if (isInImage(_x, _y))
setPixelColor(_x, _y + _thick, r, g, b);
zwx1 = x;
zwx2 = x;
zwy1 = y;
zwy2 = y + dy;
for (_thick = 0; _thick < thickness; _thick++)
for (_x = zwx1; _x <= zwx2; ++_x)
for (_y = zwy1; _y <= zwy2; _y++)
if (isInImage(_x, _y))
setPixelColor(_x - _thick, _y, r, g, b);
zwx1 = x + dx;
zwx2 = x + dx;
zwy1 = y;
zwy2 = y + dy;
for (_thick = 0; _thick < thickness; _thick++)
for (_x = zwx1; _x <= zwx2; ++_x)
for (_y = zwy1; _y <= zwy2; _y++)
if (isInImage(_x, _y))
setPixelColor(_x + _thick, _y, r, g, b);
}
void CImageBasis::drawLine(int x1, int y1, int x2, int y2, int r, int g, int b, int thickness)
{
int _x, _y, _thick;
int _zwy1, _zwy2;
thickness = (thickness-1) / 2;
for (_thick = 0; _thick <= thickness; ++_thick)
for (_x = x1 - _thick; _x <= x2 + _thick; ++_x)
{
if (x2 == x1)
{
_zwy1 = y1;
_zwy2 = y2;
}
else
{
_zwy1 = (y2 - y1) * (float)(_x - x1) / (float)(x2 - x1) + y1;
_zwy2 = (y2 - y1) * (float)(_x + 1 - x1) / (float)(x2 - x1) + y1;
}
for (_y = _zwy1 - _thick; _y <= _zwy2 + _thick; _y++)
if (isInImage(_x, _y))
setPixelColor(_x, _y, r, g, b);
}
}
void CImageBasis::drawCircle(int x1, int y1, int rad, int r, int g, int b, int thickness)
{
float deltarad, aktrad;
int _thick, _x, _y;
deltarad = 1 / (4 * M_PI * (rad + thickness - 1));
for (aktrad = 0; aktrad <= (2 * M_PI); aktrad += deltarad)
for (_thick = 0; _thick < thickness; ++_thick)
{
_x = sin(aktrad) * (rad + _thick) + x1;
_y = cos(aktrad) * (rad + _thick) + y1;
if (isInImage(_x, _y))
setPixelColor(_x, _y, r, g, b);
}
}
CImageBasis::CImageBasis()
{
externalImage = false;
}
void CImageBasis::CreateEmptyImage(int _width, int _height, int _channels)
{
bpp = _channels;
width = _width;
height = _height;
channels = _channels;
int memsize = width * height * channels;
rgb_image = (unsigned char*)GET_MEMORY(memsize);
stbi_uc* p_source;
for (int x = 0; x < width; ++x)
for (int y = 0; y < height; ++y)
{
p_source = rgb_image + (channels * (y * width + x));
for (int _channels = 0; _channels < channels; ++_channels)
p_source[_channels] = (uint8_t) 0;
}
}
void CImageBasis::LoadFromMemory(stbi_uc *_buffer, int len)
{
// if (rgb_image)
// free(rgb_image);
rgb_image = stbi_load_from_memory(_buffer, len, &width, &height, &channels, 3);
bpp = channels;
// STBIDEF stbi_uc *stbi_load_from_memory (stbi_uc const *buffer, int len , int *x, int *y, int *channels_in_file, int desired_channels);
}
CImageBasis::CImageBasis(CImageBasis *_copyfrom)
{
externalImage = false;
channels = _copyfrom->channels;
width = _copyfrom->width;
height = _copyfrom->height;
bpp = _copyfrom->bpp;
int memsize = width * height * channels;
rgb_image = (unsigned char*)GET_MEMORY(memsize);
if (!rgb_image)
{
printf(getESPHeapInfo().c_str());
printf("\nKein freier Speicher mehr!!!! Benötigt: %d %d %d %d\n", width, height, channels, memsize);
return;
}
memCopy(_copyfrom->rgb_image, rgb_image, memsize);
}
CImageBasis::CImageBasis(int _width, int _height, int _channels)
{
externalImage = false;
channels = _channels;
width = _width;
height = _height;
bpp = _channels;
int memsize = width * height * channels;
rgb_image = (unsigned char*)GET_MEMORY(memsize);
if (!rgb_image)
{
printf(getESPHeapInfo().c_str());
printf("\nKein freier Speicher mehr!!!! Benötigt: %d %d %d %d\n", width, height, channels, memsize);
return;
}
}
CImageBasis::CImageBasis(std::string _image)
{
channels = 3;
externalImage = false;
filename = _image;
long zwld = esp_get_free_heap_size();
printf("freeheapsize before: %ld\n", zwld);
rgb_image = stbi_load(_image.c_str(), &width, &height, &bpp, channels);
zwld = esp_get_free_heap_size();
printf("freeheapsize after : %ld\n", zwld);
std::string zw = "Image Load failed:" + _image + "\n";
if (rgb_image == NULL)
printf(zw.c_str());
zw = "CImageBasis after load " + _image + "\n";
printf(zw.c_str());
printf("w %d, h %d, b %d, c %d\n", width, height, bpp, channels);
}
bool CImageBasis::ImageOkay(){
return rgb_image != NULL;
}
CImageBasis::CImageBasis(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp)
{
rgb_image = _rgb_image;
channels = _channels;
width = _width;
height = _height;
bpp = _bpp;
externalImage = true;
}
void CImageBasis::Contrast(float _contrast) //input range [-100..100]
{
stbi_uc* p_source;
float contrast = (_contrast/100) + 1; //convert to decimal & shift range: [0..2]
float intercept = 128 * (1 - contrast);
for (int x = 0; x < width; ++x)
for (int y = 0; y < height; ++y)
{
p_source = rgb_image + (channels * (y * width + x));
for (int _channels = 0; _channels < channels; ++_channels)
p_source[_channels] = (uint8_t) std::min(255, std::max(0, (int) (p_source[_channels] * contrast + intercept)));
}
}
CImageBasis::~CImageBasis()
{
if (!externalImage)
stbi_image_free(rgb_image);
}
void CImageBasis::SaveToFile(std::string _imageout)
{
string typ = getFileType(_imageout);
if ((typ == "jpg") || (typ == "JPG")) // ACHTUNG PROBLEMATISCH IM ESP32
{
stbi_write_jpg(_imageout.c_str(), width, height, channels, rgb_image, 0);
}
if ((typ == "bmp") || (typ == "BMP"))
{
stbi_write_bmp(_imageout.c_str(), width, height, channels, rgb_image);
}
}
void CImageBasis::Resize(int _new_dx, int _new_dy)
{
int memsize = _new_dx * _new_dy * channels;
uint8_t* odata = (unsigned char*)GET_MEMORY(memsize);
stbir_resize_uint8(rgb_image, width, height, 0, odata, _new_dx, _new_dy, 0, channels);
stbi_image_free(rgb_image);
rgb_image = (unsigned char*)GET_MEMORY(memsize);
memCopy(odata, rgb_image, memsize);
width = _new_dx;
height = _new_dy;
stbi_image_free(odata);
}
void CImageBasis::Resize(int _new_dx, int _new_dy, CImageBasis *_target)
{
if ((_target->height != _new_dy) || (_target->width != _new_dx) || (_target->channels != channels))
{
printf("CImageBasis::Resize - Targetbildgröße passt nicht !!!!!!!!!");
return;
}
uint8_t* odata = _target->rgb_image;
stbir_resize_uint8(rgb_image, width, height, 0, odata, _new_dx, _new_dy, 0, channels);
}

View File

@@ -0,0 +1,88 @@
#pragma once
#ifndef __CIMAGEBASIS
#define __CIMAGEBASIS
#include <stdint.h>
#include <string>
#include <esp_http_server.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include "stb_image.h"
#include "stb_image_write.h"
#include "stb_image_resize.h"
#include "esp_heap_caps.h"
//#define GET_MEMORY malloc
#define GET_MEMORY(X) heap_caps_malloc(X, MALLOC_CAP_SPIRAM)
#define MAX_JPG_SIZE 128000
struct ImageData
{
uint8_t data[MAX_JPG_SIZE];
size_t size = 0;
};
class CImageBasis
{
protected:
bool externalImage;
std::string filename;
void memCopy(uint8_t* _source, uint8_t* _target, int _size);
bool isInImage(int x, int y);
public:
uint8_t* rgb_image;
int channels;
int width, height, bpp;
int getWidth(){return this->width;};
int getHeight(){return this->height;};
int getChannels(){return this->channels;};
void drawRect(int x, int y, int dx, int dy, int r = 255, int g = 255, int b = 255, int thickness = 1);
void drawLine(int x1, int y1, int x2, int y2, int r, int g, int b, int thickness = 1);
void drawCircle(int x1, int y1, int rad, int r, int g, int b, int thickness = 1);
void setPixelColor(int x, int y, int r, int g, int b);
void Contrast(float _contrast);
bool ImageOkay();
bool CopyFromMemory(uint8_t* _source, int _size);
void SetIndepended(){externalImage = false;};
void CreateEmptyImage(int _width, int _height, int _channels);
CImageBasis();
CImageBasis(std::string _image);
CImageBasis(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp);
CImageBasis(int _width, int _height, int _channels);
CImageBasis(CImageBasis *_copyfrom);
void Resize(int _new_dx, int _new_dy);
void Resize(int _new_dx, int _new_dy, CImageBasis *_target);
void LoadFromMemory(stbi_uc *_buffer, int len);
ImageData* writeToMemoryAsJPG(const int quality = 90);
esp_err_t SendJPGtoHTTP(httpd_req_t *req, const int quality = 90);
uint8_t GetPixelColor(int x, int y, int ch);
~CImageBasis();
void SaveToFile(std::string _imageout);
};
#endif

View File

@@ -2,6 +2,6 @@ FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
idf_component_register(SRCS ${app_sources} idf_component_register(SRCS ${app_sources}
INCLUDE_DIRS "." INCLUDE_DIRS "."
REQUIRES jomjol_helper jomjol_logfile) REQUIRES jomjol_helper jomjol_logfile esp_http_server)

View File

@@ -0,0 +1,171 @@
#include "CRotateImage.h"
CRotateImage::CRotateImage(CImageBasis *_org, CImageBasis *_temp)
{
rgb_image = _org->rgb_image;
channels = _org->channels;
width = _org->width;
height = _org->height;
bpp = _org->bpp;
externalImage = true;
ImageTMP = _temp;
}
void CRotateImage::Mirror(){
int memsize = width * height * channels;
uint8_t* odata;
if (ImageTMP)
{
odata = ImageTMP->rgb_image;
}
else
{
odata = (unsigned char*)GET_MEMORY(memsize);
}
int x_source, y_source;
stbi_uc* p_target;
stbi_uc* p_source;
for (int x = 0; x < width; ++x)
for (int y = 0; y < height; ++y)
{
p_target = odata + (channels * (y * width + x));
x_source = width - x;
y_source = y;
p_source = rgb_image + (channels * (y_source * width + x_source));
for (int _channels = 0; _channels < channels; ++_channels)
p_target[_channels] = p_source[_channels];
}
// memcpy(rgb_image, odata, memsize);
memCopy(odata, rgb_image, memsize);
if (!ImageTMP)
{
stbi_image_free(odata);
}
}
void CRotateImage::Rotate(float _angle, int _centerx, int _centery)
{
float m[2][3];
float x_center = _centerx;
float y_center = _centery;
_angle = _angle / 180 * M_PI;
m[0][0] = cos(_angle);
m[0][1] = sin(_angle);
m[0][2] = (1 - m[0][0]) * x_center - m[0][1] * y_center;
m[1][0] = -m[0][1];
m[1][1] = m[0][0];
m[1][2] = m[0][1] * x_center + (1 - m[0][0]) * y_center;
int memsize = width * height * channels;
uint8_t* odata;
if (ImageTMP)
{
odata = ImageTMP->rgb_image;
}
else
{
odata = (unsigned char*)GET_MEMORY(memsize);
}
int x_source, y_source;
stbi_uc* p_target;
stbi_uc* p_source;
for (int x = 0; x < width; ++x)
for (int y = 0; y < height; ++y)
{
p_target = odata + (channels * (y * width + x));
x_source = int(m[0][0] * x + m[0][1] * y);
y_source = int(m[1][0] * x + m[1][1] * y);
x_source += int(m[0][2]);
y_source += int(m[1][2]);
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)
{
stbi_image_free(odata);
}
}
void CRotateImage::Rotate(float _angle)
{
// printf("width %d, height %d\n", width, height);
Rotate(_angle, width / 2, height / 2);
}
void CRotateImage::Translate(int _dx, int _dy)
{
int memsize = width * height * channels;
uint8_t* odata;
if (ImageTMP)
{
odata = ImageTMP->rgb_image;
}
else
{
odata = (unsigned char*)GET_MEMORY(memsize);
}
int x_source, y_source;
stbi_uc* p_target;
stbi_uc* p_source;
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)
{
stbi_image_free(odata);
}
}

View File

@@ -0,0 +1,16 @@
#include "CImageBasis.h"
class CRotateImage: public CImageBasis
{
public:
CImageBasis *ImageTMP;
CRotateImage(std::string _image) : CImageBasis(_image) {ImageTMP = NULL;};
CRotateImage(uint8_t* _rgb_image, int _channels, int _width, int _height, int _bpp) : CImageBasis(_rgb_image, _channels, _width, _height, _bpp) {ImageTMP = NULL;};
CRotateImage(CImageBasis *_org, CImageBasis *_temp);
void Rotate(float _angle);
void Rotate(float _angle, int _centerx, int _centery);
void Translate(int _dx, int _dy);
void Mirror();
};

View File

@@ -19,7 +19,9 @@ void ClassLogFile::WriteToDedicatedFile(std::string _fn, std::string info, bool
return; return;
} }
pFile = OpenFileAndWait(_fn.c_str(), "a"); // pFile = OpenFileAndWait(_fn.c_str(), "a");
pFile = fopen(_fn.c_str(), "a+");
printf("Logfile opened: %s\n", _fn.c_str());
if (pFile!=NULL) { if (pFile!=NULL) {
if (_time) if (_time)
@@ -55,6 +57,7 @@ void ClassLogFile::SetRetention(unsigned short _retentionInDays){
void ClassLogFile::WriteToFile(std::string info, bool _time) void ClassLogFile::WriteToFile(std::string info, bool _time)
{ {
/*
struct stat path_stat; struct stat path_stat;
if (stat(logroot.c_str(), &path_stat) != 0) { if (stat(logroot.c_str(), &path_stat) != 0) {
ESP_LOGI(TAG, "Create log folder: %s", logroot.c_str()); ESP_LOGI(TAG, "Create log folder: %s", logroot.c_str());
@@ -62,7 +65,7 @@ void ClassLogFile::WriteToFile(std::string info, bool _time)
ESP_LOGI(TAG, "Can't create log foolder"); ESP_LOGI(TAG, "Can't create log foolder");
} }
} }
*/
time_t rawtime; time_t rawtime;
struct tm* timeinfo; struct tm* timeinfo;
char buffer[30]; char buffer[30];

View File

@@ -14,7 +14,7 @@
#include "esp_err.h" #include "esp_err.h"
#include "esp_log.h" #include "esp_log.h"
#include "CFindTemplate.h" #include "CImageBasis.h"

View File

@@ -29,9 +29,9 @@ bool flowisrunning = false;
long auto_intervall = 0; long auto_intervall = 0;
bool auto_isrunning = false; bool auto_isrunning = false;
ImageData* GetJPG(std::string _filename) esp_err_t GetJPG(std::string _filename, httpd_req_t *req)
{ {
return tfliteflow.GetJPGStream(_filename); return tfliteflow.GetJPGStream(_filename, req);
} }
esp_err_t GetRawJPG(httpd_req_t *req) esp_err_t GetRawJPG(httpd_req_t *req)

View File

@@ -1,7 +1,7 @@
#include <esp_log.h> #include <esp_log.h>
#include <esp_http_server.h> #include <esp_http_server.h>
#include "CFindTemplate.h" #include "CImageBasis.h"
//#include "ClassControllCamera.h" //#include "ClassControllCamera.h"
@@ -15,6 +15,6 @@ void TFliteDoAutoStart();
bool isSetupModusActive(); bool isSetupModusActive();
ImageData* GetJPG(std::string _filename); esp_err_t GetJPG(std::string _filename, httpd_req_t *req);
esp_err_t GetRawJPG(httpd_req_t *req); esp_err_t GetRawJPG(httpd_req_t *req);

View File

@@ -44,10 +44,15 @@ void Init_NVS_SDCard()
// sdmmc_host_t host = SDMMC_HOST_SLOT_1(); // sdmmc_host_t host = SDMMC_HOST_SLOT_1();
// host.flags = SDMMC_HOST_FLAG_1BIT; // host.flags = SDMMC_HOST_FLAG_1BIT;
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT(); sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
slot_config.width = 1; // 1 line SD mode
esp_vfs_fat_sdmmc_mount_config_t mount_config = { }; esp_vfs_fat_sdmmc_mount_config_t mount_config = { };
mount_config.format_if_mount_failed = false; mount_config.format_if_mount_failed = false;
mount_config.max_files = 5; mount_config.max_files = 5;
gpio_set_pull_mode((gpio_num_t) 15, GPIO_PULLUP_ONLY); // CMD, needed in 4- and 1- line modes
gpio_set_pull_mode((gpio_num_t) 2, GPIO_PULLUP_ONLY); // D0, needed in 4- and 1-line modes
sdmmc_card_t* card; sdmmc_card_t* card;
ret = esp_vfs_fat_sdmmc_mount("/sdcard", &host, &slot_config, &mount_config, &card); ret = esp_vfs_fat_sdmmc_mount("/sdcard", &host, &slot_config, &mount_config, &card);
if (ret != ESP_OK) { if (ret != ESP_OK) {

View File

@@ -239,30 +239,12 @@ esp_err_t img_tmp_virtual_handler(httpd_req_t *req)
return GetRawJPG(req); return GetRawJPG(req);
} }
ImageData *zw = GetJPG(filetosend); esp_err_t zw = GetJPG(filetosend, req);
if (zw) if (zw == ESP_OK)
{
ESP_LOGI(TAG, "Sending file : %s (%d bytes)...", filetosend.c_str(), zw->size);
set_content_type_from_file(req, filetosend.c_str());
if (httpd_resp_send_chunk(req, (char*) &(zw->data), zw->size) != ESP_OK) {
ESP_LOGE(TAG, "File sending failed!");
httpd_resp_sendstr_chunk(req, NULL);
httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to send file");
delete zw;
return ESP_FAIL;
}
ESP_LOGI(TAG, "File sending complete");
/* Respond with an empty chunk to signal HTTP response completion */
httpd_resp_send_chunk(req, NULL, 0);
delete zw;
return ESP_OK; return ESP_OK;
}
// File wird nicht intern bereit gestellt --> klassischer weg: // File wird nicht intern bereit gestellt --> klassischer weg:
return img_tmp_handler(req); return img_tmp_handler(req);
} }

View File

@@ -1,4 +1,4 @@
const char* GIT_REV="f5c2810"; const char* GIT_REV="b418525";
const char* GIT_TAG=""; const char* GIT_TAG="";
const char* GIT_BRANCH="rolling"; const char* GIT_BRANCH="rolling-reduce-sd-use";
const char* BUILD_TIME="2020-12-21 22:49"; const char* BUILD_TIME="2020-12-23 07:56";

View File

@@ -537,8 +537,8 @@ CONFIG_FATFS_MAX_LFN=255
CONFIG_FATFS_API_ENCODING_ANSI_OEM=y CONFIG_FATFS_API_ENCODING_ANSI_OEM=y
# CONFIG_FATFS_API_ENCODING_UTF_16 is not set # CONFIG_FATFS_API_ENCODING_UTF_16 is not set
# CONFIG_FATFS_API_ENCODING_UTF_8 is not set # CONFIG_FATFS_API_ENCODING_UTF_8 is not set
CONFIG_FATFS_FS_LOCK=0 CONFIG_FATFS_FS_LOCK=10
CONFIG_FATFS_TIMEOUT_MS=100 CONFIG_FATFS_TIMEOUT_MS=5000
CONFIG_FATFS_PER_FILE_CACHE=y CONFIG_FATFS_PER_FILE_CACHE=y
CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y
# end of FAT Filesystem support # end of FAT Filesystem support
@@ -965,7 +965,7 @@ CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y
# #
# Virtual file system # Virtual file system
# #
CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y # CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set
CONFIG_VFS_SUPPORT_TERMIOS=y CONFIG_VFS_SUPPORT_TERMIOS=y
# #
@@ -1166,6 +1166,6 @@ CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread"
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y
# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set
# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set
CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y # CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT is not set
CONFIG_SUPPORT_TERMIOS=y CONFIG_SUPPORT_TERMIOS=y
# End of deprecated options # End of deprecated options

View File

@@ -537,8 +537,8 @@ CONFIG_FATFS_MAX_LFN=255
CONFIG_FATFS_API_ENCODING_ANSI_OEM=y CONFIG_FATFS_API_ENCODING_ANSI_OEM=y
# CONFIG_FATFS_API_ENCODING_UTF_16 is not set # CONFIG_FATFS_API_ENCODING_UTF_16 is not set
# CONFIG_FATFS_API_ENCODING_UTF_8 is not set # CONFIG_FATFS_API_ENCODING_UTF_8 is not set
CONFIG_FATFS_FS_LOCK=0 CONFIG_FATFS_FS_LOCK=10
CONFIG_FATFS_TIMEOUT_MS=100 CONFIG_FATFS_TIMEOUT_MS=5000
CONFIG_FATFS_PER_FILE_CACHE=y CONFIG_FATFS_PER_FILE_CACHE=y
CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y
# end of FAT Filesystem support # end of FAT Filesystem support
@@ -965,7 +965,7 @@ CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y
# #
# Virtual file system # Virtual file system
# #
CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y # CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set
CONFIG_VFS_SUPPORT_TERMIOS=y CONFIG_VFS_SUPPORT_TERMIOS=y
# #
@@ -1166,6 +1166,6 @@ CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread"
CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y
# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set
# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set
CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y # CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT is not set
CONFIG_SUPPORT_TERMIOS=y CONFIG_SUPPORT_TERMIOS=y
# End of deprecated options # End of deprecated options

View File

@@ -1,4 +1,4 @@
const char* GIT_REV="f5c2810"; const char* GIT_REV="b418525";
const char* GIT_TAG=""; const char* GIT_TAG="";
const char* GIT_BRANCH="rolling"; const char* GIT_BRANCH="rolling-reduce-sd-use";
const char* BUILD_TIME="2020-12-21 22:49"; const char* BUILD_TIME="2020-12-23 07:56";

Binary file not shown.

Binary file not shown.

Binary file not shown.