旋转步骤:
一 matlab函数:B = imrotate(A,angle,method);A是原始图像,angle是旋转角度,B为旋转后的图像;
二 使用method参数可以改变插值算法。 B = imrotate(A,angle,method,bbox)bbox参数用于指定输出图像属性:'crop': 通过对旋转后的图像B进行裁剪, 保持旋转后输出图像B的尺寸和输入图像A的尺寸一样。{'loose'}: 使输出图像足够大, 以保证源图像旋转后超出图像尺寸范围的像素值没有丢失。 一般上这种格式产生的图像的尺寸都要大于源图像的尺寸。
我这有一段代码,一个是圆柱,一个是球的,希望对楼主有帮助 clear allclose allclc[x1, y1, z1] = cylinder(0.3)file = 'muxiao.bmp' %这个是图像的路径加名字
I1 = imread(file)
z1 = -z1
subplot(1, 2, 1)warp(x1, y1, z1, I1)
axis off
axis equal
[x2, y2, z2] = sphere(100)I2 = imread(file)
z2 = -z2
subplot(1, 2, 2)warp(x2, y2, z2, I2)
axis off
axis equal
[az, el] = viewfor n = 1 : 5 : 3*360
subplot(1, 2, 1)
view(az+n, 10)
subplot(1, 2, 2)
view(az+n, 10)
pause(0.1)
end
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)