本文整理匯總了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));
}
}
}