1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// Input Quadilateral or Image plane coordinates
PointF[] inputQuad = new PointF[4];
// Output Quadilateral or World plane coordinates
PointF[] outputQuad = new PointF[4];
Image<Bgr, Byte> outPut = opImage.Clone();
HomographyMatrix lambda = new HomographyMatrix();
inputQuad[0] = new PointF(-30, -60);
inputQuad[1] = new PointF(opImage.Cols + 50, -50);
inputQuad[2] = new PointF(opImage.Cols + 100, opImage.Rows + 50);
inputQuad[3] = new PointF(-50, opImage.Rows + 50);
outputQuad[0] = new PointF(0, 0);
outputQuad[1] = new PointF(opImage.Cols - 1, 0);
outputQuad[2] = new PointF(opImage.Cols - 1, opImage.Rows - 1);
outputQuad[3] = new PointF(0, opImage.Cols - 1);
lambda = CameraCalibration.GetPerspectiveTransform(inputQuad, outputQuad);
opImage = opImage.WarpPerspective(lambda, Emgu.CV.CvEnum.INTER.CV_INTER_NN, Emgu.CV.CvEnum.WARP.CV_WARP_FILL_OUTLIERS, new Bgr(0, 0, 0)); |
Partager