// // C++: RotatedRect CamShift(Mat probImage, Rect& window, TermCriteria criteria) // //javadoc: CamShift(probImage, window, criteria) public static RotatedRect CamShift(Mat probImage, Rect window, TermCriteria criteria) { if (probImage != null) { probImage.ThrowIfDisposed(); } #if UNITY_PRO_LICENSE || ((UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR) || UNITY_5 double[] window_out = new double[4]; double[] tmpArray = new double[5]; video_Video_CamShift_10(probImage.nativeObj, window.x, window.y, window.width, window.height, window_out, criteria.type, criteria.maxCount, criteria.epsilon, tmpArray); RotatedRect retVal = new RotatedRect(tmpArray); if (window != null) { window.x = (int)window_out [0]; window.y = (int)window_out [1]; window.width = (int)window_out [2]; window.height = (int)window_out [3]; } return(retVal); #else return(null); #endif }
public static void affineTransform(Mat src, Mat dst, OpenCVForUnity.RotatedRect roi) { Point[] pts = new Point[4]; roi.points(pts); // アフィン行列を取得 var srcPoints = new MatOfPoint2f(new Point(0.0, 0.0), new Point(src.cols() - 1, 0.0), new Point(src.cols() - 1, src.rows() - 1)); var dstPoints = new MatOfPoint2f(pts[0], pts[1], pts[2]); Mat transform = Imgproc.getAffineTransform(srcPoints, dstPoints); // アフィン変換 Imgproc.warpAffine(src, dst, transform, dst.size(), Imgproc.INTER_LINEAR); }
//@Override public override bool Equals(Object obj) { if ((RotatedRect)obj == this) { return(true); } if (!(obj is RotatedRect)) { return(false); } RotatedRect it = (RotatedRect)obj; return(center.Equals(it.center) && size.Equals(it.size) && angle == it.angle); }