Exemple #1
0
def rational_cam_img_to_global(camera,
                               i,
                               j,
                               init_lon=-1.0,
                               init_lat=-1.0,
                               init_elev=-1.0,
                               pl_elev=-1.0,
                               error_tol=0.05):
    bvxm_batch.init_process("vpglRationalImgToGlobalProcess")
    bvxm_batch.set_input_from_db(0, camera)
    bvxm_batch.set_input_unsigned(1, i)
    bvxm_batch.set_input_unsigned(2, j)
    bvxm_batch.set_input_double(3, init_lon)
    bvxm_batch.set_input_double(4, init_lat)
    bvxm_batch.set_input_double(5, init_elev)
    bvxm_batch.set_input_double(6, pl_elev)
    bvxm_batch.set_input_double(7, error_tol)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        lon = bvxm_batch.get_output_double(id)
        (id, type) = bvxm_batch.commit_output(1)
        lat = bvxm_batch.get_output_double(id)
        (id, type) = bvxm_batch.commit_output(2)
        elev = bvxm_batch.get_output_double(id)
        return lon, lat, elev
    else:
        return -1.0, -1.0, -1.0
Exemple #2
0
def affine_rectify_images(img1,
                          affine_cam1,
                          img2,
                          affine_cam2,
                          min_x,
                          min_y,
                          min_z,
                          max_x,
                          max_y,
                          max_z,
                          n_points=100):
    bvxm_batch.init_process("vpglAffineRectifyImagesProcess")
    bvxm_batch.set_input_from_db(0, img1)
    bvxm_batch.set_input_from_db(1, affine_cam1)
    bvxm_batch.set_input_from_db(2, img2)
    bvxm_batch.set_input_from_db(3, affine_cam2)
    bvxm_batch.set_input_double(4, min_x)
    bvxm_batch.set_input_double(5, min_y)
    bvxm_batch.set_input_double(6, min_z)
    bvxm_batch.set_input_double(7, max_x)
    bvxm_batch.set_input_double(8, max_y)
    bvxm_batch.set_input_double(9, max_z)
    bvxm_batch.set_input_unsigned(10, n_points)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_img1 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_cam1 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(2)
    out_img2 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(3)
    out_cam2 = dbvalue(id, type)
    return out_img1, out_cam1, out_img2, out_cam2
Exemple #3
0
def test_classifier_clouds2(tclsf,
                            dictionary_name,
                            image_resource,
                            i,
                            j,
                            width,
                            height,
                            block_size,
                            percent_cat_name,
                            category_id_file=""):
    bvxm_batch.init_process("sdetTextureClassifySatelliteCloudsProcess2")
    bvxm_batch.set_input_from_db(0, tclsf)
    bvxm_batch.set_input_string(1, dictionary_name)
    bvxm_batch.set_input_from_db(2, image_resource)
    bvxm_batch.set_input_unsigned(3, i)
    bvxm_batch.set_input_unsigned(4, j)
    bvxm_batch.set_input_unsigned(5, width)
    bvxm_batch.set_input_unsigned(6, height)
    bvxm_batch.set_input_unsigned(7, block_size)
    bvxm_batch.set_input_string(8, category_id_file)
    bvxm_batch.set_input_string(9, percent_cat_name)
    status = bvxm_batch.run_process()
    if status:
        (out_id, out_type) = bvxm_batch.commit_output(0)
        out_crop = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(1)
        out_id_map = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(2)
        out_rgb_map = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(3)
        percent = bvxm_batch.get_output_float(out_id)
        bvxm_batch.remove_data(out_id)
        return out_crop, out_id_map, out_rgb_map, percent
    else:
        return 0, 0, 0, 100
