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
def crop_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, uncertainty, lvcs=0): bvxm_batch.init_process("vpglCropImgUsing3DboxProcess") 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) 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
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
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) # of 0, it returns all resources that intersect the box, otherwise, it # picks n_seeds among these resources bvxm_batch.set_input_bool(7, pick_seeds) 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 persp2genWmargin(pcam, ni, nj, margin, level=0): bvxm_batch.init_process("vpglConvertToGenericCameraWithMarginProcess") bvxm_batch.set_input_from_db(0, pcam) bvxm_batch.set_input_unsigned(1, ni) bvxm_batch.set_input_unsigned(2, nj) bvxm_batch.set_input_unsigned(3, level) bvxm_batch.set_input_int(4, margin) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) gcam = dbvalue(id, type) (id, type) = bvxm_batch.commit_output(1) ni = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(2) nj = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(3) new_pers_cam = dbvalue(id, type) return (gcam, ni, nj, new_pers_cam)
def persp2genWmargin(pcam, ni, nj, margin, level=0) : bvxm_batch.init_process("vpglConvertToGenericCameraWithMarginProcess"); bvxm_batch.set_input_from_db(0, pcam); bvxm_batch.set_input_unsigned(1, ni); bvxm_batch.set_input_unsigned(2, nj); bvxm_batch.set_input_unsigned(3, level); bvxm_batch.set_input_int(4, margin); bvxm_batch.run_process(); (id,type) = bvxm_batch.commit_output(0); gcam = dbvalue(id,type); (id,type) = bvxm_batch.commit_output(1); ni = bvxm_batch.get_output_unsigned(id); (id,type) = bvxm_batch.commit_output(2); nj = bvxm_batch.get_output_unsigned(id); (id,type) = bvxm_batch.commit_output(3); new_pers_cam = dbvalue(id,type); return (gcam, ni, nj, new_pers_cam);
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;
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
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 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 scene_resources(res, lower_left_lon, lower_left_lat, upper_right_lon, upper_right_lat, scene_res_file, band="PAN", 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.run_process(); (id, type) = bvxm_batch.commit_output(0); cnt = bvxm_batch.get_output_unsigned(id); return cnt;
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
def generate_kml_from_image(in_img, in_cam, out_kml, threshold = 127, r = 0, g = 255, b = 0): bvxm_batch.init_process("volmGenerateKmlFromBinaryImageProcess") bvxm_batch.set_input_from_db(0, in_img) bvxm_batch.set_input_from_db(1, in_cam) bvxm_batch.set_input_unsigned(2, threshold) bvxm_batch.set_input_string(3, out_kml) bvxm_batch.set_input_unsigned(4, r) bvxm_batch.set_input_unsigned(5, g) bvxm_batch.set_input_unsigned(6, b) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) n_connected_component = bvxm_batch.get_output_unsigned(id) return n_connected_component else: return None
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 generate_kml_from_image(in_img, in_cam, out_kml, threshold=127, r=0, g=255, b=0): bvxm_batch.init_process("volmGenerateKmlFromBinaryImageProcess") bvxm_batch.set_input_from_db(0, in_img) bvxm_batch.set_input_from_db(1, in_cam) bvxm_batch.set_input_unsigned(2, threshold) bvxm_batch.set_input_string(3, out_kml) bvxm_batch.set_input_unsigned(4, r) bvxm_batch.set_input_unsigned(5, g) bvxm_batch.set_input_unsigned(6, b) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) n_connected_component = bvxm_batch.get_output_unsigned(id) return n_connected_component else: return None