Example #1
0
def gen_error_point_cloud(scene,cache,filename,thresh = 0.3):
    boxm2_batch.init_process("boxm2ExportErrorPointCloudProcess");
    boxm2_batch.set_input_from_db(0,scene);
    boxm2_batch.set_input_from_db(1,cache);
    boxm2_batch.set_input_string(2,filename); #ply filename
    boxm2_batch.set_input_float(3,thresh); #prob threshold
    boxm2_batch.run_process();
def update_grey_with_alt(scene,
                         cache,
                         cam,
                         img,
                         device=None,
                         ident="",
                         mask=None,
                         update_alpha=True,
                         var=-1.0,
                         alt_prior=None,
                         alt_density=None):
    #If no device is passed in, do cpu update
    if cache.type == "boxm2_cache_sptr":
        print "ERROR: CPU update not implemented for update_with_alt"
    elif cache.type == "boxm2_opencl_cache_sptr" and device:
        print("boxm2_batch GPU update with alt")
        boxm2_batch.init_process("boxm2OclUpdateWithAltProcess")
        boxm2_batch.set_input_from_db(0, device)
        boxm2_batch.set_input_from_db(1, scene)
        boxm2_batch.set_input_from_db(2, cache)
        boxm2_batch.set_input_from_db(3, cam)
        boxm2_batch.set_input_from_db(4, img)
        boxm2_batch.set_input_string(5, ident)
        if mask:
            boxm2_batch.set_input_from_db(6, mask)
        boxm2_batch.set_input_bool(7, update_alpha)
        boxm2_batch.set_input_float(8, var)
        boxm2_batch.set_input_from_db(9, alt_prior)
        boxm2_batch.set_input_from_db(10, alt_density)
        boxm2_batch.run_process()
    else:
        print "ERROR: Cache type not recognized: ", cache.type
Example #3
0
def gen_point_cloud(scene, cache):
    boxm2_batch.init_process("boxm2ExtractPointCloudProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_from_db(1, cache)
    boxm2_batch.set_input_float(2, 0)
    #prob threshold
    boxm2_batch.run_process()
Example #4
0
def scale_and_offset_values(img, scale, offset):
    boxm2_batch.init_process("vilScaleAndOffsetValuesProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, scale)
    boxm2_batch.set_input_float(2, offset)
    boxm2_batch.run_process()
    return
def compute_derivatives_process(scene,
                                cache,
                                prob_threshold,
                                normal_threshold,
                                kernel_x_file_name,
                                kernel_y_file_name,
                                kernel_z_file_name,
                                i=-1,
                                j=-1,
                                k=-1):
    boxm2_batch.init_process("boxm2CppComputeDerivativeProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_from_db(1, cache)
    boxm2_batch.set_input_float(2, prob_threshold)
    #prob threshold
    boxm2_batch.set_input_float(3, normal_threshold)
    #normal t
    boxm2_batch.set_input_string(
        4,
        "C:/projects/vxl/vxl/contrib/brl/bseg/bvpl/doc/taylor2_5_5_5/Ix.txt")
    boxm2_batch.set_input_string(
        5,
        "C:/projects/vxl/vxl/contrib/brl/bseg/bvpl/doc/taylor2_5_5_5/Iy.txt")
    boxm2_batch.set_input_string(
        6,
        "C:/projects/vxl/vxl/contrib/brl/bseg/bvpl/doc/taylor2_5_5_5/Iz.txt")
    boxm2_batch.set_input_int(7, i)
    boxm2_batch.set_input_int(8, j)
    boxm2_batch.set_input_int(9, k)
    boxm2_batch.run_process()
def update_grey(scene,
                cache,
                cam,
                img,
                device=None,
                ident="",
                mask=None,
                update_alpha=True,
                var=-1.0):
    #If no device is passed in, do cpu update
    if cache.type == "boxm2_cache_sptr":
        print "boxm2_batch CPU update"
        boxm2_batch.init_process("boxm2CppUpdateImageProcess")
        boxm2_batch.set_input_from_db(0, scene)
        boxm2_batch.set_input_from_db(1, cache)
        boxm2_batch.set_input_from_db(2, cam)
        boxm2_batch.set_input_from_db(3, img)
        return boxm2_batch.run_process()
    elif cache.type == "boxm2_opencl_cache_sptr" and device:
        print("boxm2_batch GPU update")
        boxm2_batch.init_process("boxm2OclUpdateProcess")
        boxm2_batch.set_input_from_db(0, device)
        boxm2_batch.set_input_from_db(1, scene)
        boxm2_batch.set_input_from_db(2, cache)
        boxm2_batch.set_input_from_db(3, cam)
        boxm2_batch.set_input_from_db(4, img)
        boxm2_batch.set_input_string(5, ident)
        if mask:
            boxm2_batch.set_input_from_db(6, mask)
        boxm2_batch.set_input_bool(7, update_alpha)
        boxm2_batch.set_input_float(8, var)
        return boxm2_batch.run_process()
    else:
        print "ERROR: Cache type not recognized: ", cache.type
        return False
Example #7
0
def scale_and_offset_values(img, scale, offset):
    boxm2_batch.init_process("vilScaleAndOffsetValuesProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, scale)
    boxm2_batch.set_input_float(2, offset)
    boxm2_batch.run_process()
    return
Example #8
0
def import_triangle_mesh(scene, cache, ply_filename, occupied_prob=0.99):
  boxm2_batch.init_process("boxm2ImportTriangleMeshProcess")
  boxm2_batch.set_input_from_db(0,scene)
  boxm2_batch.set_input_from_db(1,cache)
  boxm2_batch.set_input_string(2,ply_filename)
  boxm2_batch.set_input_float(3,occupied_prob)
  boxm2_batch.run_process()
Example #9
0
def import_triangle_mesh(scene, cache, ply_filename, occupied_prob=0.99):
    boxm2_batch.init_process("boxm2ImportTriangleMeshProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_from_db(1, cache)
    boxm2_batch.set_input_string(2, ply_filename)
    boxm2_batch.set_input_float(3, occupied_prob)
    boxm2_batch.run_process()
Example #10
0
def prob_as_expected(image, atomicity):
    boxm2_batch.init_process("bslExpectedImageProcess")
    boxm2_batch.set_input_from_db(0, image)
    boxm2_batch.set_input_float(1, atomicity)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    image_prob = dbvalue(id, type)
    return image_prob
Example #11
0
def scale_scene(scene, scale):
    boxm2_batch.init_process("boxm2ScaleSceneProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_float(1, scale)
    boxm2_batch.run_process()
    (scene_id, scene_type) = boxm2_batch.commit_output(0)
    scene = dbvalue(scene_id, scene_type)
    return scene
Example #12
0
def atmospheric_correct(image, sun_z):
    boxm2_batch.init_process('bbasAtmosphericCorrProcess')
    boxm2_batch.set_input_from_db(0, image)
    boxm2_batch.set_input_float(1, sun_z)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    image_corrected = dbvalue(id, type)
    return image_corrected
Example #13
0
def prob_as_expected(image,atomicity):
  boxm2_batch.init_process("bslExpectedImageProcess")
  boxm2_batch.set_input_from_db(0,image)
  boxm2_batch.set_input_float(1,atomicity)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  image_prob = dbvalue(id,type)
  return image_prob
Example #14
0
def detect_shadow_rgb(img, threshold):
    boxm2_batch.init_process("vilShadowDetectionProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, threshold)
    boxm2_batch.run_process()
    (o_id, o_type) = boxm2_batch.commit_output(0)
    region_img = dbvalue(o_id, o_type)
    return region_img
Example #15
0
def max_threshold_image(img, threshold):
    boxm2_batch.init_process("vilThresholdMaxImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, threshold)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    mask = dbvalue(id, type)
    return mask
Example #16
0
def atmospheric_correct(image, sun_z):
  boxm2_batch.init_process('bbasAtmosphericCorrProcess')
  boxm2_batch.set_input_from_db(0,image)
  boxm2_batch.set_input_float(1,sun_z)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  image_corrected = dbvalue(id,type)
  return image_corrected
Example #17
0
def detect_shadow_rgb(img, threshold):
    boxm2_batch.init_process("vilShadowDetectionProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, threshold)
    boxm2_batch.run_process()
    (o_id, o_type) = boxm2_batch.commit_output(0)
    region_img = dbvalue(o_id, o_type)
    return region_img
Example #18
0
def vrml_filter_ply(vrml_filename, ply_file, points_file, dist_threshold,nearest=False):
  boxm2_batch.init_process("bvrmlFilteredPlyProcess");
  boxm2_batch.set_input_string(0,vrml_filename);
  boxm2_batch.set_input_string(1,ply_file);
  boxm2_batch.set_input_string(2,points_file);
  boxm2_batch.set_input_float(3,dist_threshold);
  boxm2_batch.set_input_bool(4,nearest);
  boxm2_batch.run_process();
Example #19
0
def max_threshold_image(img, threshold):
    boxm2_batch.init_process("vilThresholdMaxImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, threshold)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    mask = dbvalue(id, type)
    return mask
Example #20
0
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
Example #21
0
def fuse_beliefs(image1,image2,atomicity):
  boxm2_batch.init_process("bslFusionProcess")
  boxm2_batch.set_input_from_db(0,image1)
  boxm2_batch.set_input_from_db(1,image2)
  boxm2_batch.set_input_float(2,atomicity)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  fused_image = dbvalue(id,type)
  return fused_image
Example #22
0
def init_float_img(ni, nj, val):
    boxm2_batch.init_process("vilInitFloatImageProcess")
    boxm2_batch.set_input_unsigned(0, ni)
    boxm2_batch.set_input_unsigned(1, nj)
    boxm2_batch.set_input_float(2, val)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Example #23
0
def fuse_beliefs(image1, image2, atomicity):
    boxm2_batch.init_process("bslFusionProcess")
    boxm2_batch.set_input_from_db(0, image1)
    boxm2_batch.set_input_from_db(1, image2)
    boxm2_batch.set_input_float(2, atomicity)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    fused_image = dbvalue(id, type)
    return fused_image
Example #24
0
def visualize_change(change_img, in_img, thresh=.5):
    boxm2_batch.init_process("boxm2OclVisualizeChangeProcess")
    boxm2_batch.set_input_from_db(0, change_img)
    boxm2_batch.set_input_from_db(1, in_img)
    boxm2_batch.set_input_float(2, thresh)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    vis_img = dbvalue(id, type)
    return vis_img
Example #25
0
def rotate_perspective_camera(cam_in, theta, phi):
    boxm2_batch.init_process('vpglRotatePerspCamProcess')
    boxm2_batch.set_input_from_db(0, cam_in)
    boxm2_batch.set_input_float(1, theta)
    boxm2_batch.set_input_float(2, phi)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    rot_cam = dbvalue(id, type)
    return rot_cam
Example #26
0
def rotate_perspective_camera(cam_in, theta, phi):
    boxm2_batch.init_process('vpglRotatePerspCamProcess');
    boxm2_batch.set_input_from_db(0,cam_in);
    boxm2_batch.set_input_float(1,theta);
    boxm2_batch.set_input_float(2,phi);
    boxm2_batch.run_process();
    (id,type) = boxm2_batch.commit_output(0);
    rot_cam = dbvalue(id,type);
    return rot_cam;
Example #27
0
def gen_error_point_cloud(scene, cache, filename, thresh=0.3):
    boxm2_batch.init_process("boxm2ExportErrorPointCloudProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_from_db(1, cache)
    boxm2_batch.set_input_string(2, filename)
    #ply filename
    boxm2_batch.set_input_float(3, thresh)
    #prob threshold
    boxm2_batch.run_process()
Example #28
0
def apply_filters_cpp(scene, cpp_cache, prob_thres, filter_basename, filter_id, octree_lvl):
  boxm2_batch.init_process("boxm2CppFilterResponseProcess");
  boxm2_batch.set_input_from_db(0,scene);
  boxm2_batch.set_input_from_db(1,cpp_cache);
  boxm2_batch.set_input_float(2, prob_thres);
  boxm2_batch.set_input_string(3, filter_basename);
  boxm2_batch.set_input_unsigned(4, filter_id); #id kernel --> read the kernel from filter_basename + str(filter_id) + ".txt"
  boxm2_batch.set_input_unsigned(5, octree_lvl); #octree level to run kernel
  boxm2_batch.run_process();
Example #29
0
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
Example #30
0
def truncate_image(img, min_value, max_value):
    boxm2_batch.init_process("vilTruncateImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, min_value)
    boxm2_batch.set_input_float(2, max_value)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Example #31
0
def truncate_image(img, min_value, max_value):
    boxm2_batch.init_process("vilTruncateImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, min_value)
    boxm2_batch.set_input_float(2, max_value)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Example #32
0
def save_sun_index(output_file_name, longitude, latitude, year, hour, minute, radius):
  boxm2_batch.init_process("bradSaveSunIndexProcess");
  boxm2_batch.set_input_string(0,output_file_name);
  boxm2_batch.set_input_float(1, longitude);
  boxm2_batch.set_input_float(2, latitude);
  boxm2_batch.set_input_int(3,year);
  boxm2_batch.set_input_int(4,hour);
  boxm2_batch.set_input_int(5,minute);
  boxm2_batch.set_input_int(6,radius);
  boxm2_batch.run_process();
Example #33
0
def estimate_atmospheric_parameters(image, metadata, mean_reflectance=None):
    boxm2_batch.init_process("bradEstimateAtmosphericParametersProcess")
    boxm2_batch.set_input_from_db(0, image)
    boxm2_batch.set_input_from_db(1, metadata)
    if mean_reflectance != None:
        boxm2_batch.set_input_float(2, mean_reflectance)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    atm_params = dbvalue(id, type)
    return atm_params
Example #34
0
def write_perspective_cam_vrml(vrml_filename, pcam, camera_rad, axis_length, r, g, b):
    boxm2_batch.init_process("bvrmlWritePerspectiveCamProcess");
    boxm2_batch.set_input_string(0,vrml_filename);
    boxm2_batch.set_input_from_db(1,pcam);
    boxm2_batch.set_input_float(2,camera_rad);
    boxm2_batch.set_input_float(3,axis_length);
    boxm2_batch.set_input_float(4,r);
    boxm2_batch.set_input_float(5,g);
    boxm2_batch.set_input_float(6,b);
    boxm2_batch.run_process();
Example #35
0
def write_perspective_cam_vrml(vrml_filename, pcam, camera_rad, axis_length, r, g, b):
    boxm2_batch.init_process("bvrmlWritePerspectiveCamProcess");
    boxm2_batch.set_input_string(0,vrml_filename);
    boxm2_batch.set_input_from_db(1,pcam);
    boxm2_batch.set_input_float(2,camera_rad);
    boxm2_batch.set_input_float(3,axis_length);
    boxm2_batch.set_input_float(4,r);
    boxm2_batch.set_input_float(5,g);
    boxm2_batch.set_input_float(6,b);
    boxm2_batch.run_process();
Example #36
0
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
Example #37
0
def extract_cell_centers(scene, cache, prob_thresh=0.0):
  if cache.type == "boxm2_cache_sptr" :
    boxm2_batch.init_process("boxm2ExtractPointCloudProcess");
    boxm2_batch.set_input_from_db(0,scene);
    boxm2_batch.set_input_from_db(1,cache);
    boxm2_batch.set_input_float(2,prob_thresh); #prob t
    return boxm2_batch.run_process();
  else : 
    print "ERROR: Cache type not recognized: ", cache.type; 
    return False;
Example #38
0
def init_float_img(ni, nj, np, val):
    boxm2_batch.init_process("vilInitFloatImageProcess")
    boxm2_batch.set_input_unsigned(0, ni)
    boxm2_batch.set_input_unsigned(1, nj)
    boxm2_batch.set_input_unsigned(2, np)
    boxm2_batch.set_input_float(3, val)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Example #39
0
def estimate_atmospheric_parameters(image, metadata, mean_reflectance=None):
    boxm2_batch.init_process("bradEstimateAtmosphericParametersProcess")
    boxm2_batch.set_input_from_db(0, image)
    boxm2_batch.set_input_from_db(1, metadata)
    if mean_reflectance != None:
        boxm2_batch.set_input_float(2, mean_reflectance)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    atm_params = dbvalue(id, type)
    return atm_params
Example #40
0
def stretch_image(img, min_value, max_value, output_type_str='float'):
    boxm2_batch.init_process("vilStretchImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, min_value)
    boxm2_batch.set_input_float(2, max_value)
    boxm2_batch.set_input_string(3, output_type_str)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Example #41
0
def extract_cell_centers(scene, cache, prob_thresh=0.0):
    if cache.type == "boxm2_cache_sptr":
        boxm2_batch.init_process("boxm2ExtractPointCloudProcess")
        boxm2_batch.set_input_from_db(0, scene)
        boxm2_batch.set_input_from_db(1, cache)
        boxm2_batch.set_input_float(2, prob_thresh)  # prob t
        return boxm2_batch.run_process()
    else:
        print "ERROR: Cache type not recognized: ", cache.type
        return False
Example #42
0
def stretch_image(img, min_value, max_value, output_type_str='float'):
    boxm2_batch.init_process("vilStretchImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_float(1, min_value)
    boxm2_batch.set_input_float(2, max_value)
    boxm2_batch.set_input_string(3, output_type_str)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Example #43
0
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
Example #44
0
def blob_change_detection(change_img, thresh, depth1=None, depth2=None):
    boxm2_batch.init_process("boxm2BlobChangeDetectionProcess")
    boxm2_batch.set_input_from_db(0, change_img)
    boxm2_batch.set_input_float(1, thresh)
    if (depth1 and depth2):
        boxm2_batch.set_input_from_db(2, depth1)
        boxm2_batch.set_input_from_db(3, depth2)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    blobImg = dbvalue(id, type)
    return blobImg
Example #45
0
def create_stream_cache(scene, type_id_fname, image_id_fname, mem=2.0):
    boxm2_batch.init_process("boxm2CreateStreamCacheProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_string(1, type_id_fname)
    boxm2_batch.set_input_string(2, image_id_fname)
    boxm2_batch.set_input_float(3, mem)
    #number of gigabytes available for stream cache
    boxm2_batch.run_process()
    (cache_id, cache_type) = boxm2_batch.commit_output(0)
    strcache = dbvalue(cache_id, cache_type)
    return strcache
Example #46
0
def save_sun_index(output_file_name, longitude, latitude, year, hour, minute,
                   radius):
    boxm2_batch.init_process("bradSaveSunIndexProcess")
    boxm2_batch.set_input_string(0, output_file_name)
    boxm2_batch.set_input_float(1, longitude)
    boxm2_batch.set_input_float(2, latitude)
    boxm2_batch.set_input_int(3, year)
    boxm2_batch.set_input_int(4, hour)
    boxm2_batch.set_input_int(5, minute)
    boxm2_batch.set_input_int(6, radius)
    boxm2_batch.run_process()
Example #47
0
def apply_filters_cpp(scene, cpp_cache, prob_thres, filter_basename, filter_id,
                      octree_lvl):
    boxm2_batch.init_process("boxm2CppFilterResponseProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_from_db(1, cpp_cache)
    boxm2_batch.set_input_float(2, prob_thres)
    boxm2_batch.set_input_string(3, filter_basename)
    boxm2_batch.set_input_unsigned(4, filter_id)
    #id kernel --> read the kernel from filter_basename + str(filter_id) + ".txt"
    boxm2_batch.set_input_unsigned(5, octree_lvl)
    #octree level to run kernel
    boxm2_batch.run_process()
Example #48
0
def create_perspective_camera_with_rot(pcam, phi, theta, cent_x, cent_y, cent_z):
    boxm2_batch.init_process("vpglCreatePerspectiveCameraProcess3");
    boxm2_batch.set_input_from_db(0, pcam);
    boxm2_batch.set_input_float(1, phi);
    boxm2_batch.set_input_float(2, theta);
    boxm2_batch.set_input_float(3, cent_x);
    boxm2_batch.set_input_float(4, cent_y);
    boxm2_batch.set_input_float(5, cent_z);
    boxm2_batch.run_process();
    (c_id,c_type) = boxm2_batch.commit_output(0);
    cam = dbvalue(c_id,c_type);
    return cam;
Example #49
0
def gen_oriented_point_cloud(scene,cache,prob_t, norm_mag_t, filename):
	boxm2_batch.init_process("boxm2CppComputeDerivativeProcesses");
	boxm2_batch.set_input_from_db(0,scene);
	boxm2_batch.set_input_from_db(1,cache);
	boxm2_batch.set_input_float(2,prob_t);
	boxm2_batch.set_input_float(3,norm_mag_t);

	boxm2_batch.init_process("boxm2ExportOrientedPointCloudProcess");
	boxm2_batch.set_input_from_db(0,scene);
	boxm2_batch.set_input_from_db(1,cache);
	boxm2_batch.set_input_string(2,filename);
	boxm2_batch.run_process();
Example #50
0
def estimate_irradiance(image, sun_z, mean_albedo=1.0):
  boxm2_batch.init_process('bbasEstimateIrradianceProcess')
  boxm2_batch.set_input_from_db(0,image)
  boxm2_batch.set_input_float(1,sun_z)
  boxm2_batch.set_input_float(2,mean_albedo)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  img_float = dbvalue(id,type)
  (id,type) = boxm2_batch.commit_output(1)
  irrad = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  return(img_float, irrad)
Example #51
0
def estimate_irradiance(image, sun_z, mean_albedo=1.0):
    boxm2_batch.init_process('bbasEstimateIrradianceProcess')
    boxm2_batch.set_input_from_db(0, image)
    boxm2_batch.set_input_float(1, sun_z)
    boxm2_batch.set_input_float(2, mean_albedo)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_float = dbvalue(id, type)
    (id, type) = boxm2_batch.commit_output(1)
    irrad = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return (img_float, irrad)
Example #52
0
def vrml_filter_ply(vrml_filename,
                    ply_file,
                    points_file,
                    dist_threshold,
                    nearest=False):
    boxm2_batch.init_process("bvrmlFilteredPlyProcess")
    boxm2_batch.set_input_string(0, vrml_filename)
    boxm2_batch.set_input_string(1, ply_file)
    boxm2_batch.set_input_string(2, points_file)
    boxm2_batch.set_input_float(3, dist_threshold)
    boxm2_batch.set_input_bool(4, nearest)
    boxm2_batch.run_process()
Example #53
0
def segment_image(img, weight_thres, margin=0, min_size=50, sigma=1,neigh=8):
  boxm2_batch.init_process("sdetSegmentImageProcess");
  boxm2_batch.set_input_from_db(0,img);
  boxm2_batch.set_input_int(1,margin);
  boxm2_batch.set_input_int(2,neigh);
  boxm2_batch.set_input_float(3,weight_thres);
  boxm2_batch.set_input_float(4,sigma);
  boxm2_batch.set_input_int(5,min_size);
  boxm2_batch.run_process();
  (id, type) = boxm2_batch.commit_output(0);
  seg_img = dbvalue(id, type);
  return seg_img
Example #54
0
def blobwise_kl_div(p_img, q_img, blob_img, thresh=.1) :
  boxm2_batch.init_process("bripBlobwiseKLDivProcess")
  boxm2_batch.set_input_from_db(0, p_img);
  boxm2_batch.set_input_from_db(1, q_img);  
  boxm2_batch.set_input_from_db(2, blob_img);
  boxm2_batch.set_input_float(3, thresh); 
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  kl_img = dbvalue(id,type);
  (id,type) = boxm2_batch.commit_output(1);
  thresh_img = dbvalue(id,type);
  return kl_img, thresh_img;
Example #55
0
def detect_shadow_ridge(region_img, blob_size_t, sun_angle):
    boxm2_batch.init_process("vilShadowRidgeDetectionProcess")
    boxm2_batch.set_input_from_db(0, region_img)
    boxm2_batch.set_input_int(1, blob_size_t)
    boxm2_batch.set_input_float(2, sun_angle)
    boxm2_batch.run_process()
    (o_id, o_type) = boxm2_batch.commit_output(0)
    region_img = dbvalue(o_id, o_type)
    (o_id, o_type) = boxm2_batch.commit_output(1)
    out_img = dbvalue(o_id, o_type)
    (o_id, o_type) = boxm2_batch.commit_output(2)
    dist_img = dbvalue(o_id, o_type)
    return region_img, out_img, dist_img
Example #56
0
def convert_local_rational_to_generic(cam_in, ni, nj, min_z, max_z, level=0):
    boxm2_batch.init_process('vpglConvertLocalRationalToGenericProcess');
    boxm2_batch.set_input_from_db(0,cam_in);
    boxm2_batch.set_input_unsigned(1,ni);
    boxm2_batch.set_input_unsigned(2,nj);
    boxm2_batch.set_input_float(3,min_z);
    boxm2_batch.set_input_float(4,max_z);
    boxm2_batch.set_input_unsigned(5,level);
    if not boxm2_batch.run_process():
        return None;
    (id,type) = boxm2_batch.commit_output(0);
    generic_cam = dbvalue(id,type);
    return generic_cam;
Example #57
0
def perturb_camera(cam_in, angle, rng):
    boxm2_batch.init_process('vpglPerturbPerspCamOrientProcess');
    boxm2_batch.set_input_from_db(0,cam_in);
    boxm2_batch.set_input_float(1,angle);
    boxm2_batch.set_input_from_db(2,rng);
    boxm2_batch.run_process();
    (id,type) = boxm2_batch.commit_output(0);
    pert_cam = dbvalue(id,type);
    (theta_id,type) = boxm2_batch.commit_output(1);
    (phi_id,type) = boxm2_batch.commit_output(2);
    theta = boxm2_batch.get_output_float(theta_id);
    phi = boxm2_batch.get_output_float(phi_id);
    return pert_cam, theta, phi;
Example #58
0
def get_backprojected_ray( cam,u,v):
  boxm2_batch.init_process("vpglGetBackprojectRayProcess");
  boxm2_batch.set_input_from_db(0, cam);
  boxm2_batch.set_input_float(1, u);
  boxm2_batch.set_input_float(2, v);
  boxm2_batch.run_process();
  (id, type) = boxm2_batch.commit_output(0);
  x=boxm2_batch.get_output_float(id);
  (id, type) = boxm2_batch.commit_output(1);
  y=boxm2_batch.get_output_float(id);
  (id, type) = boxm2_batch.commit_output(2);
  z=boxm2_batch.get_output_float(id);
  return x,y,z;
Example #59
0
def perturb_camera_uniform(cam_in, angle, rng):
    boxm2_batch.init_process('vpglPerturbUniformPerspCamOrientProcess')
    boxm2_batch.set_input_from_db(0,cam_in)
    boxm2_batch.set_input_float(1,angle)
    boxm2_batch.set_input_from_db(2,rng)
    boxm2_batch.run_process()
    (id,type) = boxm2_batch.commit_output(0)
    pert_cam = dbvalue(id,type)
    (theta_id,type) = boxm2_batch.commit_output(1)
    (phi_id,type) = boxm2_batch.commit_output(2)
    theta = boxm2_batch.get_output_float(theta_id);
    phi = boxm2_batch.get_output_float(phi_id);
    return pert_cam, theta, phi