Exemple #1
0
def correct_ransac_process(cor_file, output_folder, pixel_radius):
    bvxm_batch.init_process("volmCorrectRationalCamerasRANSACProcess")
    bvxm_batch.set_input_string(0, cor_file)
    bvxm_batch.set_input_string(1, output_folder)
    # pixel radius to count for inliers
    bvxm_batch.set_input_float(2, pixel_radius)
    bvxm_batch.run_process()
Exemple #2
0
def correct_ransac_process(res, cor_file, output_folder, pixel_radius):
  bvxm_batch.init_process("volmCorrectRationalCamerasRANSACProcess");
  bvxm_batch.set_input_from_db(0, res);
  bvxm_batch.set_input_string(1, cor_file);
  bvxm_batch.set_input_string(2, output_folder);
  bvxm_batch.set_input_float(3, pixel_radius);  ## pixel radius to count for inliers
  bvxm_batch.run_process();
Exemple #3
0
def generate_layers(land_img,
                    land_cam,
                    height_img,
                    height_cam,
                    land_txt,
                    min_h,
                    max_h,
                    beta=10.0):
    bvxm_batch.init_process("volmLayerExtractionProcess")
    bvxm_batch.set_input_from_db(0, land_img)
    bvxm_batch.set_input_from_db(1, land_cam)
    bvxm_batch.set_input_from_db(2, height_img)
    bvxm_batch.set_input_from_db(3, height_cam)
    bvxm_batch.set_input_string(4, land_txt)
    bvxm_batch.set_input_float(5, min_h)
    bvxm_batch.set_input_float(6, max_h)
    bvxm_batch.set_input_double(7, beta)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        out_prob_img = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(1)
        out_img = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(2)
        mask_img = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(3)
        out_cam = dbvalue(id, type)
        return out_prob_img, out_img, mask_img, out_cam
    else:
        return None, None, None, None
Exemple #4
0
def isfm_rational_camera_with_init(track_file,
                                   dem_folder,
                                   ll_lon=0.0,
                                   ll_lat=0.0,
                                   ur_lon=0.0,
                                   ur_lat=0.0,
                                   height_diff=20.0,
                                   pixel_radius=2.0):
    bvxm_batch.init_process("vpglIsfmRationalCameraWithInitialProcess")
    bvxm_batch.set_input_string(0, track_file)
    bvxm_batch.set_input_string(1, dem_folder)
    bvxm_batch.set_input_double(2, ll_lon)
    bvxm_batch.set_input_double(3, ll_lat)
    bvxm_batch.set_input_double(4, ur_lon)
    bvxm_batch.set_input_double(5, ur_lat)
    bvxm_batch.set_input_double(6, height_diff)
    bvxm_batch.set_input_float(7, pixel_radius)
    if not bvxm_batch.run_process():
        return None, -1.0, -1.0
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    error = bvxm_batch.get_output_float(id)
    (id, type) = bvxm_batch.commit_output(2)
    inliers = bvxm_batch.get_output_float(id)
    return cam, error, inliers
Exemple #5
0
def generate_ndsm(ll_lon, ll_lat, ur_lon, ur_lat, img_size_ni, img_size_nj, geo_index_txt, h_map_folder, grd_map_folder, window_size = 20, max_h_limit = 254.0):
  bvxm_batch.init_process("volmNdsmGenearationProcess")
  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, img_size_ni)
  bvxm_batch.set_input_unsigned(5, img_size_nj)
  bvxm_batch.set_input_string(6, geo_index_txt)
  bvxm_batch.set_input_string(7, h_map_folder)
  bvxm_batch.set_input_string(8, grd_map_folder)
  bvxm_batch.set_input_unsigned(9, window_size)
  bvxm_batch.set_input_float(10, max_h_limit)
  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)
    grd_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(3)
    out_cam = dbvalue(id, type)
    return out_ndsm, out_dsm, grd_img, out_cam
  else:
    return None, None, None, None
Exemple #6
0
def correct_ransac_process(cor_file, output_folder, pixel_radius):
    bvxm_batch.init_process("volmCorrectRationalCamerasRANSACProcess")
    bvxm_batch.set_input_string(0, cor_file)
    bvxm_batch.set_input_string(1, output_folder)
    # pixel radius to count for inliers
    bvxm_batch.set_input_float(2, pixel_radius)
    bvxm_batch.run_process()
