您的位置 首页 > 德语词汇

rotation是什么意思,rotation的意思翻译、用法、同义词、,图像透视变换

大家好,rotation是什么意思,rotation的意思翻译、用法、同义词、相信很多的网友都不是很明白,包括图像透视变换也是一样,不过没有关系,接下来就来为大家分享关于rotation是什么意思,rotation的意思翻译、用法、同义词、和图像透视变换的一些知识点,大家可以关注收藏,免得下次来找不到哦,下面我们开始吧!

图形旋转是以图像的中心为原点,旋转一定的角度,也就是将图像上的所有像素都旋转一个相同的角度。旋转后图像的的大小一般会改变,即可以把转出显示区域的图像截去,或者扩大图像范围来显示所有的图像。图像的旋转变换也可以用矩阵变换来表示。

函数说明:Imgproc.getRotationMatrix2D(Pointcenter,doubleangle,doublescale)

rotation是什么意思,rotation的意思翻译、用法、同义词、,图像透视变换

参数详解:Pointcenter:表示旋转的中心点;doubleangle:表示旋转的角度;doublescale:图像缩放因子;

packagecom.what21.opencv01.demo05;\n\nimportorg.opencv.core.Core;\nimportorg.opencv.core.Mat;\nimportorg.opencv.core.Point;\nimportorg.opencv.imgcodecs.Imgcodecs;\nimportorg.opencv.imgproc.Imgproc;\n\n/**\n*图像旋转\n*/\npublicclassOpenCVRotate{\n\nstatic{\nSystem.loadLibrary(Core.NATIVE_LIBRARY_NAME);\n}\n\npublicstaticvoidmain(String[]args){\nMatsrc=Imgcodecs.imread("D:/1.jpg");\nMatdst=src.clone();\n//复制矩阵进入dst\nPointcenter=newPoint(src.width()/2.0,src.height()/2.0);\nMataffineTrans=Imgproc.getRotationMatrix2D(center,33.0,1.0);\nImgproc.warpAffine(src,dst,affineTrans,dst.size(),Imgproc.INTER_NEAREST);\nImgcodecs.imwrite("D:/1$1.jpg",dst);\naffineTrans=Imgproc.getRotationMatrix2D(center,110.0,1.1);\nImgproc.warpAffine(src,dst,affineTrans,dst.size(),Imgproc.INTER_NEAREST);\nImgcodecs.imwrite("D:/1$2.jpg",dst);\n}\n\n}

1.jpg

透视变换(PerspectiveTransformation)是指利用透视中心、像点、目标点三点共线的条件,按透视旋转定律使承影面(透视面)绕迹线(透视轴)旋转某一角度,破坏原有的投影光线束,仍能保持承影面上投影几何图形不变的变换。

packagecom.what21.opencv01.demo05;\n\nimportorg.opencv.core.Core;\nimportorg.opencv.core.CvType;\nimportorg.opencv.core.Mat;\nimportorg.opencv.core.Point;\nimportorg.opencv.imgcodecs.Imgcodecs;\nimportorg.opencv.imgproc.Imgproc;\nimportorg.opencv.utils.Converters;\n\nimportjava.util.List;\n\n/**\n*透视变换\n*/\npublicclassOpenCVPerspective{\n\nstatic{\nSystem.loadLibrary(Core.NATIVE_LIBRARY_NAME);\n}\n\npublicstaticvoidmain(String[]args){\nMatsrc=Imgcodecs.imread("D:/1.jpg");\n//读取图像到矩阵中,取灰度图像\nif(src.empty()){\nreturn;\n}\ntry{\nintxMargin,yMargin;\nintx0=src.cols()/4;\nintx1=(src.cols()/4)*3;\ninty0=src.cols()/4;\ninty1=(src.cols()/4)*3;\nMatdst=newMat();\n\nList<Point>listSrcs=java.util.Arrays.asList(newPoint(x0,y0),newPoint(x0,y1),newPoint(x1,y1),newPoint(x1,y0));\nMatsrcPoints=Converters.vector_Point_to_Mat(listSrcs,CvType.CV_32F);\n\nxMargin=src.cols()/10;\nyMargin=src.rows()/10;\nList<Point>listDsts=java.util.Arrays.asList(newPoint(x0+xMargin,y0+yMargin),listSrcs.get(1),listSrcs.get(2),newPoint(x1-xMargin,y0+yMargin));\nMatdstPoints=Converters.vector_Point_to_Mat(listDsts,CvType.CV_32F);\n\nMatperspectiveMmat=Imgproc.getPerspectiveTransform(srcPoints,dstPoints);\nImgproc.warpPerspective(src,dst,perspectiveMmat,src.size(),Imgproc.INTER_LINEAR);\nImgcodecs.imwrite("D:/1.dst1.jpg",dst);\n\nxMargin=src.cols()/8;\nyMargin=src.cols()/8;\nlistDsts.set(0,listSrcs.get(0));\nlistDsts.set(1,listSrcs.get(1));\nlistDsts.set(2,newPoint(x1-xMargin,y1-yMargin));\nlistDsts.set(3,newPoint(x1-xMargin,y0-yMargin));\ndstPoints=Converters.vector_Point_to_Mat(listDsts,CvType.CV_32F);\n\nperspectiveMmat=Imgproc.getPerspectiveTransform(srcPoints,dstPoints);\nImgproc.warpPerspective(src,dst,perspectiveMmat,src.size(),Imgproc.INTER_LINEAR);\nImgcodecs.imwrite("D:/1.dst2.jpg",dst);\n\nxMargin=src.cols()/6;\nyMargin=src.cols()/6;\nlistDsts.set(0,newPoint(x0+xMargin,y0+yMargin));\nlistDsts.set(1,listSrcs.get(1));\nlistDsts.set(2,newPoint(x1-xMargin,y1-yMargin));\nlistDsts.set(3,listSrcs.get(3));\ndstPoints=Converters.vector_Point_to_Mat(listDsts,CvType.CV_32F);\n\nperspectiveMmat=Imgproc.getPerspectiveTransform(srcPoints,dstPoints);\nImgproc.warpPerspective(src,dst,perspectiveMmat,src.size(),Imgproc.INTER_LINEAR);\n\nImgcodecs.imwrite("D:/1.dst3.jpg",dst);\n}catch(Exceptione){\ne.printStackTrace();\n}\n\n}\n\n}

1.dst1.jpg

好了,文章到此结束,希望可以帮助到大家。

本站涵盖的内容、图片、视频等数据,部分未能与原作者取得联系。若涉及版权问题,请及时通知我们并提供相关证明材料,我们将及时予以删除!谢谢大家的理解与支持!

Copyright © 2023