- Updated the `isActive` function in `Header.jsx` to handle root path and include logic for other paths. chore: Update package-lock.json to remove peer dependencies - Removed unnecessary peer dependencies from various packages in `package-lock.json`. feat: Update frameworks.json to include example links - Changed `exemplo_codigo` to `exemplo` and added `exemplos` links for various frameworks in `frameworks.json`. feat: Add placa images to series.json - Included image paths for different ESP32 series in `series.json`. feat: Create CodeExample component for displaying code snippets - Added a new `CodeExample.jsx` component to fetch and display code examples dynamically. feat: Add example Arduino code for Wi-Fi connection - Created `arduino.ino` example for connecting to Wi-Fi. feat: Add example code for audio playback using ESP-ADF - Created `esp-adf.c` example for audio playback using ESP-ADF. feat: Add example code for DSP operations - Created `esp-dsp.c` example demonstrating basic DSP operations. feat: Add example code for ESP-IDF LED blinking - Created `esp-idf.c` example for blinking an LED using ESP-IDF. feat: Add example code for Matter integration - Created `esp-matter.c` example for Matter device initialization and event handling. feat: Add example code for neural network operations - Created `esp-nn.c` example demonstrating basic neural network operations. feat: Add example code for face detection using ESP-WHO - Created `esp-who.c` example for face detection using ESP-WHO library. feat: Add MicroPython example for LED blinking - Created `micropython.py` example for blinking an LED using MicroPython.
72 lines
2.1 KiB
C
72 lines
2.1 KiB
C
#include "esp_camera.h"
|
|
#include "fd_forward.h" // Face Detection
|
|
#include "fr_forward.h" // Face Recognition
|
|
#include "human_face_detect_msr01.hpp"
|
|
#include "human_face_detect_mnp01.hpp"
|
|
|
|
#define CAMERA_MODEL_AI_THINKER // ou o modelo da sua placa
|
|
|
|
#include "camera_pins.h"
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
Serial.setDebugOutput(true);
|
|
Serial.println("Iniciando câmera...");
|
|
|
|
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_RGB565;
|
|
config.frame_size = FRAMESIZE_QVGA;
|
|
config.fb_count = 1;
|
|
|
|
if (esp_camera_init(&config) != ESP_OK) {
|
|
Serial.println("Falha ao iniciar a câmera!");
|
|
return;
|
|
}
|
|
|
|
Serial.println("Câmera inicializada com sucesso!");
|
|
}
|
|
|
|
void loop() {
|
|
camera_fb_t *fb = esp_camera_fb_get();
|
|
if (!fb) {
|
|
Serial.println("Falha ao capturar imagem!");
|
|
return;
|
|
}
|
|
|
|
// Detecta rostos na imagem
|
|
box_array_t *faces = face_detect_msr01(fb->buf, fb->width, fb->height, fb->format);
|
|
if (faces) {
|
|
Serial.printf("Rostos detectados: %d\n", faces->len);
|
|
for (int i = 0; i < faces->len; i++) {
|
|
box_t *box = &faces->box[i];
|
|
Serial.printf("Face %d - x:%d y:%d w:%d h:%d\n", i, box->box_p[0], box->box_p[1],
|
|
box->box_p[2] - box->box_p[0], box->box_p[3] - box->box_p[1]);
|
|
}
|
|
dl_lib_free(faces);
|
|
} else {
|
|
Serial.println("Nenhum rosto detectado.");
|
|
}
|
|
|
|
esp_camera_fb_return(fb);
|
|
delay(1000);
|
|
}
|