Skip to content

Commit

Permalink
* update camera doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Jul 18, 2024
1 parent 6b79b89 commit c64ff5e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/doc/en/vision/camera.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,25 @@ Notes:

1. if `Camera` is passed in a size larger than `1280x720`, for example written as `camera.Camera(1920, 1080, fps=60)`, then the `fps` parameter will be invalidated, and the frame rate will remain at `30fps`.
2. A `60fps` frame will be offset by a few pixels compared to a `30fps` frame, and the offset will need to be corrected if the viewing angle is critical.
3. Note that due to the fact that `60fps‘ and `30fps` share the same `isp` configuration, in some environments there will be some deviation in the quality of the screen at the two frame rates.

## Image correction

In case of distortion such as fisheye, you can use the `lens_corr` function under the `Image` object to correct the distortion of the image. In general, you just need to increase or decrease the value of `strength` to adjust the image to the right effect.

``python
from maix import camera, display

cam = camera.Camera(320, 240)
disp = display.Display()
while not app.need_exit():: t = time.
t = time.ticks_ms()
img = cam.read()
img = img.lens_corr(strength=1.5) # Adjust the strength value until the image is no longer distorted.
disp = display.Display()
``

TODO: Support for hardware distortion correction

## Skipping Initial Frames

Expand Down
19 changes: 19 additions & 0 deletions docs/doc/zh/vision/camera.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,25 @@ cam = camera.Camera(640, 480) # 分辨率低于或等于1280x72

1. 如果`Camera`传入的尺寸大于`1280x720`,例如写成`camera.Camera(1920, 1080, fps=60)`,此时`fps`参数将会失效,帧率将保持在`30fps`
2. `60fps``30fps`的画面相比会有几个像素的偏移,在对视角有严格要求的应用下需要注意修正偏移。
3. 需要注意由于`60fps``30fps`共用了`isp`配置,在某些环境下两种帧率下的画面画质会存在一些偏差。

## 图像矫正

对于画面存在鱼眼等畸变的情况,可以使用`Image`对象下的`lens_corr`函数对图片进行畸变矫正。一般情况只需要调大和调小`strength`的值来将画面调整到合适效果即可。

```python
from maix import camera, display

cam = camera.Camera(320, 240)
disp = display.Display()
while not app.need_exit():
t = time.ticks_ms()
img = cam.read()
img = img.lens_corr(strength=1.5) # 调整strength的值直到画面不再畸变
disp = display.Display()
```

TODO:支持硬件畸变矫正

## 跳过 开头的帧

Expand Down

0 comments on commit c64ff5e

Please sign in to comment.