Document IDE setup and repository commit rules
- note that compile_commands.json must be regenerated locally - add a commit-rule table and a warning to back up calibration photos - fix the intrinsics example to read configs/camera.yaml
This commit is contained in:
@@ -5,10 +5,20 @@ RoboMaster 视觉工程(MindVision 相机 + OpenCV)。
|
|||||||
## 构建
|
## 构建
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
xmake # 产出两个程序(见下)
|
xmake # 产出三个程序(见下)
|
||||||
xmake run 27RM # 跑主程序
|
xmake run 27RM # 跑主程序
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### VSCode + clangd
|
||||||
|
|
||||||
|
`compile_commands.json` 含本机绝对路径,**不入库**,克隆后自己生成一次:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xmake project -k compile_commands .vscode
|
||||||
|
```
|
||||||
|
|
||||||
|
(`.vscode/settings.json` 里已配置 `clangd.arguments: ["--compile-commands-dir=.vscode"]`)
|
||||||
|
|
||||||
## 程序清单
|
## 程序清单
|
||||||
|
|
||||||
| 程序 | 用途 |
|
| 程序 | 用途 |
|
||||||
@@ -113,9 +123,12 @@ if (auto pose = calib.solvePose(corners, ArmorSize::small())) {
|
|||||||
|
|
||||||
### 3. 使用内参
|
### 3. 使用内参
|
||||||
|
|
||||||
|
推荐直接用封装好的 `CameraCalib`(见上方「配置」一节),它已经处理了配置路径、去畸变缓存和位姿门限。
|
||||||
|
若要手动读:
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
cv::Mat K, D;
|
cv::Mat K, D;
|
||||||
cv::FileStorage fs("camera_calib.yml", cv::FileStorage::READ);
|
cv::FileStorage fs("configs/camera.yaml", cv::FileStorage::READ);
|
||||||
fs["camera_matrix"] >> K;
|
fs["camera_matrix"] >> K;
|
||||||
fs["dist_coeffs"] >> D;
|
fs["dist_coeffs"] >> D;
|
||||||
```
|
```
|
||||||
@@ -129,3 +142,26 @@ fs["dist_coeffs"] >> D;
|
|||||||
```
|
```
|
||||||
|
|
||||||
用卷尺量出真实距离,与程序算出的距离对比:误差 < 2% 说明标定可用。
|
用卷尺量出真实距离,与程序算出的距离对比:误差 < 2% 说明标定可用。
|
||||||
|
|
||||||
|
## 提交规则(.gitignore)
|
||||||
|
|
||||||
|
| 内容 | 是否入库 | 原因 |
|
||||||
|
|---|---|---|
|
||||||
|
| `src/` `inc/` `xmake.lua` `README.md` | ✅ 入库 | 源码与构建脚本 |
|
||||||
|
| `configs/camera.yaml` | ✅ **必须入库** | 相机内参,全队共用 |
|
||||||
|
| `calib_images/` `calib_all/` | ❌ 不入库 | 标定照片,20MB+ 且随时重拍 |
|
||||||
|
| `*.jpg` `*.png` `*.bmp` `*.avi` `*.mp4` | ❌ 不入库 | 图片视频一律不入库 |
|
||||||
|
| `build/` `.xmake/` `Camera/` `*.log` | ❌ 不入库 | 编译产物、SDK 运行时日志 |
|
||||||
|
| `.vscode/compile_commands.json` | ❌ 不入库 | xmake 生成,含本机绝对路径 |
|
||||||
|
|
||||||
|
确有少量配图(例如 README 插图)要提交时,用强制添加:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add -f docs/xxx.png
|
||||||
|
```
|
||||||
|
|
||||||
|
### ⚠️ 标定图请自己留备份
|
||||||
|
|
||||||
|
照片不入库 = 只有本机一份。重装系统前记得把 `calib_images/` 拷到网盘或 U 盘,
|
||||||
|
否则将来想重新标定(换镜头、调焦后)就没有原始数据了。
|
||||||
|
标定**结果**在 `configs/camera.yaml` 里,但结果无法替代原始照片。
|
||||||
|
|||||||
Reference in New Issue
Block a user