xuos-web/docs/doc/sensor/image_sensor.md

42 lines
1007 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 图像传感器
## 传感器介绍
| 传感器信号 | 传感器说明 | 驱动支持 | 传感器外形 |
| --- | --- | --- | --- |
| 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);
```