相信许多小伙伴和我一样,刚接触OpenCV,遇到了如下问题,具体代码如下:
Traceback (most recent call last):
File "D:\Light\pycharm\code\pose gesture\PoseModule.py", line 74, in <module>
main()
File "D:\Light\pycharm\code\pose gesture\PoseModule.py", line 53, in main
detector = poseDetector()
File "D:\Light\pycharm\code\pose gesture\PoseModule.py", line 22, in __init__
self.pose = self.mpPose.Pose(self.mode, self.upBody, self.smooth,
File "D:\Light\pycharm\python\code\lib\site-packages\mediapipe\python\solutions\pose.py", line 146, in __init__
super().__init__(
File "D:\Light\pycharm\python\code\lib\site-packages\mediapipe\python\solution_base.py", line 289, in __init__
self._input_side_packets = {
File "D:\Light\pycharm\python\code\lib\site-packages\mediapipe\python\solution_base.py", line 290, in <dictcomp>
name: self._make_packet(self._side_input_type_info[name], data)
File "D:\Light\pycharm\python\code\lib\site-packages\mediapipe\python\solution_base.py", line 592, in _make_packet
return getattr(packet_creator, 'create_' + packet_data_type.value)(data)
TypeError: create_bool(): incompatible function arguments. The following argument types are supported:
1. (arg0: bool) -> mediapipe.python._framework_bindings.packet.Packet
Invoked with: 0.5
这个是由于版本更新了,新增了个参数:enable_segmentation=False,具体添加位置如下:
self.pose = self.mpPose.Pose(self.mode, self.upBody, self.smooth,
self.detectionCon, self.trackCon)
改为:
self.pose = self.mpPose.Pose(self.mode, self.upBody, self.smooth,False,
self.detectionCon, self.trackCon)
大功告成!