mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 04:26:58 +03:00
Fix initialflip issue
This commit is contained in:
@@ -208,6 +208,10 @@ bool ClassFlowAlignment::doFlow(string time)
|
|||||||
int _zw = ImageBasis->height;
|
int _zw = ImageBasis->height;
|
||||||
ImageBasis->height = ImageBasis->width;
|
ImageBasis->height = ImageBasis->width;
|
||||||
ImageBasis->width = _zw;
|
ImageBasis->width = _zw;
|
||||||
|
|
||||||
|
_zw = ImageTMP->width;
|
||||||
|
ImageTMP->width = ImageTMP->height;
|
||||||
|
ImageTMP->height = _zw;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initialmirror)
|
if (initialmirror)
|
||||||
@@ -246,13 +250,6 @@ bool ClassFlowAlignment::doFlow(string time)
|
|||||||
|
|
||||||
if (SaveAllFiles)
|
if (SaveAllFiles)
|
||||||
{
|
{
|
||||||
if (initialflip)
|
|
||||||
{
|
|
||||||
int _zw = ImageTMP->width;
|
|
||||||
ImageTMP->width = ImageTMP->height;
|
|
||||||
ImageTMP->height = _zw;
|
|
||||||
}
|
|
||||||
|
|
||||||
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/alg.jpg"));
|
AlignAndCutImage->SaveToFile(FormatFileName("/sdcard/img_tmp/alg.jpg"));
|
||||||
ImageTMP->SaveToFile(FormatFileName("/sdcard/img_tmp/alg_roi.jpg"));
|
ImageTMP->SaveToFile(FormatFileName("/sdcard/img_tmp/alg_roi.jpg"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -755,7 +755,8 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
|
|||||||
fseek(file, 0, SEEK_SET); /* reset */
|
fseek(file, 0, SEEK_SET); /* reset */
|
||||||
|
|
||||||
if (flowalignment->AlgROI->size > MAX_JPG_SIZE) {
|
if (flowalignment->AlgROI->size > MAX_JPG_SIZE) {
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "File /sdcard/html/Flowstate_take_image.jpg too large: " + std::to_string(flowalignment->AlgROI->size));
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "File /sdcard/html/Flowstate_take_image.jpg (" + std::to_string(flowalignment->AlgROI->size) +
|
||||||
|
") > allocated buffer (" + std::to_string(MAX_JPG_SIZE) + ")");
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ void writejpghelp(void *context, void *data, int size)
|
|||||||
uint8_t *voidstart = _zw->data;
|
uint8_t *voidstart = _zw->data;
|
||||||
uint8_t *datastart = (uint8_t*) data;
|
uint8_t *datastart = (uint8_t*) data;
|
||||||
|
|
||||||
if ((_zw->size < MAX_JPG_SIZE)) { // Abort copy -> no buffer anymore
|
if ((_zw->size < MAX_JPG_SIZE)) { // Abort copy to prevent buffer overflow
|
||||||
voidstart += _zw->size;
|
voidstart += _zw->size;
|
||||||
|
|
||||||
for (int i = 0; i < size; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
@@ -91,7 +91,7 @@ ImageData* CImageBasis::writeToMemoryAsJPG(const int quality)
|
|||||||
|
|
||||||
if (jpgFileTooLarge) {
|
if (jpgFileTooLarge) {
|
||||||
jpgFileTooLarge = false;
|
jpgFileTooLarge = false;
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "writeToMemoryAsJPG: JPG creation aborted! Preallocated buffer not sufficient: " + std::to_string(MAX_JPG_SIZE));
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "writeToMemoryAsJPG: Creation aborted! JPG size > preallocated buffer: " + std::to_string(MAX_JPG_SIZE));
|
||||||
}
|
}
|
||||||
return ii;
|
return ii;
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ void CImageBasis::writeToMemoryAsJPG(ImageData* i, const int quality)
|
|||||||
|
|
||||||
if (jpgFileTooLarge) {
|
if (jpgFileTooLarge) {
|
||||||
jpgFileTooLarge = false;
|
jpgFileTooLarge = false;
|
||||||
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "writeToMemoryAsJPG: JPG creation aborted! Preallocated buffer not sufficient: " + std::to_string(MAX_JPG_SIZE));
|
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "writeToMemoryAsJPG: Creation aborted! JPG size > preallocated buffer: " + std::to_string(MAX_JPG_SIZE));
|
||||||
}
|
}
|
||||||
memCopy((uint8_t*) ii, (uint8_t*) i, sizeof(ImageData));
|
memCopy((uint8_t*) ii, (uint8_t*) i, sizeof(ImageData));
|
||||||
delete ii;
|
delete ii;
|
||||||
|
|||||||
Reference in New Issue
Block a user