Example #1
0
def read_CLIF07(indir,outdir,camnum,datatype="CLIF06") :
  bvxm_batch.init_process("bilReadCLIF07DataProcess")
  bvxm_batch.set_input_string(0,indir);
  bvxm_batch.set_input_string(1,outdir);
  bvxm_batch.set_input_int(2,camnum);
  bvxm_batch.set_input_string(3,datatype);
  bvxm_batch.run_process();
Example #2
0
def save_occupancy_raw(world, filename, app_model, scale=0):
    batch.init_process("bvxmSaveOccupancyRawProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_string(1, filename)
    batch.set_input_unsigned(2, scale)
    batch.set_input_string(3, app_model)
    batch.run_process()
Example #3
0
def scale_and_offset_values(img,scale,offset):
  bvxm_batch.init_process("vilScaleAndOffsetValuesProcess")
  bvxm_batch.set_input_from_db(0,img)
  bvxm_batch.set_input_float(1,scale)
  bvxm_batch.set_input_float(2,offset)
  bvxm_batch.run_process()
  return
Example #4
0
def debayer(img):
  bvxm_batch.init_process("vilDebayerBGGRToRGBProcess")
  bvxm_batch.set_input_from_db(0,img);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  outimg = dbvalue(id,type);
  return outimg;
Example #5
0
def fill_holes(img):
  bvxm_batch.init_process("vilFillHolesInRegionsProcess")
  bvxm_batch.set_input_from_db(0,img)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  outimg = dbvalue(id, type);
  return outimg
Example #6
0
def model_dir(scene):
    batch.init_process("bvxmSceneModelDirProcess")
    batch.set_input_from_db(0, scene)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    model_dir = batch.get_output_string(id)
    return model_dir
Example #7
0
def rgb_to_grey(img):
  bvxm_batch.init_process("vilRGBToGreyProcess");
  bvxm_batch.set_input_from_db(0,img)
  bvxm_batch.run_process()
  (id, type) = bvxm_batch.commit_output(0)
  outimg = dbvalue(id, type);
  return outimg
Example #8
0
def get_number_of_planes(img):
  bvxm_batch.init_process("vilGetNumberOfPlanesProcess");
  bvxm_batch.set_input_from_db(0, img);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  n_planes = bvxm_batch.get_output_unsigned(id)
  return n_planes;
Example #9
0
def histogram_equalize(img):
  bvxm_batch.init_process("vilHistogramEqualizeProcess");
  bvxm_batch.set_input_from_db(0, img);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  img_equalized = dbvalue(id, type);
  return img_equalized;
Example #10
0
def scene_local_box(scene):
    batch.init_process("bvxmSceneLocalBoxProcess")
    batch.set_input_from_db(0, scene)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    lower_left_x = batch.get_output_double(id)
    batch.remove_data(id)
    (id, type) = batch.commit_output(1)
    lower_left_y = batch.get_output_double(id)
    batch.remove_data(id)
    (id, type) = batch.commit_output(2)
    upper_right_x = batch.get_output_double(id)
    batch.remove_data(id)
    (id, type) = batch.commit_output(3)
    upper_right_y = batch.get_output_double(id)
    batch.remove_data(id)
    (id, type) = batch.commit_output(4)
    voxel_size = batch.get_output_double(id)
    batch.remove_data(id)
    (id, type) = batch.commit_output(5)
    lower_left_z = batch.get_output_double(id)  # min z
    batch.remove_data(id)
    (id, type) = batch.commit_output(6)
    upper_right_z = batch.get_output_double(id)  # max z
    batch.remove_data(id)
    return lower_left_x, lower_left_y, upper_right_x, upper_right_y, voxel_size, lower_left_z, upper_right_z
Example #11
0
def detect_shadow_rgb(img,threshold) :
  bvxm_batch.init_process("vilShadowDetectionProcess");
  bvxm_batch.set_input_from_db(0,img)
  bvxm_batch.set_input_float(1, threshold);
  bvxm_batch.run_process();
  (o_id,o_type) = bvxm_batch.commit_output(0);
  region_img = dbvalue(o_id,o_type);
  return region_img;
Example #12
0
def image_entropy(img, block_size = 5):
  bvxm_batch.init_process("vilBlockEntropyProcess");
  bvxm_batch.set_input_from_db(0, img);
  bvxm_batch.set_input_unsigned(1, block_size);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  entropy_img = dbvalue(id, type);
  return entropy_img;
Example #13
0
def image_mean(img):
  bvxm_batch.init_process("vilImageMeanProcess")
  bvxm_batch.set_input_from_db(0,img)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  mean_val = bvxm_batch.get_output_float(id)
  bvxm_batch.remove_data(id)
  return mean_val
Example #14
0
def median_filter(img, operator_half_size):
    bvxm_batch.init_process("vilMedianFilterProcess")
    bvxm_batch.set_input_from_db(0,img)
    bvxm_batch.set_input_int(1, operator_half_size)
    bvxm_batch.run_process()
    (id,type) = bvxm_batch.commit_output(0)
    img_out = dbvalue(id,type)
    return img_out
Example #15
0
def img_sum(img, plane_index=0):
  bvxm_batch.init_process("vilImageSumProcess")
  bvxm_batch.set_input_from_db(0,img)
  bvxm_batch.set_input_unsigned(1,plane_index)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  value = bvxm_batch.get_output_double(id)
  return value
Example #16
0
def combine_eo_ir(eo_img,ir_img):
  bvxm_batch.init_process("vilEOIRCombineProcess")
  bvxm_batch.set_input_from_db(0,eo_img)
  bvxm_batch.set_input_from_db(1,ir_img)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  img_out = dbvalue(id,type)
  return img_out
Example #17
0
def create_ortho_camera(world, is_utm=False):
    batch.init_process("bvxmCreateOrthoCameraProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_bool(1, is_utm)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    ortho_cam = dbvalue(id, type)
    return ortho_cam
Example #18
0
def bvxm_detect_edges(cropped_image, edge_params_xml):
    batch.init_process("bvxmDetectEdgesProcess")
    batch.set_input_from_db(0, cropped_image)
    batch.set_params_process(edge_params_xml)
    batch.run_process()
    (cropped_edge_image_id, cropped_edge_image) = batch.commit_output(0)
    cropped_edge_image = dbvalue(cropped_edge_image_id, cropped_edge_image)
    return cropped_edge_image
Example #19
0
def convert_image(img, type="byte") :
  bvxm_batch.init_process("vilConvertPixelTypeProcess");
  bvxm_batch.set_input_from_db(0, img);
  bvxm_batch.set_input_string(1, type);
  bvxm_batch.run_process();
  (id,type) = bvxm_batch.commit_output(0);
  cimg = dbvalue(id,type);
  return cimg;
Example #20
0
def get_plane(img, plane_id):
  bvxm_batch.init_process("vilGetPlaneProcess");
  bvxm_batch.set_input_from_db(0, img);
  bvxm_batch.set_input_unsigned(1, plane_id);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  img_plane = dbvalue(id, type);
  return img_plane;
Example #21
0
def threshold_image(img, value, threshold_above=True):
    bvxm_batch.init_process("vilThresholdImageProcess")
    bvxm_batch.set_input_from_db(0,img)
    bvxm_batch.set_input_float(1,value)
    bvxm_batch.set_input_bool(2,threshold_above)
    bvxm_batch.run_process()
    (id,type) = bvxm_batch.commit_output(0)
    mask = dbvalue(id,type)
    return mask
Example #22
0
def gradient_angle(Ix, Iy) :
    bvxm_batch.init_process('vilGradientAngleProcess')
    bvxm_batch.set_input_from_db(0,Ix)
    bvxm_batch.set_input_from_db(1,Iy)
    bvxm_batch.run_process()
    #x image
    (id,type) = bvxm_batch.commit_output(0)
    angleImg = dbvalue(id,type)
    return angleImg
Example #23
0
def image_range(img):
    bvxm_batch.init_process('vilImageRangeProcess')
    bvxm_batch.set_input_from_db(0,img)
    bvxm_batch.run_process()
    (id,type) = bvxm_batch.commit_output(0)
    minVal = bvxm_batch.get_output_float(id)
    (id,type) = bvxm_batch.commit_output(1)
    maxVal = bvxm_batch.get_output_float(id)
    return minVal, maxVal
Example #24
0
def bvxm_truncate_image(img,min_value,max_value):
    bvxm_batch.init_process("vilTruncateImageProcess")
    bvxm_batch.set_input_from_db(0,img)
    bvxm_batch.set_input_float(1,min_value)
    bvxm_batch.set_input_float(2,max_value)
    bvxm_batch.run_process()
    (id,type) = bvxm_batch.commit_output(0)
    img_out = dbvalue(id,type)
    return img_out
Example #25
0
def binary_img_op(img1, img2, operation="sum"):
  bvxm_batch.init_process("vilBinaryImageOpProcess")
  bvxm_batch.set_input_from_db(0,img1)
  bvxm_batch.set_input_from_db(1,img2)
  bvxm_batch.set_input_string(2,operation)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  out = dbvalue(id, type);
  return out
Example #26
0
def combine_planes(img_red, img_green, img_blue):
  bvxm_batch.init_process("vilCombinePlanesProcess");
  bvxm_batch.set_input_from_db(0, img_red);
  bvxm_batch.set_input_from_db(1, img_green);
  bvxm_batch.set_input_from_db(2, img_blue);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  img_out = dbvalue(id, type);
  return img_out;
Example #27
0
def mask_image_using_id(img, id_img, input_id):
  bvxm_batch.init_process("vilMaskImageUsingIDsProcess");
  bvxm_batch.set_input_from_db(0, img);
  bvxm_batch.set_input_from_db(1, id_img);
  bvxm_batch.set_input_unsigned(2, input_id);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  masked_img = dbvalue(id, type);
  return masked_img;
Example #28
0
def undistort_image(img, param_file, iters) :
  bvxm_batch.init_process("vilUndistortImageProcess");
  bvxm_batch.set_input_from_db(0,img)
  bvxm_batch.set_input_string(1, param_file);
  bvxm_batch.set_input_int(2, iters);
  bvxm_batch.run_process();
  (o_id,o_type) = bvxm_batch.commit_output(0);
  out_img = dbvalue(o_id,o_type);
  return out_img;
Example #29
0
def next_frame(rawStream) :
  bvxm_batch.init_process("bilReadFrameProcess")
  bvxm_batch.set_input_from_db(0,rawStream);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  img = dbvalue(id,type);
  #(id, type) = bvxm_batch.commit_output(1);
  #time = bvxm_batch.get_output_unsigned(id);
  return img
Example #30
0
def arf_stream(file_path) :
  bvxm_batch.init_process("bilCreateArfImageIstreamProcess")
  bvxm_batch.set_input_string(0,file_path);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  stream = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  numImgs = bvxm_batch.get_output_int(id);
  return stream, numImgs
Example #31
0
def pixel_wise_roc2(class_img,
                    gt_img,
                    negative_gt_img=None,
                    positive_sign="high",
                    mask_img=None):
    bvxm_batch.init_process("vilPixelwiseRocProcess2")
    bvxm_batch.set_input_from_db(0, class_img)
    bvxm_batch.set_input_from_db(1, gt_img)
    if negative_gt_img:
        bvxm_batch.set_input_from_db(2, negative_gt_img)
    if mask_img:
        bvxm_batch.set_input_from_db(3, mask_img)
    bvxm_batch.set_input_string(4, positive_sign)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        thres_out = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(1)
        tp = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(2)
        tn = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(3)
        fp = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(4)
        fn = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(5)
        tpr = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(6)
        fpr = bvxm_batch.get_bbas_1d_array_float(id)
        return thres_out, tp, tn, fp, fn, tpr, fpr
    else:
        return None, None, None, None, None, None, None
Example #32
0
def create_scene_xml(scene_xml,
                     world_dir,
                     lvcs,
                     lvcs_file,
                     dim_x,
                     dim_y,
                     dim_z,
                     voxel_size=1.0,
                     corner_x=0.0,
                     corner_y=0.0,
                     corner_z=0.0,
                     min_ocp_prob=0.001,
                     max_ocp_prob=0.999,
                     max_scale=1):
    batch.init_process("bvxmCreateSceneXmlProcess")
    batch.set_input_string(0, scene_xml)
    batch.set_input_string(1, world_dir)
    batch.set_input_float(2, corner_x)
    batch.set_input_float(3, corner_y)
    batch.set_input_float(4, corner_z)
    batch.set_input_unsigned(5, dim_x)
    batch.set_input_unsigned(6, dim_y)
    batch.set_input_unsigned(7, dim_z)
    batch.set_input_float(8, voxel_size)
    batch.set_input_from_db(9, lvcs)
    batch.set_input_string(10, lvcs_file)
    batch.set_input_float(11, min_ocp_prob)
    batch.set_input_float(12, max_ocp_prob)
    batch.set_input_unsigned(13, max_scale)
    return batch.run_process()
Example #33
0
def img_registration_by_rmse(src_img,
                             tgr_img,
                             sx,
                             sy,
                             sz=0.0,
                             pixel_res=1.0,
                             invalid_pixel=-9999.0,
                             mask_img=None):
    bvxm_batch.init_process("vilImageRegistrationProcess")
    bvxm_batch.set_input_from_db(0, src_img)
    bvxm_batch.set_input_from_db(1, tgr_img)
    bvxm_batch.set_input_unsigned(2, sx)
    bvxm_batch.set_input_unsigned(3, sy)
    bvxm_batch.set_input_double(4, sz)
    bvxm_batch.set_input_double(5, pixel_res)
    bvxm_batch.set_input_float(6, invalid_pixel)
    if mask_img:
        bvxm_batch.set_input_from_db(7, mask_img)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        trans_x = bvxm_batch.get_output_double(id)
        (id, type) = bvxm_batch.commit_output(1)
        trans_y = bvxm_batch.get_output_double(id)
        (id, type) = bvxm_batch.commit_output(2)
        trans_z = bvxm_batch.get_output_double(id)
        (id, type) = bvxm_batch.commit_output(3)
        rmse_z = bvxm_batch.get_output_double(id)
        (id, type) = bvxm_batch.commit_output(4)
        var_z = bvxm_batch.get_output_double(id)
        return trans_x, trans_y, trans_z, rmse_z, var_z
    else:
        return -1.0, -1.0, -1.0, -1.0, -1.0
Example #34
0
def create_scene_large_scale(roi_kml,
                             scene_root,
                             world_dir,
                             dem_folder,
                             world_size=500.0,
                             voxel_size=1.0,
                             height_diff=120.0,
                             height_sub=25.0,
                             extension=500.0,
                             land_folder=""):
    batch.init_process("bvxmCreateSceneXmlLargeScaleProcess")
    batch.set_input_string(0, roi_kml)
    batch.set_input_string(1, scene_root)
    batch.set_input_string(2, world_dir)
    batch.set_input_string(3, dem_folder)
    batch.set_input_string(4, land_folder)
    batch.set_input_float(5, world_size)
    batch.set_input_float(6, voxel_size)
    batch.set_input_float(7, height_diff)
    batch.set_input_float(8, height_sub)
    batch.set_input_float(9, extension)
    status = batch.run_process()
    if status:
        (id, type) = batch.commit_output(0)
        n_scenes = batch.get_output_unsigned(id)
        batch.remove_data(id)
        return n_scenes
    else:
        return 0
Example #35
0
def update_edges(world,
                 cropped_cam,
                 cropped_edge_image,
                 edge_prob_mask_size=21,
                 edge_prob_mask_sigma=1.0,
                 scale=0):
    batch.init_process("bvxmUpdateEdgesProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_from_db(1, cropped_cam)
    batch.set_input_from_db(2, cropped_edge_image)
    batch.set_input_unsigned(3, 0)
    batch.set_input_int(4, edge_prob_mask_size)
    batch.set_input_float(5, edge_prob_mask_sigma)
    # batch.set_params_process(update_params_xml); #
    # "./bvxmUpdateEdgesProcess.xml");
    batch.run_process()
Example #36
0
def scene_box(scene):
    batch.init_process("bvxmSceneBoxProcess")
    batch.set_input_from_db(0, scene)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    lower_left_lon = batch.get_output_double(id)
    (id, type) = batch.commit_output(1)
    lower_left_lat = batch.get_output_double(id)
    (id, type) = batch.commit_output(2)
    lower_left_elev = batch.get_output_double(id)
    (id, type) = batch.commit_output(3)
    upper_right_lon = batch.get_output_double(id)
    (id, type) = batch.commit_output(4)
    upper_right_lat = batch.get_output_double(id)
    (id, type) = batch.commit_output(5)
    upper_right_elev = batch.get_output_double(id)
    return lower_left_lon, lower_left_lat, lower_left_elev, upper_right_lon, upper_right_lat, upper_right_elev
Example #37
0
def write_scene_kml(scene,
                    kml_filename,
                    is_overwrite=True,
                    r=255,
                    g=255,
                    b=255,
                    a=0,
                    name=""):
    batch.init_process("bvxmSceneKmlProcess")
    batch.set_input_from_db(0, scene)
    batch.set_input_string(1, kml_filename)
    batch.set_input_bool(2, is_overwrite)
    batch.set_input_unsigned(3, r)
    batch.set_input_unsigned(4, g)
    batch.set_input_unsigned(5, b)
    batch.set_input_unsigned(6, a)
    batch.set_input_string(7, name)
    batch.run_process()
Example #38
0
def create_scene(scene_params_xml):
    batch.init_process("bvxmCreateVoxelWorldProcess")
    # "./bvxmCreateVoxelWorldProcess.xml"
    batch.set_params_process(scene_params_xml)
    status = batch.run_process()
    if status != 1:
        raise Exception('Error creating scene from ' + scene_params_xml)
    (world_id, world_type) = batch.commit_output(0)
    world = dbvalue(world_id, world_type)
    return world
Example #39
0
def scene_lvcs(world):
    batch.init_process("bvxmSceneLvcsProcess")
    batch.set_input_from_db(0, world)
    status = batch.run_process()
    if status:
        (id, type) = batch.commit_output(0)
        lvcs = dbvalue(id, type)
        return lvcs
    else:
        return 0
Example #40
0
def scene_local_box(scene):
    batch.init_process("bvxmSceneLocalBoxProcess")
    batch.set_input_from_db(0, scene)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    lower_left_x = batch.get_output_double(id)
    (id, type) = batch.commit_output(1)
    lower_left_y = batch.get_output_double(id)
    (id, type) = batch.commit_output(2)
    upper_right_x = batch.get_output_double(id)
    (id, type) = batch.commit_output(3)
    upper_right_y = batch.get_output_double(id)
    (id, type) = batch.commit_output(4)
    voxel_size = batch.get_output_double(id)
    (id, type) = batch.commit_output(5)
    lower_left_z = batch.get_output_double(id)  # min z
    (id, type) = batch.commit_output(6)
    upper_right_z = batch.get_output_double(id)  # max z
    return lower_left_x, lower_left_y, upper_right_x, upper_right_y, voxel_size, lower_left_z, upper_right_z
Example #41
0
def pixel_wise_roc(cd_img, gt_img, mask_img=None):
    bvxm_batch.init_process("vilPixelwiseRocProcess")
    bvxm_batch.set_input_from_db(0, cd_img)
    bvxm_batch.set_input_from_db(1, gt_img)
    if mask_img:
        bvxm_batch.set_input_from_db(2, mask_img)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    tp = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(1)
    tn = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(2)
    fp = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(3)
    fn = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(6)
    outimg = dbvalue(id, type)
    #return tuple of true positives, true negatives, false positives, etc..
    return (tp, tn, fp, fn, outimg)
Example #42
0
def grey_to_rgb(img, color_txt):
    bvxm_batch.init_process("vilGreyToRGBProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_string(1, color_txt)
    result = bvxm_batch.run_process()
    if result:
        (id, type) = bvxm_batch.commit_output(0)
        outimg = dbvalue(id, type)
    else:
        outimg = 0
    return outimg
Example #43
0
def dilate_image_disk(in_img, disk_size):
    bvxm_batch.init_process("vilImageDilateDiskProcess")
    bvxm_batch.set_input_from_db(0, in_img)
    bvxm_batch.set_input_float(1, disk_size)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        out_img = dbvalue(id, type)
        return out_img
    else:
        return None
Example #44
0
def geo_index_region_poly_resource(geo_index_txt, poly_kml, out_file):
    bvxm_batch.init_process("bvglGeoIndexRegionPolyResourceProcess")
    bvxm_batch.set_input_string(0, geo_index_txt)
    bvxm_batch.set_input_string(1, poly_kml)
    bvxm_batch.set_input_string(2, out_file)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        n_leaves = bvxm_batch.get_output_unsigned(id)
        return n_leaves
    else:
        return 0
Example #45
0
def update_appearance(img,
                      cam,
                      world,
                      app_type,
                      bin_index=0,
                      scale_index=0,
                      use_cache=0):
    batch.init_process("bvxmUpdateProcess")
    batch.set_input_from_db(0, img)
    batch.set_input_from_db(1, cam)
    batch.set_input_from_db(2, world)
    batch.set_input_string(3, app_type)
    # set bin index to be 0 for all images
    batch.set_input_unsigned(4, bin_index)
    batch.set_input_unsigned(5, scale_index)
    batch.set_input_unsigned(6, use_cache)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    density_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    density_mask_img = dbvalue(id, type)
    return density_img, density_mask_img
Example #46
0
def render_exp_image(cam,
                     ni,
                     nj,
                     world,
                     app_model,
                     bin_index=0,
                     scale_index=0):
    batch.init_process("bvxmRenderExpectedImageProcess")
    batch.set_input_from_db(0, cam)
    batch.set_input_unsigned(1, ni)
    batch.set_input_unsigned(2, nj)
    batch.set_input_from_db(3, world)
    batch.set_input_string(4, app_model)
    # set bin index to be 0 for all images
    batch.set_input_unsigned(5, bin_index)
    batch.set_input_unsigned(6, scale_index)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_img = dbvalue(id, type)
    (id, type) = batch.commit_output(1)
    out_conf_img = dbvalue(id, type)
    return out_img, out_conf_img
Example #47
0
def threshold_image_inside(img, min_thres, max_thres, threshold_inside=True):
    bvxm_batch.init_process("vilThresholdImageInsideProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_float(1, min_thres)
    bvxm_batch.set_input_float(2, max_thres)
    bvxm_batch.set_input_bool(3, threshold_inside)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        mask = dbvalue(id, type)
        return mask
    else:
        return None
Example #48
0
def bvxm_load_image_resource(file_path):
    bvxm_batch.init_process("vilLoadImageResourceProcess")
    bvxm_batch.set_input_string(0, file_path)
    status = bvxm_batch.run_process()
    if not status:
        return None, 0, 0
    (id, type) = bvxm_batch.commit_output(0)
    (ni_id, ni_type) = bvxm_batch.commit_output(1)
    (nj_id, nj_type) = bvxm_batch.commit_output(2)
    ni = bvxm_batch.get_output_unsigned(ni_id)
    nj = bvxm_batch.get_output_unsigned(nj_id)
    img = dbvalue(id, type)
    bvxm_batch.remove_data(ni_id)
    bvxm_batch.remove_data(nj_id)
    return img, ni, nj
Example #49
0
def geo_index_region_resource(geo_index_txt, ll_lon, ll_lat, ur_lon, ur_lat,
                              out_file):
    bvxm_batch.init_process("bvglGeoIndexRegionResourceProcess")
    bvxm_batch.set_input_string(0, geo_index_txt)
    bvxm_batch.set_input_double(1, ll_lon)
    bvxm_batch.set_input_double(2, ll_lat)
    bvxm_batch.set_input_double(3, ur_lon)
    bvxm_batch.set_input_double(4, ur_lat)
    bvxm_batch.set_input_string(5, out_file)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        n_leaves = bvxm_batch.get_output_unsigned(id)
        return n_leaves
    else:
        return 0
Example #50
0
def remove_nitf_margin(img_res):
    bvxm_batch.init_process("vilNITFRemoveMarginProcess")
    bvxm_batch.set_input_from_db(0, img_res)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        vi = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(1)
        vj = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(2)
        vni = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(3)
        vnj = bvxm_batch.get_output_unsigned(id)
        return vi, vj, vni, vnj
    else:
        return 0, 0, 0, 0
Example #51
0
def box_2d_intersection(in_kml, out_kml=""):
  bvxm_batch.init_process("bvgl2DBoxIntersectionProcess")
  bvxm_batch.set_input_string(0, in_kml)
  bvxm_batch.set_input_string(1, out_kml)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    ll_lon = bvxm_batch.get_output_double(id)
    (id, type) = bvxm_batch.commit_output(1)
    ll_lat = bvxm_batch.get_output_double(id)
    (id, type) = bvxm_batch.commit_output(2)
    ur_lon = bvxm_batch.get_output_double(id)
    (id, type) = bvxm_batch.commit_output(3)
    ur_lat = bvxm_batch.get_output_double(id)
    return ll_lon, ll_lat, ur_lon, ur_lat
  else:
    return 0.0, 0.0, 0.0, 0.0
Example #52
0
def combine_planes_8_bands(img_coastal, img_blue, img_green, img_yellow,
                           img_red, img_red_edge, img_nir1, img_nir2):
    bvxm_batch.init_process("vilCombinePlanes8BandsProcess")
    bvxm_batch.set_input_from_db(0, img_coastal)
    bvxm_batch.set_input_from_db(1, img_blue)
    bvxm_batch.set_input_from_db(2, img_green)
    bvxm_batch.set_input_from_db(3, img_yellow)
    bvxm_batch.set_input_from_db(4, img_red)
    bvxm_batch.set_input_from_db(5, img_red_edge)
    bvxm_batch.set_input_from_db(6, img_nir1)
    bvxm_batch.set_input_from_db(7, img_nir2)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        out_img = dbvalue(id, type)
        return out_img
    else:
        return 0
Example #53
0
def edge_detection(img,
                   noise_multiplier=1.5,
                   smooth=1.5,
                   auto_threshold=False,
                   junctionp=False,
                   aggressive_junc_closure=False):
    bvxm_batch.init_process("vilEdgeDetectionProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_float(1, noise_multiplier)
    bvxm_batch.set_input_float(2, smooth)
    bvxm_batch.set_input_bool(3, auto_threshold)
    bvxm_batch.set_input_bool(4, junctionp)
    bvxm_batch.set_input_bool(5, aggressive_junc_closure)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        edge_img = dbvalue(id, type)
        return edge_img
    else:
        return 0
Example #54
0
def generate_xyz_from_dem_multi(world,
                                img_folder,
                                geoid_height,
                                fill_in_value=-1.0):
    batch.init_process("bvxmDemToXYZProcess2")
    batch.set_input_from_db(0, world)
    batch.set_input_string(1, img_folder)
    batch.set_input_double(2, geoid_height)
    batch.set_input_float(3, fill_in_value)
    result = batch.run_process()
    if result:
        (xi_id, xi_type) = batch.commit_output(0)
        x_img = dbvalue(xi_id, xi_type)
        (yi_id, yi_type) = batch.commit_output(1)
        y_img = dbvalue(yi_id, yi_type)
        (zi_id, zi_type) = batch.commit_output(2)
        z_img = dbvalue(zi_id, zi_type)
    else:
        x_img = 0
        y_img = 0
        z_img = 0
    return x_img, y_img, z_img
Example #55
0
def roi_init(image_filename,
             cam,
             world,
             roi_init_params_xml,
             is_all_bits=False):
    batch.init_process("bvxmRoiInitProcess")
    batch.set_input_string(0, image_filename)
    batch.set_input_from_db(1, cam)
    batch.set_input_from_db(2, world)
    batch.set_input_bool(3, is_all_bits)
    # "bvxmRoiInitProcess.xml")
    batch.set_params_process(roi_init_params_xml)
    statuscode = batch.run_process()
    if statuscode:
        (cropped_cam_id, cropped_cam_type) = batch.commit_output(0)
        cropped_cam = dbvalue(cropped_cam_id, cropped_cam_type)
        (cropped_image_id, cropped_image_type) = batch.commit_output(1)
        cropped_image = dbvalue(cropped_image_id, cropped_image_type)
        (uncertainty_id, uncertainty_type) = batch.commit_output(2)
        uncertainty = dbvalue(uncertainty_id, uncertainty_type)
        return statuscode, cropped_cam, cropped_image, uncertainty
    else:
        return statuscode, dbvalue(0, ""), dbvalue(0, ""), dbvalue(0, "")
Example #56
0
def create_land_map(world,
                    geo_folder,
                    urban_folder,
                    osm_folder,
                    is_osm_pt,
                    is_osm_region,
                    is_osm_line,
                    is_convert=True):
    batch.init_process("bvxmCreateLandMapProcess")
    batch.set_input_from_db(0, world)
    batch.set_input_string(1, geo_folder)
    batch.set_input_string(2, urban_folder)
    batch.set_input_string(3, osm_folder)
    batch.set_input_bool(4, is_osm_pt)
    batch.set_input_bool(5, is_osm_line)
    batch.set_input_bool(6, is_osm_region)
    batch.set_input_bool(7, is_convert)
    result = batch.run_process()
    if result:
        (img_id, img_type) = batch.commit_output(0)
        land_img = dbvalue(img_id, img_type)
    else:
        land_img = 0
    return land_img
import bvxm_batch
bvxm_batch.register_processes()
bvxm_batch.register_datatypes()


class dbvalue:

    def __init__(self, index, type):
        self.id = index    # unsigned integer
        self.type = type   # string

print("Creating Voxel World")
bvxm_batch.init_process("bvxmCreateVoxelWorldProcess")
bvxm_batch.set_params_process("./bvxmCreateVoxelWorldProcess.xml")
bvxm_batch.run_process()
(world_id, world_type) = bvxm_batch.commit_output(0)
world = dbvalue(world_id, world_type)

lidar_1st_image_original = "C:/test_images/BaghdadLIDAR/dem_1m_a1_baghdad_tile39.tif"
lidar_2nd_image_original = "C:/test_images/BaghdadLIDAR/dem_1m_a2_baghdad_tile39.tif"

bvxm_batch.init_process("bvxmLidarInitProcess")
bvxm_batch.set_input_string(0, lidar_1st_image_original)
bvxm_batch.set_input_string(1, lidar_2nd_image_original)
bvxm_batch.set_input_from_db(2, world)
bvxm_batch.run_process()
(lidar_camera_id, lidar_camera_type) = bvxm_batch.commit_output(0)
lidar_camera = dbvalue(lidar_camera_id, lidar_camera_type)
(lidar_1st_image_id, lidar_1st_image_type) = bvxm_batch.commit_output(1)
lidar_1st_image = dbvalue(lidar_1st_image_id, lidar_1st_image_type)
(lidar_2nd_image_id, lidar_2nd_image_type) = bvxm_batch.commit_output(2)
Example #58
0
def normalize_image(img):
    bvxm_batch.init_process("vilImageNormaliseProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.run_process()
Example #59
0
def bvxm_save_image(img, file_path):
    assert not isinstance(list, tuple)
    bvxm_batch.init_process("vilSaveImageViewProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_string(1, file_path)
    bvxm_batch.run_process()
Example #60
0
def check_scene_poly_overlap(scene, kml_file):
    batch.init_process("bvxmScenePolyOverlapProcess")
    batch.set_input_from_db(0, scene)
    batch.set_input_string(1, kml_file)
    status = batch.run_process()
    return status