42 lines
1007 B
Markdown
42 lines
1007 B
Markdown
# 图像传感器
|
||
|
||
## 传感器介绍
|
||
|
||
| 传感器信号 | 传感器说明 | 驱动支持 | 传感器外形 |
|
||
| --- | --- | --- | --- |
|
||
| OV7670 | 最大支持 40x480,30万像素,不支持 JPEG 输出,不支持自动对焦 | 已支持 |  |
|
||
| OV2640 | 最大支持 1600x1200,200万像素,支持 JPEG 输出,不支持自动对焦 | 待支持 |  |
|
||
|
||
## 使用说明
|
||
|
||
本系统支持 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);
|
||
```
|