예제 #1
0
    print("Loading Image");
    boxm_batch.init_process("vilLoadImageViewProcess");
    boxm_batch.set_input_string(0,image_fnames % i);
    status = status & boxm_batch.run_process();
    (id,type) = boxm_batch.commit_output(0);
    image = dbvalue(id,type);

    if(status):
      print("Updating Scene");
      boxm_batch.init_process("boxmUpdateRTProcess");
      boxm_batch.set_input_from_db(0,image);
      boxm_batch.set_input_from_db(1,cam);
      boxm_batch.set_input_from_db(2,scene);
      boxm_batch.set_input_unsigned(3,0);
      boxm_batch.set_input_bool(4, 0);
      boxm_batch.run_process();

      # Generate Expected Image 
      print("Generating Expected Image");
      boxm_batch.init_process("boxmRenderExpectedRTProcess");
      boxm_batch.set_input_from_db(0,scene);
      boxm_batch.set_input_from_db(1,vcam); 
      boxm_batch.set_input_unsigned(2,1280);
      boxm_batch.set_input_unsigned(3,720);
      boxm_batch.set_input_bool(4,0);
      boxm_batch.run_process();
      (id,type) = boxm_batch.commit_output(0);
      expected = dbvalue(id,type);
      (id,type) = boxm_batch.commit_output(1);
      mask = dbvalue(id,type);
    def __init__(self, index, type):
        self.id = index  # unsigned integer
        self.type = type  # string


dir = "/Users/isa/Experiments/super3d/scene/expectedImgs_2"
test_frames = [8, 112, 96, 208]

for frame in test_frames:
    boxm_batch.init_process("vilLoadImageViewProcess")
    boxm_batch.set_input_string(0, dir + "/predicted_img_mask_%(#)05d.tiff" % {"#": frame})
    boxm_batch.run_process()
    (id, type) = boxm_batch.commit_output(0)
    vis_img = dbvalue(id, type)

    boxm_batch.init_process("vilThresholdImageProcess")
    boxm_batch.set_input_from_db(0, vis_img)
    boxm_batch.set_input_float(1, 0.99)
    boxm_batch.set_input_bool(2, True)
    boxm_batch.run_process()
    (id, type) = boxm_batch.commit_output(0)
    mask_img = dbvalue(id, type)

    boxm_batch.init_process("vilSaveImageViewProcess")
    boxm_batch.set_input_from_db(0, mask_img)
    boxm_batch.set_input_string(1, dir + "/binary_mask_%(#)05d.tiff" % {"#": frame})
    boxm_batch.run_process()

    boxm_batch.remove_data(vis_img.id)
    boxm_batch.remove_data(mask_img.id)
(scene_id, scene_type) = boxm_batch.commit_output(0);
scene = dbvalue(scene_id, scene_type);

print("Loading Top Camera");
boxm_batch.init_process("vpglLoadPerspectiveCameraProcess");
boxm_batch.set_input_string(0,camera_fname);
boxm_batch.run_process();
(id,type) = boxm_batch.commit_output(0);
top_cam = dbvalue(id,type);


# Generate Expected Image 
print("Generating Expected Image");
boxm_batch.init_process("boxmRenderExpectedRTProcess");
boxm_batch.set_input_from_db(0,scene);
boxm_batch.set_input_from_db(1,top_cam); 
boxm_batch.set_input_unsigned(2,1280);
boxm_batch.set_input_unsigned(3,720);
boxm_batch.set_input_bool(4,0);   #black background
boxm_batch.run_process();
(id,type) = boxm_batch.commit_output(0);
expected = dbvalue(id,type);
(id,type) = boxm_batch.commit_output(1);
mask = dbvalue(id,type);
      
print("saving expected image");
boxm_batch.init_process("vilSaveImageViewProcess");
boxm_batch.set_input_from_db(0,expected);
boxm_batch.set_input_string(1,expected_fname);
boxm_batch.run_process();
      
#boxm_batch.set_input_bool(1, convert_alpha);
#boxm_batch.run_process();
#(scene_id, scene_type) = boxm_batch.commit_output(0);
#apm_scene = dbvalue(scene_id, scene_type);
#(scene_id, scene_type) = boxm_batch.commit_output(1);
#alpha_scene = dbvalue(scene_id, scene_type);

#print("Save Scene");
#boxm_batch.init_process("boxmSaveOccupancyRawProcess");
#boxm_batch.set_input_from_db(0,alpha_scene);
#boxm_batch.set_input_string(1,model_dir + "/drishti/alpha_scene");
#boxm_batch.set_input_unsigned(2,0);
#boxm_batch.set_input_unsigned(3,1);
#boxm_batch.run_process();

