def refine_time(scene, cpu_cache, change_prob_t, time): bstm_batch.init_process("bstmCppRefineTTProcess"); bstm_batch.set_input_from_db(0,scene); bstm_batch.set_input_from_db(1,cpu_cache); bstm_batch.set_input_float(2,change_prob_t); bstm_batch.set_input_float(3,time); bstm_batch.run_process();
def change_btw_frames(scene, cpu_cache, time0, time1): bstm_batch.init_process("bstmCppChangeBtwFramesProcess"); bstm_batch.set_input_from_db(0,scene); bstm_batch.set_input_from_db(1,cpu_cache); bstm_batch.set_input_float(2,time0); bstm_batch.set_input_float(3,time1); bstm_batch.run_process();
def merge(scene, cpu_cache, p_threshold, time): bstm_batch.init_process("bstmCppMergeTTProcess") bstm_batch.set_input_from_db(0, scene) bstm_batch.set_input_from_db(1, cpu_cache) bstm_batch.set_input_float(2, p_threshold) bstm_batch.set_input_float(3, time) bstm_batch.run_process()
def refine(scene, cpu_cache, p_threshold, time): bstm_batch.init_process("bstmCppRefineSpacetimeProcess"); bstm_batch.set_input_from_db(0,scene); bstm_batch.set_input_from_db(1,cpu_cache); bstm_batch.set_input_float(2,p_threshold); bstm_batch.set_input_float(3,time); bstm_batch.run_process();
def change_btw_frames(scene, cpu_cache, time0, time1): bstm_batch.init_process("bstmCppChangeBtwFramesProcess") bstm_batch.set_input_from_db(0, scene) bstm_batch.set_input_from_db(1, cpu_cache) bstm_batch.set_input_float(2, time0) bstm_batch.set_input_float(3, time1) bstm_batch.run_process()
def refine(scene, cpu_cache, p_threshold, time): bstm_batch.init_process("bstmCppRefineSpacetimeProcess") bstm_batch.set_input_from_db(0, scene) bstm_batch.set_input_from_db(1, cpu_cache) bstm_batch.set_input_float(2, p_threshold) bstm_batch.set_input_float(3, time) bstm_batch.run_process()
def scale_and_offset_values(img, scale, offset): bstm_batch.init_process("vilScaleAndOffsetValuesProcess") bstm_batch.set_input_from_db(0, img) bstm_batch.set_input_float(1, scale) bstm_batch.set_input_float(2, offset) bstm_batch.run_process() return
def refine_time(scene, cpu_cache, change_prob_t, time): bstm_batch.init_process("bstmCppRefineTTProcess") bstm_batch.set_input_from_db(0, scene) bstm_batch.set_input_from_db(1, cpu_cache) bstm_batch.set_input_float(2, change_prob_t) bstm_batch.set_input_float(3, time) bstm_batch.run_process()
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
def merge(scene, cpu_cache, p_threshold, time): bstm_batch.init_process("bstmCppMergeTTProcess"); bstm_batch.set_input_from_db(0,scene); bstm_batch.set_input_from_db(1,cpu_cache); bstm_batch.set_input_float(2,p_threshold); bstm_batch.set_input_float(3,time); bstm_batch.run_process();
def close_image(img, disk_radius): bstm_batch.init_process("vilImageClosingDiskProcess") bstm_batch.set_input_from_db(0, img) bstm_batch.set_input_float(1, disk_radius) bstm_batch.run_process() (id, type) = bstm_batch.commit_output(0) cimg = dbvalue(id, type) return cimg
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
def label_change(scene, device, cache, cam, change_img, change_t, label, time) : bstm_batch.init_process("bstmOclLabelRayProcess"); 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,change_img); bstm_batch.set_input_float(5, change_t); bstm_batch.set_input_float(6, time); bstm_batch.set_input_int(7, label); bstm_batch.run_process();
def label_change(scene, device, cache, cam, change_img, change_t, label, time): bstm_batch.init_process("bstmOclLabelRayProcess") 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, change_img) bstm_batch.set_input_float(5, change_t) bstm_batch.set_input_float(6, time) bstm_batch.set_input_int(7, label) bstm_batch.run_process()
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();
def update_change(scene, device, cache, cam, img, time, mask_img=None): bstm_batch.init_process("bstmOclUpdateChangeProcess") 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_float(6, time) bstm_batch.run_process() (id, type) = bstm_batch.commit_output(0) cd_img = dbvalue(id, type) return cd_img
def update_change(scene, device, cache, cam, img, time, mask_img = None): bstm_batch.init_process("bstmOclUpdateChangeProcess"); 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_float(6,time); bstm_batch.run_process(); (id,type) = bstm_batch.commit_output(0); cd_img = dbvalue(id,type); return cd_img;
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()
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;
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
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
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;
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;
def project_point(camera, x, y, z): bstm_batch.init_process('vpglProjectProcess') bstm_batch.set_input_from_db(0, camera) bstm_batch.set_input_float(1, x) bstm_batch.set_input_float(2, y) bstm_batch.set_input_float(3, z) bstm_batch.run_process() (id, type) = bstm_batch.commit_output(0) u = bstm_batch.get_output_float(id) (id, type) = bstm_batch.commit_output(1) v = bstm_batch.get_output_float(id) return (u, v)
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
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;
def filter_changes(scene, cpu_cache, time): bstm_batch.init_process("bstmCppMajorityFilterProcess"); bstm_batch.set_input_from_db(0,scene); bstm_batch.set_input_from_db(1,cpu_cache); bstm_batch.set_input_float(2,time); bstm_batch.run_process();
def copy_data_to_future(scene, cpu_cache, time): bstm_batch.init_process("bstmCppCopyDataToFutureProcess") bstm_batch.set_input_from_db(0, scene) bstm_batch.set_input_from_db(1, cpu_cache) bstm_batch.set_input_float(2, time) bstm_batch.run_process()
def filter_changes(scene, cpu_cache, time): bstm_batch.init_process("bstmCppMajorityFilterProcess") bstm_batch.set_input_from_db(0, scene) bstm_batch.set_input_from_db(1, cpu_cache) bstm_batch.set_input_float(2, time) bstm_batch.run_process()
def copy_data_to_future(scene, cpu_cache, time): bstm_batch.init_process("bstmCppCopyDataToFutureProcess"); bstm_batch.set_input_from_db(0,scene); bstm_batch.set_input_from_db(1,cpu_cache); bstm_batch.set_input_float(2,time); bstm_batch.run_process();