MATLAB三维图像修饰

一、从不同的观察点观察物体 view(az,e1),az为方位角,e1为仰角,默认az=-37.5,e1=30

subplot(2,2,1);
mesh(peaks);
view(-37.5,30);
title('标准视角');

subplot(2,2,2);
mesh(peaks);
view(0,90);
title('从上往下');

subplot(2,2,3);
mesh(peaks);
view(90,0);
title('侧面观看');

subplot(2,2,4);
mesh(peaks);
view(-7,10);
title('视角4');

 

 

 二、色彩处理

 figure函数

 colormap函数

 getframe

 gcf

 imshow

 

%色彩处理
t=0:pi/20:2*pi;
z=peaks(20);
%使用色图着色colormap
figure(1);
colormap("summer");
surf(z);
title('summer');
fg1=getframe(gcf);

figure(2);
colormap("cool");
surf(z);
title('cool');
fg2=getframe(gcf);

figure(3);
colormap("pink");
surf(z);
title('pink');
fg3=getframe(gcf);

figure(4);
colormap("hot");
surf(z);
title('hot');
fg4=getframe(gcf);

figure(5);
colormap("spring");
surf(z);
title('spring');
fg5=getframe(gcf);

figure(6);
colormap("copper");
surf(z);
title('copper');
fg6=getframe(gcf);

close all;
figure(5);

subplot(231);
imshow(fg1.cdata);

subplot(232);
imshow(fg2.cdata);

subplot(233);
imshow(fg3.cdata);

subplot(234);
imshow(fg4.cdata);

subplot(235);
imshow(fg5.cdata);

subplot(236);
imshow(fg6.cdata);

 

 三、利用色图以及shading进行三维曲面着色演示

%example
t=0:pi/20:2*pi;
z=peaks(20);
%使用色图着色
colormap("cool");
subplot(2,2,1);surf(z);
%shading改变着色
subplot(2,2,2);surf(z);shading flat;%平滑着色,相对光滑
subplot(2,2,3);surf(z);shading interp;%插值着色,最光滑

 四、图形裁剪处理

%图形裁剪
%裁剪正弦>0.5部分的赋值,用常数NaN
x=0:pi/10:4*pi;
y=sin(x);
plot(x,y,'--k');

% hold on;
% i=find(y>0.5);
% x(i)=NaN;
% plot(x,y,'r');

 %图形裁剪
%裁剪正弦>0.5部分的赋值,用常数NaN
x=0:pi/10:4*pi;
y=sin(x);
plot(x,y,'--k');
hold on;
i=find(y>0.5);
x(i)=NaN;
plot(x,y,'r');

 五、对图形的基本操作

imread

 %对图像的基本操作
img1=imread('111.jpg');
image(img1);
[imagDate,map]=imread("111.jpg");将图像以数据读出来

 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值