从原理上理解
1.旋转公式
def CaculateNewPoint(X,Y,angle):
X=Xmath.cos(anglemath.pi/180)+Ymath.sin(anglemath.pi/180)
Y=Ymath.cos(anglemath.pi/180)-Xmath.sin(anglemath.pi/180)
newPoint=GvVisionAssembly.sc2Vector(X,Y)
return newPoint
2.图像坐标转平台坐标
def ImgToPlatfoam(ImgX,ImgY,caliRes):
M=caliRes.matrixImageToPlatform
CoordPos=caliRes.coordPosPlatform
ImgPos=caliRes.coordPosImage
M00=M.GetElement(0,0)
M01=M.GetElement(0,1)
M10=M.GetElement(1,0)
M11=M.GetElement(1,1)
tempX=ImgX-ImgPos.X
tempY=ImgY-ImgPos.Y
coordx=tempXM00+tempYM01+CoordPos.X
coordy=tempXM10+tempYM11+CoordPos.Y
newPoint=GvVisionAssembly.sc2Vector(coordx,coordy)
return newPoint
3.平台坐标转换为平台坐标
def CaculateImgPoint(newCoordPos,CaliRes):
M=CaliRes.matrixImageT