opencv
runtime_error
ai_generated
true
cv::error: ROI is outside of the image
ID: opencv/roi-out-of-bounds
85%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 4 | active | — | — | — |
Root Cause
Region of interest exceeds image dimensions.
genericWorkarounds
-
90% success Validate ROI before extraction: clamp to image bounds
-
92% success Check: 0<=x, 0<=y, x+w<=img.cols, y+h<=img.rows
Dead Ends
Common approaches that don't work:
-
Clip ROI silently
72% fail
May return empty or wrong region
-
Pad image to fit ROI
68% fail
Changes image content