💡 README_zh_CN for camera_terminal
parent
fdd940ffb9
commit
35ef71e585
|
@ -1 +1 @@
|
|||
Subproject commit 420fc7e219ba98e40a5493b9d4be270db2f2d724
|
||||
Subproject commit 11b38828ea2b46b4ca0a30ec6711900ab9604cd1
|
|
@ -18,14 +18,16 @@
|
|||
#include "stdlib.h"
|
||||
#include "fb_gfx.h"
|
||||
|
||||
typedef struct { // Data stored PER GLYPH
|
||||
typedef struct
|
||||
{ // Data stored PER GLYPH
|
||||
uint16_t bitmapOffset; // Pointer into GFXfont->bitmap
|
||||
uint8_t width, height; // Bitmap dimensions in pixels
|
||||
uint8_t xAdvance; // Distance to advance cursor (x axis)
|
||||
int8_t xOffset, yOffset; // Dist from cursor pos to UL corner
|
||||
} GFXglyph;
|
||||
|
||||
typedef struct { // Data stored for FONT AS A WHOLE:
|
||||
typedef struct
|
||||
{ // Data stored for FONT AS A WHOLE:
|
||||
uint8_t *bitmap; // Glyph bitmaps, concatenated
|
||||
GFXglyph *glyph; // Glyph array
|
||||
uint8_t first, last; // ASCII extents
|
||||
|
@ -43,8 +45,10 @@ void fb_gfx_fillRect(fb_data_t *fb, int32_t x, int32_t y, int32_t w, int32_t h,
|
|||
uint8_t c0 = color >> 16;
|
||||
uint8_t c1 = color >> 8;
|
||||
uint8_t c2 = color;
|
||||
for (int i=0; i<h; i++){
|
||||
for (int j=0; j<w; j++){
|
||||
for (int i = 0; i < h; i++)
|
||||
{
|
||||
for (int j = 0; j < w; j++)
|
||||
{
|
||||
data[0] = c0;
|
||||
data[1] = c1;
|
||||
data[2] = c2;
|
||||
|
@ -71,7 +75,8 @@ uint8_t fb_gfx_putc(fb_data_t *fb, int32_t x, int32_t y, uint32_t color, unsigne
|
|||
uint8_t *bitmap;
|
||||
GFXglyph *glyph;
|
||||
|
||||
if ((c < 32) || (c < gfxFont->first) || (c > gfxFont->last)) {
|
||||
if ((c < 32) || (c < gfxFont->first) || (c > gfxFont->last))
|
||||
{
|
||||
return xa;
|
||||
}
|
||||
|
||||
|
@ -86,21 +91,28 @@ uint8_t fb_gfx_putc(fb_data_t *fb, int32_t x, int32_t y, uint32_t color, unsigne
|
|||
y += gfxFont->yOffset;
|
||||
line_width = 0;
|
||||
|
||||
for(yy=0; yy<glyph->height; yy++) {
|
||||
for(xx=0; xx<glyph->width; xx++) {
|
||||
if(bit == 0) {
|
||||
for (yy = 0; yy < glyph->height; yy++)
|
||||
{
|
||||
for (xx = 0; xx < glyph->width; xx++)
|
||||
{
|
||||
if (bit == 0)
|
||||
{
|
||||
bits = *bitmap++;
|
||||
bit = 0x80;
|
||||
}
|
||||
if(bits & bit) {
|
||||
if (bits & bit)
|
||||
{
|
||||
line_width++;
|
||||
} else if (line_width) {
|
||||
}
|
||||
else if (line_width)
|
||||
{
|
||||
fb_gfx_drawFastHLine(fb, x + xx - line_width, y + yy, line_width, color);
|
||||
line_width = 0;
|
||||
}
|
||||
bit >>= 1;
|
||||
}
|
||||
if (line_width) {
|
||||
if (line_width)
|
||||
{
|
||||
fb_gfx_drawFastHLine(fb, x + xx - line_width, y + yy, line_width, color);
|
||||
line_width = 0;
|
||||
}
|
||||
|
@ -114,13 +126,19 @@ uint32_t fb_gfx_print(fb_data_t *fb, int x, int y, uint32_t color, const char *
|
|||
int xc = x, yc = y, lc = fb->width - gfxFont->glyph[0].xAdvance;
|
||||
uint8_t fh = gfxFont->yAdvance;
|
||||
char c = *str++;
|
||||
while(c){
|
||||
if(c != '\r'){
|
||||
if(c == '\n'){
|
||||
while (c)
|
||||
{
|
||||
if (c != '\r')
|
||||
{
|
||||
if (c == '\n')
|
||||
{
|
||||
yc += fh;
|
||||
xc = x;
|
||||
} else {
|
||||
if(xc > lc){
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xc > lc)
|
||||
{
|
||||
yc += fh;
|
||||
xc = x;
|
||||
}
|
||||
|
@ -144,16 +162,19 @@ uint32_t fb_gfx_printf(fb_data_t *fb, int32_t x, int32_t y, uint32_t color, cons
|
|||
va_copy(copy, arg);
|
||||
len = vsnprintf(loc_buf, sizeof(loc_buf), format, arg);
|
||||
va_end(copy);
|
||||
if(len >= sizeof(loc_buf)){
|
||||
if (len >= sizeof(loc_buf))
|
||||
{
|
||||
temp = (char *)malloc(len + 1);
|
||||
if(temp == NULL) {
|
||||
if (temp == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
vsnprintf(temp, len + 1, format, arg);
|
||||
va_end(arg);
|
||||
fb_gfx_print(fb, x, y, color, temp);
|
||||
if(len > 64){
|
||||
if (len > 64)
|
||||
{
|
||||
free(temp);
|
||||
}
|
||||
return len;
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
# Camera Terminal[[English](./README.md)]
|
||||
|
||||
该示例的输入图片来自摄像头,输出结果打印在终端。该示例演示了以下模型接口在实际项目中的使用情况。
|
||||
|
||||
- [HumanFaceDetectMSR01](https://github.com/espressif/esp-dl/blob/master/include/model_zoo/human_face_detect_msr01.hpp)
|
||||
- [HumanFaceDetectMNP01](https://github.com/espressif/esp-dl/blob/master/include/model_zoo/human_face_detect_mnp01.hpp)
|
||||
- [CatFaceDetectMN03](https://github.com/espressif/esp-dl/blob/master/include/model_zoo/cat_face_detect_mn03.hpp)
|
||||
|
||||
|
||||
|
||||
## 硬件要求:
|
||||
|
||||
芯片: ESP32,ESP32-S2,ESP32-S3
|
||||
|
||||
摄像头: OV2640,OV3660
|
||||
|
||||
对于新手,我们为您推荐开发套件:[ESP-EYE](https://www.espressif.com/zh-hans/products/devkits/esp-eye/overview),ESP-S3-EYE,[ESP32-WROVER-KIT](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-wrover-kit-v3.html)
|
||||
|
||||
|
||||
|
||||
## 示例演示:
|
||||
|
||||
如果您完成了硬件准备并已正确安装好摄像头,那我们可以开始软件演示了。
|
||||
|
||||
1. 打开终端,并进入当前示例所在目录路经:
|
||||
|
||||
```shell
|
||||
cd ~/esp-who/examples/camera_terminal
|
||||
```
|
||||
|
||||
|
||||
|
||||
2. 设定目标芯片:
|
||||
|
||||
```shell
|
||||
idf.py set-target [SoC]
|
||||
```
|
||||
|
||||
将 [SoC] 替换为您的目标芯片,如 esp32、 esp32s2、esp32s3。
|
||||
|
||||
|
||||
|
||||
3. 打开 menuconfig,设置参数:
|
||||
|
||||
```shell
|
||||
idf.py menuconfig
|
||||
```
|
||||
|
||||
1. 选用自定义分区:
|
||||
|
||||
![](../../img/menuconfig_custom_partition_table.png)
|
||||
|
||||
|
||||
|
||||
2. 选择正确的摄像头管脚配置,下图以 ESP-EYE 为例:
|
||||
|
||||
![](../../img/menuconfig_select_camera_pinout.png)
|
||||
|
||||
如果您使用的是非官方支持的开发组件,请在 Custom Camera Pinout 中配置正确管脚信息。
|
||||
|
||||
|
||||
|
||||
3. 选择您想要运行的模型接口:
|
||||
|
||||
![](./img/menuconfig_dl_config.png)
|
||||
|
||||
|
||||
|
||||
4. 打开外部 RAM:
|
||||
|
||||
![](../../img/menuconfig_support_external_ram.png)
|
||||
|
||||
|
||||
|
||||
注意:
|
||||
|
||||
- 每次设定芯片之后,都需要重新设定以上参数。
|
||||
|
||||
- 除了以上参数,用户也可以根据应用场景配置 CPU、Flash等的其他参数。
|
||||
|
||||
|
||||
|
||||
4. 烧录程序,运行 IDF 监视器获取实时结果:
|
||||
|
||||
```shell
|
||||
idf.py flash monitor
|
||||
```
|
||||
|
||||
以步骤 3 中的模型选择为例,打印结果如下所示:
|
||||
|
||||
![](./img/result_on_terminal.png)
|
||||
|
||||
打印结果中包括时间消耗和检测结果。
|
||||
|
||||
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
Loading…
Reference in New Issue