videoTransforms.py 文件源码

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

项目:Computer-Vision 作者: PratikRamdasi 项目源码 文件源码
def perspectiveTransform(self):
        folder=self.sort_files()
        P=self.get_points()
        self.height,self.width=cv2.imread("Frames/1.jpg").shape[:2]
        # Process frames  
        for i in folder:
            pic="Frames/"+str(i)+".jpg"
            img = cv2.imread(pic)
            pts1 = np.float32([[P[0][0],P[0][1]],[P[1][0],P[1][1]],[P[2][0],P[2][1]],[P[3][0],P[3][1]]])
            pts2 = np.float32([[P[0][2],P[0][3]],[P[1][2],P[1][3]],[P[2][2],P[2][3]],[P[3][2],P[3][3]]])
            M = cv2.getPerspectiveTransform(pts1,pts2)
            dst = cv2.warpPerspective(img,M,(self.width,self.height))
            cv2.imwrite("Frames/%d.jpg" % i, dst)

    # Get x,y co-ordinates
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号