sensor: add image sensor doc

add image sensor (camera) introduction and usage to sensor docs.
more details will be updated later.

Signed-off-by: Bao Li <baoli@aiit.org.cn>
This commit is contained in:
Bao Li 2020-10-30 14:56:58 +08:00
parent 0343c50fb4
commit c8877714d8
5 changed files with 46 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 KiB

View File

@ -48,7 +48,8 @@ const sidebar = {
'/doc/sensor/magneto_sensor', '/doc/sensor/magneto_sensor',
'/doc/sensor/photoelec_sensor', '/doc/sensor/photoelec_sensor',
'/doc/sensor/pressure_sensor', '/doc/sensor/pressure_sensor',
'/doc/sensor/voice_sensor' '/doc/sensor/voice_sensor',
'/doc/sensor/image_sensor'
], ],
'appdev': [ 'appdev': [
'/doc/appdev/env', '/doc/appdev/env',

View File

@ -18,3 +18,5 @@
- [声音传感器](/doc/sensor/voice_sensor.md) - [声音传感器](/doc/sensor/voice_sensor.md)
- [图像传感器](/doc/sensor/image_sensor.md)

View File

@ -0,0 +1,41 @@
# 图像传感器
## 传感器介绍
| 传感器信号 | 传感器说明 | 驱动支持 | 传感器外形 |
| --- | --- | --- | --- |
| OV7670 | 最大支持 40x48030万像素不支持 JPEG 输出,不支持自动对焦 | 已支持 | ![ov7670](/images/sensor-ov7670.png) |
| OV2640 | 最大支持 1600x1200200万像素支持 JPEG 输出,不支持自动对焦 | 待支持 | ![ov7670](/images/sensor-ov2640.png) |
## 使用说明
本系统支持 dev fscamera 设备会在 /dev 下面注册。
相关数据结构:
```c
enum CameraOutputFormat {
RGB565,
JPEG,
};
struct CameraInfo {
int width;
int height;
CameraOutputFormat format;
};
```
基本使用说明:
```c
// open camera device
int fd = open(“/dev/cam1”);
// get camera info
struct CameraInfo cam_info;
int ret = ioctl(fd, GET_INFO, &cam_info);
// read camera data to buf
void *buf = malloc(cam_info.width * cam_info.height * 2); // assume the format is RGB565
int ret = read(fd, buf, size);
```