帮助中心帮助中心
为扭曲图像创建输出视图
溃败= affineOutputView (sizeA tform)
溃败= affineOutputView (sizeA tform,“BoundsStyle”,风格)
溃败= affineOutputView (sizeA,tform)取输入图像的大小,sizeA,和仿射几何变换,tform,并返回空间引用对象,溃败。的输入imwarp控制扭曲图像的输出限制和网格间距。
溃败= affineOutputView (sizeA,tform)
溃败
sizeA
tform
imwarp
例子
溃败= affineOutputView (sizeA,tform“BoundsStyle”,风格)还指定了对输出视图的空间限制的约束,比如输出视图是否应该完全包含输出图像,或者输出视图是否应该匹配输入限制。
溃败= affineOutputView (sizeA,tform“BoundsStyle”,风格)
风格
全部折叠
读取并显示图像。要查看图像的空间范围,请使坐标轴可见。
一个= imread (“kobi.png”);= imresize (0.25);iptsetpref (“ImshowAxesVisible”,“上”) imshow (A)
创建二维仿射变换。这个例子创建了一个随机变换,由范围[1.2,2.4]的一个因子的缩放、范围[- 45,45]度的一个角度的旋转和范围[100,200]像素的距离的水平平移组成。
tform = randomAffine2d (“规模”[1.2, 2.4],“XTranslation”(100 200),“旋转”, -45年,45);
为图像和转换创建三个不同的输出视图。
centerOutput = affineOutputView(大小(A)、tform“BoundsStyle”,“CenterOutput”);followOutput = affineOutputView(大小(A)、tform“BoundsStyle”,“FollowOutput”);sameAsInput = affineOutputView(大小(A)、tform“BoundsStyle”,“SameAsInput”);
使用每种不同的输出视图样式将转换应用到输入图像上。
BCenterOutput = imwarp (tform,“OutputView”, centerOutput);BFollowOutput = imwarp (tform,“OutputView”, followOutput);BSameAsInput = imwarp (tform,“OutputView”, sameAsInput);
显示结果图像。
imshow (BCenterOutput)标题(“CenterOutput边界风格”);
imshow (BFollowOutput)标题(“FollowOutput边界风格”);
imshow (BSameAsInput)标题(“SameAsInput边界风格”);
iptsetpref (“ImshowAxesVisible”,“关闭”)
输入图像大小,指定为二维图像输入的2元素数字向量或三维体积图像输入的3元素数字向量。
几何变换,指定为表中列出的几何变换对象。
transltform2d
rigidtform3d
simtform2d
affinetform2d
transltform3d
simtform3d
affinetform3d
请注意
您还可以指定tform作为一个affine2d对象或一个affine3d对象。但是,不推荐使用这些对象。有关更多信息,请参见兼容性的考虑。
affine2d
affine3d
“CenterOutput”
“FollowOutput”
“SameAsInput”
Bounds样式,指定为以下值之一。
imref2d
imref3d
空间引用,返回为imref2d或imref3d对象。使用溃败随着OutputView论点的imwarp函数指定扭曲输出的空间引用。
OutputView
backgroundPool
ThreadPool
这个函数完全支持基于线程的环境。有关更多信息,请参见在基于线程的环境中运行MATLAB函数。
全部展开
从R2022b开始,大多数图像处理工具箱™函数使用预乘法约定创建和执行几何变换。因此,您现在可以指定tform作为使用前置乘法约定的几何变换对象,例如affinetform2d或affinetform3d对象。
尽管你仍然可以指定tform作为一个affine2d或affine3d对象,这些对象不推荐,因为它们使用后乘约定。通过切换到使用前置乘法约定的对象,可以简化几何变换工作流。有关更多信息,请参见将几何变换迁移到预乘法约定。
affineOutputView现在支持基于线程的环境。
affineOutputView
imwarp|randomAffine2d|randomAffine3d
randomAffine2d
randomAffine3d
你有了这个例子的修改版本。您想用您的编辑打开这个示例吗?
你点击了对应这个MATLAB命令的链接:
在MATLAB命令窗口中输入命令来运行该命令。Web浏览器不支持MATLAB命令。
选择一个网站,在可用的地方获得翻译的内容,并查看当地的活动和优惠。根据您的位置,我们建议您选择:。
你也可以从以下列表中选择一个网站:
选择中国网站(中文或英文)以获得最佳的网站性能。其他MathWorks国家站点没有针对您所在位置的访问进行优化。
联系当地办事处