Exemple #7
0
def construct_height_map_from_disparity(img1, img1_disp, min_disparity,
                                        local_rational_cam1, img2,
                                        local_rational_cam2, min_x, min_y,
                                        min_z, max_x, max_y, max_z, path_H1,
                                        path_H2, voxel_size):
    bvxm_batch.init_process("vpglConstructHeightMapProcess")
    bvxm_batch.set_input_from_db(0, img1)
    bvxm_batch.set_input_from_db(1, local_rational_cam1)
    bvxm_batch.set_input_string(2, img1_disp)
    bvxm_batch.set_input_float(3, min_disparity)
    bvxm_batch.set_input_from_db(4, img2)
    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_double(12, voxel_size)
    bvxm_batch.set_input_string(13, path_H1)
    bvxm_batch.set_input_string(14, path_H2)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_map = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    disparity_map = dbvalue(id, type)
    return out_map, disparity_map
Exemple #8
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 #9
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
Exemple #10
0
def combine_height_map(height_map_folder, poly_roi, out_folder, size_in_degree = 0.0625, leaf_id = -1):
  bvxm_batch.init_process("volmCombineHeightMapProcess");
  bvxm_batch.set_input_string(0, height_map_folder);
  bvxm_batch.set_input_string(1, poly_roi);
  bvxm_batch.set_input_string(2, out_folder);
  bvxm_batch.set_input_float(3, size_in_degree);
  bvxm_batch.set_input_int(4, leaf_id);
  bvxm_batch.run_process();
Exemple #11
0
def find_seed_sat_resources(res, poly_kml, downsample_factor, sat_res_file):
  bvxm_batch.init_process("volmFindOverlappingSatResourcesProcess")
  bvxm_batch.set_input_from_db(0,res);             # satellite resource
  bvxm_batch.set_input_string(1,poly_kml);         # kml polygon filename
  bvxm_batch.set_input_float(2,downsample_factor); # factor by which to downsample resource footprints when 
                                                   # computing the raster (smaller factor takes more time & memory)
  bvxm_batch.set_input_string(3,sat_res_file);     # output file to print the list (this will also save a kml version)
  bvxm_batch.run_process();
Exemple #12
0
def find_intersecting_sat_resources(res, poly_kml, max_intersecting_resources, sat_res_file):
  bvxm_batch.init_process("volmFindIntersectingSatResourcesProcess")
  bvxm_batch.set_input_from_db(0,res);         # satellite resource
  bvxm_batch.set_input_string(1,poly_kml);     # kml polygon filename
  bvxm_batch.set_input_float(2,max_intersecting_resources); # maximum number of intersecting images to consider, e.g., 5;
                                                            # be careful with this number as this process computes
                                                            # a rising powerset, i.e., n choose k ... n choose l
  bvxm_batch.set_input_string(3,sat_res_file); # output file to print the list (this will also save a kml version)
  bvxm_batch.run_process();
Exemple #13
0
def create_satellite_resouces(roi_kml, leaf_size=0.1, eliminate_same_images=False):
    bvxm_batch.init_process("volmCreateSatResourcesProcess")
    bvxm_batch.set_input_string(0, roi_kml)
    bvxm_batch.set_input_float(1, leaf_size)
    bvxm_batch.set_input_bool(2, eliminate_same_images)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    sat_res = dbvalue(id, type)
    return sat_res
Exemple #14
0
def rotate_perspective_camera(cam_in, theta, phi):
    bvxm_batch.init_process('vpglRotatePerspCamProcess')
    bvxm_batch.set_input_from_db(0, cam_in)
    bvxm_batch.set_input_float(1, theta)
    bvxm_batch.set_input_float(2, phi)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    rot_cam = dbvalue(id, type)
    return rot_cam
Exemple #15
0
def rotate_perspective_camera(cam_in, theta, phi):
    bvxm_batch.init_process('vpglRotatePerspCamProcess');
    bvxm_batch.set_input_from_db(0,cam_in);
    bvxm_batch.set_input_float(1,theta);
    bvxm_batch.set_input_float(2,phi);
    bvxm_batch.run_process();
    (id,type) = bvxm_batch.commit_output(0);
    rot_cam = dbvalue(id,type);
    return rot_cam;
