face_feature_detection.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:Face_recog_LBPH 作者: vedvasu 项目源码 文件源码
def crop_out(img,x1,y1,x2,y2,b,h):
        '''
        This function is used to crop the image into desired dimmensions.
        img: image from which the rectangle is to be cropped
        x1,y1: top left vertex parameter
        x2,y2: bottom right parameter
        b,h: dimmesions of the cropped image
        '''
        xa=x1
        xb=x2
        xc=x1
        xd=x2
        ya=y1
        yb=y1
        yc=y2
        yd=y2

        pts1 = np.float32([[xa,ya],[xc,yc],[xb,yb],[xd,yd]]) 
        pts2 = np.float32([[0,0],[0,h],[b,0],[b,h]])
        persM = cv2.getPerspectiveTransform(pts1,pts2)
        dst = cv2.warpPerspective(img,persM,(b,h))

        return dst




#detection begins here
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号