Skip to content

Commit

Permalink
* optimize camera and find blobs doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Jul 31, 2024
1 parent 6d713fa commit 6cc9e58
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 46 deletions.
4 changes: 2 additions & 2 deletions docs/doc/en/vision/camera.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ cam = camera.Camera(1920, 1280) # Frame rate is set to 30 fps when resolution is
```python
from maix import camera
cam = camera.Camera(640, 480, fps=60) # Set frame rate to 60 fps
# or
cam = camera.Camera(640, 480) # Set frame rate to 60fps if resolution is less than or equal to 1280x720
```

### Set the frame rate to 80 fps

```python
from maix import camera
cam = camera.Camera(640, 480, fps=80) # Set frame rate to 60 fps
# or
cam = camera.Camera(640, 480) # Set frame rate to 80fps if resolution is less than or equal to 1280x720
```

Notes:
Expand Down
48 changes: 25 additions & 23 deletions docs/doc/en/vision/find_blobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,49 +94,51 @@ Here are explanations of commonly used parameters. If you cannot find parameters

This article introduces commonly used methods. For more APIs, please see the [image](../../../api/maix/image.md) section of the API documentation.

## Using the Find Blobs App
## Setting Thresholds Offline

To quickly verify the find blobs functionality, you can first use the find blobs application provided by MaixCam to experience the effect of finding color blobs.
To quickly verify the function of find blobs, you can first use the find blobs application provided by MaixCam to experience the effect of finding color blobs.

### Usage
Open the device, select the `Find Blobs` app, then select the color to be recognized from the bottom options or customize a color, and you can recognize the corresponding color. At the same time, the serial port will also output the recognized coordinates and color information.
### Demo
Turn on the device, select `Find Blobs` application, then select the colour you want to identify, or customize the colour, then you can identify the corresponding colour, the `setting bar` at the bottom will show the `threshold range`, and the serial port will also output the coordinates and colour information of the identified coordinates.

<video src="/static/video/find_blobs.mp4" controls="controls" width="100%" height="auto"></video>

### Detailed Explanation
[source code address](https://github.com/sipeed/MaixCDK/tree/main/projects/app_find_blobs)

The app interface is as follows:
### Quick use

#### Using the default threshold

The find blobs app provides four configurations, `red`, `green`, `blue` and `user`, where `red`, `green` and `blue` are used to find `red`, `green` and `blue` colour blocks, and `user` customized thresholds are saved when the app is exited, and the next time the app is opened the thresholds from the last debugging are loaded. For quick experience, you can switch to the corresponding configuration by `clicking` the `button` at the bottom of the interface, the app interface is referenced below:

![](../../../static/image/find_blobs_app.jpg)

#### Using Default Configuration
#### Quick Debug Thresholds

The find blobs app provides four default configurations: `red`, `green`, `blue`, and `user`. `red`, `green`, and `blue` are used to `find red, green, and blue color blobs`, respectively, while `user` is mainly provided for `user-defined color blob finding`. The method for customizing configurations is described below. For a quick experience, you can switch to the corresponding configuration by `clicking` the `buttons` at the bottom of the interface.
Method of operation:

#### Finding Custom Color Blobs
1. Aim the `camera` at the `object` you need to `find`, `click` on the `target` on the screen, then the `left` side will show the `rectangle` of the corresponding colour of the object, and the LAB value of the object's colour.
2. Click on the rectangular box, the system will `automatically set' the LAB threshold, then the screen will draw the edge of the object.
The app provides two ways to find custom color blobs: using adaptive LAB thresholds and manually setting LAB thresholds.
The advantage of this method is that it is easy and quick to set the threshold and find the corresponding colour block. The disadvantage is that it is not precise enough, you can fine tuning it manually in the next step.

##### 1. Finding Color Blobs with Adaptive LAB Thresholds
#### Manually fine tune the threshold

Steps:
Method of operation:

1. `Click` the `options icon` in the bottom-left corner to enter configuration mode.
2. Point the `camera` at the `object` you need to `find`, `click` on the `target object` on the screen, and the `left side` will display a `rectangular frame` of the object's color and show the LAB values of that color.
3. Click on the appearing `rectangular frame`, and the system will `automatically set` the LAB thresholds. At this point, the image will outline the edges of the object.
1. `Click` on the `Options icon` in the lower left corner to enter configuration mode

##### 2. Manually Setting LAB Thresholds to Find Color Blobs
2. Aim the `camera` at the `object` you need to `find`, `click` on the `target object` on the screen, at this time the `left` side will show the `rectangular box` of the corresponding colour of the object, and display the `LAB value` of the object's colour.

Manual setting allows for more precise targeting of the desired color blobs.
3. Click on the lower option `L Min, L Max, A Min, A Max, B Min, B Max`, and a slider will appear on the right to set the value of this option. These values correspond to the minimum and maximum values of the L, A and B channels of the LAB colour format.

Steps:
4. Referring to the `LAB value` of the object colour calculated in step 2, adjust `L Min, L Max, A Min, A Max, B Min, B Max` to the appropriate value to identify the corresponding colour block.

For example, `LAB=(20, 50, 80)`, since `L=20`, in order to fit a certain range, let `L Min=10`, `L Max=30`; similarly, since `A=50`, let `A Min=40`, `A Max=60`; since `B=80`, let `B Min=70`, `B Max=90`.

1. `Click` the `options icon` in the bottom-left corner to enter configuration mode.
2. Point the `camera` at the `object` you need to `find`, `click` on the `target object` on the screen, and the `left side` will display a `rectangular frame` of the object's color and show the `LAB values` of that color.
3. Click on the bottom options `L Min`, `L Max`, `A Min`, `A Max`, `B Min`, `B Max`. After clicking, a slider will appear on the right side to set the value for that option. These values correspond to the minimum and maximum values of the L, A, and B channels in the LAB color format, respectively.
4. Referring to the `LAB values` of the object color calculated in step 2, adjust `L Min`, `L Max`, `A Min`, `A Max`, `B Min`, `B Max` to appropriate values to identify the corresponding color blobs. For example, if `LAB = (20, 50, 80)`, since `L=20`, to accommodate a certain range, set `L Min=10` and `L Max=30`. Similarly, since `A=50`, set `A Min=40` and `A Max=60`. Since `B=80`, set `B Min=70` and `B Max=90`.
This method can be more precise to find the right threshold, with the `Quick Debug Threshold` method, it is easy to find the desired threshold.

#### Getting Detection Data via Serial Protocol
#### Get recognition results via serial protocol

The find blobs app supports reporting information about detected color blobs via the serial port (default baud rate is 115200).

Expand Down
4 changes: 2 additions & 2 deletions docs/doc/zh/vision/camera.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ cam = camera.Camera(1920, 1280) # 分辨率高于1280x720时帧率
```python
from maix import camera
cam = camera.Camera(640, 480, fps=60) # 设置帧率为60帧
# or
cam = camera.Camera(640, 480) # 分辨率低于或等于1280x720时帧率会设置为80fps
```

### 设置帧率为80帧

```python
from maix import camera
cam = camera.Camera(640, 480, fps=80) # 设置帧率为80帧
# or
cam = camera.Camera(640, 480) # 分辨率低于或等于1280x720时帧率会设置为80fps
```

注意:
Expand Down
35 changes: 16 additions & 19 deletions docs/doc/zh/vision/find_blobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,40 +96,35 @@ while 1:

本文介绍常用方法,更多 API 请看 API 文档的 [image](../../../api/maix/image.md) 部分。

## 使用寻找色块APP
## 离线设置阈值

为了快速验证寻找色块的功能,可以先使用MaixCam提供的寻找色块应用程序来体验寻找色块的效果。

### 使用方法
打开设备,选择`找色块`应用,然后在下方选择要识别的颜色,或者自定义颜色,即可以识别到对应的颜色了,同时串口也会输出识别到的坐标和颜色信息。
### 演示
打开设备,选择`找色块`应用,然后在下方选择要识别的颜色,或者自定义颜色,即可以识别到对应的颜色了,在下方`设置栏`会显示当前设置的`阈值范围`同时串口也会输出识别到的坐标和颜色信息。

<video src="/static/video/find_blobs.mp4" controls="controls" width="100%" height="auto"></video>

### 详细说明
[源码地址](https://github.com/sipeed/MaixCDK/tree/main/projects/app_find_blobs)

APP界面参考如下:
### 快速使用

![](../../../static/image/find_blobs_app.jpg)

#### 使用默认配置

寻找色块APP默认提供了`red、green、blue、user`四种配置,其中`red、green和blue`用来`寻找红色、绿色和蓝色的色块``user`主要提供给`用户自定义寻找色块`,自定义配置的方法见下文。快速体验时通过`点击`界面下方`按钮`即可切换到对应配置,
#### 使用默认阈值

#### 寻找自定义色块
寻找色块APP提供了`red``green``blue``user`四种配置,其中`red``green``blue`用来寻找`红色``绿色``蓝色`的色块,`user`自定义的阈值在程序退出时会保存下来,下次打开应用时会加载上一次调试的阈值。快速体验时通过`点击`界面下方`按钮`即可切换到对应配置,APP界面参考如下:

APP提供两种方式来寻找自定义的色块:通过自适应LAB阈值寻找和手动设置LAB阈值寻找
![](../../../static/image/find_blobs_app.jpg)

##### 1. 自适应LAB阈值寻找色块
#### 快速调试阈值

操作方法:

1. `点击`左下角`选项图标`,进入配置模式
2. 将`摄像头对准`需要`寻找的物体``点击`屏幕上的`目标物体`,此时`左侧`会显示该物体对应颜色的`矩形框`,并显示该物体颜色的LAB值。
3. 点击出现的`矩形框`,系统将会`自动设置`LAB阈值,此时画面将会画出该物体边缘。
1. 将`摄像头对准`需要`寻找的物体``点击`屏幕上的`目标物体`,此时`左侧`会显示该物体对应颜色的`矩形框`,并显示该物体颜色的LAB值。
2. 点击出现的`矩形框`,系统将会`自动设置`LAB阈值,此时画面将会画出该物体边缘。

##### 2. 手动设置LAB阈值寻找色块
这个方法优点是方便,快捷,可以很快的设置阈值并找到对应的色块。缺点是还不够精确,可以在下一步中手动微调。

手动设置可以更精确的找到目标色块。
#### 手动微调阈值

操作方法:

Expand All @@ -143,7 +138,9 @@ APP提供两种方式来寻找自定义的色块:通过自适应LAB阈值寻

例如`LAB=(20, 50, 80)`,由于`L=20`,为了适配一定范围让`L Min=10``L Max=30`;同理,由于`A=50`,让`A Min=40``A Max=60`; 由于`B=80`,让`B Min=70``B Max=90`

#### 通过串口协议获取检测数据
这个方法可以更精确的找到合适的阈值,搭配`快速调试阈值`的方法,轻松找到想要的阈值。

#### 通过串口协议获取识别结果

寻找色块APP支持通过串口(默认波特率为115200)上报检测到的色块信息。

Expand Down

0 comments on commit 6cc9e58

Please sign in to comment.