Exemple #16
0
def correct_ransac_process2(res, cor_file, output_folder, pixel_radius, enforce_existing = 0):
  bvxm_batch.init_process("volmCorrectRationalCamerasRANSACProcess2");
  bvxm_batch.set_input_from_db(0, res);
  bvxm_batch.set_input_string(1, cor_file);
  bvxm_batch.set_input_string(2, output_folder);
  bvxm_batch.set_input_float(3, pixel_radius);  ## pixel radius to count for inliers
  bvxm_batch.set_input_int(4, enforce_existing);  ## if 1: enforce to have at least 2 existing images
  statuscode = bvxm_batch.run_process();
  return statuscode;
Exemple #17
0
def find_seed_sat_resources(res, poly_kml, downsample_factor, sat_res_file):
    bvxm_batch.init_process("volmFindOverlappingSatResourcesProcess")
    bvxm_batch.set_input_from_db(0, res)  # satellite resource
    bvxm_batch.set_input_string(1, poly_kml)  # kml polygon filename
    # factor by which to downsample resource footprints when
    bvxm_batch.set_input_float(2, downsample_factor)
    # computing the raster (smaller factor takes more time & memory)
    # output file to print the list (this will also save a kml version)
    bvxm_batch.set_input_string(3, sat_res_file)
    bvxm_batch.run_process()
Exemple #18
0
def correct_ransac_with_initial_process(res, cor_file, dem_folder, output_folder, pixel_radius, enforce_existing=False):
    bvxm_batch.init_process("volmCorrectRationalCameraRANSACwithIntialProcess")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_string(1, cor_file)
    bvxm_batch.set_input_string(2, dem_folder)
    bvxm_batch.set_input_string(3, output_folder)
    bvxm_batch.set_input_float(4, pixel_radius)
    bvxm_batch.set_input_bool(5, enforce_existing)
    status = bvxm_batch.run_process()
    return status
Exemple #19
0
def write_perspective_cam_vrml(vrml_filename, pcam, camera_rad, axis_length, r, g, b):
    bvxm_batch.init_process("bvrmlWritePerspectiveCamProcess")
    bvxm_batch.set_input_string(0, vrml_filename)
    bvxm_batch.set_input_from_db(1, pcam)
    bvxm_batch.set_input_float(2, camera_rad)
    bvxm_batch.set_input_float(3, axis_length)
    bvxm_batch.set_input_float(4, r)
    bvxm_batch.set_input_float(5, g)
    bvxm_batch.set_input_float(6, b)
    bvxm_batch.run_process()
Exemple #20
0
def write_perspective_cam_vrml(vrml_filename, pcam, camera_rad, axis_length, r, g, b):
    bvxm_batch.init_process("bvrmlWritePerspectiveCamProcess");
    bvxm_batch.set_input_string(0,vrml_filename);
    bvxm_batch.set_input_from_db(1,pcam);
    bvxm_batch.set_input_float(2,camera_rad);
    bvxm_batch.set_input_float(3,axis_length);
    bvxm_batch.set_input_float(4,r);
    bvxm_batch.set_input_float(5,g);
    bvxm_batch.set_input_float(6,b);
    bvxm_batch.run_process();
Exemple #21
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 #22
0
def combine_height_map2(height_map_folder, threshold):
    bvxm_batch.init_process("volmCombineHeightMapProcess2")
    bvxm_batch.set_input_string(0, height_map_folder)
    bvxm_batch.set_input_float(1, threshold)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        out_map = dbvalue(id, type)
        return out_map
    else:
        return 0
Exemple #23
0
def find_stereo_pairs2(res, poly_roi, GSD_threshold, scene_res_file, satellite_name):
  bvxm_batch.init_process("volmFindSatellitePairsPolyProcess")
  bvxm_batch.set_input_from_db(0,res);
  bvxm_batch.set_input_string(1, poly_roi);
  bvxm_batch.set_input_string(2, scene_res_file);
  bvxm_batch.set_input_string(3, satellite_name);
  bvxm_batch.set_input_float(4, GSD_threshold);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  cnt = bvxm_batch.get_output_unsigned(id);
  return cnt;
Exemple #24
0
def combine_height_map2(height_map_folder, threshold):
  bvxm_batch.init_process("volmCombineHeightMapProcess2");
  bvxm_batch.set_input_string(0, height_map_folder);
  bvxm_batch.set_input_float(1, threshold)
  status = bvxm_batch.run_process();
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    out_map = dbvalue(id, type);
    return out_map;
  else:
    return 0;
