我具有检测视频中人物的功能。我只想在边框内显示图像。我将不胜感激任何帮助。我已经试过了。这不是完整的代码。只是重要部分的片段。
def run(self,image):
self.personBBs = [] #person bounding boxes
self.sub_image = None # image inside the bounding box
for i, c in reversed(list(enumerate(out_classes))):
predicted_class = self.class_names[c]
if "person" != predicted_class:
continue
score = out_scores[i]
if score > person_threshold:
self.personFlag = True
box = out_boxes[i]
bounding_boxes_list = [int(v) for v in box]
x,y,w,h = bounding_boxes_list
#condition for getting the image inside the bounding box
self.sub_image = image[y:y+h, x:x+w]
self.personBBs.append(bounding_boxes_list)
return self.sub_image,self.personBBsenter code here
当我检查帧中的图像时,它不是在显示人物而是背景。