コード例 #1
0
def render(scene,
           device,
           cache,
           cam,
           time=0,
           ni=1624,
           nj=1224,
           render_label=False):
    if cache.type == "bstm_cache_sptr":
        print "bstm_batch CPU render grey and vis not yet implemented"
        return
    elif cache.type == "bstm_opencl_cache_sptr" and device:
        bstm_batch.init_process("bstmOclRenderExpectedImageProcess")
        bstm_batch.set_input_from_db(0, device)
        bstm_batch.set_input_from_db(1, scene)
        bstm_batch.set_input_from_db(2, cache)
        bstm_batch.set_input_from_db(3, cam)
        bstm_batch.set_input_unsigned(4, ni)
        bstm_batch.set_input_unsigned(5, nj)
        bstm_batch.set_input_float(6, time)
        bstm_batch.set_input_bool(7, render_label)
        bstm_batch.run_process()
        (id, type) = bstm_batch.commit_output(0)
        exp_image = dbvalue(id, type)
        (id, type) = bstm_batch.commit_output(1)
        vis_image = dbvalue(id, type)
        return exp_image, vis_image
    else:
        print "ERROR: Cache type not recognized: ", cache.type
コード例 #2
0
def bundle2scene(bundle_file,
                 img_dir,
                 app_model="bstm_mog3_grey",
                 isalign=True,
                 out_dir="",
                 timeSteps=32):
    if app_model == "bstm_mog3_grey":
        nobs_model = "bstm_num_obs"
    else:
        print "ERROR appearance model not recognized!!!", app_model
        return

    # run process
    bstm_batch.init_process("bstmBundleToSceneProcess")
    bstm_batch.set_input_string(0, bundle_file)
    bstm_batch.set_input_string(1, img_dir)
    bstm_batch.set_input_string(2, app_model)
    bstm_batch.set_input_string(3, nobs_model)
    bstm_batch.set_input_bool(4, isalign)
    bstm_batch.set_input_unsigned(5, timeSteps)
    bstm_batch.set_input_string(6, out_dir)
    bstm_batch.run_process()
    (scene_id, scene_type) = bstm_batch.commit_output(0)
    uscene = dbvalue(scene_id, scene_type)
    return uscene
コード例 #3
0
ファイル: bstm_vil_adaptor.py プロジェクト: jhoare/vxl
def img_sum(img, plane_index=0):
    bstm_batch.init_process("vilImageSumProcess")
    bstm_batch.set_input_from_db(0, img)
    bstm_batch.set_input_unsigned(1, plane_index)
    bstm_batch.run_process()
    (id, type) = bstm_batch.commit_output(0)
    value = bstm_batch.get_output_double(id)
    return value
コード例 #4
0
ファイル: bstm_vil_adaptor.py プロジェクト: rfabbri/vpe
def img_sum(img, plane_index=0):
    bstm_batch.init_process("vilImageSumProcess")
    bstm_batch.set_input_from_db(0, img)
    bstm_batch.set_input_unsigned(1, plane_index)
    bstm_batch.run_process()
    (id, type) = bstm_batch.commit_output(0)
    value = bstm_batch.get_output_double(id)
    return value
コード例 #5
0
ファイル: bstm_vil_adaptor.py プロジェクト: jhoare/vxl
def threshold_image(img, value, threshold_above=True, id=255):
    bstm_batch.init_process("vilThresholdImageProcess")
    bstm_batch.set_input_from_db(0, img)
    bstm_batch.set_input_float(1, value)
    bstm_batch.set_input_bool(2, threshold_above)
    bstm_batch.set_input_unsigned(3, id)
    bstm_batch.run_process()
    (id, type) = bstm_batch.commit_output(0)
    mask = dbvalue(id, type)
    return mask
コード例 #6
0
ファイル: bstm_vil_adaptor.py プロジェクト: rfabbri/vpe
def threshold_image(img, value, threshold_above=True, id=255):
    bstm_batch.init_process("vilThresholdImageProcess")
    bstm_batch.set_input_from_db(0, img)
    bstm_batch.set_input_float(1, value)
    bstm_batch.set_input_bool(2, threshold_above)
    bstm_batch.set_input_unsigned(3, id)
    bstm_batch.run_process()
    (id, type) = bstm_batch.commit_output(0)
    mask = dbvalue(id, type)
    return mask
コード例 #7
0
ファイル: bstm_adaptor.py プロジェクト: Skylion007/vxl
def init_trajectory(scene, startInc, endInc, radius, ni=1280, nj=720):
    bstm_batch.init_process("bstmViewInitTrajectoryProcess")
    bstm_batch.set_input_from_db(0, scene)
    bstm_batch.set_input_double(1, float(startInc))  # incline0
    bstm_batch.set_input_double(2, float(endInc))  # incline1
    bstm_batch.set_input_double(3, float(radius))  # radius
    bstm_batch.set_input_unsigned(4, ni)  # ni
    bstm_batch.set_input_unsigned(5, nj)  # nj
    bstm_batch.run_process()
    (id, type) = bstm_batch.commit_output(0)
    trajectory = dbvalue(id, type)
    return trajectory
