opencv C++ negative X,Y cordinates from detections (yolo detections)

我是研究僧i 提交于 2021-02-11 13:07:25

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!