def load_affine_camera(file_path, viewing_dist=1000) : bvxm_batch.init_process("vpglLoadAffineCameraProcess"); bvxm_batch.set_input_string(0, file_path); bvxm_batch.set_input_double(1, viewing_dist); bvxm_batch.run_process(); (id,type) = bvxm_batch.commit_output(0); cam = dbvalue(id,type); return cam;
def translate_geo_camera(geocam, x, y): bvxm_batch.init_process("vpglTranslateGeoCameraProcess"); bvxm_batch.set_input_from_db(0, geocam); bvxm_batch.set_input_double(1, x); bvxm_batch.set_input_double(2, y); bvxm_batch.run_process(); (c_id, c_type) = bvxm_batch.commit_output(0); cam = dbvalue(c_id, c_type); return cam;
def correct_rational_camera(cam_in, offset_x, offset_y): bvxm_batch.init_process('vpglCorrectRationalCameraProcess'); bvxm_batch.set_input_from_db(0,cam_in); bvxm_batch.set_input_double(1,offset_x); bvxm_batch.set_input_double(2,offset_y); bvxm_batch.run_process(); (id,type) = bvxm_batch.commit_output(0); corrected_cam = dbvalue(id,type); return corrected_cam;
def geo2generic(geocam, ni, nj, scene_height, level): bvxm_batch.init_process("vpglConvertGeoCameraToGenericProcess"); bvxm_batch.set_input_from_db(0, geocam); bvxm_batch.set_input_int(1, ni); bvxm_batch.set_input_int(2, nj); bvxm_batch.set_input_double(3, scene_height); bvxm_batch.set_input_int(4, level); bvxm_batch.run_process(); (c_id, c_type) = bvxm_batch.commit_output(0); cam = dbvalue(c_id, c_type); return cam;
def geo_cam_global_to_img(geocam, lon, lat): bvxm_batch.init_process("vpglGeoGlobalToImgProcess"); bvxm_batch.set_input_from_db(0, geocam); bvxm_batch.set_input_double(1, lon); bvxm_batch.set_input_double(2, lat); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); u = bvxm_batch.get_output_int(id); (id, type) = bvxm_batch.commit_output(1); v = bvxm_batch.get_output_int(id); return u, v;
def scene_resources2(res, poly_kml, scene_res_file, band="PAN", GSD_threshold=10.0, pick_seeds=0, n_seeds=0): bvxm_batch.init_process("volmQuerySatelliteResourceKmlProcess"); bvxm_batch.set_input_from_db(0, res); bvxm_batch.set_input_string(1, poly_kml); bvxm_batch.set_input_string(2, scene_res_file); bvxm_batch.set_input_string(3, band); bvxm_batch.set_input_bool(4, pick_seeds); bvxm_batch.set_input_int(5, n_seeds); bvxm_batch.set_input_double(6, GSD_threshold); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0) cnt = bvxm_batch.get_output_unsigned(id); return cnt;
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
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
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
def find_resource_pair(res, name, tol=10.0): bvxm_batch.init_process("volmFindResourcePairProcess") bvxm_batch.set_input_from_db(0, res) bvxm_batch.set_input_string(1, name) bvxm_batch.set_input_double(2, tol) statuscode = bvxm_batch.run_process() (f_id, f_type) = bvxm_batch.commit_output(0) full_path = bvxm_batch.get_output_string(f_id) bvxm_batch.remove_data(f_id) (n_id, n_type) = bvxm_batch.commit_output(1) pair_name = bvxm_batch.get_output_string(n_id) bvxm_batch.remove_data(n_id) (p_id, p_type) = bvxm_batch.commit_output(2) full_path_pair_name = bvxm_batch.get_output_string(p_id) bvxm_batch.remove_data(p_id) return statuscode, full_path, pair_name, full_path_pair_name
def scene_resources(res, lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat, scene_res_file, band="PAN",GSD_threshold=10.0, pick_seeds=0, n_seeds=0): bvxm_batch.init_process("volmQuerySatelliteResourcesProcess"); 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, band); bvxm_batch.set_input_bool(7, pick_seeds); ## of 0, it returns all resources that intersect the box, otherwise, it picks n_seeds among these resources bvxm_batch.set_input_int(8, n_seeds); bvxm_batch.set_input_double(9, GSD_threshold); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); cnt = bvxm_batch.get_output_unsigned(id); return cnt;
def utm_coords(lon, lat): bvxm_batch.init_process("vpglComputeUTMZoneProcess") bvxm_batch.set_input_double(0, lon) bvxm_batch.set_input_double(1, lat) result = bvxm_batch.run_process() if result: (id, type) = bvxm_batch.commit_output(0) x = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(1) y = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(2) utm_zone = bvxm_batch.get_output_int(id) (id, type) = bvxm_batch.commit_output(3) northing = bvxm_batch.get_output_int(id) return x, y, utm_zone, northing else: return 0.0, 0.0, 0, 0
def find_stereo_pairs(res, lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat, 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.run_process();
def project_dem_to_sat_img(sat_cam, sat_img, dem_file, lower_left_lon=-1.0, lower_left_lat=-1.0, upper_right_lon=-1.0, upper_right_lat=-1.0, dem_cam=0): bvxm_batch.init_process("volmProjectDEMtoSatImgPorcess"); bvxm_batch.set_input_from_db(0, sat_cam); bvxm_batch.set_input_from_db(1, sat_img); bvxm_batch.set_input_string(2, dem_file); bvxm_batch.set_input_from_db(3, dem_cam); bvxm_batch.set_input_double(4, lower_left_lon) bvxm_batch.set_input_double(5, lower_left_lat) bvxm_batch.set_input_double(6, upper_right_lon) bvxm_batch.set_input_double(7, upper_right_lat) status = bvxm_batch.run_process(); return status;
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
def generate_xyz_from_dem_multi(world, img_folder, geoid_height, fill_in_value=-1.0): bvxm_batch.init_process("bvxmDemToXYZProcess2") bvxm_batch.set_input_from_db(0, world) bvxm_batch.set_input_string(1, img_folder) bvxm_batch.set_input_double(2, geoid_height) bvxm_batch.set_input_float(3, fill_in_value) result = bvxm_batch.run_process() if result: (xi_id, xi_type) = bvxm_batch.commit_output(0) x_img = dbvalue(xi_id, xi_type) (yi_id, yi_type) = bvxm_batch.commit_output(1) y_img = dbvalue(yi_id, yi_type) (zi_id, zi_type) = bvxm_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
def pick_nadir_resource(res, lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat, satellite_name, band_name="PAN"): bvxm_batch.init_process("volmPickNadirResProcess"); 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, band_name); bvxm_batch.set_input_string(6, satellite_name); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); sat_path = bvxm_batch.get_output_string(id); return sat_path;
def find_stereo_pairs(res, lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat, 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.run_process(); (id, type) = bvxm_batch.commit_output(0); cnt = bvxm_batch.get_output_unsigned(id); return cnt;
def generate_xyz_from_dem(world, geotiff_dem, geoid_height, geocam=0, fill_in_value=-1.0): bvxm_batch.init_process("bvxmDemToXYZProcess"); bvxm_batch.set_input_from_db(0, world); bvxm_batch.set_input_string(1, geotiff_dem); bvxm_batch.set_input_double(2, geoid_height); bvxm_batch.set_input_from_db(3, geocam); bvxm_batch.set_input_float(4, fill_in_value); result = bvxm_batch.run_process(); if result: (xi_id, xi_type) = bvxm_batch.commit_output(0); x_img = dbvalue(xi_id, xi_type); (yi_id, yi_type) = bvxm_batch.commit_output(1); y_img = dbvalue(yi_id, yi_type); (zi_id, zi_type) = bvxm_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;
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
def registration_error_analysis(gt_file, cor_file, ori_file, gsd = 1.0, cor_vector_file = "", ori_vector_file = ""): bvxm_batch.init_process("volmRegistrationErrorProcess") bvxm_batch.set_input_string(0, gt_file) bvxm_batch.set_input_string(1, cor_file) bvxm_batch.set_input_string(2, ori_file) bvxm_batch.set_input_double(3, gsd) bvxm_batch.set_input_string(4, cor_vector_file) bvxm_batch.set_input_string(5, ori_vector_file) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) cor_average = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(1) cor_std = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(2) ori_average = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(3) ori_std = bvxm_batch.get_output_double(id) return cor_average, cor_std, ori_average, ori_std else: return 0.0, 0.0, 0.0, 0.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
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
def find_min_max_elev(ll_lon, ll_lat, ur_lon, ur_lat, dem_folder): bvxm_batch.init_process("volmFindMinMaxHeightPorcess") 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_string(4, dem_folder) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) min_elev = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(1) max_elev = bvxm_batch.get_output_double(id) return min_elev, max_elev else: return 0.0, 0.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
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
def create_lvcs(lat, lon, el, csname): bvxm_batch.init_process('vpglCreateLVCSProcess') bvxm_batch.set_input_double(0, lat) bvxm_batch.set_input_double(1, lon) bvxm_batch.set_input_double(2, el) bvxm_batch.set_input_string(3, csname) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) lvcs = dbvalue(id, type) return lvcs
def rational_cam_nadirness(camera, lat, lon, elev): bvxm_batch.init_process("vpglRationalCamNadirnessProcess"); bvxm_batch.set_input_from_db(0, camera); bvxm_batch.set_input_double(1, lat); bvxm_batch.set_input_double(2, lon); bvxm_batch.set_input_double(3, elev); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); val = bvxm_batch.get_output_double(id) return val
def pick_nadir_resource_pair(res, lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat, satellite_name, out_folder, band_name="PAN", non_cloud_folder=""): bvxm_batch.init_process("volmPickNadirResPairProcess"); 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, band_name); bvxm_batch.set_input_string(6, satellite_name); bvxm_batch.set_input_string(7, non_cloud_folder); bvxm_batch.set_input_string(8, out_folder) statuscode = bvxm_batch.run_process(); if statuscode: (p_id, p_type) = bvxm_batch.commit_output(0); pan_path = bvxm_batch.get_output_string(p_id); bvxm_batch.remove_data(p_id); (m_id, m_type) = bvxm_batch.commit_output(1); multi_path = bvxm_batch.get_output_string(m_id); bvxm_batch.remove_data(m_id); else: pan_path = ""; multi_path = ""; return statuscode, pan_path, multi_path
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): 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_string(12, path_H1) bvxm_batch.set_input_string(13, 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) (id, type) = bvxm_batch.commit_output(2) ortho_disp_map = dbvalue(id, type) return out_map, disparity_map, ortho_disp_map
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
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
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
def create_perspective_camera(scale, ppoint, center, look_pt, up=[0, 1, 0]): bvxm_batch.init_process("vpglCreatePerspectiveCameraProcess") bvxm_batch.set_input_double(0, scale[0]) bvxm_batch.set_input_double(1, ppoint[0]) bvxm_batch.set_input_double(2, scale[1]) bvxm_batch.set_input_double(3, ppoint[1]) bvxm_batch.set_input_double(4, center[0]) bvxm_batch.set_input_double(5, center[1]) bvxm_batch.set_input_double(6, center[2]) bvxm_batch.set_input_double(7, look_pt[0]) bvxm_batch.set_input_double(8, look_pt[1]) bvxm_batch.set_input_double(9, look_pt[2]) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) cam = dbvalue(id, type) return cam
def crop_ortho_image_using_3d_box(img_res, camera, lower_left_lon, lower_left_lat, lower_left_elev, upper_right_lon, upper_right_lat, upper_right_elev): bvxm_batch.init_process("vpglCropOrthoUsing3DboxPRocess") bvxm_batch.set_input_from_db(0, img_res) bvxm_batch.set_input_from_db(1, camera) bvxm_batch.set_input_double(2, lower_left_lon) bvxm_batch.set_input_double(3, lower_left_lat) bvxm_batch.set_input_double(4, lower_left_elev) bvxm_batch.set_input_double(5, upper_right_lon) bvxm_batch.set_input_double(6, upper_right_lat) bvxm_batch.set_input_double(7, upper_right_elev) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) local_geo_cam = dbvalue(id, type) (id, type) = bvxm_batch.commit_output(1) i0 = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(2) j0 = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(3) ni = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(4) nj = bvxm_batch.get_output_unsigned(id) return status, local_geo_cam, i0, j0, ni, nj else: return status, dbvalue(0, ""), 0, 0, 0, 0
def crop_image_using_3d_box_dem(img_res, camera, ll_lon, ll_lat, ur_lon, ur_lat, dem_folder, extra_height, uncertainty, lvcs=0): bvxm_batch.init_process("vpglCropImgUsing3DboxDemProcess") bvxm_batch.set_input_from_db(0, img_res) bvxm_batch.set_input_from_db(1, camera) 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_string(6, dem_folder) bvxm_batch.set_input_double(7, extra_height) bvxm_batch.set_input_double(8, uncertainty) if lvcs != 0: bvxm_batch.set_input_from_db(9, lvcs) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) local_cam = dbvalue(id, type) (id, type) = bvxm_batch.commit_output(1) i0 = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(2) j0 = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(3) ni = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(4) nj = bvxm_batch.get_output_unsigned(id) return status, local_cam, i0, j0, ni, nj else: return status, dbvalue(0, ""), 0.0, 0.0, 0.0, 0.0
def crop_ortho_image_using_3d_box(img_res, camera, lower_left_lon, lower_left_lat, lower_left_elev, upper_right_lon, upper_right_lat, upper_right_elev): bvxm_batch.init_process("vpglCropOrthoUsing3DboxPRocess") bvxm_batch.set_input_from_db(0, img_res); bvxm_batch.set_input_from_db(1, camera); bvxm_batch.set_input_double(2, lower_left_lon); bvxm_batch.set_input_double(3, lower_left_lat); bvxm_batch.set_input_double(4, lower_left_elev); bvxm_batch.set_input_double(5, upper_right_lon); bvxm_batch.set_input_double(6, upper_right_lat); bvxm_batch.set_input_double(7, upper_right_elev); status = bvxm_batch.run_process(); if status: (id, type) = bvxm_batch.commit_output(0); local_geo_cam = dbvalue(id, type); (id, type) = bvxm_batch.commit_output(1); i0 = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(2); j0 = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(3); ni = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(4); nj = bvxm_batch.get_output_unsigned(id) return status, local_geo_cam, i0, j0, ni, nj; else: return status, dbvalue(0, ""), 0, 0, 0, 0;