问题
I am using Yolo detection algorithm to predict bounding boxes, but the detection returns some values as negative integers , but the cv::rectangle
function draws correct rectangles on to images, so it's kind of puzzling why there are negative or even long values in the detection coordinates, here get_rect
function returns x,y,width,height, after applying NMS
std::vector<uint> rr = get_rect(img, res[j].bbox);
later converted it into opencv understandable format:
cv::Rect r = cv::Rect(rr[0],rr[1],rr[2],rr[3]);
when print following values of Rect r
some values are ambiguous,
r.x = 398
r.y = 1431655936
r.width = 22
r.height = -1431655867
As can be seen values of y coordinate and height are completely out of the canvas, so any reasons for this.
Also , i made sure that the input image dimensions , infering dimensions , and output image rendering dimensions all are same, Also cv::rectangle
function correctly drawing all the rectangles with there respective object locations.
来源:https://stackoverflow.com/questions/62956474/opencv-c-negative-x-y-cordinates-from-detections-yolo-detections