Exemple #25
0
def image_to_vrml_points(out_e_img, out_h_img, output_filename, prob_thres, max_scene_height):
  bvxm_batch.init_process("bvrmlImageToPointsProcess");
  bvxm_batch.set_input_from_db(0,out_e_img);
  bvxm_batch.set_input_from_db(1,out_h_img);
  bvxm_batch.set_input_string(2,output_filename);
  bvxm_batch.set_input_float(3,prob_thres);
  bvxm_batch.set_input_float(4,max_scene_height);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  out_img = dbvalue(id, type);
  return out_img
Exemple #26
0
def create_satellite_resouces(roi_kml,
                              leaf_size=0.1,
                              eliminate_same_images=False):
    bvxm_batch.init_process("volmCreateSatResourcesProcess")
    bvxm_batch.set_input_string(0, roi_kml)
    bvxm_batch.set_input_float(1, leaf_size)
    bvxm_batch.set_input_bool(2, eliminate_same_images)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    sat_res = dbvalue(id, type)
    return sat_res
Exemple #27
0
def image_to_vrml_points(out_e_img, out_h_img, output_filename, prob_thres,
                         max_scene_height):
    bvxm_batch.init_process("bvrmlImageToPointsProcess")
    bvxm_batch.set_input_from_db(0, out_e_img)
    bvxm_batch.set_input_from_db(1, out_h_img)
    bvxm_batch.set_input_string(2, output_filename)
    bvxm_batch.set_input_float(3, prob_thres)
    bvxm_batch.set_input_float(4, max_scene_height)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_img = dbvalue(id, type)
    return out_img
Exemple #28
0
def estimate_atmospheric_parameters(image, metadata, mean_reflectance = None, constrain_parameters=None):
  bvxm_batch.init_process("bradEstimateAtmosphericParametersProcess")
  bvxm_batch.set_input_from_db(0,image)
  bvxm_batch.set_input_from_db(1,metadata)
  if mean_reflectance != None:
     bvxm_batch.set_input_float(2,mean_reflectance)
  if constrain_parameters != None:
      bvxm_batch.set_input_bool(3, constrain_parameters)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  atm_params = dbvalue(id,type)
  return atm_params
Exemple #29
0
def create_perspective_camera_with_rot(pcam, phi, theta, cent_x, cent_y, cent_z):
    bvxm_batch.init_process("vpglCreatePerspectiveCameraProcess3");
    bvxm_batch.set_input_from_db(0, pcam);
    bvxm_batch.set_input_float(1, phi);
    bvxm_batch.set_input_float(2, theta);
    bvxm_batch.set_input_float(3, cent_x);
    bvxm_batch.set_input_float(4, cent_y);
    bvxm_batch.set_input_float(5, cent_z);
    bvxm_batch.run_process();
    (c_id,c_type) = bvxm_batch.commit_output(0);
    cam = dbvalue(c_id,c_type);
    return cam;
def segment_image(img, weight_thres, margin=0, min_size=50, sigma=1,neigh=8):
  bvxm_batch.init_process("sdetSegmentImageProcess");
  bvxm_batch.set_input_from_db(0,img);
  bvxm_batch.set_input_int(1,margin);
  bvxm_batch.set_input_int(2,neigh);
  bvxm_batch.set_input_float(3,weight_thres);
  bvxm_batch.set_input_float(4,sigma);
  bvxm_batch.set_input_int(5,min_size);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  seg_img = dbvalue(id, type);
  return seg_img
Exemple #31
0
def refine_bvxm_height_map(img, max_h, min_h):
  bvxm_batch.init_process("volmRefineBvxmHeightMapProcess")
  bvxm_batch.set_input_from_db(0, img)
  bvxm_batch.set_input_float(1, max_h)
  bvxm_batch.set_input_float(2, min_h)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0);
    out_img = dbvalue(id, type);
  else:
    out_img = 0;
  return out_img;
