def load_dictionary(dictionary_name): bvxm_batch.init_process("sdetLoadTextureDictionaryProcess"); bvxm_batch.set_input_string(0,dictionary_name); bvxm_batch.run_process(); (tclsf_id, tclsf_type)=bvxm_batch.commit_output(0); tclsf = dbvalue(tclsf_id, tclsf_type); return tclsf
def generate_roc(tclsf, class_out_prob_img, class_out_color_img, orig_img, prefix_for_bin_files, positive_category_name,category_id_file): bvxm_batch.init_process("sdetTextureClassifierROCProcess"); bvxm_batch.set_input_from_db(0, tclsf); bvxm_batch.set_input_from_db(1, class_out_prob_img); bvxm_batch.set_input_from_db(2, class_out_color_img); bvxm_batch.set_input_from_db(3, orig_img); bvxm_batch.set_input_string(4, prefix_for_bin_files); bvxm_batch.set_input_string(5, positive_category_name); bvxm_batch.set_input_string(6, category_id_file); bvxm_batch.run_process(); (id,type) = bvxm_batch.commit_output(0); tp = bvxm_batch.get_bbas_1d_array_float(id); (id,type) = bvxm_batch.commit_output(1); tn = bvxm_batch.get_bbas_1d_array_float(id); (id,type) = bvxm_batch.commit_output(2); fp = bvxm_batch.get_bbas_1d_array_float(id); (id,type) = bvxm_batch.commit_output(3); fn = bvxm_batch.get_bbas_1d_array_float(id); (id,type) = bvxm_batch.commit_output(4); tpr = bvxm_batch.get_bbas_1d_array_float(id); (id,type) = bvxm_batch.commit_output(5); fpr = bvxm_batch.get_bbas_1d_array_float(id); (id,type) = bvxm_batch.commit_output(6); outimg = dbvalue(id,type); return tp, tn, fp, fn, tpr, fpr, outimg;
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();
def load_image_metadata(filename): bvxm_batch.init_process("bradLoadImageMetadataProcess") bvxm_batch.set_input_string(0,filename) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) mdata = dbvalue(id,type) return mdata
def get_metadata_info(mdata): bvxm_batch.init_process("bradGetMetaDataInfoProcess") bvxm_batch.set_input_from_db(0, mdata) 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) (id, type) = bvxm_batch.commit_output(2) year = bvxm_batch.get_output_int(id) bvxm_batch.remove_data(id) (id, type) = bvxm_batch.commit_output(3) month = bvxm_batch.get_output_int(id) bvxm_batch.remove_data(id) (id, type) = bvxm_batch.commit_output(4) day = bvxm_batch.get_output_int(id) bvxm_batch.remove_data(id) (id, type) = bvxm_batch.commit_output(5) hour = bvxm_batch.get_output_int(id) bvxm_batch.remove_data(id) (id, type) = bvxm_batch.commit_output(6) minutes = bvxm_batch.get_output_int(id) bvxm_batch.remove_data(id) (id, type) = bvxm_batch.commit_output(7) seconds = bvxm_batch.get_output_int(id) bvxm_batch.remove_data(id) (id, type) = bvxm_batch.commit_output(8) gsd = bvxm_batch.get_output_float(id) bvxm_batch.remove_data(id) (id, type) = bvxm_batch.commit_output(9) sat_name = bvxm_batch.get_output_string(id) bvxm_batch.remove_data(id) return sun_az, sun_el, year, month, day, hour, minutes, seconds, gsd, sat_name
def region_wise_roc_analysis(in_img, in_cam, positive_kml, negative_kml): bvxm_batch.init_process("volmDetectionRateROCProcess") bvxm_batch.set_input_from_db(0, in_img) bvxm_batch.set_input_from_db(1, in_cam) bvxm_batch.set_input_string(2, positive_kml) bvxm_batch.set_input_string(3, negative_kml) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) thres_out = bvxm_batch.get_bbas_1d_array_float(id) (id, type) = bvxm_batch.commit_output(1) tp = bvxm_batch.get_bbas_1d_array_float(id) (id, type) = bvxm_batch.commit_output(2) tn = bvxm_batch.get_bbas_1d_array_float(id) (id, type) = bvxm_batch.commit_output(3) fp = bvxm_batch.get_bbas_1d_array_float(id) (id, type) = bvxm_batch.commit_output(4) fn = bvxm_batch.get_bbas_1d_array_float(id) (id, type) = bvxm_batch.commit_output(5) tpr = bvxm_batch.get_bbas_1d_array_float(id) (id, type) = bvxm_batch.commit_output(6) fpr = bvxm_batch.get_bbas_1d_array_float(id) return thres_out, tp, tn, fp, fn, tpr, fpr else: return None, None, None, None, None, None, None
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();
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 map_sdet_to_volm_ids(sdet_color_class_img): bvxm_batch.init_process("volmGenerateClassMapProcess"); bvxm_batch.set_input_from_db(0,sdet_color_class_img); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); out_img = dbvalue(id, type); return out_img
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 load_projective_camera(file_path): bvxm_batch.init_process("vpglLoadProjCameraProcess") bvxm_batch.set_input_string(0, file_path) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) cam = dbvalue(id, type) return cam
def load_atmospheric_parameters(filename): bvxm_batch.init_process("bradLoadAtmosphericParametersProcess") bvxm_batch.set_input_string(0,filename) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) atm_params = dbvalue(id,type) return atm_params
def load_eigenspace(filename): bvxm_batch.init_process("bradLoadEigenspaceProcess"); bvxm_batch.set_input_string(0, filename); bvxm_batch.run_process(); (eig_id,eig_type)=bvxm_batch.commit_output(0); eig = dbvalue(eig_id, eig_type); return eig;
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 load_classifier(classifier_name): bvxm_batch.init_process("sdetLoadTextureClassifierProcess"); bvxm_batch.set_input_string(0,classifier_name); bvxm_batch.run_process(); (tclsf_id, tclsf_type)=bvxm_batch.commit_output(0); tclsf = dbvalue(tclsf_id, tclsf_type); return tclsf
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 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 load_lvcs(lvcs_filename): bvxm_batch.init_process("vpglLoadLVCSProcess"); bvxm_batch.set_input_string(0, lvcs_filename); bvxm_batch.run_process(); (lvcs_id, lvcs_type) = bvxm_batch.commit_output(0); lvcs = dbvalue(lvcs_id, lvcs_type); return lvcs;
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();
def convert_local_rational_perspective_camera(local_cam) : bvxm_batch.init_process("vpglConvertLocalRationalToPerspectiveProcess"); bvxm_batch.set_input_from_db(0, local_cam); bvxm_batch.run_process(); (id,type) = bvxm_batch.commit_output(0); cam = dbvalue(id,type); return cam;
def get_geocam_footprint(geocam, geotiff_filename, out_kml_filename,init_finish=True): bvxm_batch.init_process('vpglGeoFootprintProcess'); bvxm_batch.set_input_from_db(0,geocam); bvxm_batch.set_input_string(1,geotiff_filename); bvxm_batch.set_input_string(2,out_kml_filename); bvxm_batch.set_input_bool(3,init_finish); bvxm_batch.run_process();
def create_scene(scene_params_xml): bvxm_batch.init_process("bvxmCreateVoxelWorldProcess"); bvxm_batch.set_params_process(scene_params_xml); ## "./bvxmCreateVoxelWorldProcess.xml" bvxm_batch.run_process(); (world_id, world_type) = bvxm_batch.commit_output(0); world = dbvalue(world_id, world_type); return world
def load_local_rational_camera(file_path) : bvxm_batch.init_process("vpglLoadLocalRationalCameraProcess"); bvxm_batch.set_input_string(0, file_path); bvxm_batch.run_process(); (id,type) = bvxm_batch.commit_output(0); cam = dbvalue(id,type); return cam;
def create_ortho_camera(world): bvxm_batch.init_process("bvxmCreateOrthoCameraProcess"); bvxm_batch.set_input_from_db(0,world); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); ortho_cam = dbvalue(id, type); return ortho_cam
def load_sat_resources(res_file_name): bvxm_batch.init_process("volmLoadSatResourcesProcess"); bvxm_batch.set_input_string(0,res_file_name); bvxm_batch.run_process(); (res2_id, res2_type) = bvxm_batch.commit_output(0); res2 = dbvalue(res2_id, res2_type); return res2
def load_rational_camera_nitf(file_path): bvxm_batch.init_process("vpglLoadRationalCameraNITFProcess") bvxm_batch.set_input_string(0, file_path) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) cam = dbvalue(id, type) return cam
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
def model_dir(scene): bvxm_batch.init_process("bvxmSceneModelDirProcess"); bvxm_batch.set_input_from_db(0, scene); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); model_dir = bvxm_batch.get_output_string(id); return model_dir;
def load_perspective_camera(file_path) : bvxm_batch.init_process("vpglLoadPerspectiveCameraProcess"); bvxm_batch.set_input_string(0, file_path); bvxm_batch.run_process(); (id,type) = bvxm_batch.commit_output(0); cam = dbvalue(id,type); return cam;
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 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
def create_and_save_lvcs(lat, lon, hae, cs_name, lvcs_filename): bvxm_batch.init_process("vpglCreateAndSaveLVCSProcess") bvxm_batch.set_input_float(0, lat) bvxm_batch.set_input_float(1, lon) bvxm_batch.set_input_float(2, hae) bvxm_batch.set_input_string(3, cs_name) bvxm_batch.set_input_string(4, lvcs_filename) bvxm_batch.run_process() return
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
def load_geotiff_from_header(filename, lvcs=0): bvxm_batch.init_process("vpglLoadGeotiffCamFromHeaderProcess") bvxm_batch.set_input_string(0, filename) if lvcs != 0: bvxm_batch.set_input_from_db(1, lvcs) bvxm_batch.run_process() (c_id, c_type) = bvxm_batch.commit_output(0) cam = dbvalue(c_id, c_type) return cam
def get_full_path(res, name): bvxm_batch.init_process("volmGetFullPathProcess") bvxm_batch.set_input_from_db(0, res) bvxm_batch.set_input_string(1, name) 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) return full_path
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 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 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
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()
def create_perspective_camera2(pcam, cent_x, cent_y, cent_z): bvxm_batch.init_process("vpglCreatePerspectiveCameraProcess2") bvxm_batch.set_input_from_db(0, pcam) bvxm_batch.set_input_float(1, cent_x) bvxm_batch.set_input_float(2, cent_y) bvxm_batch.set_input_float(3, cent_z) bvxm_batch.run_process() (c_id, c_type) = bvxm_batch.commit_output(0) cam = dbvalue(c_id, c_type) return cam
def convert_to_generic_camera(cam_in, ni, nj, level=0): bvxm_batch.init_process('vpglConvertToGenericCameraProcess') 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_unsigned(3, level) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) generic_cam = dbvalue(id, type) return generic_cam
def create_lvcs(lat, lon, el, csname): bvxm_batch.init_process('vpglCreateLVCSProcess') bvxm_batch.set_input_float(0, lat) bvxm_batch.set_input_float(1, lon) bvxm_batch.set_input_float(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 project_osm_to_ortho_img(img_byte, ortho_cam, osm_file): bvxm_batch.init_process("volmMapOSMProcess") bvxm_batch.set_input_from_db(0, img_byte) bvxm_batch.set_input_from_db(1, ortho_cam) bvxm_batch.set_input_string(2, osm_file) # process returns true if any osm objects hit the image area in this tile hit = bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) out_img = dbvalue(id, type) return hit, out_img
def persp2gen(pcam, ni, nj, level=0): bvxm_batch.init_process("vpglConvertToGenericCameraProcess") 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.run_process() (id, type) = bvxm_batch.commit_output(0) gcam = dbvalue(id, type) return gcam
def create_scene(scene_params_xml): bvxm_batch.init_process("bvxmCreateVoxelWorldProcess") bvxm_batch.set_params_process(scene_params_xml) ## "./bvxmCreateVoxelWorldProcess.xml" status = bvxm_batch.run_process() if status != 1: raise Exception('Error creating scene from ' + scene_params_xml) (world_id, world_type) = bvxm_batch.commit_output(0) world = dbvalue(world_id, world_type) return world
def read_nitf_metadata(nitf_filename, imd_folder=""): bvxm_batch.init_process("bradNITFReadMetadataProcess") bvxm_batch.set_input_string(0, nitf_filename) # requires full path and name bvxm_batch.set_input_string( 1, imd_folder) # pass empty if meta is in img folder bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) meta = dbvalue(id, type) return meta
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()
def scene_lvcs(world): bvxm_batch.init_process("bvxmSceneLvcsProcess") bvxm_batch.set_input_from_db(0, world) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) lvcs = dbvalue(id, type) return lvcs else: return 0
def render_height_map(world): print("Rendering height map") bvxm_batch.init_process("bvxmHeightmapOrthoProcess") bvxm_batch.set_input_from_db(0, world) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) out_d_img = dbvalue(id, type) (id, type) = bvxm_batch.commit_output(1) out_h_img = dbvalue(id, type) return out_h_img, out_d_img
def estimate_shadows(image, metadata, atmospheric_params): bvxm_batch.init_process("bradEstimateShadowsProcess") bvxm_batch.set_input_from_db(0, image) bvxm_batch.set_input_from_db(1, metadata) bvxm_batch.set_input_from_db(2, atmospheric_params) bvxm_batch.set_input_bool(3, False) # False returns probability value bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) shadow_probs = dbvalue(id, type) return shadow_probs
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
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 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 get_geocam_footprint(geocam, geotiff_filename, out_kml_filename, init_finish=True): bvxm_batch.init_process('vpglGeoFootprintProcess') bvxm_batch.set_input_from_db(0, geocam) bvxm_batch.set_input_string(1, geotiff_filename) bvxm_batch.set_input_string(2, out_kml_filename) bvxm_batch.set_input_bool(3, init_finish) bvxm_batch.run_process()
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()
def add_responses_to_filter_bank(tclsf, img_name, img, filter_folder, filter_name): bvxm_batch.init_process("sdetAddResponsestoFilterBankProcess") bvxm_batch.set_input_from_db(0, tclsf) # classifier instance bvxm_batch.set_input_string(1, img_name) bvxm_batch.set_input_from_db(2, img) bvxm_batch.set_input_string(3, filter_folder) # pass a unique name to be used to write to filter_folder bvxm_batch.set_input_string(4, filter_name) bvxm_batch.run_process()
def resample_perspective_camera(cam, size0, size1): bvxm_batch.init_process("vpglResamplePerspectiveCameraProcess") bvxm_batch.set_input_from_db(0, cam) bvxm_batch.set_input_int(1, size0[0]) bvxm_batch.set_input_int(2, size0[1]) bvxm_batch.set_input_int(3, size1[0]) bvxm_batch.set_input_int(4, size1[1]) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) out = dbvalue(id, type) return out
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 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