mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2026-01-27 12:50:39 +03:00
Rolling 20220206
This commit is contained in:
@@ -72,40 +72,44 @@ static const char *TAG_FILESERVER = "file_server";
|
||||
|
||||
using namespace std;
|
||||
|
||||
static esp_err_t get_tflite_file_handler(httpd_req_t *req){
|
||||
esp_err_t get_tflite_file_handler(httpd_req_t *req)
|
||||
{
|
||||
DIR *verzeichnis;
|
||||
struct dirent *files;
|
||||
struct dirent *entry;
|
||||
struct stat entry_stat;
|
||||
|
||||
std::string _filename, _fileext, _result = "";
|
||||
std::string _delimiter = ".";
|
||||
|
||||
std::string _filename, _fileext;
|
||||
size_t pos = 0;
|
||||
|
||||
const char verz_name[] = "/sdcard/config";
|
||||
printf("Suche TFLITE in /sdcard/config/\n");
|
||||
|
||||
verzeichnis=opendir("/sdcard/config");
|
||||
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
|
||||
httpd_resp_set_type(req, "text/plain");
|
||||
|
||||
printf("Suche TFLITE in /sdcard/config\n");
|
||||
|
||||
while((files = readdir(verzeichnis)))
|
||||
DIR *dir = opendir(verz_name);
|
||||
while ((entry = readdir(dir)) != NULL)
|
||||
{
|
||||
_filename = files->d_name;
|
||||
_fileext = _filename;
|
||||
_filename = std::string(entry->d_name);
|
||||
printf("File: %s\t", _filename.c_str());
|
||||
|
||||
while ((pos = _fileext.find(_delimiter))) {
|
||||
_fileext.erase(0, pos + _delimiter.length());
|
||||
}
|
||||
_fileext = _filename;
|
||||
pos = _fileext.find(".");
|
||||
if (pos != std::string::npos)
|
||||
_fileext = _fileext.erase(0, pos + 1);
|
||||
|
||||
printf(" Extension: %s\n", _fileext.c_str());
|
||||
|
||||
if ((_fileext == "tfl") || (_fileext == "tflite"))
|
||||
{
|
||||
_result = _result + _filename + "\t";
|
||||
_filename = "/config/" + _filename + "\t";
|
||||
httpd_resp_sendstr_chunk(req, _filename.c_str());
|
||||
}
|
||||
}
|
||||
closedir(verzeichnis);
|
||||
closedir(dir);
|
||||
|
||||
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
|
||||
httpd_resp_set_type(req, "text/plain");
|
||||
httpd_resp_sendstr_chunk(req, _result.c_str());
|
||||
httpd_resp_sendstr_chunk(req, NULL);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -363,6 +367,7 @@ static esp_err_t download_get_handler(httpd_req_t *req)
|
||||
}
|
||||
}
|
||||
|
||||
printf("uri: %s, filename: %s, filepath: %s\n", req->uri, filename, filepath);
|
||||
return http_resp_dir_html(req, filepath, filename, readonly);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,4 +5,6 @@ void register_server_file_uri(httpd_handle_t server, const char *base_path);
|
||||
|
||||
void unzip(std::string _in_zip_file, std::string _target_directory);
|
||||
|
||||
void delete_all_in_directory(std::string _directory);
|
||||
void delete_all_in_directory(std::string _directory);
|
||||
|
||||
esp_err_t get_tflite_file_handler(httpd_req_t *req);
|
||||
|
||||
@@ -435,7 +435,8 @@ void ClassFlowCNNGeneral::DrawROI(CImageBasis *_zw)
|
||||
for (int i = 0; i < GENERAL[_ana]->ROI.size(); ++i)
|
||||
{
|
||||
_zw->drawRect(GENERAL[_ana]->ROI[i]->posx, GENERAL[_ana]->ROI[i]->posy, GENERAL[_ana]->ROI[i]->deltax, GENERAL[_ana]->ROI[i]->deltay, r, g, b, 1);
|
||||
_zw->drawCircle((int) (GENERAL[_ana]->ROI[i]->posx + GENERAL[_ana]->ROI[i]->deltax/2), (int) (GENERAL[_ana]->ROI[i]->posy + GENERAL[_ana]->ROI[i]->deltay/2), (int) (GENERAL[_ana]->ROI[i]->deltax/2), r, g, b, 2);
|
||||
// _zw->drawCircle((int) (GENERAL[_ana]->ROI[i]->posx + GENERAL[_ana]->ROI[i]->deltax/2), (int) (GENERAL[_ana]->ROI[i]->posy + GENERAL[_ana]->ROI[i]->deltay/2), (int) (GENERAL[_ana]->ROI[i]->deltax/2), r, g, b, 2);
|
||||
_zw->drawEllipse( (int) (GENERAL[_ana]->ROI[i]->posx + GENERAL[_ana]->ROI[i]->deltax/2), (int) (GENERAL[_ana]->ROI[i]->posy + GENERAL[_ana]->ROI[i]->deltay/2), (int) (GENERAL[_ana]->ROI[i]->deltax/2), (int) (GENERAL[_ana]->ROI[i]->deltay/2), r, g, b, 2);
|
||||
_zw->drawLine((int) (GENERAL[_ana]->ROI[i]->posx + GENERAL[_ana]->ROI[i]->deltax/2), (int) GENERAL[_ana]->ROI[i]->posy, (int) (GENERAL[_ana]->ROI[i]->posx + GENERAL[_ana]->ROI[i]->deltax/2), (int) (GENERAL[_ana]->ROI[i]->posy + GENERAL[_ana]->ROI[i]->deltay), r, g, b, 2);
|
||||
_zw->drawLine((int) GENERAL[_ana]->ROI[i]->posx, (int) (GENERAL[_ana]->ROI[i]->posy + GENERAL[_ana]->ROI[i]->deltay/2), (int) GENERAL[_ana]->ROI[i]->posx + GENERAL[_ana]->ROI[i]->deltax, (int) (GENERAL[_ana]->ROI[i]->posy + GENERAL[_ana]->ROI[i]->deltay/2), r, g, b, 2);
|
||||
}
|
||||
|
||||
@@ -274,6 +274,28 @@ void CImageBasis::drawLine(int x1, int y1, int x2, int y2, int r, int g, int b,
|
||||
}
|
||||
}
|
||||
|
||||
void CImageBasis::drawEllipse(int x1, int y1, int radx, int rady, int r, int g, int b, int thickness)
|
||||
{
|
||||
float deltarad, aktrad;
|
||||
int _thick, _x, _y;
|
||||
int rad = radx;
|
||||
|
||||
if (rady > radx)
|
||||
rad = rady;
|
||||
|
||||
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) * (radx + _thick) + x1;
|
||||
_y = cos(aktrad) * (rady + _thick) + y1;
|
||||
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;
|
||||
|
||||
@@ -57,6 +57,8 @@ class CImageBasis
|
||||
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 drawEllipse(int x1, int y1, int radx, int rady, 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();
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
#include "ClassLogFile.h"
|
||||
#include "server_GPIO.h"
|
||||
|
||||
// #define DEBUG_DETAIL_ON
|
||||
#include "server_file.h"
|
||||
|
||||
#define DEBUG_DETAIL_ON
|
||||
|
||||
|
||||
ClassFlowControll tfliteflow;
|
||||
@@ -393,6 +395,13 @@ esp_err_t handler_editflow(httpd_req_t *req)
|
||||
}
|
||||
}
|
||||
|
||||
if (_task.compare("tflite") == 0)
|
||||
{
|
||||
printf("Get tflite list\n");
|
||||
return get_tflite_file_handler(req);
|
||||
}
|
||||
|
||||
|
||||
if (_task.compare("copy") == 0)
|
||||
{
|
||||
string in, out, zw;
|
||||
|
||||
Reference in New Issue
Block a user