Exemple #1
0
def read_CLIF07(indir, outdir, camnum, datatype="CLIF06"):
    boxm2_batch.init_process("bilReadCLIF07DataProcess")
    boxm2_batch.set_input_string(0, indir)
    boxm2_batch.set_input_string(1, outdir)
    boxm2_batch.set_input_int(2, camnum)
    boxm2_batch.set_input_string(3, datatype)
    boxm2_batch.run_process()
Exemple #2
0
def read_CLIF07(indir, outdir, camnum, datatype="CLIF06"):
    boxm2_batch.init_process("bilReadCLIF07DataProcess")
    boxm2_batch.set_input_string(0, indir)
    boxm2_batch.set_input_string(1, outdir)
    boxm2_batch.set_input_int(2, camnum)
    boxm2_batch.set_input_string(3, datatype)
    boxm2_batch.run_process()
def roi_init(NITF_path,
             camera,
             scene,
             convert_to_8bit,
             params_fname,
             margin=0):
    boxm2_batch.init_process("boxm2RoiInitProcess")
    boxm2_batch.set_params_process(params_fname)
    boxm2_batch.set_input_string(0, NITF_path)
    boxm2_batch.set_input_from_db(1, camera)
    boxm2_batch.set_input_from_db(2, scene)
    boxm2_batch.set_input_bool(3, convert_to_8bit)
    boxm2_batch.set_input_int(4, margin)
    result = boxm2_batch.run_process()
    if result:
        (id, type) = boxm2_batch.commit_output(0)
        local_cam = dbvalue(id, type)
        (id, type) = boxm2_batch.commit_output(1)
        cropped_image = dbvalue(id, type)
        (id, type) = boxm2_batch.commit_output(2)
        uncertainty = boxm2_batch.get_output_float(id)
    else:
        local_cam = 0
        cropped_image = 0
        uncertainty = 0
    return result, local_cam, cropped_image, uncertainty
