コード例 #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_adaptor.py プロジェクト: Skylion007/vxl
def write_cache(cache, do_clear=0):
    if cache.type == "bstm_cache_sptr":
        bstm_batch.init_process("bstmWriteCacheProcess")
        bstm_batch.set_input_from_db(0, cache)
        bstm_batch.set_input_bool(1, do_clear)
        bstm_batch.run_process()
    else:
        print "ERROR: Cache type needs to be bstm_cache_sptr, not ", cache.type
コード例 #4
0
ファイル: bstm_adaptor.py プロジェクト: marcge/vxl
def write_cache(cache, do_clear = 0) :
  if cache.type == "bstm_cache_sptr" :
    bstm_batch.init_process("bstmWriteCacheProcess");
    bstm_batch.set_input_from_db(0,cache);
    bstm_batch.set_input_bool(1,do_clear);
    bstm_batch.run_process();
  else :
    print "ERROR: Cache type needs to be bstm_cache_sptr, not ", cache.type;
コード例 #5
0
ファイル: bstm_vil_adaptor.py プロジェクト: spendres/vxl
def threshold_image(img, value, threshold_above=True):
    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.run_process()
    (id,type) = bstm_batch.commit_output(0)
    mask = dbvalue(id,type)
    return mask
コード例 #6
0
ファイル: bstm_adaptor.py プロジェクト: spendres/vxl
def update_color(scene, device, cache, cam, img, time, mog_var = -1, mask_img = None, update_alpha = True):
    bstm_batch.init_process("bstmOclUpdateColorProcess");
    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_from_db(4,img);
    bstm_batch.set_input_float(5,time);
    bstm_batch.set_input_float(6,mog_var);
    bstm_batch.set_input_from_db(7,mask_img);
    bstm_batch.set_input_bool(8,update_alpha);
    bstm_batch.run_process();
コード例 #7
0
ファイル: bstm_adaptor.py プロジェクト: Skylion007/vxl
def update(scene, device, cache, cam, img, time, mog_var=-1, mask_img=None, update_alpha=True, update_changes_only=False):
    bstm_batch.init_process("bstmOclUpdateProcess")
    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_from_db(4, img)
    bstm_batch.set_input_float(5, time)
    bstm_batch.set_input_float(6, mog_var)
    bstm_batch.set_input_from_db(7, mask_img)
    bstm_batch.set_input_bool(8, update_alpha)
    bstm_batch.set_input_bool(9, update_changes_only)

    bstm_batch.run_process()
コード例 #8
0
ファイル: bstm_adaptor.py プロジェクト: Skylion007/vxl
def change_detect(scene, device, cache, cam, img, time, mask_img=None, raybelief="", max_mode=False):
    bstm_batch.init_process("bstmOclChangeDetectionProcess")
    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_from_db(4, img)
    bstm_batch.set_input_from_db(5, mask_img)
    bstm_batch.set_input_string(6, raybelief)
    bstm_batch.set_input_bool(7, max_mode)
    bstm_batch.set_input_float(8, time)

    bstm_batch.run_process()
    (id, type) = bstm_batch.commit_output(0)
    cd_img = dbvalue(id, type)
    return cd_img
コード例 #9
0
ファイル: bstm_adaptor.py プロジェクト: marcge/vxl
def change_detect(scene, device, cache, cam, img, time, mask_img=None, raybelief="", max_mode=False) :
    bstm_batch.init_process("bstmOclChangeDetectionProcess");
    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_from_db(4,img);
    bstm_batch.set_input_from_db(5,mask_img);
    bstm_batch.set_input_string(6, raybelief);
    bstm_batch.set_input_bool(7, max_mode);
    bstm_batch.set_input_float(8, time);

    bstm_batch.run_process();
    (id,type) = bstm_batch.commit_output(0);
    cd_img = dbvalue(id,type);
    return cd_img;
コード例 #10
0
ファイル: bstm_adaptor.py プロジェクト: Skylion007/vxl
def export_pt_cloud(scene, cache, output_filename, prob_t, time, output_aux=True):
    bstm_batch.init_process("bstmCppExtractPointCloudProcess")
    bstm_batch.set_input_from_db(0, scene)
    bstm_batch.set_input_from_db(1, cache)
    bstm_batch.set_input_float(2, prob_t)
    bstm_batch.set_input_float(3, time)
    bstm_batch.run_process()

    bstm_batch.init_process("bstmCppExportPointCloudProcess")
    bstm_batch.set_input_from_db(0, scene)
    bstm_batch.set_input_from_db(1, cache)
    bstm_batch.set_input_string(2, output_filename)
    bstm_batch.set_input_bool(3, output_aux)
    bstm_batch.set_input_float(4, time)

    bstm_batch.run_process()
    return
コード例 #11
0
ファイル: bstm_adaptor.py プロジェクト: marcge/vxl
def export_pt_cloud(scene, cache, output_filename, prob_t, time, output_aux=True):
    bstm_batch.init_process("bstmCppExtractPointCloudProcess");
    bstm_batch.set_input_from_db(0,scene);
    bstm_batch.set_input_from_db(1,cache);
    bstm_batch.set_input_float(2, prob_t);
    bstm_batch.set_input_float(3, time);
    bstm_batch.run_process();

    bstm_batch.init_process("bstmCppExportPointCloudProcess");
    bstm_batch.set_input_from_db(0,scene);
    bstm_batch.set_input_from_db(1,cache);
    bstm_batch.set_input_string(2, output_filename);
    bstm_batch.set_input_bool(3, output_aux);
    bstm_batch.set_input_float(4, time);

    bstm_batch.run_process();
    return;
コード例 #12
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
コード例 #13
0
ファイル: bstm_adaptor.py プロジェクト: Skylion007/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
コード例 #14
0
def update(scene,
           device,
           cache,
           cam,
           img,
           time,
           mog_var=-1,
           mask_img=None,
           update_alpha=True,
           update_changes_only=False):
    bstm_batch.init_process("bstmOclUpdateProcess")
    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_from_db(4, img)
    bstm_batch.set_input_float(5, time)
    bstm_batch.set_input_float(6, mog_var)
    bstm_batch.set_input_from_db(7, mask_img)
    bstm_batch.set_input_bool(8, update_alpha)
    bstm_batch.set_input_bool(9, update_changes_only)

    bstm_batch.run_process()