mabrao / Tennis-Training-System

The goal of this project is to create a mobile application that will use computer vision and possibly a hardware mount for a tennis racket to help a tennis player improve their technique and game plan.
3 stars 0 forks source link

Pose Estimation returning null #5

Closed mabrao closed 2 years ago

mabrao commented 2 years ago

App crashes when this happens.

mabrao commented 2 years ago

FIX:

Added try statements when the pose detector method was being called.

        if self.pose:
            try:
                #find pose landmarks and do not draw them
                self.frame = self.detector.findPose(self.frame, draw=False)
                #get all landmark data and do not draw bounding box
                lmList, bboxInfo = self.detector.findPosition(self.frame, draw = False) 
                #create customized figure
                self.detector.drawCustomizedFigure(self.frame, self.lmDraw, drawRacket=False)
            except:
                pass

        if self.poseBackground:
            width, height = self.get_dims()
            self.blankImg = np.zeros((height, width, 3), np.uint8)
            if self.pose:
                try:
                    #find pose landmarks and do not draw them
                    self.frame = self.detector.findPose(self.frame, draw=False)
                    #get all landmark data and do not draw bounding box
                    lmList, bboxInfo = self.detector.findPosition(self.frame, draw = False) 
                    #create customized figure
                    self.detector.drawCustomizedFigure(self.frame, self.lmDraw, drawRacket=False, blankImg = self.blankImg, drawExtra=True)
                except:
                    pass
            self.frame = self.blankImg