Exemple #4
0
def rpc_registration(world,
                     cropped_cam,
                     cropped_edge_image,
                     uncertainty,
                     shift_3d_flag=0,
                     scale=0,
                     is_uncertainty_float=0):
    bvxm_batch.init_process("bvxmRpcRegistrationProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_from_db(1, cropped_cam)
    bvxm_batch.set_input_from_db(2, cropped_edge_image)
    bvxm_batch.set_input_bool(3, shift_3d_flag)
    if is_uncertainty_float == 1:
        print "uncertainty = ", uncertainty
        bvxm_batch.set_input_float(4, uncertainty)
    else:
        bvxm_batch.set_input_from_db(4, uncertainty)
    bvxm_batch.set_input_unsigned(5, scale)
    bvxm_batch.run_process()
    (cam_id, cam_type) = bvxm_batch.commit_output(0)
    cam = dbvalue(cam_id, cam_type)
    (expected_edge_image_id,
     expected_edge_image_type) = bvxm_batch.commit_output(1)
    expected_edge_image = dbvalue(expected_edge_image_id,
                                  expected_edge_image_type)
    (offset_u_id, offset_u_type) = bvxm_batch.commit_output(2)
    offset_u = bvxm_batch.get_output_double(offset_u_id)
    (offset_v_id, offset_v_type) = bvxm_batch.commit_output(3)
    offset_v = bvxm_batch.get_output_double(offset_v_id)
    return cam, expected_edge_image, offset_u, offset_v
Exemple #5
0
def save_occupancy_raw(world, filename, app_model, scale=0):
  bvxm_batch.init_process("bvxmSaveOccupancyRawProcess");
  bvxm_batch.set_input_from_db(0,world);
  bvxm_batch.set_input_string(1,filename);
  bvxm_batch.set_input_unsigned(2, scale);
  bvxm_batch.set_input_string(3, app_model);
  bvxm_batch.run_process();
Exemple #6
0
def affine_rectify_images2(img1, affine_cam1, local_rational_cam1, img2, affine_cam2, local_rational_cam2, min_x, min_y, min_z, max_x, max_y, max_z, output_path_H1, output_path_H2, local_ground_plane_height = 5, n_points=100):
  bvxm_batch.init_process("vpglAffineRectifyImagesProcess2");
  bvxm_batch.set_input_from_db(0, img1);
  bvxm_batch.set_input_from_db(1, affine_cam1);
  bvxm_batch.set_input_from_db(2, local_rational_cam1);
  bvxm_batch.set_input_from_db(3, img2);
  bvxm_batch.set_input_from_db(4, affine_cam2);
  bvxm_batch.set_input_from_db(5, local_rational_cam2);
  bvxm_batch.set_input_double(6, min_x);
  bvxm_batch.set_input_double(7, min_y);
  bvxm_batch.set_input_double(8, min_z);
  bvxm_batch.set_input_double(9, max_x);
  bvxm_batch.set_input_double(10, max_y);
  bvxm_batch.set_input_double(11, max_z);
  bvxm_batch.set_input_unsigned(12, n_points);
  bvxm_batch.set_input_double(13, local_ground_plane_height);
  bvxm_batch.set_input_string(14, output_path_H1);
  bvxm_batch.set_input_string(15, output_path_H2);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  out_img1 = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  out_cam1 = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(2);
  out_img2 = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(3);
  out_cam2 = dbvalue(id, type);
  return out_img1, out_cam1, out_img2, out_cam2
Exemple #7
0
def affine_rectify_images2(img1, affine_cam1, local_rational_cam1, img2, affine_cam2, local_rational_cam2, min_x, min_y, min_z, max_x, max_y, max_z, output_path_H1, output_path_H2, local_ground_plane_height=5, n_points=100):
    bvxm_batch.init_process("vpglAffineRectifyImagesProcess2")
    bvxm_batch.set_input_from_db(0, img1)
    bvxm_batch.set_input_from_db(1, affine_cam1)
    bvxm_batch.set_input_from_db(2, local_rational_cam1)
    bvxm_batch.set_input_from_db(3, img2)
    bvxm_batch.set_input_from_db(4, affine_cam2)
    bvxm_batch.set_input_from_db(5, local_rational_cam2)
    bvxm_batch.set_input_double(6, min_x)
    bvxm_batch.set_input_double(7, min_y)
    bvxm_batch.set_input_double(8, min_z)
    bvxm_batch.set_input_double(9, max_x)
    bvxm_batch.set_input_double(10, max_y)
    bvxm_batch.set_input_double(11, max_z)
    bvxm_batch.set_input_unsigned(12, n_points)
    bvxm_batch.set_input_double(13, local_ground_plane_height)
    bvxm_batch.set_input_string(14, output_path_H1)
    bvxm_batch.set_input_string(15, output_path_H2)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_img1 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_cam1 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(2)
    out_img2 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(3)
    out_cam2 = dbvalue(id, type)
    return out_img1, out_cam1, out_img2, out_cam2
Exemple #8
0
def add_to_filter_bank(tclsf, img_name, plane, filter_folder):
  bvxm_batch.init_process("sdetAddtoFilterBankProcess");
  bvxm_batch.set_input_from_db(0,tclsf);      # classifier instance
  bvxm_batch.set_input_string(1,img_name);
  bvxm_batch.set_input_unsigned(2,plane);  ## pass which plane to extract the gauss response from
  bvxm_batch.set_input_string(3,filter_folder);
  bvxm_batch.run_process();
Exemple #9
0
def interpolate_perspective_cameras(cam0, cam1, ncams, outdir):
    bvxm_batch.init_process("vpglInterpolatePerspectiveCamerasProcess")
    bvxm_batch.set_input_from_db(0, cam0)
    bvxm_batch.set_input_from_db(1, cam1)
    bvxm_batch.set_input_unsigned(2, ncams)
    bvxm_batch.set_input_string(3, outdir)
    return bvxm_batch.run_process()
Exemple #10
0
def interpolate_perspective_cameras(cam0,cam1,ncams,outdir):
    bvxm_batch.init_process("vpglInterpolatePerspectiveCamerasProcess");
    bvxm_batch.set_input_from_db(0, cam0);
    bvxm_batch.set_input_from_db(1, cam1);
    bvxm_batch.set_input_unsigned(2, ncams);
    bvxm_batch.set_input_string(3, outdir);
    return bvxm_batch.run_process();
def test_classifier_clouds2(tclsf, dictionary_name, image_resource, i, j, width, height, block_size, percent_cat_name, category_id_file=""):
    bvxm_batch.init_process("sdetTextureClassifySatelliteCloudsProcess2")
    bvxm_batch.set_input_from_db(0, tclsf)
    bvxm_batch.set_input_string(1, dictionary_name)
    bvxm_batch.set_input_from_db(2, image_resource)
    bvxm_batch.set_input_unsigned(3, i)
    bvxm_batch.set_input_unsigned(4, j)
    bvxm_batch.set_input_unsigned(5, width)
    bvxm_batch.set_input_unsigned(6, height)
    bvxm_batch.set_input_unsigned(7, block_size)
    bvxm_batch.set_input_string(8, category_id_file)
    bvxm_batch.set_input_string(9, percent_cat_name)
    status = bvxm_batch.run_process()
    if status:
        (out_id, out_type) = bvxm_batch.commit_output(0)
        out_crop = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(1)
        out_id_map = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(2)
        out_rgb_map = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(3)
        percent = bvxm_batch.get_output_float(out_id)
        bvxm_batch.remove_data(out_id)
        return out_crop, out_id_map, out_rgb_map, percent
    else:
        return 0, 0, 0, 100
Exemple #12
0
def save_occupancy_raw(world, filename, app_model, scale=0):
    bvxm_batch.init_process("bvxmSaveOccupancyRawProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_string(1, filename)
    bvxm_batch.set_input_unsigned(2, scale)
    bvxm_batch.set_input_string(3, app_model)
    bvxm_batch.run_process()
Exemple #13
0
def generate_ndsm(land_geocam,
                  land_img_file,
                  geo_index_txt,
                  h_map_folder,
                  ground_txt,
                  dem_folder,
                  max_h_limit=254.0,
                  window_size=30):
    bvxm_batch.init_process("volmNdsmGenearationProcess")
    bvxm_batch.set_input_from_db(0, land_geocam)
    bvxm_batch.set_input_string(1, land_img_file)
    bvxm_batch.set_input_string(2, geo_index_txt)
    bvxm_batch.set_input_string(3, h_map_folder)
    bvxm_batch.set_input_unsigned(4, window_size)
    bvxm_batch.set_input_float(5, max_h_limit)
    bvxm_batch.set_input_string(6, ground_txt)
    bvxm_batch.set_input_string(7, dem_folder)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        out_ndsm = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(1)
        out_dsm = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(2)
        out_cam = dbvalue(id, type)
        return out_ndsm, out_dsm, out_cam
    else:
        return None, None, None
def add_to_filter_bank(tclsf, img_name, plane, filter_folder, is_gauss_smooth = True):
  bvxm_batch.init_process("sdetAddtoFilterBankProcess");
  bvxm_batch.set_input_from_db(0,tclsf);      # classifier instance
  bvxm_batch.set_input_string(1,img_name);
  bvxm_batch.set_input_unsigned(2,plane);  ## pass which plane to extract the gauss response from
  bvxm_batch.set_input_string(3,filter_folder);
  bvxm_batch.set_input_bool(4,is_gauss_smooth)
  bvxm_batch.run_process();
Exemple #15
0
def update_edges(world, cropped_cam, cropped_edge_image, update_params_xml, scale=0):
  bvxm_batch.init_process("bvxmUpdateEdgesProcess");
  bvxm_batch.set_input_from_db(0,world);
  bvxm_batch.set_input_from_db(1,cropped_cam);
  bvxm_batch.set_input_from_db(2,cropped_edge_image);
  bvxm_batch.set_input_unsigned(3,0);
  bvxm_batch.set_params_process(update_params_xml); # "./bvxmUpdateEdgesProcess.xml");
  bvxm_batch.run_process();
Exemple #16
0
def generate_height_map_from_ply(ply_folder, ni, nj):
    bvxm_batch.init_process("volmGenerateHeightMapFromPlyProcess")
    bvxm_batch.set_input_string(0, ply_folder)
    bvxm_batch.set_input_unsigned(1, ni)
    bvxm_batch.set_input_unsigned(2, nj)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out = dbvalue(id, type)
    return out
Exemple #17
0
def load_geotiff_cam2(filename, ni, nj):
    bvxm_batch.init_process("vpglLoadGeoCameraProcess2")
    bvxm_batch.set_input_string(0, filename)
    bvxm_batch.set_input_unsigned(1, ni)
    bvxm_batch.set_input_unsigned(2, nj)
    bvxm_batch.run_process()
    (c_id, c_type) = bvxm_batch.commit_output(0)
    cam = dbvalue(c_id, c_type)
    return cam
Exemple #18
0
def add_to_filter_bank(tclsf, img_name, plane, filter_folder, filter_name, is_gauss_smooth = True):
  bvxm_batch.init_process("sdetAddtoFilterBankProcess");
  bvxm_batch.set_input_from_db(0,tclsf);      # classifier instance
  bvxm_batch.set_input_string(1,img_name);
  bvxm_batch.set_input_unsigned(2,plane);  ## pass which plane to extract the gauss response from
  bvxm_batch.set_input_string(3,filter_folder);
  bvxm_batch.set_input_string(4,filter_name);  ## pass a unique name to be used to write to filter_folder
  bvxm_batch.set_input_bool(5,is_gauss_smooth)
  bvxm_batch.run_process();
Exemple #19
0
def generate_height_map_from_ply(ply_folder, ni, nj):
  bvxm_batch.init_process("volmGenerateHeightMapFromPlyProcess")
  bvxm_batch.set_input_string(0, ply_folder);
  bvxm_batch.set_input_unsigned(1, ni);
  bvxm_batch.set_input_unsigned(2, nj);
  bvxm_batch.run_process()
  (id, type) = bvxm_batch.commit_output(0);
  out = dbvalue(id, type);
  return out
Exemple #20
0
def load_geotiff_cam2(filename, ni, nj):
    bvxm_batch.init_process("vpglLoadGeoCameraProcess2");
    bvxm_batch.set_input_string(0, filename);
    bvxm_batch.set_input_unsigned(1, ni);
    bvxm_batch.set_input_unsigned(2, nj);
    bvxm_batch.run_process();
    (c_id,c_type) = bvxm_batch.commit_output(0);
    cam = dbvalue(c_id,c_type);
    return cam;
Exemple #21
0
def render_height_map_with_cam(world, input_cam, ni, nj):
  bvxm_batch.init_process("bvxmHeightmapProcess");
  bvxm_batch.set_input_from_db(0,input_cam);
  bvxm_batch.set_input_unsigned(1,ni);
  bvxm_batch.set_input_unsigned(2,nj);
  bvxm_batch.set_input_from_db(3,world);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  out_d_img = dbvalue(id, type);
  return out_d_img
def render_height_map_with_cam(world, input_cam, ni, nj):
    bvxm_batch.init_process("bvxmHeightmapProcess")
    bvxm_batch.set_input_from_db(0, input_cam)
    bvxm_batch.set_input_unsigned(1, ni)
    bvxm_batch.set_input_unsigned(2, nj)
    bvxm_batch.set_input_from_db(3, world)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_d_img = dbvalue(id, type)
    return out_d_img
Exemple #23
0
def update_edges(world, cropped_cam, cropped_edge_image, edge_prob_mask_size=21, edge_prob_mask_sigma=1.0, scale=0):
  bvxm_batch.init_process("bvxmUpdateEdgesProcess");
  bvxm_batch.set_input_from_db(0,world);
  bvxm_batch.set_input_from_db(1,cropped_cam);
  bvxm_batch.set_input_from_db(2,cropped_edge_image);
  bvxm_batch.set_input_unsigned(3,0);
  bvxm_batch.set_input_int(4, edge_prob_mask_size)
  bvxm_batch.set_input_float(5, edge_prob_mask_sigma)
#   bvxm_batch.set_params_process(update_params_xml); # "./bvxmUpdateEdgesProcess.xml");
  bvxm_batch.run_process();
Exemple #24
0
def render_uncertainty_img(input_cam, ni, nj, world):
    bvxm_batch.init_process("bvxmUncertaintyProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_from_db(1, input_cam)
    bvxm_batch.set_input_unsigned(2, ni)
    bvxm_batch.set_input_unsigned(3, nj)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_img = dbvalue(id, type)
    return out_img
Exemple #25
0
def render_uncertainty_img(input_cam, ni, nj, world):
    bvxm_batch.init_process("bvxmUncertaintyProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_from_db(1, input_cam)
    bvxm_batch.set_input_unsigned(2, ni)
    bvxm_batch.set_input_unsigned(3, nj)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_img = dbvalue(id, type)
    return out_img
Exemple #26
0
def convert_reflectance_to_digital_count(reflectance_image, metadata, atmospheric_params, normalize_0_1 = False, max_digital_count = 2047):
  bvxm_batch.init_process("bradConvertReflectanceToDigitalCountProcess")
  bvxm_batch.set_input_from_db(0,reflectance_image)
  bvxm_batch.set_input_from_db(1,metadata)
  bvxm_batch.set_input_from_db(2,atmospheric_params)
  bvxm_batch.set_input_bool(3,normalize_0_1)
  bvxm_batch.set_input_unsigned(4,max_digital_count)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  output_img = dbvalue(id,type)
  return output_img
Exemple #27
0
def render_height_map_with_cam(world, input_cam, ni, nj, is_negate=False):
    bvxm_batch.init_process("bvxmHeightmapProcess")
    bvxm_batch.set_input_from_db(0, input_cam)
    bvxm_batch.set_input_unsigned(1, ni)
    bvxm_batch.set_input_unsigned(2, nj)
    bvxm_batch.set_input_from_db(3, world)
    bvxm_batch.set_input_bool(4, is_negate)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_d_img = dbvalue(id, type)
    return out_d_img
Exemple #28
0
def load_geotiff_cam(tfw_filename, lvcs=0, utm_zone=0, utm_hemisphere=0):
    bvxm_batch.init_process("vpglLoadGeoCameraProcess")
    bvxm_batch.set_input_string(0, tfw_filename)
    if lvcs != 0:
        bvxm_batch.set_input_from_db(1, lvcs)
    bvxm_batch.set_input_int(2, utm_zone)
    bvxm_batch.set_input_unsigned(3, utm_hemisphere)
    bvxm_batch.run_process()
    (c_id, c_type) = bvxm_batch.commit_output(0)
    cam = dbvalue(c_id, c_type)
    return cam
Exemple #29
0
def load_geotiff_cam(tfw_filename, lvcs=0, utm_zone=0, utm_hemisphere=0):
    bvxm_batch.init_process("vpglLoadGeoCameraProcess");
    bvxm_batch.set_input_string(0, tfw_filename);
    if lvcs != 0:
      bvxm_batch.set_input_from_db(1, lvcs);
    bvxm_batch.set_input_int(2, utm_zone);
    bvxm_batch.set_input_unsigned(3, utm_hemisphere);
    bvxm_batch.run_process();
    (c_id,c_type) = bvxm_batch.commit_output(0);
    cam = dbvalue(c_id,c_type);
    return cam;
Exemple #30
0
def convert_reflectance_to_digital_count(reflectance_image, metadata, atmospheric_params, normalize_0_1 = False, max_digital_count = 2047):
  bvxm_batch.init_process("bradConvertReflectanceToDigitalCountProcess")
  bvxm_batch.set_input_from_db(0,reflectance_image)
  bvxm_batch.set_input_from_db(1,metadata)
  bvxm_batch.set_input_from_db(2,atmospheric_params)
  bvxm_batch.set_input_bool(3,normalize_0_1)
  bvxm_batch.set_input_unsigned(4,max_digital_count)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  output_img = dbvalue(id,type)
  return output_img
Exemple #31
0
def render_height_map_expected_with_cam(world, input_cam, ni, nj):
    bvxm_batch.init_process("bvxmHeightmapExpectedProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_from_db(1, input_cam)
    bvxm_batch.set_input_unsigned(2, ni)
    bvxm_batch.set_input_unsigned(3, nj)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_h_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_var_img = dbvalue(id, type)
    return out_h_img, out_var_img
Exemple #32
0
def render_height_map_expected_with_cam(world, input_cam, ni, nj):
    bvxm_batch.init_process("bvxmHeightmapExpectedProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_from_db(1, input_cam)
    bvxm_batch.set_input_unsigned(2, ni)
    bvxm_batch.set_input_unsigned(3, nj)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_h_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_var_img = dbvalue(id, type)
    return out_h_img, out_var_img
def update_edges(world,
                 cropped_cam,
                 cropped_edge_image,
                 update_params_xml,
                 scale=0):
    bvxm_batch.init_process("bvxmUpdateEdgesProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_from_db(1, cropped_cam)
    bvxm_batch.set_input_from_db(2, cropped_edge_image)
    bvxm_batch.set_input_unsigned(3, 0)
    bvxm_batch.set_params_process(update_params_xml)
    # "./bvxmUpdateEdgesProcess.xml");
    bvxm_batch.run_process()
def test_classifier(tclsf, block_size, category_id_file=""):
  bvxm_batch.init_process("sdetTextureClassifierProcess2");
  bvxm_batch.set_input_from_db(0, tclsf);
  bvxm_batch.set_input_unsigned(1, block_size);
  bvxm_batch.set_input_string(2, category_id_file);
  bvxm_batch.run_process();
  (out_id, out_type)=bvxm_batch.commit_output(0);
  out = dbvalue(out_id, out_type);
  (out_id, out_type)=bvxm_batch.commit_output(1);
  out_color = dbvalue(out_id, out_type);
  (out_id, out_type)=bvxm_batch.commit_output(2);
  out_id = dbvalue(out_id, out_type);
  return out, out_color, out_id
Exemple #35
0
def geo_cam_img_to_global(geocam, i, j):
    bvxm_batch.init_process("vpglGeoImgToGlobalProcess")
    bvxm_batch.set_input_from_db(0, geocam)
    bvxm_batch.set_input_unsigned(1, i)
    bvxm_batch.set_input_unsigned(2, j)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        lon = bvxm_batch.get_output_double(id)
        (id, type) = bvxm_batch.commit_output(1)
        lat = bvxm_batch.get_output_double(id)
        return lon, lat
    else:
        return 0.0, 0.0
Exemple #36
0
def compute_affine_from_local_rational(cropped_cam, min_x, min_y, min_z, max_x, max_y, max_z, n_points=100):
    bvxm_batch.init_process("vpglComputeAffineFromRationalProcess")
    bvxm_batch.set_input_from_db(0, cropped_cam)
    bvxm_batch.set_input_double(1, min_x)
    bvxm_batch.set_input_double(2, min_y)
    bvxm_batch.set_input_double(3, min_z)
    bvxm_batch.set_input_double(4, max_x)
    bvxm_batch.set_input_double(5, max_y)
    bvxm_batch.set_input_double(6, max_z)
    bvxm_batch.set_input_unsigned(7, n_points)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_cam = dbvalue(id, type)
    return out_cam
Exemple #37
0
def compute_affine_from_local_rational(cropped_cam, min_x, min_y, min_z, max_x, max_y, max_z, n_points=100):
    bvxm_batch.init_process("vpglComputeAffineFromRationalProcess");
    bvxm_batch.set_input_from_db(0, cropped_cam);
    bvxm_batch.set_input_double(1, min_x);
    bvxm_batch.set_input_double(2, min_y);
    bvxm_batch.set_input_double(3, min_z);
    bvxm_batch.set_input_double(4, max_x);
    bvxm_batch.set_input_double(5, max_y);
    bvxm_batch.set_input_double(6, max_z);
    bvxm_batch.set_input_unsigned(7, n_points);
    bvxm_batch.run_process();
    (id, type) = bvxm_batch.commit_output(0);
    out_cam = dbvalue(id, type);
    return out_cam
Exemple #38
0
def classify_image(eig, h_no, h_atmos, input_image_filename, tile_ni, tile_nj):
  bvxm_batch.init_process("bradClassifyImageProcess");
  bvxm_batch.set_input_from_db(0, eig);
  bvxm_batch.set_input_from_db(1, h_no);
  bvxm_batch.set_input_from_db(2, h_atmos);
  bvxm_batch.set_input_string(3, input_image_filename);
  bvxm_batch.set_input_unsigned(4, tile_ni);
  bvxm_batch.set_input_unsigned(5, tile_nj);
  bvxm_batch.run_process();
  (vid, vtype) = bvxm_batch.commit_output(0);
  q_img = dbvalue(vid, vtype);
  (vid, vtype) = bvxm_batch.commit_output(1);
  q_img_orig_size = dbvalue(vid, vtype);
  return q_img, q_img_orig_size
Exemple #39
0
def geo_cam_img_to_global(geocam, i, j):
    bvxm_batch.init_process("vpglGeoImgToGlobalProcess")
    bvxm_batch.set_input_from_db(0, geocam)
    bvxm_batch.set_input_unsigned(1, i)
    bvxm_batch.set_input_unsigned(2, j)
    status = bvxm_batch.run_process()
    if status:
      (id, type) = bvxm_batch.commit_output(0)
      lon = bvxm_batch.get_output_double(id)
      (id, type) = bvxm_batch.commit_output(1)
      lat = bvxm_batch.get_output_double(id)
      return lon, lat
    else:
      return 0.0, 0.0
Exemple #40
0
def image_mutual_info(image1, image2, min_val, max_val, n_bins):
    bvxm_batch.init_process("bripImageMutualInfoProcess")
    bvxm_batch.set_input_from_db(0, image1)
    bvxm_batch.set_input_from_db(1, image2)
    bvxm_batch.set_input_double(2, min_val)
    bvxm_batch.set_input_double(3, max_val)
    bvxm_batch.set_input_unsigned(4, n_bins)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        mutual_info = bvxm_batch.get_output_double(id)
        return mutual_info
    else:
        return -1.0
Exemple #41
0
def classify_image(eig, h_no, h_atmos, input_image_filename, tile_ni, tile_nj):
    bvxm_batch.init_process("bradClassifyImageProcess")
    bvxm_batch.set_input_from_db(0, eig)
    bvxm_batch.set_input_from_db(1, h_no)
    bvxm_batch.set_input_from_db(2, h_atmos)
    bvxm_batch.set_input_string(3, input_image_filename)
    bvxm_batch.set_input_unsigned(4, tile_ni)
    bvxm_batch.set_input_unsigned(5, tile_nj)
    bvxm_batch.run_process()
    (vid, vtype) = bvxm_batch.commit_output(0)
    q_img = dbvalue(vid, vtype)
    (vid, vtype) = bvxm_batch.commit_output(1)
    q_img_orig_size = dbvalue(vid, vtype)
    return q_img, q_img_orig_size
Exemple #42
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):
    bvxm_batch.init_process("bvxmCreateSceneXmlProcess")
    bvxm_batch.set_input_string(0, scene_xml)
    bvxm_batch.set_input_string(1, world_dir)
    bvxm_batch.set_input_float(2, corner_x)
    bvxm_batch.set_input_float(3, corner_y)
    bvxm_batch.set_input_float(4, corner_z)
    bvxm_batch.set_input_unsigned(5, dim_x)
    bvxm_batch.set_input_unsigned(6, dim_y)
    bvxm_batch.set_input_unsigned(7, dim_z)
    bvxm_batch.set_input_float(8, voxel_size)
    bvxm_batch.set_input_from_db(9, lvcs)
    bvxm_batch.set_input_string(10, lvcs_file)
    bvxm_batch.set_input_float(11, min_ocp_prob)
    bvxm_batch.set_input_float(12, max_ocp_prob)
    bvxm_batch.set_input_unsigned(13, max_scale)
    return bvxm_batch.run_process()
Exemple #43
0
def image_mutual_info(image1, image2, min_val, max_val, n_bins):
    bvxm_batch.init_process("bripImageMutualInfoProcess")
    bvxm_batch.set_input_from_db(0, image1)
    bvxm_batch.set_input_from_db(1, image2)
    bvxm_batch.set_input_double(2, min_val)
    bvxm_batch.set_input_double(3, max_val)
    bvxm_batch.set_input_unsigned(4, n_bins)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        mutual_info = bvxm_batch.get_output_double(id)
        return mutual_info
    else:
        return -1.0
Exemple #44
0
def render_ortho_edgemap(world, scale=0):
  print("Rendering ortho edge map");
  bvxm_batch.init_process("bvxmEdgemapOrthoProcess");
  bvxm_batch.set_input_from_db(0,world);
  bvxm_batch.set_input_unsigned(1,0);  ## scale
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  out_e_img = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  out_e_img_byte = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(2);
  out_h_img = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(3);
  ortho_cam = dbvalue(id, type);
  return out_e_img, out_e_img_byte, out_h_img, ortho_cam
Exemple #45
0
def update_edges(world,
                 cropped_cam,
                 cropped_edge_image,
                 edge_prob_mask_size=21,
                 edge_prob_mask_sigma=1.0,
                 scale=0):
    bvxm_batch.init_process("bvxmUpdateEdgesProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_from_db(1, cropped_cam)
    bvxm_batch.set_input_from_db(2, cropped_edge_image)
    bvxm_batch.set_input_unsigned(3, 0)
    bvxm_batch.set_input_int(4, edge_prob_mask_size)
    bvxm_batch.set_input_float(5, edge_prob_mask_sigma)
    #   bvxm_batch.set_params_process(update_params_xml); # "./bvxmUpdateEdgesProcess.xml");
    bvxm_batch.run_process()
Exemple #46
0
def load_perspective_camera_from_kml_file(NI, NJ, kml_file) :
  bvxm_batch.init_process("vpglLoadPerspCameraFromKMLFileProcess");
  bvxm_batch.set_input_unsigned(0, NI);
  bvxm_batch.set_input_unsigned(1, NJ);
  bvxm_batch.set_input_string(2, kml_file);
  bvxm_batch.run_process();
  (id,type) = bvxm_batch.commit_output(0);
  cam = dbvalue(id,type);
  (id,type) = bvxm_batch.commit_output(1);
  longitude = bvxm_batch.get_output_double(id);
  (id,type) = bvxm_batch.commit_output(2);
  latitude = bvxm_batch.get_output_double(id);
  (id,type) = bvxm_batch.commit_output(3);
  altitude = bvxm_batch.get_output_double(id);
  return cam, longitude, latitude, altitude;
Exemple #47
0
def load_perspective_camera_from_kml_file(NI, NJ, kml_file):
    bvxm_batch.init_process("vpglLoadPerspCameraFromKMLFileProcess")
    bvxm_batch.set_input_unsigned(0, NI)
    bvxm_batch.set_input_unsigned(1, NJ)
    bvxm_batch.set_input_string(2, kml_file)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    longitude = bvxm_batch.get_output_double(id)
    (id, type) = bvxm_batch.commit_output(2)
    latitude = bvxm_batch.get_output_double(id)
    (id, type) = bvxm_batch.commit_output(3)
    altitude = bvxm_batch.get_output_double(id)
    return cam, longitude, latitude, altitude
Exemple #48
0
def render_ortho_edgemap(world, scale=0):
    print("Rendering ortho edge map")
    bvxm_batch.init_process("bvxmEdgemapOrthoProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_unsigned(1, 0)  # scale
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_e_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_e_img_byte = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(2)
    out_h_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(3)
    ortho_cam = dbvalue(id, type)
    return out_e_img, out_e_img_byte, out_h_img, ortho_cam
Exemple #49
0
def render_kml_polygon_mask(in_kml, image, ll_lon, ll_lat, ur_lon, ur_lat, mask_value = 255):
  bvxm_batch.init_process("volmRenderKmlPolygonMaskProcess")
  bvxm_batch.set_input_from_db(0, image)
  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, in_kml)
  bvxm_batch.set_input_unsigned(6, mask_value)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    out_cam = dbvalue(id, type)
    return out_cam
  else:
    return None
Exemple #50
0
def create_perspective_camera_from_kml(ni, nj, right_fov, top_fov, altitude, heading, tilt, roll, cent_x, cent_y):
    bvxm_batch.init_process("vpglCreatePerspCameraFromKMLProcess")
    bvxm_batch.set_input_unsigned(0, ni)
    bvxm_batch.set_input_unsigned(1, nj)
    bvxm_batch.set_input_double(2, right_fov)
    bvxm_batch.set_input_double(3, top_fov)
    bvxm_batch.set_input_double(4, altitude)
    bvxm_batch.set_input_double(5, heading)
    bvxm_batch.set_input_double(6, tilt)
    bvxm_batch.set_input_double(7, roll)
    bvxm_batch.set_input_double(8, cent_x)
    bvxm_batch.set_input_double(9, cent_y)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Exemple #51
0
def create_perspective_camera_from_kml(ni, nj, right_fov, top_fov, altitude, heading, tilt, roll, cent_x, cent_y) :
  bvxm_batch.init_process("vpglCreatePerspCameraFromKMLProcess");
  bvxm_batch.set_input_unsigned(0, ni);
  bvxm_batch.set_input_unsigned(1, nj);
  bvxm_batch.set_input_double(2, right_fov);
  bvxm_batch.set_input_double(3, top_fov);
  bvxm_batch.set_input_double(4, altitude);
  bvxm_batch.set_input_double(5, heading);
  bvxm_batch.set_input_double(6, tilt);
  bvxm_batch.set_input_double(7, roll);
  bvxm_batch.set_input_double(8, cent_x);
  bvxm_batch.set_input_double(9, cent_y);
  bvxm_batch.run_process();
  (id,type) = bvxm_batch.commit_output(0);
  cam = dbvalue(id,type);
  return cam;
Exemple #52
0
def create_geotiff_cam(ll_lon, ll_lat, ur_lon, ur_lat, ni, nj, lvcs=0):
    bvxm_batch.init_process("vpglCreateGeoCameraProcess")
    bvxm_batch.set_input_double(0, ll_lon)
    bvxm_batch.set_input_double(1, ll_lat)
    bvxm_batch.set_input_double(2, ur_lon)
    bvxm_batch.set_input_double(3, ur_lat)
    bvxm_batch.set_input_unsigned(4, ni)
    bvxm_batch.set_input_unsigned(5, nj)
    if lvcs != 0:
        bvxm_batch.set_input_from_db(6, lvcs)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        cam = dbvalue(id, type)
        return cam
    else:
        return None
Exemple #53
0
def create_geotiff_cam(ll_lon, ll_lat, ur_lon, ur_lat, ni, nj, lvcs = 0):
  bvxm_batch.init_process("vpglCreateGeoCameraProcess")
  bvxm_batch.set_input_double(0, ll_lon)
  bvxm_batch.set_input_double(1, ll_lat)
  bvxm_batch.set_input_double(2, ur_lon)
  bvxm_batch.set_input_double(3, ur_lat)
  bvxm_batch.set_input_unsigned(4, ni)
  bvxm_batch.set_input_unsigned(5, nj)
  if lvcs != 0:
    bvxm_batch.set_input_from_db(6, lvcs)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
  else:
    return None
Exemple #54
0
def write_scene_kml(scene, kml_filename, is_overwrite=True, r=255, g=255, b=255, a=0, name=""):
    bvxm_batch.init_process("bvxmSceneKmlProcess")
    bvxm_batch.set_input_from_db(0, scene)
    bvxm_batch.set_input_string(1, kml_filename)
    bvxm_batch.set_input_bool(2, is_overwrite)
    bvxm_batch.set_input_unsigned(3, r)
    bvxm_batch.set_input_unsigned(4, g)
    bvxm_batch.set_input_unsigned(5, b)
    bvxm_batch.set_input_unsigned(6, a)
    bvxm_batch.set_input_string(7, name)
    bvxm_batch.run_process()
Exemple #55
0
def test_classifier(tclsf, block_size, category_id_file="", category_name=""):
    bvxm_batch.init_process("sdetTextureClassifierProcess2")
    bvxm_batch.set_input_from_db(0, tclsf)
    bvxm_batch.set_input_unsigned(1, block_size)
    bvxm_batch.set_input_string(2, category_id_file)
    bvxm_batch.set_input_string(3, category_name)
    status = bvxm_batch.run_process()
    if status:
      (out_id, out_type) = bvxm_batch.commit_output(0)
      out_max_prob = dbvalue(out_id, out_type)
      (out_id, out_type) = bvxm_batch.commit_output(1)
      out_color_img = dbvalue(out_id, out_type)
      (out_id, out_type) = bvxm_batch.commit_output(2)
      out_id_img = dbvalue(out_id, out_type)
      (out_id, out_type) = bvxm_batch.commit_output(3)
      out_cat_prob = dbvalue(out_id, out_type)
      return out_max_prob, out_color_img, out_id_img, out_cat_prob
    else:
      return None, None, None, None
Exemple #56
0
def test_classifier(tclsf, block_size, category_id_file="", category_name=""):
    bvxm_batch.init_process("sdetTextureClassifierProcess2")
    bvxm_batch.set_input_from_db(0, tclsf)
    bvxm_batch.set_input_unsigned(1, block_size)
    bvxm_batch.set_input_string(2, category_id_file)
    bvxm_batch.set_input_string(3, category_name)
    status = bvxm_batch.run_process()
    if status:
        (out_id, out_type) = bvxm_batch.commit_output(0)
        out_max_prob = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(1)
        out_color_img = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(2)
        out_id_img = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(3)
        out_cat_prob = dbvalue(out_id, out_type)
        return out_max_prob, out_color_img, out_id_img, out_cat_prob
    else:
        return None, None, None, None
def generate_ndsm(land_geocam, land_img_file, geo_index_txt, h_map_folder, ground_txt, dem_folder, max_h_limit=254.0, window_size=30):
    bvxm_batch.init_process("volmNdsmGenearationProcess")
    bvxm_batch.set_input_from_db(0, land_geocam)
    bvxm_batch.set_input_string(1, land_img_file)
    bvxm_batch.set_input_string(2, geo_index_txt)
    bvxm_batch.set_input_string(3, h_map_folder)
    bvxm_batch.set_input_unsigned(4, window_size)
    bvxm_batch.set_input_float(5, max_h_limit)
    bvxm_batch.set_input_string(6, ground_txt)
    bvxm_batch.set_input_string(7, dem_folder)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        out_ndsm = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(1)
        out_dsm = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(2)
        out_cam = dbvalue(id, type)
        return out_ndsm, out_dsm, out_cam
    else:
        return None, None, None
Exemple #58
0
def rational_cam_img_to_global(camera, i, j, init_lon=-1.0, init_lat=-1.0, init_elev=-1.0, pl_elev = -1.0, error_tol = 0.05):
  bvxm_batch.init_process("vpglRationalImgToGlobalProcess");
  bvxm_batch.set_input_from_db(0, camera);
  bvxm_batch.set_input_unsigned(1, i);
  bvxm_batch.set_input_unsigned(2, j);
  bvxm_batch.set_input_double(3, init_lon);
  bvxm_batch.set_input_double(4, init_lat);
  bvxm_batch.set_input_double(5, init_elev);
  bvxm_batch.set_input_double(6, pl_elev);
  bvxm_batch.set_input_double(7, error_tol);
  status = bvxm_batch.run_process();
  if status:
    (id, type) = bvxm_batch.commit_output(0);
    lon = bvxm_batch.get_output_double(id);
    (id, type) = bvxm_batch.commit_output(1);
    lat = bvxm_batch.get_output_double(id);
    (id, type) = bvxm_batch.commit_output(2);
    elev = bvxm_batch.get_output_double(id)
    return lon, lat, elev
  else:
    return -1.0, -1.0, -1.0
Exemple #59
0
def create_classifier(lambda0, lambda1, n_scales, scale_interval,
                      angle_interval, laplace_radius, gauss_radius, k,
                      n_samples):
    bvxm_batch.init_process("sdetCreateTextureClassifierProcess")
    bvxm_batch.set_input_float(0, lambda0)
    # lambda0
    bvxm_batch.set_input_float(1, lambda1)
    # lambda1
    bvxm_batch.set_input_unsigned(2, n_scales)
    # n_scales
    bvxm_batch.set_input_float(3, scale_interval)
    # scale_interval
    bvxm_batch.set_input_float(4, angle_interval)
    # angle_interval
    bvxm_batch.set_input_float(5, laplace_radius)
    # laplace_radius
    bvxm_batch.set_input_float(6, gauss_radius)
    # gauss_radius
    bvxm_batch.set_input_unsigned(7, k)
    # k
    bvxm_batch.set_input_unsigned(8, n_samples)
    # number of samples
    bvxm_batch.run_process()
    (tclsf_id, tclsf_type) = bvxm_batch.commit_output(0)
    tclsf = dbvalue(tclsf_id, tclsf_type)
    return tclsf