print("Convert to regular grid");
boxm_batch.init_process("boxmSceneToBvxmGridProcess");
boxm_batch.set_input_from_db(0,scene);
boxm_batch.set_input_string(1, model_dir + "/alpha_grid.vox");
boxm_batch.set_input_unsigned(2, 0);
boxm_batch.set_input_bool(3,1);
boxm_batch.run_process();
(grid_id, grid_type) = boxm_batch.commit_output(0);
grid = dbvalue(grid_id, grid_type);


print("Save Grid");
boxm_batch.init_process("bvxmSaveGridRawProcess");
boxm_batch.set_input_from_db(0,grid);
boxm_batch.set_input_string(1,model_dir + "/drishti/alpha_grid.raw");
boxm_batch.run_process();
예제 #5
0
  print("Loading Image");
  boxm_batch.init_process("vilLoadImageViewProcess");
  boxm_batch.set_input_string(0,image_fnames % i);
  status = status & boxm_batch.run_process();
  (id,type) = boxm_batch.commit_output(0);
  image = dbvalue(id,type);

  if(status):
  
    print("Updating Scene");
    boxm_batch.init_process("boxmUpdateRTProcess");
    boxm_batch.set_input_from_db(0,image);
    boxm_batch.set_input_from_db(1,cam);
    boxm_batch.set_input_from_db(2,scene);
    boxm_batch.set_input_unsigned(3,0);
    boxm_batch.set_input_bool(4, 1);
    boxm_batch.run_process();

    print("Refine Scene");
    boxm_batch.init_process("boxmRefineSceneProcess");
    boxm_batch.set_input_from_db(0,scene);
    boxm_batch.set_input_float(1,0.2);
    boxm_batch.set_input_bool(2,1);
    boxm_batch.run_process();

    # Generate Expected Image 
    print("Generating Expected Image");
    boxm_batch.init_process("boxmRenderExpectedRTProcess");
    boxm_batch.set_input_from_db(0,scene);
    boxm_batch.set_input_from_db(1,vcam); 
    boxm_batch.set_input_unsigned(2,250);
예제 #6
0
  
  print("Loading Camera");
  boxm_batch.init_process("vpglLoadPerspectiveCameraProcess");
  boxm_batch.set_input_string(0,camera_fnames % i);
  boxm_batch.run_process();
  (id,type) = boxm_batch.commit_output(0);
  cam = dbvalue(id,type);
  
  print("Loading Image");
  boxm_batch.init_process("vilLoadImageViewProcess");
  boxm_batch.set_input_string(0,image_fnames % i);
  boxm_batch.run_process();
  (id,type) = boxm_batch.commit_output(0);
  image = dbvalue(id,type);
  
  print("Updating Scene");
  boxm_batch.init_process("boxmUpdateProcess");
  boxm_batch.set_input_from_db(0,image);
  boxm_batch.set_input_from_db(1,cam);
  boxm_batch.set_input_from_db(2,scene);
  boxm_batch.set_input_unsigned(3,0);
  boxm_batch.run_process();

  print("Refine Scene");
  boxm_batch.init_process("boxmRefineSceneProcess");
  boxm_batch.set_input_from_db(0,scene);
  boxm_batch.set_input_float(1,0.2);
  boxm_batch.set_input_bool(2,1);
  boxm_batch.run_process();

예제 #7
0
    cam = dbvalue(id,type);
    
    print("Loading Image");
    boxm_batch.init_process("vilLoadImageViewProcess");
    boxm_batch.set_input_string(0,image_fname % camera_idx[c]);
    boxm_batch.run_process();
    (id,type) = boxm_batch.commit_output(0);
    image = dbvalue(id,type);
    
    print "Generating opt_samples for camera ", camera_idx[c];
    boxm_batch.init_process("boxmGenerateOptSamplesProcess");
    boxm_batch.set_input_from_db(0,image);
    boxm_batch.set_input_from_db(1,cam);
    boxm_batch.set_input_from_db(2,scene);
    boxm_batch.set_input_string(3,image_ids[c]);
    boxm_batch.set_input_bool(4,0);
    boxm_batch.run_process();

  # Do the optimization
  boxm_batch.init_process("boxmOptBayesianUpdateProcess");
  boxm_batch.set_input_from_db(0,scene);
  boxm_batch.set_input_float(1,damping_factor);
  boxm_batch.set_input_string(2,image_id_fname);
  boxm_batch.run_process();
  
  # Generate Expected Image 
  print("Generating Expected Image");
  boxm_batch.init_process("boxmRenderExpectedRTProcess");
  boxm_batch.set_input_from_db(0,scene);
  boxm_batch.set_input_from_db(1,vcam); 
  boxm_batch.set_input_unsigned(2,1280);