Exemplo n.º 1
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
Exemplo n.º 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()
Exemplo n.º 3
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()
Exemplo n.º 4
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
Exemplo n.º 5
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,
                             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)
    status = batch.run_process()
    if status:
        (id, type) = batch.commit_output(0)
        n_scenes = batch.get_output_unsigned(id)
        return n_scenes
    else:
        return 0
Exemplo n.º 6
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
Exemplo n.º 7
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;
Exemplo n.º 8
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
Exemplo n.º 9
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
Exemplo n.º 10
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
Exemplo n.º 11
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;
Exemplo n.º 12
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
Exemplo n.º 13
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
Exemplo n.º 14
0
def bvxm_resize(img, ni, nj, pixel="float"):
    bvxm_batch.init_process("vilResampleProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_int(1, ni)
    bvxm_batch.set_input_int(2, nj)
    bvxm_batch.set_input_string(3, pixel)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    img = dbvalue(id, type)
    return img
Exemplo n.º 15
0
def bvxm_resize(img, ni, nj, pixel="float"):
    bvxm_batch.init_process("vilResampleProcess")
    bvxm_batch.set_input_from_db(0,img)
    bvxm_batch.set_input_int(1, ni)
    bvxm_batch.set_input_int(2, nj)
    bvxm_batch.set_input_string(3, pixel);
    bvxm_batch.run_process()
    (id,type) = bvxm_batch.commit_output(0)
    img = dbvalue(id,type)
    return img
Exemplo n.º 16
0
def bvxm_stretch_image(img, min_value, max_value, output_type_str='float'):
    bvxm_batch.init_process("vilStretchImageProcess")
    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.set_input_string(3,output_type_str)
    bvxm_batch.run_process()
    (id,type) = bvxm_batch.commit_output(0)
    img_out = dbvalue(id,type)
    return img_out
Exemplo n.º 17
0
def bvxm_stretch_image(img, min_value, max_value, output_type_str='float'):
    bvxm_batch.init_process("vilStretchImageProcess")
    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.set_input_string(3, output_type_str)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    img_out = dbvalue(id, type)
    return img_out
Exemplo n.º 18
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()
Exemplo n.º 19
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
Exemplo n.º 20
0
def image_to_vrml_points(out_e_img, out_h_img, output_filename, prob_thres, max_scene_height):
    batch.init_process("bvrmlImageToPointsProcess")
    batch.set_input_from_db(0, out_e_img)
    batch.set_input_from_db(1, out_h_img)
    batch.set_input_string(2, output_filename)
    batch.set_input_float(3, prob_thres)
    batch.set_input_float(4, max_scene_height)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_img = dbvalue(id, type)
    return out_img
Exemplo n.º 21
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
Exemplo n.º 22
0
def image_to_vrml_points(out_e_img, out_h_img, output_filename, prob_thres,
                         max_scene_height):
    batch.init_process("bvrmlImageToPointsProcess")
    batch.set_input_from_db(0, out_e_img)
    batch.set_input_from_db(1, out_h_img)
    batch.set_input_string(2, output_filename)
    batch.set_input_float(3, prob_thres)
    batch.set_input_float(4, max_scene_height)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    out_img = dbvalue(id, type)
    return out_img
Exemplo n.º 23
0
def bae_raw_stream(file_path, ni=0, nj=0, pixelsize=0):
    bvxm_batch.init_process("bilCreateRawImageIstreamProcess")
    bvxm_batch.set_input_string(0, file_path)
    bvxm_batch.set_input_int(1, ni)
    bvxm_batch.set_input_int(2, nj)
    bvxm_batch.set_input_int(3, pixelsize)
    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
Exemplo n.º 24
0
def bae_raw_stream(file_path,ni=0,nj=0,pixelsize=0) :
  bvxm_batch.init_process("bilCreateRawImageIstreamProcess")
  bvxm_batch.set_input_string(0,file_path);
  bvxm_batch.set_input_int(1,ni);
  bvxm_batch.set_input_int(2,nj);
  bvxm_batch.set_input_int(3,pixelsize);
  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
Exemplo n.º 25
0
def bvxm_load_image(file_path):
    bvxm_batch.init_process("vilLoadImageViewProcess")
    bvxm_batch.set_input_string(0, file_path)
    bvxm_batch.run_process()
    (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
Exemplo n.º 26
0
def bvxm_load_image(file_path) :
  bvxm_batch.init_process("vilLoadImageViewProcess");
  bvxm_batch.set_input_string(0, file_path);
  bvxm_batch.run_process();
  (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;
Exemplo n.º 27
0
def bvxm_load_image_resource(file_path) :
  bvxm_batch.init_process("vilLoadImageResourceProcess");
  bvxm_batch.set_input_string(0, file_path);
  bvxm_batch.run_process();
  (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;
Exemplo n.º 28
0
def bvxm_load_image_resource(file_path):
    bvxm_batch.init_process("vilLoadImageResourceProcess")
    bvxm_batch.set_input_string(0, file_path)
    bvxm_batch.run_process()
    (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
Exemplo n.º 29
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
Exemplo n.º 30
0
def nitf_date_time(image_filename):
  bvxm_batch.init_process("vilNITFDateTimeProcess");
  bvxm_batch.set_input_string(0,image_filename);
  bvxm_batch.run_process();
  (id,type)=bvxm_batch.commit_output(0);
  year =  bvxm_batch.get_output_int(id);
  (id,type)=bvxm_batch.commit_output(1);
  month =  bvxm_batch.get_output_int(id);
  (id,type)=bvxm_batch.commit_output(2);
  day =  bvxm_batch.get_output_int(id);
  (id,type)=bvxm_batch.commit_output(3);
  hour = bvxm_batch.get_output_int(id);
  (id,type)=bvxm_batch.commit_output(4);
  minute = bvxm_batch.get_output_int(id);
  return year, month, day, hour, minute
Exemplo n.º 31
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
Exemplo n.º 32
0
def bvxm_load_image(file_path):
    bvxm_batch.init_process("vilLoadImageViewProcess")
    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
Exemplo n.º 33
0
def nitf_date_time(image_filename):
    bvxm_batch.init_process("vilNITFDateTimeProcess")
    bvxm_batch.set_input_string(0, image_filename)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    year = bvxm_batch.get_output_int(id)
    (id, type) = bvxm_batch.commit_output(1)
    month = bvxm_batch.get_output_int(id)
    (id, type) = bvxm_batch.commit_output(2)
    day = bvxm_batch.get_output_int(id)
    (id, type) = bvxm_batch.commit_output(3)
    hour = bvxm_batch.get_output_int(id)
    (id, type) = bvxm_batch.commit_output(4)
    minute = bvxm_batch.get_output_int(id)
    return year, month, day, hour, minute
Exemplo n.º 34
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
Exemplo n.º 35
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
Exemplo n.º 36
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
Exemplo n.º 37
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
Exemplo n.º 38
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, 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)
    status = batch.run_process()
    if status:
        (id, type) = batch.commit_output(0)
        n_scenes = batch.get_output_unsigned(id)
        return n_scenes
    else:
        return 0
Exemplo n.º 39
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()
Exemplo n.º 40
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, "")
Exemplo n.º 41
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
Exemplo n.º 42
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();
Exemplo n.º 43
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()
Exemplo n.º 44
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()
Exemplo n.º 45
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
Exemplo n.º 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
Exemplo n.º 47
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
Exemplo n.º 48
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, "")
Exemplo n.º 49
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
Exemplo n.º 50
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
Exemplo n.º 51
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
Exemplo n.º 52
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()
Exemplo n.º 53
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
Exemplo n.º 54
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()
j_arr[1] = 0.3
j_arr[2] = 0.5
j_arr[3] = 0.7
j_arr[4] = 0.9

for i in range(0, len(image_fnames), 1):
    print(str(i))

    image_filename = image_fnames[i]
    image_filename = image_filename[:-1]

    if i < num_cam:
        cam_name = cam_fnames[i]
        cam_name = cam_name[:-1]
        bvxm_batch.init_process("LoadRationalCameraProcess")
        bvxm_batch.set_input_string(0, cam_name)
        bvxm_batch.run_process()
        orig_cam_id = bvxm_batch.commit_output(0)
    else:
        bvxm_batch.init_process("LoadRationalCameraNITFProcess")
        bvxm_batch.set_input_string(0, image_filename)
        bvxm_batch.run_process()
        orig_cam_id = bvxm_batch.commit_output(0)

    # get a roi from the image
    bvxm_batch.init_process("bvxmRoiInitProcess")
    bvxm_batch.set_input_string(0, image_filename)
    bvxm_batch.set_input_from_db(1, orig_cam_id)
    bvxm_batch.set_input_from_db(2, voxel_world_id)
    bvxm_batch.set_params_process("./roi_params.xml")
    statuscode = bvxm_batch.run_process()
Exemplo n.º 56
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
    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)
lidar_2nd_image = dbvalue(lidar_2nd_image_id, lidar_2nd_image_type)
(lidar_mask_image_id, lidar_mask_image_type) = bvxm_batch.commit_output(3)
lidar_mask_image = dbvalue(lidar_mask_image_id, lidar_mask_image_type)

bvxm_batch.init_process("bvxmLidarEdgeDetectionProcess")
bvxm_batch.set_input_from_db(0, lidar_1st_image)
bvxm_batch.set_input_from_db(1, lidar_2nd_image)
Exemplo n.º 58
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();