本文整理汇总了Java中org.opencv.imgproc.Imgproc.warpPerspective方法的典型用法代码示例。如果您正苦于以下问题:Java Imgproc.warpPerspective方法的具体用法?Java Imgproc.warpPerspective怎么用?Java Imgproc.warpPerspective使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opencv.imgproc.Imgproc
的用法示例。
在下文中一共展示了Imgproc.warpPerspective方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adaptativeProcess
import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
public static Mat adaptativeProcess(Mat img){
Mat im = new Mat();
Imgproc.threshold(img,im,120,255,Imgproc.THRESH_TRUNC);
im = Thresholding.adaptativeThresholding(im);
Imgproc.medianBlur(im,im,7);
Mat threshImg = Thresholding.InvertImageColor(im);
Thresholding.gridDetection(threshImg);
Mat mat = Mat.zeros(4,2,CvType.CV_32F);
mat.put(0,0,0); mat.put(0,1,512);
mat.put(1,0,0); mat.put(1,1,0);
mat.put(2,0,512); mat.put(2,1,0);
mat.put(3,0,512); mat.put(3,1,512);
mat = Imgproc.getPerspectiveTransform(Thresholding.grid,mat);
Mat M = new Mat();
Imgproc.warpPerspective(threshImg,M,mat, new Size(512,512));
Imgproc.medianBlur(M,M,3);
Imgproc.threshold(M,M,254,255,Imgproc.THRESH_BINARY);
return Thresholding.InvertImageColor(M);
}
示例2: normalProcess
import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
public static Mat normalProcess(Mat img){
Mat threshImg = Thresholding.InvertImageColor(img);
Thresholding.gridDetection(threshImg);
Mat mat = Mat.zeros(4,2,CvType.CV_32F);
mat.put(0,0,0); mat.put(0,1,512);
mat.put(1,0,0); mat.put(1,1,0);
mat.put(2,0,512); mat.put(2,1,0);
mat.put(3,0,512); mat.put(3,1,512);
mat = Imgproc.getPerspectiveTransform(Thresholding.grid,mat);
Mat M = new Mat();
Imgproc.warpPerspective(threshImg,M,mat, new Size(512,512));
return Thresholding.InvertImageColor(M);
}
示例3: doProjection
import org.opencv.imgproc.Imgproc; //导入方法依赖的package包/类
private static void doProjection(ImgWindow projWnd) {
if (corners.size() == 4) {
Mat cornersMat = Converters.vector_Point2f_to_Mat(corners);
Mat targetMat = Converters.vector_Point2f_to_Mat(target);
trans = Imgproc.getPerspectiveTransform(cornersMat, targetMat);
invTrans = Imgproc.getPerspectiveTransform(targetMat, cornersMat);
proj = new Mat();
Imgproc.warpPerspective(img, proj, trans, new Size(img.cols(), img.rows()));
if (projWnd.isClicked()) {
perspPoints.add(new Point(projWnd.mouseX, projWnd.mouseY));
}
}
}