def export_points_and_normals(scene, cache, file_out, save_aux=True, prob_thresh=0.0, vis_thresh=0.0, nmag_thresh=0.0, exp_thresh=0.0, bbox_file=""): if cache.type == "boxm2_cache_sptr": print("Exporting to oriented point cloud") batch.init_process("boxm2ExportOrientedPointCloudProcess") batch.set_input_from_db(0, scene) batch.set_input_from_db(1, cache) batch.set_input_string(2, file_out) # output aux (prob, vis, normal magnitdue) batch.set_input_bool(3, save_aux) batch.set_input_float(4, vis_thresh) # vis threshold batch.set_input_float(5, nmag_thresh) # nmag threshold batch.set_input_float(6, prob_thresh) # prob threshold # batch.set_input_float(7,exp_thresh); #exp threshold # batch.set_input_string(8, bbox_file); #bb filename batch.set_input_string(7, bbox_file) # bb filename return batch.run_process() else: print "ERROR: Cache type not recognized: ", cache.type return False
def threshold_image(img, value, threshold_above=True): boxm2_batch.init_process("vilThresholdImageProcess") boxm2_batch.set_input_from_db(0,img) boxm2_batch.set_input_float(1,value) boxm2_batch.set_input_bool(2,threshold_above) boxm2_batch.run_process() (id,type) = boxm2_batch.commit_output(0) mask = dbvalue(id,type) return mask
def threshold_image(img, value, threshold_above=True): boxm2_batch.init_process("vilThresholdImageProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.set_input_float(1, value) boxm2_batch.set_input_bool(2, threshold_above) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) mask = dbvalue(id, type) return mask
def threshold_image_inside(img, min_thres, max_thres, threshold_inside=True): boxm2_batch.init_process("vilThresholdImageInsideProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.set_input_float(1, min_thres) boxm2_batch.set_input_float(2, max_thres) boxm2_batch.set_input_bool(3, threshold_inside) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) mask = dbvalue(id, type) return mask
def make_inside_empty(scene, cache, device, use_sum=False): if cache.type == "boxm2_opencl_cache_sptr": print("Flipping Normal") batch.init_process("boxm2OclMakeInsideVoxelsEmptyProcess") batch.set_input_from_db(0, device) batch.set_input_from_db(1, scene) batch.set_input_from_db(2, cache) batch.set_input_bool(3, use_sum) return batch.run_process() else: print "ERROR: Cache type not recognized: ", cache.type return False
def flip_normals(scene, cache, device, use_sum=False): if cache.type == "boxm2_opencl_cache_sptr": print("Flipping Normal") batch.init_process("boxm2OclFlipNormalsUsingVisProcess") batch.set_input_from_db(0, device) batch.set_input_from_db(1, scene) batch.set_input_from_db(2, cache) batch.set_input_bool(3, use_sum) return batch.run_process() else: print "ERROR: Cache type not recognized: ", cache.type return False
def update_multi(scene, mcache, cam, img, ident="", update_alpha=True, var=-1.0, update_app=True, tnear=100000.0, tfar=0.000001): # If no device is passed in, do cpu update print("boxm2_batch multi GPU update") batch.init_process("boxm2MultiUpdateProcess") batch.set_input_from_db(0, mcache) batch.set_input_from_db(1, scene) batch.set_input_from_db(2, cam) batch.set_input_from_db(3, img) batch.set_input_string(4, ident) batch.set_input_bool(5, update_alpha) batch.set_input_float(6, var) batch.set_input_bool(7, update_app) batch.set_input_float(8, tnear) batch.set_input_float(9, tfar) return batch.run_process()
def refine_scene_around_geometry( self, filter_v, n_times, p_thresh, use_gpu): if self.opencl_cache.type == "boxm2_opencl_cache_sptr": print("Refining around surface geometry") batch.init_process( "boxm2_ocl_refine_scene_around_geometry_process") batch.set_input_from_db(0, self.scene) batch.set_input_from_db(1, self.opencl_cache) batch.set_input_from_db(2, self.device) batch.set_input_from_db(3, filter_v) batch.set_input_int(4, n_times) # use negative value to refine all batch.set_input_float(5, p_thresh) batch.set_input_bool(6, use_gpu) return batch.run_process() else: print "ERROR: Cache type not recognized: ", self.opencl_cache.type return False
def refine_scene_around_geometry(self, filter_v, n_times, p_thresh, use_gpu): if self.opencl_cache.type == "boxm2_opencl_cache_sptr": print("Refining around surface geometry") batch.init_process( "boxm2_ocl_refine_scene_around_geometry_process") batch.set_input_from_db(0, self.scene) batch.set_input_from_db(1, self.opencl_cache) batch.set_input_from_db(2, self.device) batch.set_input_from_db(3, filter_v) batch.set_input_int(4, n_times) # use negative value to refine all batch.set_input_float(5, p_thresh) batch.set_input_bool(6, use_gpu) return batch.run_process() else: print "ERROR: Cache type not recognized: ", self.opencl_cache.type return False
def write_mcache(mcache, do_clear=0): batch.init_process("boxm2WriteMultiCacheProcess") batch.set_input_from_db(0, mcache) batch.set_input_bool(1, do_clear) batch.run_process()