46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using OpenCVForUnity.CoreModule;
|
|||
|
using Vuforia;
|
|||
|
using OpenCVForUnity.ImgprocModule;
|
|||
|
using OpenCVForUnity.Calib3dModule;
|
|||
|
|
|||
|
public class Unwarp_sript : MonoBehaviour
|
|||
|
{
|
|||
|
// Start is called before the first frame update
|
|||
|
void Start()
|
|||
|
{
|
|||
|
var point1 = new Point(-0.5f, 0.5f);
|
|||
|
var point2 = new Point(0.5f, 0.5f);
|
|||
|
var point3 = new Point(0.5f, -0.5f);
|
|||
|
var point4 = new Point(-0.5f, -0.5f);
|
|||
|
|
|||
|
|
|||
|
var point5 = new Point(10f, 4f);
|
|||
|
var point6 = new Point(3f, 5f);
|
|||
|
var point7 = new Point(4f, -4f);
|
|||
|
var point8 = new Point(3f, -2f);
|
|||
|
|
|||
|
|
|||
|
MatOfPoint dstMat_ = new MatOfPoint(point1, point2, point3, point4);
|
|||
|
MatOfPoint srcMat_ = new MatOfPoint(point5, point6, point7, point8);
|
|||
|
|
|||
|
MatOfPoint2f dstMat = new MatOfPoint2f();
|
|||
|
dstMat_.convertTo(dstMat, CvType.CV_32FC2);
|
|||
|
|
|||
|
MatOfPoint2f srcMat = new MatOfPoint2f();
|
|||
|
srcMat_.convertTo(srcMat, CvType.CV_32FC2);
|
|||
|
|
|||
|
|
|||
|
var homo = Calib3d.findHomography(srcMat, dstMat);
|
|||
|
print(homo);
|
|||
|
}
|
|||
|
|
|||
|
// Update is called once per frame
|
|||
|
void Update()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|