forked from tianli/matlab_offscreen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectMesh2Image.m
More file actions
executable file
·39 lines (33 loc) · 1.55 KB
/
ProjectMesh2Image.m
File metadata and controls
executable file
·39 lines (33 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ProjectMesh2Image: adaptor for type check and other pre-processing
%
% FaceM: the nx3 matrix to hold the vertex indices
% VertexM: the mx3 matrix to hold the 3D vertex coordinates
% CamParamSA: the cell array of camera parameters
% each cell contains a camera structure with these fields:
% tcV: 3x1 vector, the translation vector
% RcM: 3x3 matrix, the rotation matrix
% fcV: 2x1 vector, the focal length in x and y direction
% ccV: 2x1 vector, the camera center
% imSizeV: 2x1 vector, the image size of the current camera
% channelModFactor: the factor to create distinctive face color, usually 2 or 4
% ScreenSizeV: the maximum size of the screen needed, (note the the rendered image size
% can be smaller, but no bigger)
% zoomFactor: non zero to zoom the rendered image, must be integer
% ZNearFarV: the closest and furthest distance to generate the view frustum
%
% Copyright (c) 2009 Tianli Yu (yu_tianli@hotmail.com)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function LabeledImageA = ProjectMesh2Image(FaceM, VertexM, CamParamSA, channelModFactor, ...
ScreenSizeV, zoomFactor, ZNearFarV)
MexGlutInit;
%% Check the input data type
if (~isa(FaceM, 'double'))
FaceM = double(FaceM);
end
if (~isa(VertexM, 'double'))
VertexM = double(VertexM);
end
LabeledImageA = ProjectMesh2ImageImpl(FaceM, VertexM, CamParamSA, channelModFactor, ...
ScreenSizeV, zoomFactor, ZNearFarV);