|
|
|
@ -140,6 +140,7 @@ public class Test extends DllLoad {
|
|
|
|
|
Imgproc.line(src, point[3], point[0], new Scalar(0, 0, 255));
|
|
|
|
|
|
|
|
|
|
Mat dst = new Mat(src,rotatedRect.boundingRect());
|
|
|
|
|
show(dst);
|
|
|
|
|
|
|
|
|
|
Mat dst2 = new Mat(dst.size(), dst.type());
|
|
|
|
|
//旋转中心点
|
|
|
|
@ -152,8 +153,7 @@ public class Test extends DllLoad {
|
|
|
|
|
Mat matrix2D = Imgproc.getRotationMatrix2D(cp, angle, scale);
|
|
|
|
|
Imgproc.warpAffine(dst,dst2,matrix2D,dst2.size(),Imgproc.INTER_NEAREST);
|
|
|
|
|
|
|
|
|
|
show(dst2);
|
|
|
|
|
HighGui.waitKey();
|
|
|
|
|
// show(dst2);
|
|
|
|
|
|
|
|
|
|
// Mat mat = new Mat();
|
|
|
|
|
// Imgproc.Sobel(src, mat, -1, 0, 1);
|
|
|
|
@ -170,8 +170,7 @@ public class Test extends DllLoad {
|
|
|
|
|
// Imgproc.drawContours(src, matOfPoints, -1, new Scalar(0, 255, 0), 1, Imgproc.LINE_AA);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HighGui.imshow("轮廓", src);
|
|
|
|
|
HighGui.waitKey();
|
|
|
|
|
show(src);
|
|
|
|
|
//
|
|
|
|
|
// // 创建输出单通道图像
|
|
|
|
|
// Mat grayImage = new Mat(src.rows(), src.cols(), CvType.CV_8SC1);
|
|
|
|
@ -181,7 +180,5 @@ public class Test extends DllLoad {
|
|
|
|
|
// HighGui.imshow("Processed Image", grayImage);
|
|
|
|
|
// Imgcodecs.imwrite("D://2.jpg", grayImage);
|
|
|
|
|
// HighGui.waitKey();
|
|
|
|
|
|
|
|
|
|
System.out.println(src);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|