# cv::error: (-215:断言失败) !boundingBox.empty() 在函数 'init' 中

- **ID:** `opencv/tracker-init-no-bbox`
- **领域:** opencv
- **类别:** assertion_error
- **错误码:** `-215`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

传递给 cv::Tracker::init 的边界框为空（宽度或高度为零），通常是由于无效的检测或用户输入。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 4.5.0 | active | — | — |
| 4.7.0 | active | — | — |
| 4.10.0 | active | — | — |

## 解决方案

1. ```
   在 init 之前验证边界框：if (bbox.width > 0 && bbox.height > 0) { tracker->init(frame, bbox); } else { /* 处理错误 */ }
   ```
2. ```
   确保从检测中正确计算边界框；例如，如果使用 cv::selectROI，检查用户是否实际选择了区域。
   ```

## 无效尝试

- **** — The empty() check only verifies width and height are zero; negative coordinates are allowed but may cause later issues; however, the assertion still passes if width/height > 0. (60% 失败率)
- **** — empty() returns true if width <= 0 or height <= 0; both must be positive for the assertion to pass. (100% 失败率)
