mirror of
https://github.com/sipeed/sipeed_wiki.git
synced 2026-09-11 00:22:49 -05:00
update sensor.md
This commit is contained in:
81
.history/news/MaixPy/sensor_20230613170728.md
Normal file
81
.history/news/MaixPy/sensor_20230613170728.md
Normal file
@@ -0,0 +1,81 @@
|
||||
---
|
||||
title: Sensor 感光元件曝光控制
|
||||
tags: Sebsor, 曝光控制, 修改曝光
|
||||
keywords: Sebsor, 曝光控制, 修改曝光
|
||||
---
|
||||
|
||||
> 最近有社区的小伙伴在实现功能时需对 Sensor 摄像头的曝光强弱进行调整以及修改,可根据下文的代码来进行调整曝光,源代码链接:[点击](https://book.openmv.cc/example/21-Sensor-Control/sensor_exposure_control.html)查看。
|
||||
|
||||
## 摄像头型号
|
||||
|
||||
我们测过两种型号的摄像头分别是:`OV2640` 以及 `OV5640`,只有 `OV2640` 型号的支持使用 `sensor_exposure_control` 对曝光进行修改以及控制。
|
||||
|
||||

|
||||
|
||||
## 控制曝光代码
|
||||
|
||||
```python
|
||||
|
||||
import sensor, image, time
|
||||
|
||||
# 更改此值以调整曝光。试试10.0 / 0.1 /等。
|
||||
EXPOSURE_TIME_SCALE = 0.01
|
||||
|
||||
sensor.reset() # Reset and initialize the sensor.
|
||||
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
|
||||
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
|
||||
|
||||
# 打印出初始曝光时间以进行比较。
|
||||
print("Initial exposure == %d" % sensor.get_exposure_us())
|
||||
|
||||
sensor.skip_frames(time = 2000) # Wait for settings take effect.
|
||||
clock = time.clock() # Create a clock object to track the FPS.
|
||||
|
||||
# 您必须关闭自动增益控制和自动白平衡,否则他们将更改图像增益以撤消您放置的任何曝光设置...
|
||||
sensor.set_auto_gain(False)
|
||||
sensor.set_auto_whitebal(False)
|
||||
# 需要让以上设置生效
|
||||
sensor.skip_frames(time = 500)
|
||||
|
||||
print("New exposure == %d" % sensor.get_exposure_us())
|
||||
|
||||
# 如果要重新打开自动曝光,请执行以下操作:sensor.set_auto_exposure(True)
|
||||
# 请注意,相机传感器将根据需要更改曝光时间。
|
||||
|
||||
current_exposure_time_in_microseconds = sensor.get_exposure_us()
|
||||
sensor.set_auto_exposure(False, exposure_us = int(current_exposure_time_in_microseconds * EXPOSURE_TIME_SCALE))
|
||||
|
||||
sensor.set_auto_exposure(False)
|
||||
# 执行:sensor.set_auto_exposure(False),只是禁用曝光值更新,但不会更改相机传感器确定的曝光值。
|
||||
|
||||
while(True):
|
||||
current_exposure_time_in_microseconds = sensor.get_exposure_us()
|
||||
print("Current Exposure == %d" % current_exposure_time_in_microseconds)
|
||||
|
||||
clock.tick() # Update the FPS clock.
|
||||
img = sensor.snapshot() # Take a picture and return the image.
|
||||
print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
|
||||
# to the IDE. The FPS should increase once disconnected.
|
||||
```
|
||||
|
||||
## 用法以及效果演示
|
||||
|
||||
### 修改 EXPOSURE_TIME_SCALE 的值为 0.1
|
||||
|
||||
在上文的代码中修改控制曝光 EXPOSURE_TIME_SCALE 的值为 0.1,看看是什么效果。
|
||||
|
||||

|
||||
|
||||
### 修改 EXPOSURE_TIME_SCALE 的值为 0.4
|
||||
|
||||
递增修改控制曝光 EXPOSURE_TIME_SCALE 的值为 0.4,看看是什么效果。
|
||||
|
||||

|
||||
|
||||
### 修改 EXPOSURE_TIME_SCALE 的值为 0.8
|
||||
|
||||
再次修改控制曝光 EXPOSURE_TIME_SCALE 的值为 0.8,看看是什么效果。
|
||||
|
||||

|
||||
|
||||
> 从应用效果来看 0.1 跟 0.8 的曝光补光的图像差距非常大,用户可根据自己的需求进行修改值即可。
|
||||
@@ -214,8 +214,8 @@ keywords: MAIX-III, AXera-Pi, Maix3, Sipeed, ax620a, axera, sipeed, AI, model, m
|
||||
- [[m3axpi] YOLOv5 训练到部署全流程(最新)](https://github.com/Abandon-ht/m3axpi_model/blob/main/yolov5/README_zh-CN.md)
|
||||
- [[m3axpi] YOLOv8 训练到部署全流程(最新)](https://github.com/Abandon-ht/m3axpi_model/blob/main/yolov8/README_zh-CN.md)
|
||||
- [爱芯元智AX620A部署yolov5 6.0模型实录(已过时)](https://zhuanlan.zhihu.com/p/569083585)
|
||||
- [ubuntu22.04搭建AX620A官方例程开发环境](http://t.csdn.cn/p8Nno)
|
||||
- [AX620A运行yolov5s自训练模型全过程记录(windows)](http://t.csdn.cn/oNeYG)
|
||||
- [ubuntu22.04搭建AX620A官方例程开发环境](https://blog.csdn.net/flamebox/article/details/127103964)
|
||||
- [AX620A运行yolov5s自训练模型全过程记录(windows)](https://blog.csdn.net/flamebox/article/details/127249243)
|
||||
- [MAIX-III AXera-Pi爱芯派从零入门开发【1】开箱试玩](https://www.bilibili.com/video/BV1LP4y1274d/?spm_id_from=333.999.0.0)
|
||||
- [MAIX-III AXera-Pi爱芯派从零入门开发【2】开发部署](https://www.bilibili.com/video/BV1Ne4y117U9/?spm_id_from=333.999.0.0)
|
||||
- [MAIX-III AXera-Pi爱芯派从零入门开发【3】模型转换及部署](https://www.bilibili.com/video/BV1jg411z7C8/?spm_id_from=333.999.0.0)
|
||||
@@ -224,7 +224,7 @@ keywords: MAIX-III, AXera-Pi, Maix3, Sipeed, ax620a, axera, sipeed, AI, model, m
|
||||
- [HonestQiao —— 矽速 MAIX-III AXera-Pi 开箱](https://bbs.elecfans.com/m/jishu_2314161_1_1.html)
|
||||
- [一款国产「3.6TOPS@INT8」视觉 AI 开发板](https://mp.weixin.qq.com/s/3bxFxO0Q0UmpzSM3_K794g)
|
||||
- [国产AI开发板测评 | MAIX-III AXera-Pi 上手 YOLOv5s 实时目标检测](https://mp.weixin.qq.com/s/lqxL-DmhBa-K9gu3uEyebQ)
|
||||
- [【AXPI】如何在 M1/M2 Mac上使用 Rndis](https://blog.csdn.net/flamebox/article/details/127103964)
|
||||
- [【AXPI】如何在 M1/M2 Mac上使用 Rndis](https://zhuanlan.zhihu.com/p/593627641)
|
||||
|
||||
|
||||
产品相关的新闻内容有:
|
||||
|
||||
BIN
news/MaixPy/assets/ov2640.jpg
Normal file
BIN
news/MaixPy/assets/ov2640.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
BIN
news/MaixPy/assets/sensor_one.png
Normal file
BIN
news/MaixPy/assets/sensor_one.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 99 KiB |
BIN
news/MaixPy/assets/sensor_three.png
Normal file
BIN
news/MaixPy/assets/sensor_three.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 100 KiB |
BIN
news/MaixPy/assets/sensor_two.png
Normal file
BIN
news/MaixPy/assets/sensor_two.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
81
news/MaixPy/sensor.md
Normal file
81
news/MaixPy/sensor.md
Normal file
@@ -0,0 +1,81 @@
|
||||
---
|
||||
title: Sensor 感光元件曝光控制
|
||||
tags: Sebsor, 曝光控制, 修改曝光
|
||||
keywords: Sebsor, 曝光控制, 修改曝光
|
||||
---
|
||||
|
||||
> 最近有社区的小伙伴在实现功能时需对 Sensor 摄像头的曝光强弱进行调整以及修改,可根据下文的代码来进行调整曝光,源代码链接:[点击](https://book.openmv.cc/example/21-Sensor-Control/sensor_exposure_control.html)查看。
|
||||
|
||||
## 摄像头型号
|
||||
|
||||
我们测过两种型号的摄像头分别是:`OV2640` 以及 `OV5640`,只有 `OV2640` 型号的支持使用 `sensor_exposure_control` 对曝光进行修改以及控制。
|
||||
|
||||

|
||||
|
||||
## 控制曝光代码
|
||||
|
||||
```python
|
||||
|
||||
import sensor, image, time
|
||||
|
||||
# 更改此值以调整曝光。试试10.0 / 0.1 /等。
|
||||
EXPOSURE_TIME_SCALE = 0.01
|
||||
|
||||
sensor.reset() # Reset and initialize the sensor.
|
||||
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
|
||||
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
|
||||
|
||||
# 打印出初始曝光时间以进行比较。
|
||||
print("Initial exposure == %d" % sensor.get_exposure_us())
|
||||
|
||||
sensor.skip_frames(time = 2000) # Wait for settings take effect.
|
||||
clock = time.clock() # Create a clock object to track the FPS.
|
||||
|
||||
# 您必须关闭自动增益控制和自动白平衡,否则他们将更改图像增益以撤消您放置的任何曝光设置...
|
||||
sensor.set_auto_gain(False)
|
||||
sensor.set_auto_whitebal(False)
|
||||
# 需要让以上设置生效
|
||||
sensor.skip_frames(time = 500)
|
||||
|
||||
print("New exposure == %d" % sensor.get_exposure_us())
|
||||
|
||||
# 如果要重新打开自动曝光,请执行以下操作:sensor.set_auto_exposure(True)
|
||||
# 请注意,相机传感器将根据需要更改曝光时间。
|
||||
|
||||
current_exposure_time_in_microseconds = sensor.get_exposure_us()
|
||||
sensor.set_auto_exposure(False, exposure_us = int(current_exposure_time_in_microseconds * EXPOSURE_TIME_SCALE))
|
||||
|
||||
sensor.set_auto_exposure(False)
|
||||
# 执行:sensor.set_auto_exposure(False),只是禁用曝光值更新,但不会更改相机传感器确定的曝光值。
|
||||
|
||||
while(True):
|
||||
current_exposure_time_in_microseconds = sensor.get_exposure_us()
|
||||
print("Current Exposure == %d" % current_exposure_time_in_microseconds)
|
||||
|
||||
clock.tick() # Update the FPS clock.
|
||||
img = sensor.snapshot() # Take a picture and return the image.
|
||||
print(clock.fps()) # Note: OpenMV Cam runs about half as fast when connected
|
||||
# to the IDE. The FPS should increase once disconnected.
|
||||
```
|
||||
|
||||
## 用法以及效果演示
|
||||
|
||||
### 修改 EXPOSURE_TIME_SCALE 的值为 0.1
|
||||
|
||||
在上文的代码中修改控制曝光 EXPOSURE_TIME_SCALE 的值为 0.1,看看是什么效果。
|
||||
|
||||

|
||||
|
||||
### 修改 EXPOSURE_TIME_SCALE 的值为 0.4
|
||||
|
||||
递增修改控制曝光 EXPOSURE_TIME_SCALE 的值为 0.4,看看是什么效果。
|
||||
|
||||

|
||||
|
||||
### 修改 EXPOSURE_TIME_SCALE 的值为 0.8
|
||||
|
||||
再次修改控制曝光 EXPOSURE_TIME_SCALE 的值为 0.8,看看是什么效果。
|
||||
|
||||

|
||||
|
||||
> 从应用效果来看 0.1 跟 0.8 的曝光补光的图像差距非常大,用户可根据自己的需求进行修改值即可。
|
||||
@@ -562,7 +562,7 @@ echo "usb_device" > /sys/devices/platform/soc/usbc0/otg_role
|
||||
1. [V831 如何使用 libmaix SDK C++ 开发](https://wiki.sipeed.com/news/MaixPy3/run_lvgl/run_lvgl.html)
|
||||
2. [Linux 连接不上 adb 设备](https://wiki.sipeed.com/news/others/linux_adb/linux_adb.html)
|
||||
|
||||
完成上面的环境配置后,这里提供了可运行的 `Demo` 内容就是如何使用 V831 LINUX C++ 进行图像视觉处理和开发,在此我们提供了 `串口 + mv cv ai` 的示例项目,供开发者评估使用,此处不涉及到 ISP 调试,需要进一步 ISP 图像调试则需要联系大佬鼠。
|
||||
完成上面的环境配置后,这里提供了可运行的 `Demo` 内容就是如何使用 V831 LINUX C++ 进行图像视觉处理和开发,在此我们提供了 `串口 + mv cv ai` 的示例项目,供开发者评估使用,此处不涉及到 ISP 调试,需要进一步 ISP 图像调试则需要联系 SIPEED。
|
||||
|
||||
>相关资料:[libmaix](https://github.com/sipeed/libmaix/blob/6ad1102a0527bd3d394c0b1de82cbf64d6eac40d/components/maix_dls831/src/dls831_uvai.cpp#L435-L663)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user