# cv::error: (-215:Assertion failed) !nms_iou_threshold.empty() && nms_iou_threshold > 0 && nms_iou_threshold <= 1 in function 'NMSBoxes'

- **ID:** `opencv/dnn-softnms-parameter-error`
- **Domain:** opencv
- **Category:** assertion_error
- **Verification:** ai_generated
- **Fix Rate:** 88%

## Root Cause

Non-maximum suppression (NMS) called with an invalid or out-of-range IoU threshold parameter.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 4.5.5 | active | — | — |
| 4.6.0 | active | — | — |
| 4.7.0 | active | — | — |
| 4.8.1 | active | — | — |
| 4.9.0 | active | — | — |

## Workarounds

1. **Ensure nms_iou_threshold is a float between 0.01 and 1.0, e.g., cv::NMSBoxes(boxes, scores, 0.5, 0.4) where 0.4 is the IoU threshold.** (95% success)
   ```
   Ensure nms_iou_threshold is a float between 0.01 and 1.0, e.g., cv::NMSBoxes(boxes, scores, 0.5, 0.4) where 0.4 is the IoU threshold.
   ```
2. **Validate the parameter before calling NMSBoxes: if (iou_threshold <= 0.0 || iou_threshold > 1.0) { iou_threshold = 0.5; }** (90% success)
   ```
   Validate the parameter before calling NMSBoxes: if (iou_threshold <= 0.0 || iou_threshold > 1.0) { iou_threshold = 0.5; }
   ```

## Dead Ends

- **Setting nms_iou_threshold to 0 to disable NMS** — IoU threshold must be strictly greater than 0; 0 triggers the assertion. (95% fail)
- **Using a negative value like -0.5 for aggressive suppression** — Negative values fail the '> 0' check in the assertion. (100% fail)
- **Passing a string or list instead of a float** — The empty() check on a non-scalar type passes, but the comparison fails with type error. (80% fail)