コード例 #8
0
ファイル: bstm_adaptor.py プロジェクト: marcge/vxl
def init_trajectory(scene, startInc, endInc, radius, ni=1280, nj=720) :
  bstm_batch.init_process("bstmViewInitTrajectoryProcess");
  bstm_batch.set_input_from_db(0, scene);
  bstm_batch.set_input_double(1, float(startInc) );  #incline0
  bstm_batch.set_input_double(2, float(endInc) ); #incline1
  bstm_batch.set_input_double(3, float(radius) ); #radius
  bstm_batch.set_input_unsigned(4, ni); #ni
  bstm_batch.set_input_unsigned(5, nj); #nj
  bstm_batch.run_process();
  (id,type) = bstm_batch.commit_output(0);
  trajectory = dbvalue(id,type);
  return trajectory;
コード例 #9
0
def load_perspective_camera_from_kml_file(NI, NJ, kml_file):
    bstm_batch.init_process("vpglLoadPerspCameraFromKMLFileProcess")
    bstm_batch.set_input_unsigned(0, NI)
    bstm_batch.set_input_unsigned(1, NJ)
    bstm_batch.set_input_string(2, kml_file)
    bstm_batch.run_process()
    (id, type) = bstm_batch.commit_output(0)
    cam = dbvalue(id, type)
    (id, type) = bstm_batch.commit_output(1)
    longitude = bstm_batch.get_output_double(id)
    (id, type) = bstm_batch.commit_output(2)
    latitude = bstm_batch.get_output_double(id)
    (id, type) = bstm_batch.commit_output(3)
    altitude = bstm_batch.get_output_double(id)
    return cam, longitude, latitude, altitude
コード例 #10
0
ファイル: bstm_vil_adaptor.py プロジェクト: jhoare/vxl
def crop_image(img, i0, j0, ni, nj):
    bstm_batch.init_process("vilCropImageProcess")
    bstm_batch.set_input_from_db(0, img)
    bstm_batch.set_input_unsigned(1, i0)
    bstm_batch.set_input_unsigned(2, j0)
    bstm_batch.set_input_unsigned(3, ni)
    bstm_batch.set_input_unsigned(4, nj)
    bstm_batch.run_process()
    (id, type) = bstm_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
コード例 #11
0
ファイル: bstm_vil_adaptor.py プロジェクト: rfabbri/vpe
def crop_image(img, i0, j0, ni, nj):
    bstm_batch.init_process("vilCropImageProcess")
    bstm_batch.set_input_from_db(0, img)
    bstm_batch.set_input_unsigned(1, i0)
    bstm_batch.set_input_unsigned(2, j0)
    bstm_batch.set_input_unsigned(3, ni)
    bstm_batch.set_input_unsigned(4, nj)
    bstm_batch.run_process()
    (id, type) = bstm_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
コード例 #12
0
ファイル: bstm_adaptor.py プロジェクト: Skylion007/vxl
def render_change(scene, device, cache, cam, time=0, ni=1624, nj=1224):
    if cache.type == "bstm_cache_sptr":
        print "bstm_batch CPU render grey and vis not yet implemented"
        return
    elif cache.type == "bstm_opencl_cache_sptr" and device:
        bstm_batch.init_process("bstmOclRenderExpectedChangeProcess")
        bstm_batch.set_input_from_db(0, device)
        bstm_batch.set_input_from_db(1, scene)
        bstm_batch.set_input_from_db(2, cache)
        bstm_batch.set_input_from_db(3, cam)
        bstm_batch.set_input_unsigned(4, ni)
        bstm_batch.set_input_unsigned(5, nj)
        bstm_batch.set_input_float(6, time)
        bstm_batch.run_process()
        (id, type) = bstm_batch.commit_output(0)
        exp_image = dbvalue(id, type)
        return exp_image
    else:
        print "ERROR: Cache type not recognized: ", cache.type
コード例 #13
0
ファイル: bstm_adaptor.py プロジェクト: marcge/vxl
def render_change(scene, device, cache, cam, time=0, ni=1624, nj=1224) :
  if cache.type == "bstm_cache_sptr" :
    print "bstm_batch CPU render grey and vis not yet implemented";
    return;
  elif cache.type == "bstm_opencl_cache_sptr" and device :
    bstm_batch.init_process("bstmOclRenderExpectedChangeProcess");
    bstm_batch.set_input_from_db(0,device);
    bstm_batch.set_input_from_db(1,scene);
    bstm_batch.set_input_from_db(2,cache);
    bstm_batch.set_input_from_db(3,cam);
    bstm_batch.set_input_unsigned(4,ni);
    bstm_batch.set_input_unsigned(5,nj);
    bstm_batch.set_input_float(6, time );
    bstm_batch.run_process();
    (id,type) = bstm_batch.commit_output(0);
    exp_image = dbvalue(id,type);
    return exp_image;
  else :
    print "ERROR: Cache type not recognized: ", cache.type;
