def img_registration_by_rmse(src_img, tgr_img, sx, sy, sz = 0.0, pixel_res=1.0, invalid_pixel=-9999.0, mask_img=None): bvxm_batch.init_process("vilImageRegistrationProcess") bvxm_batch.set_input_from_db(0, src_img) bvxm_batch.set_input_from_db(1, tgr_img) bvxm_batch.set_input_unsigned(2,sx) bvxm_batch.set_input_unsigned(3,sy) bvxm_batch.set_input_double(4, sz) bvxm_batch.set_input_double(5, pixel_res) bvxm_batch.set_input_float(6,invalid_pixel) if mask_img: bvxm_batch.set_input_from_db(7,mask_img) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) trans_x = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(1) trans_y = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(2) trans_z = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(3) rmse_z = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(4) var_z = bvxm_batch.get_output_double(id) return trans_x, trans_y, trans_z, rmse_z, var_z else: return -1.0, -1.0, -1.0, -1.0, -1.0
def img_registration_by_rmse(src_img, tgr_img, sx, sy, sz=0.0, pixel_res=1.0, invalid_pixel=-9999.0, mask_img=None): bvxm_batch.init_process("vilImageRegistrationProcess") bvxm_batch.set_input_from_db(0, src_img) bvxm_batch.set_input_from_db(1, tgr_img) bvxm_batch.set_input_unsigned(2, sx) bvxm_batch.set_input_unsigned(3, sy) bvxm_batch.set_input_double(4, sz) bvxm_batch.set_input_double(5, pixel_res) bvxm_batch.set_input_float(6, invalid_pixel) if mask_img: bvxm_batch.set_input_from_db(7, mask_img) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) trans_x = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(1) trans_y = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(2) trans_z = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(3) rmse_z = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(4) var_z = bvxm_batch.get_output_double(id) return trans_x, trans_y, trans_z, rmse_z, var_z else: return -1.0, -1.0, -1.0, -1.0, -1.0
def generate_xyz_from_dem_multi(world, img_folder, geoid_height, fill_in_value=-1.0): batch.init_process("bvxmDemToXYZProcess2") batch.set_input_from_db(0, world) batch.set_input_string(1, img_folder) batch.set_input_double(2, geoid_height) batch.set_input_float(3, fill_in_value) result = batch.run_process() if result: (xi_id, xi_type) = batch.commit_output(0) x_img = dbvalue(xi_id, xi_type) (yi_id, yi_type) = batch.commit_output(1) y_img = dbvalue(yi_id, yi_type) (zi_id, zi_type) = 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 geo_index_region_resource(geo_index_txt, ll_lon, ll_lat, ur_lon, ur_lat, out_file): bvxm_batch.init_process("bvglGeoIndexRegionResourceProcess") bvxm_batch.set_input_string(0, geo_index_txt) 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, out_file) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) n_leaves = bvxm_batch.get_output_unsigned(id) return n_leaves else: return 0
print statuscode if statuscode: (cropped_cam_id, cropped_cam_type) = batch.commit_output(0) cropped_cam = dbvalue(cropped_cam_id, cropped_cam_type) (cropped_image_id, cropped_image_type) = batch.commit_output(1) cropped_image = dbvalue(cropped_image_id, cropped_image_type) (uncertainty_id, uncertainty_type) = batch.commit_output(2) uncertainty = dbvalue(uncertainty_id, uncertainty_type) print("Compass edge detector Image") batch.init_process("bilCompassEdgeDetectorProcess") batch.set_input_from_db(0, cropped_image) batch.set_input_unsigned(1, 8) batch.set_input_double(2, 2.0) batch.set_input_double(3, 0.4) batch.run_process() (cropped_edge_image_id, cropped_edge_image_type) = batch.commit_output(0) cropped_edge_image = dbvalue( cropped_edge_image_id, cropped_edge_image_type) batch.init_process("bvxmRpcRegistrationProcess") batch.set_input_from_db(0, world) batch.set_input_from_db(1, cropped_cam) batch.set_input_from_db(2, cropped_edge_image) batch.set_input_bool(3, 0) batch.set_input_float(4, 25) batch.set_input_float(5, 0) batch.set_input_unsigned(6, 0) batch.run_process()
print statuscode; if statuscode: (cropped_cam_id, cropped_cam_type) = bvxm_batch.commit_output(0); cropped_cam = dbvalue(cropped_cam_id, cropped_cam_type); (cropped_image_id, cropped_image_type) = bvxm_batch.commit_output(1); cropped_image=dbvalue(cropped_image_id, cropped_image_type); (uncertainty_id,uncertainty_type) = bvxm_batch.commit_output(2); uncertainty = dbvalue(uncertainty_id,uncertainty_type); print("Compass edge detector Image"); bvxm_batch.init_process("bilCompassEdgeDetectorProcess"); bvxm_batch.set_input_from_db(0,cropped_image); bvxm_batch.set_input_unsigned(1,8); bvxm_batch.set_input_double(2,2.0); bvxm_batch.set_input_double(3,0.4); bvxm_batch.run_process(); (cropped_edge_image_id,cropped_edge_image_type) = bvxm_batch.commit_output(0); cropped_edge_image = dbvalue(cropped_edge_image_id,cropped_edge_image_type); 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,0); bvxm_batch.set_input_float(4,25); bvxm_batch.set_input_float(5,0); bvxm_batch.set_input_unsigned(6,0); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0);
print statuscode if statuscode: (cropped_cam_id, cropped_cam_type) = batch.commit_output(0) cropped_cam = dbvalue(cropped_cam_id, cropped_cam_type) (cropped_image_id, cropped_image_type) = batch.commit_output(1) cropped_image = dbvalue(cropped_image_id, cropped_image_type) (uncertainty_id, uncertainty_type) = batch.commit_output(2) uncertainty = dbvalue(uncertainty_id, uncertainty_type) print("Compass edge detector Image") batch.init_process("bilCompassEdgeDetectorProcess") batch.set_input_from_db(0, cropped_image) batch.set_input_unsigned(1, 8) batch.set_input_double(2, 2.0) batch.set_input_double(3, 0.4) batch.run_process() (cropped_edge_image_id, cropped_edge_image_type) = batch.commit_output(0) cropped_edge_image = dbvalue(cropped_edge_image_id, cropped_edge_image_type) batch.init_process("bvxmRpcRegistrationProcess") batch.set_input_from_db(0, world) batch.set_input_from_db(1, cropped_cam) batch.set_input_from_db(2, cropped_edge_image) batch.set_input_bool(3, 0) batch.set_input_float(4, 25) batch.set_input_float(5, 0) batch.set_input_unsigned(6, 0)