Exemple #32
0
def find_intersecting_sat_resources(res, poly_kml, max_intersecting_resources,
                                    sat_res_file):
    bvxm_batch.init_process("volmFindIntersectingSatResourcesProcess")
    bvxm_batch.set_input_from_db(0, res)  # satellite resource
    bvxm_batch.set_input_string(1, poly_kml)  # kml polygon filename
    # maximum number of intersecting images to consider, e.g., 5
    bvxm_batch.set_input_float(2, max_intersecting_resources)
    # be careful with this number as this process computes
    # a rising powerset, i.e., n choose k ... n choose l
    # output file to print the list (this will also save a kml version)
    bvxm_batch.set_input_string(3, sat_res_file)
    bvxm_batch.run_process()
Exemple #33
0
def combine_height_map(height_map_folder,
                       poly_roi,
                       out_folder,
                       size_in_degree=0.0625,
                       leaf_id=-1):
    bvxm_batch.init_process("volmCombineHeightMapProcess")
    bvxm_batch.set_input_string(0, height_map_folder)
    bvxm_batch.set_input_string(1, poly_roi)
    bvxm_batch.set_input_string(2, out_folder)
    bvxm_batch.set_input_float(3, size_in_degree)
    bvxm_batch.set_input_int(4, leaf_id)
    bvxm_batch.run_process()
Exemple #34
0
def refine_bvxm_height_map(img, max_h, min_h):
    bvxm_batch.init_process("volmRefineBvxmHeightMapProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_float(1, max_h)
    bvxm_batch.set_input_float(2, min_h)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        out_img = dbvalue(id, type)
    else:
        out_img = 0
    return out_img
Exemple #35
0
def find_stereo_pairs2(res, poly_roi, GSD_threshold, scene_res_file,
                       satellite_name):
    bvxm_batch.init_process("volmFindSatellitePairsPolyProcess")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_string(1, poly_roi)
    bvxm_batch.set_input_string(2, scene_res_file)
    bvxm_batch.set_input_string(3, satellite_name)
    bvxm_batch.set_input_float(4, GSD_threshold)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cnt = bvxm_batch.get_output_unsigned(id)
    return cnt
Exemple #36
0
def create_perspective_camera_with_rot(pcam, phi, theta, cent_x, cent_y, cent_z):
    bvxm_batch.init_process("vpglCreatePerspectiveCameraProcess3")
    bvxm_batch.set_input_from_db(0, pcam)
    bvxm_batch.set_input_float(1, phi)
    bvxm_batch.set_input_float(2, theta)
    bvxm_batch.set_input_float(3, cent_x)
    bvxm_batch.set_input_float(4, cent_y)
    bvxm_batch.set_input_float(5, cent_z)
    bvxm_batch.run_process()
    (c_id, c_type) = bvxm_batch.commit_output(0)
    cam = dbvalue(c_id, c_type)
    return cam
Exemple #37
0
def convert_local_rational_to_generic(cam_in, ni, nj, min_z, max_z, level=0):
    bvxm_batch.init_process('vpglConvertLocalRationalToGenericProcess');
    bvxm_batch.set_input_from_db(0,cam_in);
    bvxm_batch.set_input_unsigned(1,ni);
    bvxm_batch.set_input_unsigned(2,nj);
    bvxm_batch.set_input_float(3,min_z);
    bvxm_batch.set_input_float(4,max_z);
    bvxm_batch.set_input_unsigned(5,level);
    if not bvxm_batch.run_process():
        return None;
    (id,type) = bvxm_batch.commit_output(0);
    generic_cam = dbvalue(id,type);
    return generic_cam;
Exemple #38
0
def dsm_ground_estimation_edge(dsm_image, edge_img, invalid_pixel = -1.0, sample_size = 10):
  bvxm_batch.init_process("volmDsmGroundEstimationEdgeProcess")
  bvxm_batch.set_input_from_db(0, dsm_image)
  bvxm_batch.set_input_from_db(1, edge_img)
  bvxm_batch.set_input_int(2, sample_size)
  bvxm_batch.set_input_float(3, invalid_pixel)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    grd_img = dbvalue(id, type)
    return grd_img
  else:
    return None
def segment_image_using_height(img, height_img, weight_thres, margin=0, min_size=50, sigma=1, neigh=8):
    bvxm_batch.init_process("sdetSegmentUsingHeightMapProcess")
    bvxm_batch.set_input_from_db(0, img)
    bvxm_batch.set_input_from_db(1, height_img)
    bvxm_batch.set_input_int(2, margin)
    bvxm_batch.set_input_int(3, neigh)
    bvxm_batch.set_input_float(4, weight_thres)
    bvxm_batch.set_input_float(5, sigma)
    bvxm_batch.set_input_int(6, min_size)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    seg_img = dbvalue(id, type)
    return seg_img
Exemple #40
0
def perturb_camera(cam_in, angle, rng):
    bvxm_batch.init_process('vpglPerturbPerspCamOrientProcess');
    bvxm_batch.set_input_from_db(0,cam_in);
    bvxm_batch.set_input_float(1,angle);
    bvxm_batch.set_input_from_db(2,rng);
    bvxm_batch.run_process();
    (id,type) = bvxm_batch.commit_output(0);
    pert_cam = dbvalue(id,type);
    (theta_id,type) = bvxm_batch.commit_output(1);
    (phi_id,type) = bvxm_batch.commit_output(2);
    theta = bvxm_batch.get_output_float(theta_id);
    phi = bvxm_batch.get_output_float(phi_id);
    return pert_cam, theta, phi;
Exemple #41
0
def convert_local_rational_to_generic(cam_in, ni, nj, min_z, max_z, level=0):
    bvxm_batch.init_process('vpglConvertLocalRationalToGenericProcess')
    bvxm_batch.set_input_from_db(0, cam_in)
    bvxm_batch.set_input_unsigned(1, ni)
    bvxm_batch.set_input_unsigned(2, nj)
    bvxm_batch.set_input_float(3, min_z)
    bvxm_batch.set_input_float(4, max_z)
    bvxm_batch.set_input_unsigned(5, level)
    if not bvxm_batch.run_process():
        return None
    (id, type) = bvxm_batch.commit_output(0)
    generic_cam = dbvalue(id, type)
    return generic_cam
Exemple #42
0
def perturb_camera(cam_in, angle, rng):
    bvxm_batch.init_process('vpglPerturbPerspCamOrientProcess')
    bvxm_batch.set_input_from_db(0, cam_in)
    bvxm_batch.set_input_float(1, angle)
    bvxm_batch.set_input_from_db(2, rng)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    pert_cam = dbvalue(id, type)
    (theta_id, type) = bvxm_batch.commit_output(1)
    (phi_id, type) = bvxm_batch.commit_output(2)
    theta = bvxm_batch.get_output_float(theta_id)
    phi = bvxm_batch.get_output_float(phi_id)
    return pert_cam, theta, phi
Exemple #43
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=""):
    bvxm_batch.init_process("bvxmCreateSceneXmlLargeScaleProcess")
    bvxm_batch.set_input_string(0, roi_kml)
    bvxm_batch.set_input_string(1, scene_root)
    bvxm_batch.set_input_string(2, world_dir)
    bvxm_batch.set_input_string(3, dem_folder)
    bvxm_batch.set_input_string(4, land_folder)
    bvxm_batch.set_input_float(5, world_size)
    bvxm_batch.set_input_float(6, voxel_size)
    bvxm_batch.set_input_float(7, height_diff)
    bvxm_batch.set_input_float(8, height_sub)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        n_scenes = bvxm_batch.get_output_unsigned(id)
        return n_scenes
    else:
        return 0
