videoTransforms.py 文件源码

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

项目:Computer-Vision 作者: PratikRamdasi 项目源码 文件源码
def affineTransform(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]]])
            pts2 = np.float32([[P[0][2],P[0][3]],[P[1][2],P[1][3]],[P[2][2],P[2][3]]])
            M = cv2.getAffineTransform(pts1,pts2)
            dst = cv2.warpAffine(img,M,(self.width,self.height))
            cv2.imwrite("Frames/%d.jpg" % i, dst)


    # Method for Perspective transformation: OpenCV Module
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号