mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-07 20:16:55 +03:00
Modify ClassControllCamera_MakeImage
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "ClassControllCamera.h"
|
||||
#include "ClassLogFile.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "driver/gpio.h"
|
||||
@@ -184,6 +185,8 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
|
||||
|
||||
LEDOnOff(true);
|
||||
|
||||
// if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - Start");
|
||||
|
||||
if (delay > 0)
|
||||
{
|
||||
LightOnOff(true);
|
||||
@@ -191,18 +194,37 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
|
||||
vTaskDelay( xDelay );
|
||||
}
|
||||
|
||||
// if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After LightOn");
|
||||
|
||||
camera_fb_t * fb = esp_camera_fb_get();
|
||||
if (!fb) {
|
||||
ESP_LOGE(TAGCAMERACLASS, "Camera Capture Failed");
|
||||
LEDOnOff(false);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
// if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After fb_get");
|
||||
|
||||
LEDOnOff(false);
|
||||
|
||||
uint8_t * buf = NULL;
|
||||
size_t buf_len = 0;
|
||||
|
||||
frame2bmp(fb, &buf, &buf_len);
|
||||
int _anz = 0;
|
||||
TickType_t xDelay = 3000 / portTICK_PERIOD_MS;
|
||||
|
||||
while (!frame2bmp(fb, &buf, &buf_len) && _anz < 5)
|
||||
{
|
||||
esp_camera_fb_return(fb);
|
||||
std::string _zw1 = "CCamera::CaptureToBasisImage failed #" + std::to_string(++_anz);
|
||||
LogFile.WriteToFile(_zw1);
|
||||
vTaskDelay( xDelay );
|
||||
fb = esp_camera_fb_get();
|
||||
}
|
||||
|
||||
esp_camera_fb_return(fb);
|
||||
|
||||
if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After frame2bmp");
|
||||
|
||||
int _len_zw = buf_len - BMP_HEADER_LEN;
|
||||
uint8_t *_buf_zeiger = buf + BMP_HEADER_LEN;
|
||||
@@ -213,6 +235,11 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
|
||||
int width = image_width;
|
||||
int height = image_height;
|
||||
|
||||
std::string _zw = "Targetimage: " + std::to_string((int) _Image->rgb_image) + " Size: " + std::to_string(_Image->width) + ", " + std::to_string(_Image->height);
|
||||
_zw = _zw + " Buf: " + std::to_string((int) buf);
|
||||
|
||||
if (debug_detail_heap) LogFile.WriteToFile(_zw);
|
||||
|
||||
for (int x = 0; x < width; ++x)
|
||||
for (int y = 0; y < height; ++y)
|
||||
{
|
||||
@@ -223,6 +250,8 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
|
||||
p_target[2] = p_source[0];
|
||||
}
|
||||
|
||||
if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - After Copy To Target");
|
||||
|
||||
// _Image->CopyFromMemory(_buf_zeiger, _len_zw);
|
||||
|
||||
free(buf);
|
||||
@@ -232,6 +261,8 @@ esp_err_t CCamera::CaptureToBasisImage(CImageBasis *_Image, int delay)
|
||||
LightOnOff(false);
|
||||
}
|
||||
|
||||
if (debug_detail_heap) LogFile.WriteHeapInfo("CCamera::CaptureToBasisImage - Done");
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,5 +45,6 @@ class CCamera {
|
||||
|
||||
extern CCamera Camera;
|
||||
|
||||
extern bool debug_detail_heap;
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "ClassFlowMakeImage.h"
|
||||
#include "Helper.h"
|
||||
#include "ClassLogFile.h"
|
||||
|
||||
#include "CImageBasis.h"
|
||||
#include "ClassControllCamera.h"
|
||||
@@ -99,13 +100,16 @@ bool ClassFlowMakeImage::doFlow(string zwtime)
|
||||
|
||||
int flashdauer = (int) waitbeforepicture * 1000;
|
||||
|
||||
if (debug_detail_heap) LogFile.WriteHeapInfo("ClassFlowMakeImage::doFlow - Before takePictureWithFlash");
|
||||
|
||||
takePictureWithFlash(flashdauer);
|
||||
|
||||
// time(&TimeImageTaken);
|
||||
// localtime(&TimeImageTaken);
|
||||
if (debug_detail_heap) LogFile.WriteHeapInfo("ClassFlowMakeImage::doFlow - After takePictureWithFlash");
|
||||
|
||||
LogImage(logPath, "raw", NULL, NULL, zwtime, rawImage);
|
||||
|
||||
RemoveOldLogs();
|
||||
if (debug_detail_heap) LogFile.WriteHeapInfo("ClassFlowMakeImage::doFlow - After RemoveOldLogs");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,3 +48,6 @@ public:
|
||||
~ClassFlowMakeImage(void);
|
||||
};
|
||||
|
||||
|
||||
extern bool debug_detail_heap;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const char* GIT_REV="db0ca1c";
|
||||
const char* GIT_REV="c05313a";
|
||||
const char* GIT_TAG="";
|
||||
const char* GIT_BRANCH="rolling-reduce-sd-use";
|
||||
const char* BUILD_TIME="2020-12-26 19:56";
|
||||
const char* BUILD_TIME="2020-12-27 17:35";
|
||||
@@ -1,4 +1,4 @@
|
||||
const char* GIT_REV="db0ca1c";
|
||||
const char* GIT_REV="c05313a";
|
||||
const char* GIT_TAG="";
|
||||
const char* GIT_BRANCH="rolling-reduce-sd-use";
|
||||
const char* BUILD_TIME="2020-12-26 19:56";
|
||||
const char* BUILD_TIME="2020-12-27 11:05";
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user