diff --git a/docs/doc/en/vision/camera.md b/docs/doc/en/vision/camera.md index 2e36b431..57484321 100644 --- a/docs/doc/en/vision/camera.md +++ b/docs/doc/en/vision/camera.md @@ -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 diff --git a/docs/doc/zh/vision/camera.md b/docs/doc/zh/vision/camera.md index 88b8e284..2bb05b48 100644 --- a/docs/doc/zh/vision/camera.md +++ b/docs/doc/zh/vision/camera.md @@ -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:支持硬件畸变矫正 ## 跳过 开头的帧