Exemple #44
0
def isfm_rational_camera_seed(track_file, out_folder, dem_folder, ll_lon=0.0, ll_lat=0.0, ur_lon=0.0, ur_lat=0.0, height_diff=20.0, pixel_radius=2.0, enforce_existing=False):
    bvxm_batch.init_process("vpglIsfmRationalCameraSeedProcess")
    bvxm_batch.set_input_string(0, track_file)
    bvxm_batch.set_input_string(1, out_folder)
    bvxm_batch.set_input_string(2, dem_folder)
    bvxm_batch.set_input_float(3, ll_lon)
    bvxm_batch.set_input_float(4, ll_lat)
    bvxm_batch.set_input_float(5, ur_lon)
    bvxm_batch.set_input_float(6, ur_lat)
    bvxm_batch.set_input_double(7, height_diff)
    bvxm_batch.set_input_float(8, pixel_radius)
    bvxm_batch.set_input_bool(9, enforce_existing)
    status = bvxm_batch.run_process()
    return status
Exemple #45
0
def isfm_rational_camera( trackfile, output_folder, pixel_radius):
  bvxm_batch.init_process("vpglIsfmRationalCameraProcess");
  bvxm_batch.set_input_string(0, trackfile);
  bvxm_batch.set_input_string(1, output_folder);
  bvxm_batch.set_input_float(2, pixel_radius);  ## pixel radius to count for inliers
  if not bvxm_batch.run_process():
    return None, -1.0, -1.0
  (id, type) = bvxm_batch.commit_output(0);
  cam = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  error = bvxm_batch.get_output_float(id);
  (id, type) = bvxm_batch.commit_output(2);
  inliers = bvxm_batch.get_output_float(id);
  return cam,error,inliers
