⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 model1.m

📁 用MATLAB实现模拟立方体的重构
💻 M
字号:
%模拟图象数据点

clc

%物体1空间坐标
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% cubelengh=1000;
% position=[0 1000 3500];
% angle=[pi/4 0 pi/6];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cubelengh=1050;
position=[0 1100 3400];
angle=[pi/4 0 pi/5];

X1=objmodel(cubelengh,position,angle)
hold on;
title('3-D模拟立方体')
XLABEL('X-axis')
YLABEL('Y-axis')
ZLABEL('Z-axis')
axis equal
grid
plotcube(X1)
%物体2空间坐标
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% cubelengh=1000;
% position=[0 -1000 3000];
% %angle=[pi pi/9 pi/4];
% angle=[pi/5 0 pi/6];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cubelengh=1100;
position=[0 -1050 3050];
angle=[pi/8 0 pi/5];
X2=objmodel(cubelengh,position,angle)
plotcube(X2,'r')
hold off

%模拟生成摄像机矩阵
K=[500 90 150;0 400 200;0 0 1]
angle=[pi/3 0 0];
position=[0 3500*sqrt(3)/2 3500/2];
[P1,P2]=cammodel(K,position,angle);

%生成图象点并画出
x11=imgdata(X1,P1,8);
x12=imgdata(X2,P1,8);
x21=imgdata(X1,P2,8);
x22=imgdata(X2,P2,8);
Im1=[x11 x12];
Im2=[x21 x22];
figure
subplot(1,2,1)
hold on;
axis equal
grid
title('2D模拟图像1')
XLABEL('X-axis')
YLABEL('Y-axis')
plotcube(x11)
plotcube(x12,'r')

subplot(1,2,2)
hold on
axis equal
grid
title('2D模拟图像1')
XLABEL('X-axis')
YLABEL('Y-axis')
plotcube(x21)
plotcube(x22,'r')
hold off

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -