cv2.dnn.NMSBoxes() 要求输入边界框格式
1. OpenCV 官方文档 明确说明:
void cv::dnn::NMSBoxes(const std::vector<Rect> & bboxes,const std::vector<float> & scores,float score_threshold,float nms_threshold,std::vector<int> & indices,float eta = 1.f,int top_k = 0
)
其中 Rect
定义为:
typedef Rect_<int> Rect;template<typename _Tp> class Rect_
{
public:_Tp x; // 左上角 x 坐标_Tp y; // 左上角 y 坐标_Tp width; // 框的宽度_Tp height; // 框的高度
};
说明要求输入的边界框格式是[x,y, w,h] 格式,不是常用的[x_min, y_min, x_max, y_max]