From 5b23317d0a9d60a3e777de9718d5745d4dc5a7a8 Mon Sep 17 00:00:00 2001 From: Deimos1994 <31592485+Deimos1994@users.noreply.github.com> Date: Sun, 22 Mar 2020 01:32:09 +0200 Subject: [PATCH] Add files via upload --- CameraWebServer.ino | 113 +++++++ app_httpd.cpp | 698 ++++++++++++++++++++++++++++++++++++++++++++ camera_index.h | 121 ++++++++ camera_pins.h | 99 +++++++ 4 files changed, 1031 insertions(+) create mode 100644 CameraWebServer.ino create mode 100644 app_httpd.cpp create mode 100644 camera_index.h create mode 100644 camera_pins.h diff --git a/CameraWebServer.ino b/CameraWebServer.ino new file mode 100644 index 0000000..494e5ce --- /dev/null +++ b/CameraWebServer.ino @@ -0,0 +1,113 @@ +#include "esp_camera.h" +#include + +// +// WARNING!!! Make sure that you have either selected ESP32 Wrover Module, +// or another board which has PSRAM enabled +// + +// Select camera model +//#define CAMERA_MODEL_WROVER_KIT +//#define CAMERA_MODEL_ESP_EYE +//#define CAMERA_MODEL_M5STACK_PSRAM +//#define CAMERA_MODEL_M5STACK_WIDE +#define CAMERA_MODEL_AI_THINKER + +#include "camera_pins.h" + +const char* ssid = "NetworkName"; +const char* password = "Password"; + + +void startCameraServer(); + +void setup() { + Serial.begin(115200); + Serial.setDebugOutput(true); + Serial.println(); + + camera_config_t config; + config.ledc_channel = LEDC_CHANNEL_0; + config.ledc_timer = LEDC_TIMER_0; + config.pin_d0 = Y2_GPIO_NUM; + config.pin_d1 = Y3_GPIO_NUM; + config.pin_d2 = Y4_GPIO_NUM; + config.pin_d3 = Y5_GPIO_NUM; + config.pin_d4 = Y6_GPIO_NUM; + config.pin_d5 = Y7_GPIO_NUM; + config.pin_d6 = Y8_GPIO_NUM; + config.pin_d7 = Y9_GPIO_NUM; + config.pin_xclk = XCLK_GPIO_NUM; + config.pin_pclk = PCLK_GPIO_NUM; + config.pin_vsync = VSYNC_GPIO_NUM; + config.pin_href = HREF_GPIO_NUM; + config.pin_sscb_sda = SIOD_GPIO_NUM; + config.pin_sscb_scl = SIOC_GPIO_NUM; + config.pin_pwdn = PWDN_GPIO_NUM; + config.pin_reset = RESET_GPIO_NUM; + config.xclk_freq_hz = 20000000; + config.pixel_format = PIXFORMAT_JPEG; + //init with high specs to pre-allocate larger buffers + if(psramFound()){ + config.frame_size = FRAMESIZE_UXGA; + config.jpeg_quality = 10; + config.fb_count = 2; + } else { + config.frame_size = FRAMESIZE_SVGA; + config.jpeg_quality = 12; + config.fb_count = 1; + } + +#if defined(CAMERA_MODEL_ESP_EYE) + pinMode(13, INPUT_PULLUP); + pinMode(14, INPUT_PULLUP); +#endif + + // camera init + esp_err_t err = esp_camera_init(&config); + if (err != ESP_OK) { + Serial.printf("Camera init failed with error 0x%x", err); + return; + } + + sensor_t * s = esp_camera_sensor_get(); + //initial sensors are flipped vertically and colors are a bit saturated + s->set_vflip(s, 1);//flip it back + s->set_hmirror(s, 1); + + //drop down frame size for higher initial frame rate + s->set_framesize(s, FRAMESIZE_XGA); + + + WiFi.setHostname("ESP32_CAM"); + delay(500); + +// ==== Static IP (optional) ====// +// IPAddress ip(192, 168, 4, 222); +// IPAddress gateway(192, 168, 4, 1); +// IPAddress subnet(255, 255, 255, 0); +// IPAddress dnsAdrr(8, 8, 8, 8); +// Serial.println(F("Wifi config...")); +// WiFi.config(ip, gateway, subnet, dnsAdrr); + + WiFi.begin(ssid, password); + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + + Serial.println(""); + Serial.println("WiFi connected"); + + startCameraServer(); + + Serial.print("Camera Ready! Use 'http://"); + Serial.print(WiFi.localIP()); + Serial.println("' to connect"); +} + +void loop() { + // put your main code here, to run repeatedly: + delay(10000); +} diff --git a/app_httpd.cpp b/app_httpd.cpp new file mode 100644 index 0000000..3cd6994 --- /dev/null +++ b/app_httpd.cpp @@ -0,0 +1,698 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +#include +#include "esp_http_server.h" +#include "esp_timer.h" +#include "esp_camera.h" +#include "img_converters.h" +#include "camera_index.h" +#include "Arduino.h" + +#include "fb_gfx.h" +#include "fd_forward.h" +#include "fr_forward.h" + +#define ENROLL_CONFIRM_TIMES 5 +#define FACE_ID_SAVE_NUMBER 7 + +#define FACE_COLOR_WHITE 0x00FFFFFF +#define FACE_COLOR_BLACK 0x00000000 +#define FACE_COLOR_RED 0x000000FF +#define FACE_COLOR_GREEN 0x0000FF00 +#define FACE_COLOR_BLUE 0x00FF0000 +#define FACE_COLOR_YELLOW (FACE_COLOR_RED | FACE_COLOR_GREEN) +#define FACE_COLOR_CYAN (FACE_COLOR_BLUE | FACE_COLOR_GREEN) +#define FACE_COLOR_PURPLE (FACE_COLOR_BLUE | FACE_COLOR_RED) + +typedef struct { + size_t size; //number of values used for filtering + size_t index; //current value index + size_t count; //value count + int sum; + int * values; //array to be filled with values +} ra_filter_t; + +typedef struct { + httpd_req_t *req; + size_t len; +} jpg_chunking_t; + +#define PART_BOUNDARY "123456789000000000000987654321" +static const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY; +static const char* _STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n"; +static const char* _STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\n\r\n"; + +static ra_filter_t ra_filter; +httpd_handle_t stream_httpd = NULL; +httpd_handle_t camera_httpd = NULL; + +static mtmn_config_t mtmn_config = {0}; +static int8_t detection_enabled = 0; +static int8_t recognition_enabled = 0; +static int8_t is_enrolling = 0; +static face_id_list id_list = {0}; +static int8_t flash_enabled = 0; + +static ra_filter_t * ra_filter_init(ra_filter_t * filter, size_t sample_size){ + memset(filter, 0, sizeof(ra_filter_t)); + + filter->values = (int *)malloc(sample_size * sizeof(int)); + if(!filter->values){ + return NULL; + } + memset(filter->values, 0, sample_size * sizeof(int)); + + filter->size = sample_size; + return filter; +} + +static int ra_filter_run(ra_filter_t * filter, int value){ + if(!filter->values){ + return value; + } + filter->sum -= filter->values[filter->index]; + filter->values[filter->index] = value; + filter->sum += filter->values[filter->index]; + filter->index++; + filter->index = filter->index % filter->size; + if (filter->count < filter->size) { + filter->count++; + } + return filter->sum / filter->count; +} + +static void rgb_print(dl_matrix3du_t *image_matrix, uint32_t color, const char * str){ + fb_data_t fb; + fb.width = image_matrix->w; + fb.height = image_matrix->h; + fb.data = image_matrix->item; + fb.bytes_per_pixel = 3; + fb.format = FB_BGR888; + fb_gfx_print(&fb, (fb.width - (strlen(str) * 14)) / 2, 10, color, str); +} + +static int rgb_printf(dl_matrix3du_t *image_matrix, uint32_t color, const char *format, ...){ + char loc_buf[64]; + char * temp = loc_buf; + int len; + va_list arg; + va_list copy; + va_start(arg, format); + va_copy(copy, arg); + len = vsnprintf(loc_buf, sizeof(loc_buf), format, arg); + va_end(copy); + if(len >= sizeof(loc_buf)){ + temp = (char*)malloc(len+1); + if(temp == NULL) { + return 0; + } + } + vsnprintf(temp, len+1, format, arg); + va_end(arg); + rgb_print(image_matrix, color, temp); + if(len > 64){ + free(temp); + } + return len; +} + +static void draw_face_boxes(dl_matrix3du_t *image_matrix, box_array_t *boxes, int face_id){ + int x, y, w, h, i; + uint32_t color = FACE_COLOR_YELLOW; + if(face_id < 0){ + color = FACE_COLOR_RED; + } else if(face_id > 0){ + color = FACE_COLOR_GREEN; + } + fb_data_t fb; + fb.width = image_matrix->w; + fb.height = image_matrix->h; + fb.data = image_matrix->item; + fb.bytes_per_pixel = 3; + fb.format = FB_BGR888; + for (i = 0; i < boxes->len; i++){ + // rectangle box + x = (int)boxes->box[i].box_p[0]; + y = (int)boxes->box[i].box_p[1]; + w = (int)boxes->box[i].box_p[2] - x + 1; + h = (int)boxes->box[i].box_p[3] - y + 1; + fb_gfx_drawFastHLine(&fb, x, y, w, color); + fb_gfx_drawFastHLine(&fb, x, y+h-1, w, color); + fb_gfx_drawFastVLine(&fb, x, y, h, color); + fb_gfx_drawFastVLine(&fb, x+w-1, y, h, color); +#if 0 + // landmark + int x0, y0, j; + for (j = 0; j < 10; j+=2) { + x0 = (int)boxes->landmark[i].landmark_p[j]; + y0 = (int)boxes->landmark[i].landmark_p[j+1]; + fb_gfx_fillRect(&fb, x0, y0, 3, 3, color); + } +#endif + } +} + +static int run_face_recognition(dl_matrix3du_t *image_matrix, box_array_t *net_boxes){ + dl_matrix3du_t *aligned_face = NULL; + int matched_id = 0; + + aligned_face = dl_matrix3du_alloc(1, FACE_WIDTH, FACE_HEIGHT, 3); + if(!aligned_face){ + Serial.println("Could not allocate face recognition buffer"); + return matched_id; + } + if (align_face(net_boxes, image_matrix, aligned_face) == ESP_OK){ + if (is_enrolling == 1){ + int8_t left_sample_face = enroll_face(&id_list, aligned_face); + + if(left_sample_face == (ENROLL_CONFIRM_TIMES - 1)){ + Serial.printf("Enrolling Face ID: %d\n", id_list.tail); + } + Serial.printf("Enrolling Face ID: %d sample %d\n", id_list.tail, ENROLL_CONFIRM_TIMES - left_sample_face); + rgb_printf(image_matrix, FACE_COLOR_CYAN, "ID[%u] Sample[%u]", id_list.tail, ENROLL_CONFIRM_TIMES - left_sample_face); + if (left_sample_face == 0){ + is_enrolling = 0; + Serial.printf("Enrolled Face ID: %d\n", id_list.tail); + } + } else { + matched_id = recognize_face(&id_list, aligned_face); + if (matched_id >= 0) { + Serial.printf("Match Face ID: %u\n", matched_id); + rgb_printf(image_matrix, FACE_COLOR_GREEN, "Hello Subject %u", matched_id); + } else { + Serial.println("No Match Found"); + rgb_print(image_matrix, FACE_COLOR_RED, "Intruder Alert!"); + matched_id = -1; + } + } + } else { + Serial.println("Face Not Aligned"); + //rgb_print(image_matrix, FACE_COLOR_YELLOW, "Human Detected"); + } + + dl_matrix3du_free(aligned_face); + return matched_id; +} + +static size_t jpg_encode_stream(void * arg, size_t index, const void* data, size_t len){ + jpg_chunking_t *j = (jpg_chunking_t *)arg; + if(!index){ + j->len = 0; + } + if(httpd_resp_send_chunk(j->req, (const char *)data, len) != ESP_OK){ + return 0; + } + j->len += len; + return len; +} + +static esp_err_t capture_handler(httpd_req_t *req){ + camera_fb_t * fb = NULL; + esp_err_t res = ESP_OK; + int64_t fr_start = esp_timer_get_time(); + + fb = esp_camera_fb_get(); + if (!fb) { + Serial.println("Camera capture failed"); + httpd_resp_send_500(req); + return ESP_FAIL; + } + + httpd_resp_set_type(req, "image/jpeg"); + httpd_resp_set_hdr(req, "Content-Disposition", "inline; filename=capture.jpg"); + httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + + size_t out_len, out_width, out_height; + uint8_t * out_buf; + bool s; + bool detected = false; + int face_id = 0; + if(!detection_enabled || fb->width > 400){ + size_t fb_len = 0; + if(fb->format == PIXFORMAT_JPEG){ + fb_len = fb->len; + res = httpd_resp_send(req, (const char *)fb->buf, fb->len); + } else { + jpg_chunking_t jchunk = {req, 0}; + res = frame2jpg_cb(fb, 80, jpg_encode_stream, &jchunk)?ESP_OK:ESP_FAIL; + httpd_resp_send_chunk(req, NULL, 0); + fb_len = jchunk.len; + } + esp_camera_fb_return(fb); + int64_t fr_end = esp_timer_get_time(); + Serial.printf("JPG: %uB %ums\n", (uint32_t)(fb_len), (uint32_t)((fr_end - fr_start)/1000)); + return res; + } + + dl_matrix3du_t *image_matrix = dl_matrix3du_alloc(1, fb->width, fb->height, 3); + if (!image_matrix) { + esp_camera_fb_return(fb); + Serial.println("dl_matrix3du_alloc failed"); + httpd_resp_send_500(req); + return ESP_FAIL; + } + + out_buf = image_matrix->item; + out_len = fb->width * fb->height * 3; + out_width = fb->width; + out_height = fb->height; + + s = fmt2rgb888(fb->buf, fb->len, fb->format, out_buf); + esp_camera_fb_return(fb); + if(!s){ + dl_matrix3du_free(image_matrix); + Serial.println("to rgb888 failed"); + httpd_resp_send_500(req); + return ESP_FAIL; + } + + box_array_t *net_boxes = face_detect(image_matrix, &mtmn_config); + + if (net_boxes){ + detected = true; + if(recognition_enabled){ + face_id = run_face_recognition(image_matrix, net_boxes); + } + draw_face_boxes(image_matrix, net_boxes, face_id); + free(net_boxes->score); + free(net_boxes->box); + free(net_boxes->landmark); + free(net_boxes); + } + + jpg_chunking_t jchunk = {req, 0}; + s = fmt2jpg_cb(out_buf, out_len, out_width, out_height, PIXFORMAT_RGB888, 90, jpg_encode_stream, &jchunk); + dl_matrix3du_free(image_matrix); + if(!s){ + Serial.println("JPEG compression failed"); + return ESP_FAIL; + } + + int64_t fr_end = esp_timer_get_time(); + Serial.printf("FACE: %uB %ums %s%d\n", (uint32_t)(jchunk.len), (uint32_t)((fr_end - fr_start)/1000), detected?"DETECTED ":"", face_id); + return res; +} + +static esp_err_t stream_handler(httpd_req_t *req){ + camera_fb_t * fb = NULL; + esp_err_t res = ESP_OK; + size_t _jpg_buf_len = 0; + uint8_t * _jpg_buf = NULL; + char * part_buf[64]; + dl_matrix3du_t *image_matrix = NULL; + bool detected = false; + int face_id = 0; + int64_t fr_start = 0; + int64_t fr_ready = 0; + int64_t fr_face = 0; + int64_t fr_recognize = 0; + int64_t fr_encode = 0; + + static int64_t last_frame = 0; + if(!last_frame) { + last_frame = esp_timer_get_time(); + } + + res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE); + if(res != ESP_OK){ + return res; + } + + httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + + while(true){ + detected = false; + face_id = 0; + fb = esp_camera_fb_get(); + if (!fb) { + Serial.println("Camera capture failed"); + res = ESP_FAIL; + } else { + fr_start = esp_timer_get_time(); + fr_ready = fr_start; + fr_face = fr_start; + fr_encode = fr_start; + fr_recognize = fr_start; + if(!detection_enabled || fb->width > 400){ + if(fb->format != PIXFORMAT_JPEG){ + bool jpeg_converted = frame2jpg(fb, 80, &_jpg_buf, &_jpg_buf_len); + esp_camera_fb_return(fb); + fb = NULL; + if(!jpeg_converted){ + Serial.println("JPEG compression failed"); + res = ESP_FAIL; + } + } else { + _jpg_buf_len = fb->len; + _jpg_buf = fb->buf; + } + } else { + + image_matrix = dl_matrix3du_alloc(1, fb->width, fb->height, 3); + + if (!image_matrix) { + Serial.println("dl_matrix3du_alloc failed"); + res = ESP_FAIL; + } else { + if(!fmt2rgb888(fb->buf, fb->len, fb->format, image_matrix->item)){ + Serial.println("fmt2rgb888 failed"); + res = ESP_FAIL; + } else { + fr_ready = esp_timer_get_time(); + box_array_t *net_boxes = NULL; + if(detection_enabled){ + net_boxes = face_detect(image_matrix, &mtmn_config); + } + fr_face = esp_timer_get_time(); + fr_recognize = fr_face; + if (net_boxes || fb->format != PIXFORMAT_JPEG){ + if(net_boxes){ + detected = true; + if(recognition_enabled){ + face_id = run_face_recognition(image_matrix, net_boxes); + } + fr_recognize = esp_timer_get_time(); + draw_face_boxes(image_matrix, net_boxes, face_id); + free(net_boxes->score); + free(net_boxes->box); + free(net_boxes->landmark); + free(net_boxes); + } + if(!fmt2jpg(image_matrix->item, fb->width*fb->height*3, fb->width, fb->height, PIXFORMAT_RGB888, 90, &_jpg_buf, &_jpg_buf_len)){ + Serial.println("fmt2jpg failed"); + res = ESP_FAIL; + } + esp_camera_fb_return(fb); + fb = NULL; + } else { + _jpg_buf = fb->buf; + _jpg_buf_len = fb->len; + } + fr_encode = esp_timer_get_time(); + } + dl_matrix3du_free(image_matrix); + } + } + } + if(res == ESP_OK){ + size_t hlen = snprintf((char *)part_buf, 64, _STREAM_PART, _jpg_buf_len); + res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen); + } + if(res == ESP_OK){ + res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len); + } + if(res == ESP_OK){ + res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY)); + } + if(fb){ + esp_camera_fb_return(fb); + fb = NULL; + _jpg_buf = NULL; + } else if(_jpg_buf){ + free(_jpg_buf); + _jpg_buf = NULL; + } + if(res != ESP_OK){ + break; + } + int64_t fr_end = esp_timer_get_time(); + + int64_t ready_time = (fr_ready - fr_start)/1000; + int64_t face_time = (fr_face - fr_ready)/1000; + int64_t recognize_time = (fr_recognize - fr_face)/1000; + int64_t encode_time = (fr_encode - fr_recognize)/1000; + int64_t process_time = (fr_encode - fr_start)/1000; + + int64_t frame_time = fr_end - last_frame; + last_frame = fr_end; + frame_time /= 1000; + uint32_t avg_frame_time = ra_filter_run(&ra_filter, frame_time); + Serial.printf("MJPG: %uB %ums (%.1ffps), AVG: %ums (%.1ffps), %u+%u+%u+%u=%u %s%d\n", + (uint32_t)(_jpg_buf_len), + (uint32_t)frame_time, 1000.0 / (uint32_t)frame_time, + avg_frame_time, 1000.0 / avg_frame_time, + (uint32_t)ready_time, (uint32_t)face_time, (uint32_t)recognize_time, (uint32_t)encode_time, (uint32_t)process_time, + (detected)?"DETECTED ":"", face_id + ); + } + + last_frame = 0; + return res; +} + +static esp_err_t cmd_handler(httpd_req_t *req){ + char* buf; + size_t buf_len; + char variable[32] = {0,}; + char value[32] = {0,}; + + buf_len = httpd_req_get_url_query_len(req) + 1; + if (buf_len > 1) { + buf = (char*)malloc(buf_len); + if(!buf){ + httpd_resp_send_500(req); + return ESP_FAIL; + } + if (httpd_req_get_url_query_str(req, buf, buf_len) == ESP_OK) { + if (httpd_query_key_value(buf, "var", variable, sizeof(variable)) == ESP_OK && + httpd_query_key_value(buf, "val", value, sizeof(value)) == ESP_OK) { + } else { + free(buf); + httpd_resp_send_404(req); + return ESP_FAIL; + } + } else { + free(buf); + httpd_resp_send_404(req); + return ESP_FAIL; + } + free(buf); + } else { + httpd_resp_send_404(req); + return ESP_FAIL; + } + + int val = atoi(value); + sensor_t * s = esp_camera_sensor_get(); + int res = 0; + + if(!strcmp(variable, "framesize")) { + if(s->pixformat == PIXFORMAT_JPEG) res = s->set_framesize(s, (framesize_t)val); + } + else if(!strcmp(variable, "quality")) res = s->set_quality(s, val); + else if(!strcmp(variable, "contrast")) res = s->set_contrast(s, val); + else if(!strcmp(variable, "brightness")) res = s->set_brightness(s, val); + else if(!strcmp(variable, "saturation")) res = s->set_saturation(s, val); + else if(!strcmp(variable, "gainceiling")) res = s->set_gainceiling(s, (gainceiling_t)val); + else if(!strcmp(variable, "colorbar")) res = s->set_colorbar(s, val); + else if(!strcmp(variable, "awb")) res = s->set_whitebal(s, val); + else if(!strcmp(variable, "agc")) res = s->set_gain_ctrl(s, val); + else if(!strcmp(variable, "aec")) res = s->set_exposure_ctrl(s, val); + else if(!strcmp(variable, "hmirror")) res = s->set_hmirror(s, val); + else if(!strcmp(variable, "vflip")) res = s->set_vflip(s, val); + else if(!strcmp(variable, "awb_gain")) res = s->set_awb_gain(s, val); + else if(!strcmp(variable, "agc_gain")) res = s->set_agc_gain(s, val); + else if(!strcmp(variable, "aec_value")) res = s->set_aec_value(s, val); + else if(!strcmp(variable, "aec2")) res = s->set_aec2(s, val); + else if(!strcmp(variable, "dcw")) res = s->set_dcw(s, val); + else if(!strcmp(variable, "bpc")) res = s->set_bpc(s, val); + else if(!strcmp(variable, "wpc")) res = s->set_wpc(s, val); + else if(!strcmp(variable, "raw_gma")) res = s->set_raw_gma(s, val); + else if(!strcmp(variable, "lenc")) res = s->set_lenc(s, val); + else if(!strcmp(variable, "special_effect")) res = s->set_special_effect(s, val); + else if(!strcmp(variable, "wb_mode")) res = s->set_wb_mode(s, val); + else if(!strcmp(variable, "ae_level")) res = s->set_ae_level(s, val); + else if(!strcmp(variable, "face_detect")) { + detection_enabled = val; + if(!detection_enabled) { + recognition_enabled = 0; + } + } + else if(!strcmp(variable, "face_enroll")) is_enrolling = val; + else if(!strcmp(variable, "face_recognize")) { + recognition_enabled = val; + if(recognition_enabled){ + detection_enabled = val; + } + } + else if(!strcmp(variable, "flash")) { + #define LED_BUILTIN 4 + pinMode(LED_BUILTIN, OUTPUT); + digitalWrite(LED_BUILTIN, flash_enabled = atoi(value)); + } + else { + res = -1; + } + + if(res){ + return httpd_resp_send_500(req); + } + + httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + return httpd_resp_send(req, NULL, 0); +} + +static esp_err_t status_handler(httpd_req_t *req){ + static char json_response[1024]; + + sensor_t * s = esp_camera_sensor_get(); + char * p = json_response; + *p++ = '{'; + + p+=sprintf(p, "\"framesize\":%u,", s->status.framesize); + p+=sprintf(p, "\"quality\":%u,", s->status.quality); + p+=sprintf(p, "\"brightness\":%d,", s->status.brightness); + p+=sprintf(p, "\"contrast\":%d,", s->status.contrast); + p+=sprintf(p, "\"saturation\":%d,", s->status.saturation); + p+=sprintf(p, "\"sharpness\":%d,", s->status.sharpness); + p+=sprintf(p, "\"special_effect\":%u,", s->status.special_effect); + p+=sprintf(p, "\"wb_mode\":%u,", s->status.wb_mode); + p+=sprintf(p, "\"awb\":%u,", s->status.awb); + p+=sprintf(p, "\"awb_gain\":%u,", s->status.awb_gain); + p+=sprintf(p, "\"aec\":%u,", s->status.aec); + p+=sprintf(p, "\"aec2\":%u,", s->status.aec2); + p+=sprintf(p, "\"ae_level\":%d,", s->status.ae_level); + p+=sprintf(p, "\"aec_value\":%u,", s->status.aec_value); + p+=sprintf(p, "\"agc\":%u,", s->status.agc); + p+=sprintf(p, "\"agc_gain\":%u,", s->status.agc_gain); + p+=sprintf(p, "\"gainceiling\":%u,", s->status.gainceiling); + p+=sprintf(p, "\"bpc\":%u,", s->status.bpc); + p+=sprintf(p, "\"wpc\":%u,", s->status.wpc); + p+=sprintf(p, "\"raw_gma\":%u,", s->status.raw_gma); + p+=sprintf(p, "\"lenc\":%u,", s->status.lenc); + p+=sprintf(p, "\"vflip\":%u,", s->status.vflip); + p+=sprintf(p, "\"hmirror\":%u,", s->status.hmirror); + p+=sprintf(p, "\"dcw\":%u,", s->status.dcw); + p+=sprintf(p, "\"colorbar\":%u,", s->status.colorbar); + p+=sprintf(p, "\"face_detect\":%u,", detection_enabled); + p+=sprintf(p, "\"face_enroll\":%u,", is_enrolling); + p+=sprintf(p, "\"face_recognize\":%u", recognition_enabled); + p+=sprintf(p, "\"flash\":%u,", flash_enabled); + *p++ = '}'; + *p++ = 0; + httpd_resp_set_type(req, "application/json"); + httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + return httpd_resp_send(req, json_response, strlen(json_response)); +} + +static esp_err_t index_handler(httpd_req_t *req){ + httpd_resp_set_type(req, "text/html"); + httpd_resp_set_hdr(req, "Content-Encoding", "gzip"); + sensor_t * s = esp_camera_sensor_get(); + return httpd_resp_send(req, (const char *)index_ov2640_html_gz, index_ov2640_html_gz_len); +} + +static esp_err_t signal_handler(httpd_req_t *req){ + httpd_resp_set_type(req, "text/html"); + httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + char buf[8]; + itoa(WiFi.RSSI(), buf, 10); + return httpd_resp_send(req, buf, strlen(buf)); +} + +static esp_err_t restart_handler(httpd_req_t *req){ + WiFi.disconnect(); + Serial.println("WiFi disconnected, preparing for reboot"); + delay(3000); + ESP.restart(); + return false; +} + +void startCameraServer(){ + httpd_config_t config = HTTPD_DEFAULT_CONFIG(); + httpd_uri_t index_uri = { + .uri = "/", + .method = HTTP_GET, + .handler = index_handler, + .user_ctx = NULL + }; + + httpd_uri_t status_uri = { + .uri = "/esp32_cam_status", + .method = HTTP_GET, + .handler = status_handler, + .user_ctx = NULL + }; + + httpd_uri_t signal_uri = { + .uri = "/signal", + .method = HTTP_GET, + .handler = signal_handler, + .user_ctx = NULL + }; + + httpd_uri_t restart_uri = { + .uri = "/esp32_cam_restart", + .method = HTTP_GET, + .handler = restart_handler, + .user_ctx = NULL + }; + + httpd_uri_t cmd_uri = { + .uri = "/esp32_cam_control", + .method = HTTP_GET, + .handler = cmd_handler, + .user_ctx = NULL + }; + + httpd_uri_t capture_uri = { + .uri = "/esp32_cam_capture", + .method = HTTP_GET, + .handler = capture_handler, + .user_ctx = NULL + }; + + httpd_uri_t stream_uri = { + .uri = "/esp32_cam_stream", + .method = HTTP_GET, + .handler = stream_handler, + .user_ctx = NULL + }; + + + ra_filter_init(&ra_filter, 20); + + mtmn_config.type = FAST; + mtmn_config.min_face = 80; + mtmn_config.pyramid = 0.707; + mtmn_config.pyramid_times = 4; + mtmn_config.p_threshold.score = 0.6; + mtmn_config.p_threshold.nms = 0.7; + mtmn_config.p_threshold.candidate_number = 20; + mtmn_config.r_threshold.score = 0.7; + mtmn_config.r_threshold.nms = 0.7; + mtmn_config.r_threshold.candidate_number = 10; + mtmn_config.o_threshold.score = 0.7; + mtmn_config.o_threshold.nms = 0.7; + mtmn_config.o_threshold.candidate_number = 1; + + face_id_init(&id_list, FACE_ID_SAVE_NUMBER, ENROLL_CONFIRM_TIMES); + + Serial.printf("Starting web server on port: '%d'\n", config.server_port); + if (httpd_start(&camera_httpd, &config) == ESP_OK) { + httpd_register_uri_handler(camera_httpd, &index_uri); + httpd_register_uri_handler(camera_httpd, &cmd_uri); + httpd_register_uri_handler(camera_httpd, &status_uri); + httpd_register_uri_handler(camera_httpd, &signal_uri); + httpd_register_uri_handler(camera_httpd, &restart_uri); + httpd_register_uri_handler(camera_httpd, &capture_uri); + } + + config.server_port += 1; + config.ctrl_port += 1; + Serial.printf("Starting stream server on port: '%d'\n", config.server_port); + if (httpd_start(&stream_httpd, &config) == ESP_OK) { + httpd_register_uri_handler(stream_httpd, &stream_uri); + } +} diff --git a/camera_index.h b/camera_index.h new file mode 100644 index 0000000..2f96699 --- /dev/null +++ b/camera_index.h @@ -0,0 +1,121 @@ + + +//File: index_ov2640.html.gz, Size: 4074 +#define index_ov2640_html_gz_len 4076 +const uint8_t index_ov2640_html_gz[] = {0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0xdd, 0x5c, 0x7d, 0x73, 0x9b, 0x46, 0x13, 0xff, 0xdf, 0x9f, 0x82, 0x90, 0x36, 0x96, 0xa6, 0x96, 0x2c, 0xc9, 0x8e, +0xe3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 0x62, 0x75, 0xba, 0x94, 0xb1, 0xd4, 0xec, 0x2c, 0x70, 0x32, 0x06, 0x7c, 0x67, 0x60, +0x19, 0x4f, 0x8b, 0x7b, 0x67, 0xde, 0x8f, 0x71, 0x65, 0x0b, 0x5d, 0x98, 0x3e, 0x41, 0xa9, 0x94, 0x9b, 0xa3, 0x02, 0x84, 0xd3, 0xcf, 0x12, 0x73, 0xa1, 0x28, 0xc8, 0xc7, 0x31, 0xa9, 0x98, 0xef, 0x7d, 0x4c, 0xf7, +0x35, 0xe2, 0x9d, 0xaa, 0xab, 0x9f, 0x5f, 0x19, 0x61, 0x6c, 0xb0, 0x0f, 0x7b, 0xd1, 0x7e, 0x56, 0x7c, 0x21, 0xc6, 0xe0, 0xdf, 0x6e, 0xe2, 0xbb, 0x47, 0x9a, 0x83, 0x48, 0xdf, 0x4b, 0xa0, 0x85, 0xa6, 0xef, 0x4f, +0xe3, 0x47, 0xa6, 0xe8, 0x49, 0x96, 0x50, 0x8f, 0x77, 0xca, 0x67, 0x7b, 0x59, 0x9b, 0x9e, 0x33, 0x27, 0xa7, 0xc9, 0x6c, 0xf9, 0x48, 0xe8, 0x38, 0x95, 0x88, 0xe6, 0xed, 0x57, 0x57, 0x30, 0xa1, 0xba, 0xfc, 0xcd, +0x5a, 0xb1, 0x5c, 0x81, 0x85, 0x86, 0x54, 0x64, 0x99, 0x2d, 0x33, 0x5d, 0xa7, 0xac, 0x59, 0x76, 0x53, 0x60, 0x0e, 0xa2, 0xf4, 0xde, 0x58, 0x69, 0x96, 0x9f, 0x8d, 0x0a, 0xb7, 0x38, 0x2f, 0xac, 0xea, 0x9e, 0xac, +0xb8, 0x03, 0xcb, 0xcf, 0xf8, 0x97, 0xa7, 0xce, 0x0f, 0xf9, 0x77, 0xb2, 0xff, 0x0f, 0x63, 0x58, 0x72, 0x08, 0x3f, 0x5b, 0x00, 0x00 }; diff --git a/camera_pins.h b/camera_pins.h new file mode 100644 index 0000000..d61dc86 --- /dev/null +++ b/camera_pins.h @@ -0,0 +1,99 @@ + +#if defined(CAMERA_MODEL_WROVER_KIT) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 21 +#define SIOD_GPIO_NUM 26 +#define SIOC_GPIO_NUM 27 + +#define Y9_GPIO_NUM 35 +#define Y8_GPIO_NUM 34 +#define Y7_GPIO_NUM 39 +#define Y6_GPIO_NUM 36 +#define Y5_GPIO_NUM 19 +#define Y4_GPIO_NUM 18 +#define Y3_GPIO_NUM 5 +#define Y2_GPIO_NUM 4 +#define VSYNC_GPIO_NUM 25 +#define HREF_GPIO_NUM 23 +#define PCLK_GPIO_NUM 22 + +#elif defined(CAMERA_MODEL_ESP_EYE) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 4 +#define SIOD_GPIO_NUM 18 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 36 +#define Y8_GPIO_NUM 37 +#define Y7_GPIO_NUM 38 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 35 +#define Y4_GPIO_NUM 14 +#define Y3_GPIO_NUM 13 +#define Y2_GPIO_NUM 34 +#define VSYNC_GPIO_NUM 5 +#define HREF_GPIO_NUM 27 +#define PCLK_GPIO_NUM 25 + +#elif defined(CAMERA_MODEL_M5STACK_PSRAM) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM 15 +#define XCLK_GPIO_NUM 27 +#define SIOD_GPIO_NUM 25 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 19 +#define Y8_GPIO_NUM 36 +#define Y7_GPIO_NUM 18 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 5 +#define Y4_GPIO_NUM 34 +#define Y3_GPIO_NUM 35 +#define Y2_GPIO_NUM 32 +#define VSYNC_GPIO_NUM 22 +#define HREF_GPIO_NUM 26 +#define PCLK_GPIO_NUM 21 + +#elif defined(CAMERA_MODEL_M5STACK_WIDE) +#define PWDN_GPIO_NUM -1 +#define RESET_GPIO_NUM 15 +#define XCLK_GPIO_NUM 27 +#define SIOD_GPIO_NUM 22 +#define SIOC_GPIO_NUM 23 + +#define Y9_GPIO_NUM 19 +#define Y8_GPIO_NUM 36 +#define Y7_GPIO_NUM 18 +#define Y6_GPIO_NUM 39 +#define Y5_GPIO_NUM 5 +#define Y4_GPIO_NUM 34 +#define Y3_GPIO_NUM 35 +#define Y2_GPIO_NUM 32 +#define VSYNC_GPIO_NUM 25 +#define HREF_GPIO_NUM 26 +#define PCLK_GPIO_NUM 21 + +#elif defined(CAMERA_MODEL_AI_THINKER) +#define PWDN_GPIO_NUM 32 +#define RESET_GPIO_NUM -1 +#define XCLK_GPIO_NUM 0 +#define SIOD_GPIO_NUM 26 +#define SIOC_GPIO_NUM 27 + +#define Y9_GPIO_NUM 35 +#define Y8_GPIO_NUM 34 +#define Y7_GPIO_NUM 39 +#define Y6_GPIO_NUM 36 +#define Y5_GPIO_NUM 21 +#define Y4_GPIO_NUM 19 +#define Y3_GPIO_NUM 18 +#define Y2_GPIO_NUM 5 +#define VSYNC_GPIO_NUM 25 +#define HREF_GPIO_NUM 23 +#define PCLK_GPIO_NUM 22 + +#else +#error "Camera model not selected" +#endif