error: OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in cv::Mat::Mat


問題原因:

You are probably working outside of the image dimensions. Does any of the values you pass to the cvSetImageROI function lay outside the image boudaries?

圖像的ROI區域超過了圖像的尺寸,即roi.x + roi.width > m.cols && roi.y + roi.height > m.rows

解決辦法:

判斷截取的ROI尺寸是否在圖像內


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM