项目中的相机参数以json文件的格式给出。
为了形象化看观察每个相机的位置,将其用matlab解析并绘制成球。
% facebookX24.m
clc;
addpath('C:\Program Files\MATLAB\R2015b\toolbox\jsonlab-1.5');
% read .json
json2data=loadjson('E:\JZChen\X24\museum_metadata.json');
Cameras_number = json2data.Informative.Cameras_number;
% fprintf('%d',Cameras_number);
% draw the camera and it's index
for index = 1:Cameras_number
%fprintf('%d\n',index);
name = json2data.cameras{1,index}.Name;
Position = json2data.cameras{1,index}.Position;
%fprintf('%s,%d\n',name,Position);
tmp_x = Position(1);
tmp_z = Position(2);
tmp_y = Position(3);
plot3(tmp_z,tmp_x,tmp_y,'rx');
text(tmp_z,tmp_x,tmp_y,name,'FontSize',12);
hold on;
end
r=sqrt(0.0955); % radius
x0=0;y0=1.65;z0=0; % sphere center
[z,x,y]=sphere(); % generate sphere
surf(r*z+z0,r*x+x0,r*y+y0); % draw sphere
axis on;
axis equal;
xlabel('z');
ylabel('x');
zlabel('y');
% color
%colormap('white');
%colormap('gray');
colormap('default');
alpha(0.5);
{
"Content_name": "TechnicolorMuseum",
"BoundingBox_center": [0.0,0.0,1.65],
"Fps": 30,
"Frames_number": 300,
"Informative":
{
"Cameras_number": 24,
"RigRadius": 0.30
},
"cameras":
[
{
"Name":"camE0",
"Position": [ 0.0777, -0.1429, 1.3872],
"Rotation": [ -61.4676, 40.3759, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE1",
"Position": [ 0.1429, 0.2628, 1.7277],
"Rotation": [ 61.4676, -14.1095, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE2",
"Position": [ 0.2628, 0.0777, 1.7929],
"Rotation": [ 16.4676, -24.8121, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE3",
"Position": [ 0.1429, -0.2628, 1.5723],
"Rotation": [ -61.4676, 14.1095, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE4",
"Position": [ 0.0777, 0.1429, 1.9128],
"Rotation": [ 61.4676, -40.3759, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE5",
"Position": [ 0.2628, -0.0777, 1.5071],
"Rotation": [ -16.4676, 24.8121, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE6",
"Position": [ 0.1429, 0.0777, 1.3872],
"Rotation": [ 28.5324, 40.3759, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE7",
"Position": [ 0.0777, 0.2628, 1.5071],
"Rotation": [ 73.5324, 24.8121, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE8",
"Position": [ 0.2628, 0.1429, 1.5723],
"Rotation": [ 28.5324, 14.1095, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE9",
"Position": [ 0.1429, -0.0777, 1.9128],
"Rotation": [ -28.5324, -40.3759, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE10",
"Position": [ 0.0777, -0.2628, 1.7929],
"Rotation": [ -73.5324, -24.8121, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE11",
"Position": [ 0.2628, -0.1429, 1.7277],
"Rotation": [ -28.5324, -14.1095, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE12",
"Position": [ -0.2628, -0.0777, 1.7929],
"Rotation": [ -163.5324, -24.8121, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE13",
"Position": [ -0.0777, -0.1429, 1.9128],
"Rotation": [ -118.5324, -40.3759, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE14",
"Position": [ -0.1429, -0.2628, 1.7277],
"Rotation": [ -118.5324, -14.1095, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE15",
"Position": [ -0.0777, 0.1429, 1.3872],
"Rotation": [ 118.5324, 40.3759, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE16",
"Position": [ -0.2628, 0.0777, 1.5071],
"Rotation": [ 163.5324, 24.8121, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE17",
"Position": [ -0.1429, 0.2628, 1.5723],
"Rotation": [ 118.5324, 14.1095, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE18",
"Position": [ -0.0777, 0.2628, 1.7929],
"Rotation": [ 106.4676, -24.8121, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE19",
"Position": [ -0.2628, -0.1429, 1.5723],
"Rotation": [ -151.4676, 14.1095, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE20",
"Position": [ -0.1429, -0.0777, 1.3872],
"Rotation": [ -151.4676, 40.3759, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE21",
"Position": [ -0.2628, 0.1429, 1.7277],
"Rotation": [ 151.4676, -14.1095, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE22",
"Position": [ -0.1429, 0.0777, 1.9128],
"Rotation": [ 151.4676, -40.3759, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
},
{
"Name":"camE23",
"Position": [ -0.0777, -0.2628, 1.5071],
"Rotation": [ -106.4676, 24.8121, 0.0000],
"Depthmap": 1,
"Background": 1,
"Rmin": 0.50,
"Rmax": 25.00,
"Resolution": [2048,2048],
"Hor_range": [ -90.0, +90.0 ],
"Ver_range": [ -90.0, +90.0 ]
}
]
}