Exemple #4
0
def median_filter_image(img, neighborhood_radius):
    boxm2_batch.init_process("vilMedianFilterProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_int(1, neighborhood_radius)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    filt_img = dbvalue(id, type)
    return filt_img
Exemple #5
0
def median_filter_image(img, neighborhood_radius):
    boxm2_batch.init_process("vilMedianFilterProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_int(1, neighborhood_radius)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    filt_img = dbvalue(id, type)
    return filt_img
Exemple #6
0
def pixel(img, point):
    boxm2_batch.init_process("vilPixelValueProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_int(1, int(point[0]))
    boxm2_batch.set_input_int(2, int(point[1]))
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    val = boxm2_batch.get_output_float(id)
    return val
Exemple #7
0
def undistort_image(img, param_file, iters):
    boxm2_batch.init_process("vilUndistortImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_string(1, param_file)
    boxm2_batch.set_input_int(2, iters)
    boxm2_batch.run_process()
    (o_id, o_type) = boxm2_batch.commit_output(0)
    out_img = dbvalue(o_id, o_type)
    return out_img
Exemple #8
0
def undistort_image(img, param_file, iters):
    boxm2_batch.init_process("vilUndistortImageProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_string(1, param_file)
    boxm2_batch.set_input_int(2, iters)
    boxm2_batch.run_process()
    (o_id, o_type) = boxm2_batch.commit_output(0)
    out_img = dbvalue(o_id, o_type)
    return out_img
Exemple #9
0
def pixel(img, point):
    boxm2_batch.init_process("vilPixelValueProcess") 
    boxm2_batch.set_input_from_db(0,img)
    boxm2_batch.set_input_int(1, int(point[0]))
    boxm2_batch.set_input_int(2, int(point[1]))
    boxm2_batch.run_process()
    (id,type) = boxm2_batch.commit_output(0)
    val = boxm2_batch.get_output_float(id)
    return val
Exemple #10
0
def resize(img, ni, nj, pixel="float"):
    boxm2_batch.init_process("vilResampleProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_int(1, ni)
    boxm2_batch.set_input_int(2, nj)
    boxm2_batch.set_input_string(3, pixel)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img = dbvalue(id, type)
    return img
Exemple #11
0
def load_geotiff_cam(tfw_filename, lvcs, utm_zone, utm_hemisphere):
    boxm2_batch.init_process("vpglLoadGeoCameraProcess")
    boxm2_batch.set_input_string(0, tfw_filename)
    boxm2_batch.set_input_from_db(1, lvcs)
    boxm2_batch.set_input_int(2, utm_zone)
    boxm2_batch.set_input_unsigned(3, utm_hemisphere)
    boxm2_batch.run_process()
    (c_id, c_type) = boxm2_batch.commit_output(0)
    cam = dbvalue(c_id, c_type)
    return cam
Exemple #12
0
def load_geotiff_cam(tfw_filename, lvcs, utm_zone, utm_hemisphere):
    boxm2_batch.init_process("vpglLoadGeoCameraProcess");
    boxm2_batch.set_input_string(0, tfw_filename);
    boxm2_batch.set_input_from_db(1, lvcs);
    boxm2_batch.set_input_int(2, utm_zone);
    boxm2_batch.set_input_unsigned(3, utm_hemisphere);
    boxm2_batch.run_process()
    (c_id,c_type) = boxm2_batch.commit_output(0)
    cam = dbvalue(c_id,c_type);
    return cam
Exemple #13
0
def compute_mi_cost_surface(img0, img0_mask, img1, search_radius):
    boxm2_batch.init_process('ihogComputeMiCostSurfaceProcess')
    boxm2_batch.set_input_from_db(0,img0)
    boxm2_batch.set_input_from_db(1,img0_mask)
    boxm2_batch.set_input_from_db(2,img1)
    boxm2_batch.set_input_int(3,search_radius)
    boxm2_batch.run_process()
    (id,type) = boxm2_batch.commit_output(0)
    cost_image = dbvalue(id,type)
    return cost_image
Exemple #14
0
def resize(img, ni, nj, pixel="float"):
    boxm2_batch.init_process("vilResampleProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_int(1, ni)
    boxm2_batch.set_input_int(2, nj)
    boxm2_batch.set_input_string(3, pixel)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img = dbvalue(id, type)
    return img
def update_PusingQ(scene,device,opencl_cache,operation = 2,view_ident=""):
  #print("Init Manager");
  boxm2_batch.init_process("boxm2OclUpdateUsingQProcess");
  boxm2_batch.set_input_from_db(0, device);
  boxm2_batch.set_input_from_db(1, scene);
  boxm2_batch.set_input_from_db(2, opencl_cache);
  boxm2_batch.set_input_int(3, operation);
  boxm2_batch.set_input_string(4, view_ident);
  status = boxm2_batch.run_process();
  if(status != True):
	print "Error in Running Aux Q ";
Exemple #16
0
def register_translational(img0, img0_mask, img1, search_radius=0):
    boxm2_batch.init_process('ihogRegisterTranslationalProcess')
    boxm2_batch.set_input_from_db(0,img0)
    boxm2_batch.set_input_from_db(1,img0_mask)
    boxm2_batch.set_input_from_db(2,img1)
    boxm2_batch.set_input_int(3,search_radius)
    boxm2_batch.run_process()
    (id,type) = boxm2_batch.commit_output(0)
    trans_x = boxm2_batch.get_output_double(id)
    (id,type) = boxm2_batch.commit_output(1)
    trans_y = boxm2_batch.get_output_double(id)
    return (trans_x, trans_y)
Exemple #17
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
Exemple #18
0
def load_multi_cache(scene, numdevices=1):
    ###############################################################
    # Create multi cache, opencl manager, device, and gpu cache
    ###############################################################
    #print("Create Main Cache");
    boxm2_batch.init_process("boxm2CreateMultiCacheProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_int(1, numdevices)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    mcache = dbvalue(id, type)

    return mcache
Exemple #19
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
def filter_scene_data(scene, cache, device, filters, filter_idx):
    if cache.type == "boxm2_opencl_cache_sptr":
        print("Filtering Scene Data")
        boxm2_batch.init_process("boxm2_ocl_filter_scene_data_process")
        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, filters)
        boxm2_batch.set_input_int(4, filter_idx)
        return boxm2_batch.run_process()
    else:
        print "ERROR: Cache type not recognized: ", cache.type
        return False
Exemple #21
0
def filter_scene_data(scene, cache, device, filters, filter_idx):
    if cache.type == "boxm2_opencl_cache_sptr":
        print("Filtering Scene Data")
        boxm2_batch.init_process("boxm2_ocl_filter_scene_data_process")
        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, filters)
        boxm2_batch.set_input_int(4, filter_idx)
        return boxm2_batch.run_process()
    else:
        print "ERROR: Cache type not recognized: ", cache.type
        return False
Exemple #22
0
def get_3d_point_from_index(scene, cache, block_index, index):
    #Warning, you probably shouldn't be doing this!
    boxm2_batch.init_process("boxm2CppGet3dPointFromIndexProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_from_db(1, cache)
    boxm2_batch.set_input_int(2, block_index[0])
    boxm2_batch.set_input_int(3, block_index[1])
    boxm2_batch.set_input_int(4, block_index[2])
    boxm2_batch.set_input_int(5, index)
    boxm2_batch.run_process()

    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)

    (id, type) = boxm2_batch.commit_output(3)
    xs = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(4)
    ys = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(5)
    zs = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(6)
    leaf = boxm2_batch.get_output_int(id)
    boxm2_batch.remove_data(id)

    return ((x, y, z), (xs, ys, zs), leaf)
Exemple #23
0
def get_3d_point_from_index(scene,cache,block_index, index): 
    #Warning, you probably shouldn't be doing this!
    boxm2_batch.init_process("boxm2CppGet3dPointFromIndexProcess");
    boxm2_batch.set_input_from_db(0, scene);
    boxm2_batch.set_input_from_db(1, cache);
    boxm2_batch.set_input_int(2, block_index[0]);
    boxm2_batch.set_input_int(3, block_index[1]);
    boxm2_batch.set_input_int(4, block_index[2]);
    boxm2_batch.set_input_int(5, index);
    boxm2_batch.run_process();

    (id,type) = boxm2_batch.commit_output(0);
    x=boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(1);
    y=boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(2);
    z=boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);

    (id,type) = boxm2_batch.commit_output(3);
    xs=boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(4);
    ys=boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(5);
    zs=boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(6);
    leaf=boxm2_batch.get_output_int(id);
    boxm2_batch.remove_data(id);

    return ((x, y, z), (xs, ys, zs), leaf)
Exemple #24
0
def persp2genWmargin(pcam, ni, nj, margin, level=0):
    boxm2_batch.init_process("vpglConvertToGenericCameraWithMarginProcess")
    boxm2_batch.set_input_from_db(0, pcam)
    boxm2_batch.set_input_unsigned(1, ni)
    boxm2_batch.set_input_unsigned(2, nj)
    boxm2_batch.set_input_unsigned(3, level)
    boxm2_batch.set_input_int(4, margin)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    gcam = dbvalue(id, type)
    (id, type) = boxm2_batch.commit_output(1)
    ni = boxm2_batch.get_output_unsigned(id)
    (id, type) = boxm2_batch.commit_output(2)
    nj = boxm2_batch.get_output_unsigned(id)
    (id, type) = boxm2_batch.commit_output(3)
    new_pers_cam = dbvalue(id, type)
    return (gcam, ni, nj, new_pers_cam)
Exemple #25
0
def persp2genWmargin(pcam, ni, nj, margin, level=0) :
  boxm2_batch.init_process("vpglConvertToGenericCameraWithMarginProcess");
  boxm2_batch.set_input_from_db(0, pcam);
  boxm2_batch.set_input_unsigned(1, ni);
  boxm2_batch.set_input_unsigned(2, nj);
  boxm2_batch.set_input_unsigned(3, level);
  boxm2_batch.set_input_int(4, margin);
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  gcam = dbvalue(id,type);
  (id,type) = boxm2_batch.commit_output(1);
  ni = boxm2_batch.get_output_unsigned(id);
  (id,type) = boxm2_batch.commit_output(2);
  nj = boxm2_batch.get_output_unsigned(id);
  (id,type) = boxm2_batch.commit_output(3);
  new_pers_cam = dbvalue(id,type);
  return (gcam, ni, nj, new_pers_cam);
Exemple #26
0
def get_sun_angles_date_time(lat, lon, year, month, day, hour, minute):
  boxm2_batch.init_process("bradGetSunAnglesDateTimeProcess")
  boxm2_batch.set_input_float(0,lat)
  boxm2_batch.set_input_float(1,lon)
  boxm2_batch.set_input_int(2,year)
  boxm2_batch.set_input_int(3,month)
  boxm2_batch.set_input_int(4,day)
  boxm2_batch.set_input_int(5,hour)
  boxm2_batch.set_input_int(6,minute)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  sun_az = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  (id,type) = boxm2_batch.commit_output(1)
  sun_el = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  return sun_az, sun_el
Exemple #27
0
def get_sun_angles_date_time(lat, lon, year, month, day, hour, minute):
    boxm2_batch.init_process("bradGetSunAnglesDateTimeProcess")
    boxm2_batch.set_input_float(0, lat)
    boxm2_batch.set_input_float(1, lon)
    boxm2_batch.set_input_int(2, year)
    boxm2_batch.set_input_int(3, month)
    boxm2_batch.set_input_int(4, day)
    boxm2_batch.set_input_int(5, hour)
    boxm2_batch.set_input_int(6, minute)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    sun_az = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    sun_el = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return sun_az, sun_el
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();
Exemple #29
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()
def change_detect(scene,
                  cache,
                  cam,
                  img,
                  exp_img,
                  device=None,
                  rgb=False,
                  n=1,
                  raybelief="",
                  max_mode=False):
    if cache.type == "boxm2_cache_sptr":
        print "boxm2_batch CPU change detection"
        boxm2_batch.init_process("boxm2CppChangeDetectionProcess")
        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)
        boxm2_batch.set_input_from_db(4, exp_img)
        boxm2_batch.run_process()
        (id, type) = boxm2_batch.commit_output(0)
        cd_img = dbvalue(id, type)
        return cd_img
    elif cache.type == "boxm2_opencl_cache_sptr" and device:
        print "boxm2_batch GPU change detection"
        boxm2_batch.init_process("boxm2OclChangeDetectionProcess")
        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_from_db(5, exp_img)
        boxm2_batch.set_input_int(6, n)
        boxm2_batch.set_input_string(7, raybelief)
        boxm2_batch.set_input_bool(8, max_mode)
        boxm2_batch.run_process()
        if not rgb:
            (id, type) = boxm2_batch.commit_output(0)
            cd_img = dbvalue(id, type)
        else:
            (id, type) = boxm2_batch.commit_output(1)
            cd_img = dbvalue(id, type)
        return cd_img
    else:
        print "ERROR: Cache type not recognized: ", cache.type
Exemple #31
0
def resample_perspective_camera( cam, size0, size1 ):
  boxm2_batch.init_process("vpglResamplePerspectiveCameraProcess");
  boxm2_batch.set_input_from_db(0, cam);
  boxm2_batch.set_input_int(1, size0[0]);
  boxm2_batch.set_input_int(2, size0[1]);
  boxm2_batch.set_input_int(3, size1[0]);
  boxm2_batch.set_input_int(4, size1[1]);
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  out = dbvalue(id,type);
  return out;
Exemple #32
0
def resample_perspective_camera(cam, size0, size1):
    boxm2_batch.init_process("vpglResamplePerspectiveCameraProcess")
    boxm2_batch.set_input_from_db(0, cam)
    boxm2_batch.set_input_int(1, size0[0])
    boxm2_batch.set_input_int(2, size0[1])
    boxm2_batch.set_input_int(3, size1[0])
    boxm2_batch.set_input_int(4, size1[1])
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    out = dbvalue(id, type)
    return out
Exemple #33
0
def persp2genWmargin(pcam, ni, nj, margin, level=0):
    boxm2_batch.init_process("vpglConvertToGenericCameraWithMarginProcess")
    boxm2_batch.set_input_from_db(0, pcam)
    boxm2_batch.set_input_unsigned(1, ni)
    boxm2_batch.set_input_unsigned(2, nj)
    boxm2_batch.set_input_unsigned(3, level)
    boxm2_batch.set_input_int(4, margin)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    gcam = dbvalue(id, type)
    (id, type) = boxm2_batch.commit_output(1)
    ni = boxm2_batch.get_output_unsigned(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    nj = boxm2_batch.get_output_unsigned(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(3)
    new_pers_cam = dbvalue(id, type)
    return (gcam, ni, nj, new_pers_cam)
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 create_scene_and_blocks(scene_dir,
                            app_model,
                            obs_model,
                            lon1,
                            lat1,
                            elev1,
                            lon2,
                            lat2,
                            elev2,
                            vox_size,
                            block_len_xy,
                            block_len_z,
                            num_bins=0,
                            xml_name="scene"):
    boxm2_batch.init_process("boxm2CreateSceneAndBlocksProcess")
    boxm2_batch.set_input_string(0, scene_dir)
    boxm2_batch.set_input_string(1, app_model)
    boxm2_batch.set_input_string(2, obs_model)
    boxm2_batch.set_input_float(3, lon1)
    boxm2_batch.set_input_float(4, lat1)
    boxm2_batch.set_input_float(5, elev1)
    boxm2_batch.set_input_float(6, lon2)
    boxm2_batch.set_input_float(7, lat2)
    boxm2_batch.set_input_float(8, elev2)
    boxm2_batch.set_input_float(9, vox_size)
    boxm2_batch.set_input_float(10, block_len_xy)
    boxm2_batch.set_input_float(11, block_len_z)
    boxm2_batch.set_input_int(12, num_bins)
    boxm2_batch.run_process()
    (scene_id, scene_type) = boxm2_batch.commit_output(0)
    scene = dbvalue(scene_id, scene_type)

    print("Write Scene")
    boxm2_batch.init_process("boxm2WriteSceneXMLProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_string(1, xml_name)
    boxm2_batch.run_process()
Exemple #36
0
def geo2generic(geocam, ni, nj, scene_height, level):
    boxm2_batch.init_process("vpglConvertGeoCameraToGenericProcess");
    boxm2_batch.set_input_from_db(0, geocam);
    boxm2_batch.set_input_int(1, ni);
    boxm2_batch.set_input_int(2, nj);
    boxm2_batch.set_input_double(3, scene_height);
    boxm2_batch.set_input_int(4, level);
    boxm2_batch.run_process();
    (c_id, c_type) = boxm2_batch.commit_output(0);
    cam = dbvalue(c_id, c_type);
    return cam;
Exemple #37
0
def geo2generic(geocam, ni, nj, scene_height, level):
    boxm2_batch.init_process("vpglConvertGeoCameraToGenericProcess")
    boxm2_batch.set_input_from_db(0, geocam)
    boxm2_batch.set_input_int(1, ni)
    boxm2_batch.set_input_int(2, nj)
    boxm2_batch.set_input_double(3, scene_height)
    boxm2_batch.set_input_int(4, level)
    boxm2_batch.run_process()
    (c_id, c_type) = boxm2_batch.commit_output(0)
    cam = dbvalue(c_id, c_type)
    return cam
Exemple #38
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
Exemple #39
0
def segment_image_using_height(img, height_img, weight_thres, margin=0, min_size=50, sigma=1, neigh=8):
    boxm2_batch.init_process("sdetSegmentUsingHeightMapProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_from_db(1, height_img)
    boxm2_batch.set_input_int(2, margin)
    boxm2_batch.set_input_int(3, neigh)
    boxm2_batch.set_input_float(4, weight_thres)
    boxm2_batch.set_input_float(5, sigma)
    boxm2_batch.set_input_int(6, min_size)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    seg_img = dbvalue(id, type)
    return seg_img
Exemple #40
0
def bae_raw_stream(file_path, ni=0, nj=0, pixelsize=0):
    boxm2_batch.init_process("bilCreateRawImageIstreamProcess")
    boxm2_batch.set_input_string(0, file_path)
    boxm2_batch.set_input_int(1, ni)
    boxm2_batch.set_input_int(2, nj)
    boxm2_batch.set_input_int(3, pixelsize)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    stream = dbvalue(id, type)
    (id, type) = boxm2_batch.commit_output(1)
    numImgs = boxm2_batch.get_output_int(id)
    boxm2_batch.remove_data(id)
    return stream, numImgs
Exemple #41
0
def bae_raw_stream(file_path, ni=0, nj=0, pixelsize=0):
    boxm2_batch.init_process("bilCreateRawImageIstreamProcess")
    boxm2_batch.set_input_string(0, file_path)
    boxm2_batch.set_input_int(1, ni)
    boxm2_batch.set_input_int(2, nj)
    boxm2_batch.set_input_int(3, pixelsize)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    stream = dbvalue(id, type)
    (id, type) = boxm2_batch.commit_output(1)
    numImgs = boxm2_batch.get_output_int(id)
    boxm2_batch.remove_data(id)
    return stream, numImgs
Exemple #42
0
def segment_image_using_height2(img, height_img, edge_img, weight_thres, margin=0, min_size=50, sigma=1,neigh=8):
  boxm2_batch.init_process("sdetSegmentUsingHeightMapProcess2");
  boxm2_batch.set_input_from_db(0,img);
  boxm2_batch.set_input_from_db(1,height_img);
  boxm2_batch.set_input_from_db(2,edge_img);
  boxm2_batch.set_input_int(3,margin);
  boxm2_batch.set_input_int(4,neigh);
  boxm2_batch.set_input_float(5,weight_thres);
  boxm2_batch.set_input_float(6,sigma);
  boxm2_batch.set_input_int(7,min_size);
  boxm2_batch.run_process();
  (id, type) = boxm2_batch.commit_output(0);
  seg_img = dbvalue(id, type);
  return seg_img
Exemple #43
0
def geo2generic_nonnadir(geocam, ni, nj, scene_height, dir_x, dir_y, dir_z, level):
    boxm2_batch.init_process("vpglConvertNonNadirGeoCameraToGenericProcess")
    boxm2_batch.set_input_from_db(0, geocam)
    boxm2_batch.set_input_int(1, ni)
    boxm2_batch.set_input_int(2, nj)
    boxm2_batch.set_input_double(3, scene_height)
    boxm2_batch.set_input_int(4, level)
    boxm2_batch.set_input_double(5, dir_x)
    boxm2_batch.set_input_double(6, dir_y)
    boxm2_batch.set_input_double(7, dir_z)
    boxm2_batch.run_process()
    (c_id, c_type) = boxm2_batch.commit_output(0)
    cam = dbvalue(c_id, c_type)
    return cam
def block_similarity(scene, cache, i, j, k, vrml_filename,
                     feature_sim_variance, entropy_range_min,
                     entropy_range_max):
    boxm2_batch.init_process("boxm2BlockSimilarityProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_from_db(1, cache)
    boxm2_batch.set_input_int(2, i)
    boxm2_batch.set_input_int(3, j)
    boxm2_batch.set_input_int(4, k)
    boxm2_batch.set_input_string(5, vrml_filename)
    boxm2_batch.set_input_float(6, feature_sim_variance)
    boxm2_batch.set_input_float(7, entropy_range_min)
    # for visualization
    boxm2_batch.set_input_float(8, entropy_range_max)
    boxm2_batch.run_process()
Exemple #45
0
def query_cell(scene,cache,point,model_name,model_type): 
    #Point should be 3 len, for a x, y, z coordinate OR
    #4 in lenght, blk_i, blk_j, blk_k, index

    if len(point)==3:
        (blk, index) = get_index_from_3d_point(scene,cache,point)
        point = blk+(index,)

    boxm2_batch.init_process("boxm2CppQueryCellProcess");
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_from_db(1, cache)
    boxm2_batch.set_input_int(2, point[0])
    boxm2_batch.set_input_int(3, point[1])
    boxm2_batch.set_input_int(4, point[2])
    boxm2_batch.set_input_int(5, point[3])
    boxm2_batch.set_input_string(6, model_name)
    boxm2_batch.set_input_string(7, model_type)
    boxm2_batch.run_process();

    (id,type) = boxm2_batch.commit_output(0);
    data=boxm2_batch.get_bbas_1d_array_float(id);
    boxm2_batch.remove_data(id);

    return data
Exemple #46
0
def query_cell(scene, cache, point, model_name, model_type):
    #Point should be 3 len, for a x, y, z coordinate OR
    #4 in lenght, blk_i, blk_j, blk_k, index

    if len(point) == 3:
        (blk, index) = get_index_from_3d_point(scene, cache, point)
        point = blk + (index, )

    boxm2_batch.init_process("boxm2CppQueryCellProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_from_db(1, cache)
    boxm2_batch.set_input_int(2, point[0])
    boxm2_batch.set_input_int(3, point[1])
    boxm2_batch.set_input_int(4, point[2])
    boxm2_batch.set_input_int(5, point[3])
    boxm2_batch.set_input_string(6, model_name)
    boxm2_batch.set_input_string(7, model_type)
    boxm2_batch.run_process()

    (id, type) = boxm2_batch.commit_output(0)
    data = boxm2_batch.get_bbas_1d_array_float(id)
    boxm2_batch.remove_data(id)

    return data
Exemple #47
0
def segment_image_using_height(img,
                               height_img,
                               weight_thres,
                               margin=0,
                               min_size=50,
                               sigma=1,
                               neigh=8):
    boxm2_batch.init_process("sdetSegmentUsingHeightMapProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_from_db(1, height_img)
    boxm2_batch.set_input_int(2, margin)
    boxm2_batch.set_input_int(3, neigh)
    boxm2_batch.set_input_float(4, weight_thres)
    boxm2_batch.set_input_float(5, sigma)
    boxm2_batch.set_input_int(6, min_size)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    seg_img = dbvalue(id, type)
    return seg_img