def segment_image_using_height2(img, height_img, edge_img, weight_thres, margin=0, min_size=50, sigma=1,neigh=8):
  bvxm_batch.init_process("sdetSegmentUsingHeightMapProcess2");
  bvxm_batch.set_input_from_db(0,img);
  bvxm_batch.set_input_from_db(1,height_img);
  bvxm_batch.set_input_from_db(2,edge_img);
  bvxm_batch.set_input_int(3,margin);
  bvxm_batch.set_input_int(4,neigh);
  bvxm_batch.set_input_float(5,weight_thres);
  bvxm_batch.set_input_float(6,sigma);
  bvxm_batch.set_input_int(7,min_size);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  seg_img = dbvalue(id, type);
  return seg_img
Exemple #47
0
def find_stereo_pairs(res, lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat, GSD_threshold, scene_res_file, satellite_name):
  bvxm_batch.init_process("volmFindSatellitePairsProcess");
  bvxm_batch.set_input_from_db(0,res);
  bvxm_batch.set_input_double(1, lower_left_lon);
  bvxm_batch.set_input_double(2, lower_left_lat);
  bvxm_batch.set_input_double(3, upper_right_lon);
  bvxm_batch.set_input_double(4, upper_right_lat);
  bvxm_batch.set_input_string(5, scene_res_file);
  bvxm_batch.set_input_string(6, satellite_name);
  bvxm_batch.set_input_float(7, GSD_threshold);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  cnt = bvxm_batch.get_output_unsigned(id);
  return cnt;
Exemple #48
0
def isfm_rational_camera_seed(track_file, out_folder, dem_folder, ll_lon=0.0, ll_lat=0.0, ur_lon=0.0, ur_lat=0.0, height_diff=20.0, pixel_radius=2.0, enforce_existing=False):
    bvxm_batch.init_process("vpglIsfmRationalCameraSeedProcess")
    bvxm_batch.set_input_string(0, track_file)
    bvxm_batch.set_input_string(1, out_folder)
    bvxm_batch.set_input_string(2, dem_folder)
    bvxm_batch.set_input_float(3, ll_lon)
    bvxm_batch.set_input_float(4, ll_lat)
    bvxm_batch.set_input_float(5, ur_lon)
    bvxm_batch.set_input_float(6, ur_lat)
    bvxm_batch.set_input_double(7, height_diff)
    bvxm_batch.set_input_float(8, pixel_radius)
    bvxm_batch.set_input_bool(9, enforce_existing)
    status = bvxm_batch.run_process()
    return status
Exemple #49
0
def isfm_rational_camera(trackfile, output_folder, pixel_radius):
    bvxm_batch.init_process("vpglIsfmRationalCameraProcess")
    bvxm_batch.set_input_string(0, trackfile)
    bvxm_batch.set_input_string(1, output_folder)
    # pixel radius to count for inliers
    bvxm_batch.set_input_float(2, pixel_radius)
    if not bvxm_batch.run_process():
        return None, -1.0, -1.0
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    error = bvxm_batch.get_output_float(id)
    (id, type) = bvxm_batch.commit_output(2)
    inliers = bvxm_batch.get_output_float(id)
    return cam, error, inliers
Exemple #50
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 #51
0
def correct_ransac_with_initial_process(res,
                                        cor_file,
                                        dem_folder,
                                        output_folder,
                                        pixel_radius,
                                        enforce_existing=False):
    bvxm_batch.init_process("volmCorrectRationalCameraRANSACwithIntialProcess")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_string(1, cor_file)
    bvxm_batch.set_input_string(2, dem_folder)
    bvxm_batch.set_input_string(3, output_folder)
    bvxm_batch.set_input_float(4, pixel_radius)
    bvxm_batch.set_input_bool(5, enforce_existing)
    status = bvxm_batch.run_process()
    return status
