def get_body(self,id, tag): if tag == 'F': if self.args: folder = self.args['folder'] person_id = self.args['person_id'] body = FrontBody(id,folder,person_id) else: body = FrontBody(id) elif tag == 'B': if self.args: folder = self.args['folder'] person_id = self.args['person_id'] body = BackBody(id,folder,person_id) else: body = BackBody(id) else: if self.args: folder = self.args['folder'] person_id = self.args['person_id'] body = SideBody(id,folder,person_id) else: body = SideBody(id) body.load_outline() body.load_pre_feature() return body
def set_body(self, body_id): self.body_id = body_id if self.tag == 'F': self.body = FrontBody(self.body_id) elif self.tag == 'S': self.body = SideBody(self.body_id) else: self.body = BackBody(self.body_id) self.body.process_display_img() self.body.load_pre_feature() # self.body.calculate_features() img = self.body.get_result_img() img = cv2.resize(img, dst_size) # img = img[:,:,::-1] img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # print(img.shape) showImage = QtGui.QImage(img.data, img.shape[1], img.shape[0], QtGui.QImage.Format_RGB888) self.pix_img = QtGui.QPixmap.fromImage(showImage) # palette = QPalette() # palette.setBrush(self.backgroundRole(),QBrush(pix_img)) # self.resize(500,750) # self.setPalette(palette) self.update()
def x_data(self): body = FrontBody(self.body_id) body.load_feature() left, right = body.features['neck_left_L'], body.features['neck_left_R'] front_distance = distance(left, right) front_height = body.bottom_y - body.top_head_point[1] side_body = SideBody(self.body_id) side_body.load_feature() left, right = side_body.features['neck_left_L'], side_body.features['neck_left_R'] # print(left,right) side_distance = distance(left, right) side_height = side_body.bottom_y - side_body.top_head_point[1] # print(front_distance,front_height,side_distance,side_height) front = front_distance*self.height/front_height side = side_distance*self.height/side_height return [front,side,front**2,side**2,front*side]
def get_body(id, tag): if tag=='F': body = FrontBody(id) elif tag == 'B': body = BackBody(id) else: body = SideBody(id) body.load_outline() body.load_pre_feature() return body
def side_height(id): body = SideBody(id) body.load_feature() # print(id) h = body.bottom_y - body.top_head_point[1] return h
def side_distance(id): body = SideBody(id) body.load_feature() left, right = body.features['neck_left_L'], body.features['neck_left_R'] return distance(left, right)