我正在尝试制作一个图形用户界面,帮助我裁剪人脸,并根据他们的情绪(如愤怒、悲伤、高兴等)对其进行折叠。我的代码看起来工作正常,但当我裁剪图像时,它会保存图像的其余部分。我真的不知道怎么才能做到!!
我的裁剪功能:def on_mouse(self, event, x, y, buttons, user_param):
# Mouse callback that gets called for every mouse event (i.e. moving, clicking, etc.)
if self.done: # Nothing more to do
return
if event == cv2.EVENT_MOUSEMOVE:
# We want to be able to draw the line-in-progress, so update current mouse position
self.current = (x, y)
elif event == cv2.EVENT_LBUTTONDOWN:
# Left click means adding a point at current position to the list of points
print("Adding point #%d with position(%d,%d)" % (len(self.points), x, y))
self.points.append((x, y))
elif event == cv2.EVENT_RBUTTONDOWN:
# Right click means we're done
print("Completing polygon with %d poi