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:
parent
0343c50fb4
commit
c8877714d8
Binary file not shown.
After Width: | Height: | Size: 490 KiB |
Binary file not shown.
After Width: | Height: | Size: 487 KiB |
|
@ -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',
|
||||||
|
|
|
@ -18,3 +18,5 @@
|
||||||
|
|
||||||
- [声音传感器](/doc/sensor/voice_sensor.md)
|
- [声音传感器](/doc/sensor/voice_sensor.md)
|
||||||
|
|
||||||
|
- [图像传感器](/doc/sensor/image_sensor.md)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
# 图像传感器
|
||||||
|
|
||||||
|
## 传感器介绍
|
||||||
|
|
||||||
|
| 传感器信号 | 传感器说明 | 驱动支持 | 传感器外形 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| OV7670 | 最大支持 40x480,30万像素,不支持 JPEG 输出,不支持自动对焦 | 已支持 | ![ov7670](/images/sensor-ov7670.png) |
|
||||||
|
| OV2640 | 最大支持 1600x1200,200万像素,支持 JPEG 输出,不支持自动对焦 | 待支持 | ![ov7670](/images/sensor-ov2640.png) |
|
||||||
|
|
||||||
|
## 使用说明
|
||||||
|
|
||||||
|
本系统支持 dev fs,camera 设备会在 /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);
|
||||||
|
```
|
Loading…
Reference in New Issue