//Java一维数组给Mat赋值*********************************
float data[] = {1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8};
Mat mat_gray=new Mat(4,6,CvType.CV_32FC1);
Mat mat_color=new Mat(2,4,CvType.CV_32FC3);
mat_gray.put(0,0,mask);
mat_color.put(0,0,mask);
//C++一维数组给Mat赋值*********************************
float data[24]={1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8};
Mat mat_gray=Mat(4,6,CV_32FC1,data);
Mat mat_color=Mat(2,4,CV_32FC3,data);
Point SEShedCornerDst = new Point(49, 74);
Point CloseForsythiaDst = new Point(41, 41);
Point CornerHazelDst = new Point(111, 157);
Point FarForsythiaDst = new Point(175, 21);
Point FirstLiquidAmberDst = new Point(235, 164);
Point SecondLiquidAmberDst = new Point(282, 721);
Point ThirdLiquidAmberDst = new Point(317, 544);
Point SEShedCornerSrc = new Point(30, 231);
Point CloseForsythiaSrc = new Point(160, 290);
Point CornerHazelSrc = new Point(50, 125);
Point FarForsythiaSrc = new Point(628, 146);
Point FirstLiquidAmberSrc = new Point(299, 64);
Point SecondLiquidAmberSrc = new Point(146, 37);
Point ThirdLiquidAmberSrc = new Point(48,34);
MatOfPoint2f dst = new MatOfPoint2f();
dst.fromList(dstArray);
MatOfPoint2f src = new MatOfPoint2f();
src.fromArray(srcArray);
Mat Homog;
Homog = Calib3d.findHomography(src, dst, Calib3d.RANSAC, 10, OutputMat);
Mat homography = Calib3d.findHomography(src, dst, Calib3d.RANSAC, 10);
// image you want to transform
Mat image = Highgui.imread("image/img.jpg");
// outputMat will contain the perspectively changed image
Imgproc.warpPerspective(image, outputMat, homography, new Size(image.cols(), image.rows()));
Mat src = new Mat();
// push a mat object with your points to the src
src.push_back(new MatOfPoint2f(new Point(x,y)));
// dst will contain your transformed points
Core.perspectiveTransform(src, dst, homography)