看目标物体的坐标之print(r[‘rois‘])
作者:互联网
Jupyter:
# Load a random image from the images folder
file_names = next(os.walk(IMAGE_DIR))[2]
image = skimage.io.imread(os.path.join(IMAGE_DIR, random.choice(file_names)))
# Run detection
results = model.detect([image], verbose=1)
# Visualize results
r = results[0]
visualize.display_instances(image, r['rois'], r['masks'], r['class_ids'],
class_names, r['scores'])
print(r['rois'])
输出:
[[215 410 295 622]
[232 47 395 163]
[238 255 271 342]
[234 99 342 215]]
依次输出为矩形左上角坐标(x,y),右下角坐标(x,y)。
坐标原点(0,0)为图片左上角
PS验证:我的(x,y)反了?
标签:image,results,rois,names,file,print,坐标 来源: https://blog.csdn.net/weixin_46106424/article/details/122760441