0

我正在使用 Openpose 制作锻炼计数器。现在我正处于测试阶段我遇到的问题是我有这个代码片段

            if len(pose) > 0:
            print ("Start Pushup")
            if (lh_angle and ll_angle and rh_angle  and rl_angle != 0 ):

                if (lh_angle < 75  and ll_angle < 35 and rh_angle < 75  and rl_angle < 35 ):
                    print ('Pushup Detected')
                    a = "Pushup"
                    reps = reps + 1

                    if (reps == 2):
                        sets = sets + 1
                        reps = 0

                    else:
                        sets = sets

                else:
                    print ('No Pushup')
                    a = "No Pushup"
                    reps = reps***

但问题是由于该人处于俯卧撑位置,因此计数器不断增加。有没有办法解决这个问题,计数器不会继续增加并且只增加一次

4

1 回答 1

0

这将停止重复计算:

bool inPushup = false
whileloop {
   if (pushup detected){
      if(inPushup == false) {
         reps = reps + 1
      }
      inPushup = true
   }else{
      inPushup = false
   }  
}
于 2020-04-20T03:14:25.840 回答