Exemple #52
0
def correct_ransac_process2(res,
                            cor_file,
                            output_folder,
                            pixel_radius,
                            enforce_existing=0):
    bvxm_batch.init_process("volmCorrectRationalCamerasRANSACProcess2")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_string(1, cor_file)
    bvxm_batch.set_input_string(2, output_folder)
    # pixel radius to count for inliers
    bvxm_batch.set_input_float(3, pixel_radius)
    # if 1: enforce to have at least 2 existing images
    bvxm_batch.set_input_int(4, enforce_existing)
    statuscode = bvxm_batch.run_process()
    return statuscode
Exemple #53
0
def dsm_ground_estimation_edge(dsm_image,
                               edge_img,
                               invalid_pixel=-1.0,
                               sample_size=10):
    bvxm_batch.init_process("volmDsmGroundEstimationEdgeProcess")
    bvxm_batch.set_input_from_db(0, dsm_image)
    bvxm_batch.set_input_from_db(1, edge_img)
    bvxm_batch.set_input_int(2, sample_size)
    bvxm_batch.set_input_float(3, invalid_pixel)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        grd_img = dbvalue(id, type)
        return grd_img
    else:
        return None
Exemple #54
0
def find_stereo_pairs(res, lower_left_lon, lower_left_lat, upper_right_lon,
                      upper_right_lat, GSD_threshold, scene_res_file,
                      satellite_name):
    bvxm_batch.init_process("volmFindSatellitePairsProcess")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_double(1, lower_left_lon)
    bvxm_batch.set_input_double(2, lower_left_lat)
    bvxm_batch.set_input_double(3, upper_right_lon)
    bvxm_batch.set_input_double(4, upper_right_lat)
    bvxm_batch.set_input_string(5, scene_res_file)
    bvxm_batch.set_input_string(6, satellite_name)
    bvxm_batch.set_input_float(7, GSD_threshold)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cnt = bvxm_batch.get_output_unsigned(id)
    return cnt
Exemple #55
0
def get_sun_angles_date_time(lat, lon, year, month, day, hour, minute):
  bvxm_batch.init_process("bradGetSunAnglesDateTimeProcess")
  bvxm_batch.set_input_float(0,lat)
  bvxm_batch.set_input_float(1,lon)
  bvxm_batch.set_input_int(2,year)
  bvxm_batch.set_input_int(3,month)
  bvxm_batch.set_input_int(4,day)
  bvxm_batch.set_input_int(5,hour)
  bvxm_batch.set_input_int(6,minute)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  sun_az = bvxm_batch.get_output_float(id)
  bvxm_batch.remove_data(id)
  (id,type) = bvxm_batch.commit_output(1)
  sun_el = bvxm_batch.get_output_float(id)
  bvxm_batch.remove_data(id)
  return sun_az, sun_el
Exemple #56
0
def combine_geotiff_images(ll_lon, ll_lat, ur_lon, ur_lat, in_img_folder, init_value = -1.0):
  bvxm_batch.init_process("volmCombineHeightMapProcess3")
  bvxm_batch.set_input_string(0, in_img_folder)
  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_float(5, init_value)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    out_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_cam = dbvalue(id, type)
    return out_img, out_cam
  else:
    return None, None
Exemple #57
0
def isfm_rational_camera_with_init(track_file, dem_folder, ll_lon=0.0, ll_lat=0.0, ur_lon=0.0, ur_lat=0.0, height_diff=20.0, pixel_radius=2.0):
    bvxm_batch.init_process("vpglIsfmRationalCameraWithInitialProcess")
    bvxm_batch.set_input_string(0, track_file)
    bvxm_batch.set_input_string(1, dem_folder)
    bvxm_batch.set_input_double(2, ll_lon)
    bvxm_batch.set_input_double(3, ll_lat)
    bvxm_batch.set_input_double(4, ur_lon)
    bvxm_batch.set_input_double(5, ur_lat)
    bvxm_batch.set_input_double(6, height_diff)
    bvxm_batch.set_input_float(7, pixel_radius)
    if not bvxm_batch.run_process():
        return None, -1.0, -1.0
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    error = bvxm_batch.get_output_float(id)
    (id, type) = bvxm_batch.commit_output(2)
    inliers = bvxm_batch.get_output_float(id)
    return cam, error, inliers