@@ -130,8 +130,11 @@ int main(int argc, char *argv[])
130
130
double obj_dist, bg_dist, y_range;
131
131
if (front_view)
132
132
{
133
+ if (label_class == 12 )
134
+ obj_dist = 340 ;
135
+ else
136
+ obj_dist = 240 ;
133
137
ite_depth = ite_depth + 1 ;
134
- obj_dist = 240 ;
135
138
bg_dist = 700 ;
136
139
y_range = 0.85 ;
137
140
}
@@ -193,8 +196,6 @@ int main(int argc, char *argv[])
193
196
/* Set background color. */
194
197
myWindow.setBackgroundColor (viz::Color::gray ());
195
198
myWindow.spin ();
196
- /* Add light. */
197
- // myWindow.addLight(Vec3d(0,0,100000), Vec3d(0,0,0), viz::Color::white(), viz::Color::gray(), viz::Color::black(), viz::Color::white());
198
199
/* Create a Mesh widget, loading .ply models. */
199
200
viz::Mesh objmesh = viz::Mesh::load (plymodel);
200
201
/* Get the center of the generated mesh widget, cause some .ply files, this could be ignored if you are using PASCAL database*/
@@ -235,6 +236,11 @@ int main(int argc, char *argv[])
235
236
{
236
237
cnt_img = 0 ;
237
238
for (int pose = 0 ; pose < static_cast <int >(campos.size ()); pose++){
239
+ /* Add light. */
240
+ // double alpha1 = rand()%(314/2)/100;
241
+ // double alpha2 = rand()%(314*2)/100;
242
+ // printf("%f %f %f/n", ceil(10000*sqrt(1 - sin(alpha1)*sin(alpha1))*sin(alpha2)), 10000*sqrt(1 - sin(alpha1)*sin(alpha1))*cos(alpha2), sin(alpha1)*10000);
243
+ // myWindow.addLight(Vec3d(10000*sqrt(1 - sin(alpha1)*sin(alpha1))*sin(alpha2),10000*sqrt(1 - sin(alpha1)*sin(alpha1))*cos(alpha2),sin(alpha1)*10000), Vec3d(0,0,0), viz::Color::white(), viz::Color::white(), viz::Color::black(), viz::Color::white());
238
244
int label_x, label_y, label_z;
239
245
label_x = static_cast <int >(campos.at (pose).x *100 );
240
246
label_y = static_cast <int >(campos.at (pose).y *100 );
@@ -245,6 +251,10 @@ int main(int argc, char *argv[])
245
251
imglabel << filename << ' ' << label_class << endl;
246
252
filename = imagedir + filename;
247
253
/* Get the pose of the camera using makeCameraPoses. */
254
+ if (front_view)
255
+ {
256
+ cam_focal_point.y = cam_focal_point.y - label_x/30 ;
257
+ }
248
258
Affine3f cam_pose = viz::makeCameraPose (campos.at (pose)*obj_dist+cam_focal_point, cam_focal_point, cam_y_dir*obj_dist+cam_focal_point);
249
259
/* Get the transformation matrix from camera coordinate system to global. */
250
260
Affine3f transform = viz::makeTransformToGlobal (Vec3f (1 .0f ,0 .0f ,0 .0f ), Vec3f (0 .0f ,1 .0f ,0 .0f ), Vec3f (0 .0f ,0 .0f ,1 .0f ), campos.at (pose));
0 commit comments