コード例 #14
0
ファイル: bstm_adaptor.py プロジェクト: Skylion007/vxl
def bundle2scene(bundle_file, img_dir, app_model="bstm_mog3_grey", isalign=True, out_dir="", timeSteps=32):
    if app_model == "bstm_mog3_grey":
        nobs_model = "bstm_num_obs"
    else:
        print "ERROR appearance model not recognized!!!", app_model
        return

    # run process
    bstm_batch.init_process("bstmBundleToSceneProcess")
    bstm_batch.set_input_string(0, bundle_file)
    bstm_batch.set_input_string(1, img_dir)
    bstm_batch.set_input_string(2, app_model)
    bstm_batch.set_input_string(3, nobs_model)
    bstm_batch.set_input_bool(4, isalign)
    bstm_batch.set_input_unsigned(5, timeSteps)
    bstm_batch.set_input_string(6, out_dir)
    bstm_batch.run_process()
    (scene_id, scene_type) = bstm_batch.commit_output(0)
    uscene = dbvalue(scene_id, scene_type)
    return uscene
コード例 #15
0
ファイル: bstm_adaptor.py プロジェクト: brandonmayer/vxl
def render(scene, device, cache, cam, time=0, ni=1624, nj=1224, render_label=False) :
  if cache.type == "bstm_cache_sptr" :
    print "bstm_batch CPU render grey and vis not yet implemented";
    return;
  elif cache.type == "bstm_opencl_cache_sptr" and device :
    bstm_batch.init_process("bstmOclRenderExpectedImageProcess");
    bstm_batch.set_input_from_db(0,device);
    bstm_batch.set_input_from_db(1,scene);
    bstm_batch.set_input_from_db(2,cache);
    bstm_batch.set_input_from_db(3,cam);
    bstm_batch.set_input_unsigned(4,ni);
    bstm_batch.set_input_unsigned(5,nj);
    bstm_batch.set_input_float(6,time);
    bstm_batch.set_input_bool(7,render_label);
    bstm_batch.run_process();
    (id,type) = bstm_batch.commit_output(0);
    exp_image = dbvalue(id,type);
    (id,type) = bstm_batch.commit_output(1);
    vis_image = dbvalue(id,type);
    return exp_image,vis_image;
  else :
    print "ERROR: Cache type not recognized: ", cache.type;
コード例 #16
0
def convert_to_generic_camera(cam_in, ni, nj, level=0):
    bstm_batch.init_process('vpglConvertToGenericCameraProcess')
    bstm_batch.set_input_from_db(0, cam_in)
    bstm_batch.set_input_unsigned(1, ni)
    bstm_batch.set_input_unsigned(2, nj)
    bstm_batch.set_input_unsigned(3, level)
    bstm_batch.run_process()
    (id, type) = bstm_batch.commit_output(0)
    generic_cam = dbvalue(id, type)
    return generic_cam
コード例 #17
0
def persp2gen(pcam, ni, nj, level=0):
    bstm_batch.init_process("vpglConvertToGenericCameraProcess")
    bstm_batch.set_input_from_db(0, pcam)
    bstm_batch.set_input_unsigned(1, ni)
    bstm_batch.set_input_unsigned(2, nj)
    bstm_batch.set_input_unsigned(3, level)
    bstm_batch.run_process()
    (id, type) = bstm_batch.commit_output(0)
    gcam = dbvalue(id, type)
    return gcam
コード例 #18
0
ファイル: bstm_adaptor.py プロジェクト: marcge/vxl
def boxm22scene(boxm2_filename, bstm_datapath, timeSteps = 32) :
  bstm_batch.init_process("bstmBoxm2SceneToBstmProcess");
  bstm_batch.set_input_string(0, boxm2_filename);
  bstm_batch.set_input_string(1, bstm_datapath);
  bstm_batch.set_input_unsigned(2, timeSteps);
  bstm_batch.run_process();
コード例 #19
0
ファイル: bstm_adaptor.py プロジェクト: Skylion007/vxl
def boxm22scene(boxm2_filename, bstm_datapath, timeSteps=32):
    bstm_batch.init_process("bstmBoxm2SceneToBstmProcess")
    bstm_batch.set_input_string(0, boxm2_filename)
    bstm_batch.set_input_string(1, bstm_datapath)
    bstm_batch.set_input_unsigned(2, timeSteps)
    bstm_batch.run_process()