Home > other >  Inquire of python and Opencv - CV for the realization of the get_affine_transform different
Inquire of python and Opencv - CV for the realization of the get_affine_transform different

Time:10-24

Version is:
Python 3.6.3
Opencv v2.4.12

The case for the function I use is
(1) python version
The import cv2

In [2] : import numpy as np

In [3] : SRC=https://bbs.csdn.net/topics/[[100, 50], [100, 390], [600, 50]].

In [4] : SRC=https://bbs.csdn.net/topics/np.asarray (SRC)

In [5] : DST=[[200, 100], [200, 330], [500, 50]]

In [6] : DST=np, asarray (DST)

In [7] : trans=cv2 getAffineTransform (np) float32 (SRC), np. Float32 (DST))

In [8] : trans
The Out [8] :
Array ([[6.00000000 e-01 e+00 0.00000000, 1.40000000 e+02],
E-01 e-01 [1.00000000, 6.76470588, 7.61764706 e+01]])

(2) c + + version
CV: : Point2f AffinePoints0 [3]={CV: : Point2f (100, 50), CV: : Point2f (100, 390), CV: : Point2f (600, 50)};
//set the target image transform vertex
CV: : Point2f AffinePoints1 [3]={CV: : Point2f (200, 100), CV: : Point2f (200, 330), CV: : Point2f (500, 50)};
//calculate the transformation matrix
CV: : Mat trans=CV: : getAffineTransform (AffinePoints0 AffinePoints1);

Trans results are as follows:
4.17233 e-08 1.775 0
1.58819 e-23-1.45-2.87352 e-16

The two results should not be the same

CodePudding user response:

The original poster is printed in the wrong? C + + version is the result of the py version of the value is the same.

CodePudding user response:

However, my c + + is opencv 3.4.6
  • Related