王兵 3 years ago
parent 7557e80fa0
commit 75813a7739

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

Loading…
Cancel
Save

Powered by TurnKey Linux.