def rpc_registration(world, cropped_cam, cropped_edge_image, uncertainty, shift_3d_flag=0, scale=0, is_uncertainty_float=0): 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, shift_3d_flag) if is_uncertainty_float == 1: print "uncertainty = ", uncertainty batch.set_input_float(4, uncertainty) else: batch.set_input_from_db(4, uncertainty) batch.set_input_unsigned(5, scale) batch.run_process() (cam_id, cam_type) = batch.commit_output(0) cam = dbvalue(cam_id, cam_type) (expected_edge_image_id, expected_edge_image_type) = batch.commit_output(1) expected_edge_image = dbvalue(expected_edge_image_id, expected_edge_image_type) (offset_u_id, offset_u_type) = batch.commit_output(2) offset_u = batch.get_output_double(offset_u_id) (offset_v_id, offset_v_type) = batch.commit_output(3) offset_v = batch.get_output_double(offset_v_id) return cam, expected_edge_image, offset_u, offset_v
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 scene_origin(scene): batch.init_process("bvxmSceneOriginProcess") batch.set_input_from_db(0, scene) batch.run_process() (id, type) = batch.commit_output(0) lower_left_lon = batch.get_output_double(id) (id, type) = batch.commit_output(1) lower_left_lat = batch.get_output_double(id) (id, type) = batch.commit_output(2) lower_left_z = batch.get_output_double(id) return lower_left_lon, lower_left_lat, lower_left_z
def img_sum(img, plane_index=0): bvxm_batch.init_process("vilImageSumProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_unsigned(1, plane_index) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) value = bvxm_batch.get_output_double(id) return value
def img_sum(img, plane_index=0): bvxm_batch.init_process("vilImageSumProcess") bvxm_batch.set_input_from_db(0,img) bvxm_batch.set_input_unsigned(1,plane_index) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) value = bvxm_batch.get_output_double(id) return value
def box_2d_intersection(in_kml, out_kml=""): bvxm_batch.init_process("bvgl2DBoxIntersectionProcess") bvxm_batch.set_input_string(0, in_kml) bvxm_batch.set_input_string(1, out_kml) status = bvxm_batch.run_process() if status: (id, type) = bvxm_batch.commit_output(0) ll_lon = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(1) ll_lat = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(2) ur_lon = bvxm_batch.get_output_double(id) (id, type) = bvxm_batch.commit_output(3) ur_lat = bvxm_batch.get_output_double(id) return ll_lon, ll_lat, ur_lon, ur_lat else: return 0.0, 0.0, 0.0, 0.0
def scene_local_box(scene): batch.init_process("bvxmSceneLocalBoxProcess") batch.set_input_from_db(0, scene) batch.run_process() (id, type) = batch.commit_output(0) lower_left_x = batch.get_output_double(id) batch.remove_data(id) (id, type) = batch.commit_output(1) lower_left_y = batch.get_output_double(id) batch.remove_data(id) (id, type) = batch.commit_output(2) upper_right_x = batch.get_output_double(id) batch.remove_data(id) (id, type) = batch.commit_output(3) upper_right_y = batch.get_output_double(id) batch.remove_data(id) (id, type) = batch.commit_output(4) voxel_size = batch.get_output_double(id) batch.remove_data(id) (id, type) = batch.commit_output(5) lower_left_z = batch.get_output_double(id) # min z batch.remove_data(id) (id, type) = batch.commit_output(6) upper_right_z = batch.get_output_double(id) # max z batch.remove_data(id) return lower_left_x, lower_left_y, upper_right_x, upper_right_y, voxel_size, lower_left_z, upper_right_z
def rpc_registration(world, cropped_cam, cropped_edge_image, uncertainty, shift_3d_flag=0, scale=0, is_uncertainty_float=0): 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, shift_3d_flag) if is_uncertainty_float == 1: print "uncertainty = ", uncertainty batch.set_input_float(4, uncertainty) else: batch.set_input_from_db(4, uncertainty) batch.set_input_unsigned(5, scale) batch.run_process() (cam_id, cam_type) = batch.commit_output(0) cam = dbvalue(cam_id, cam_type) (expected_edge_image_id, expected_edge_image_type) = batch.commit_output(1) expected_edge_image = dbvalue( expected_edge_image_id, expected_edge_image_type) (offset_u_id, offset_u_type) = batch.commit_output(2) offset_u = batch.get_output_double(offset_u_id) (offset_v_id, offset_v_type) = batch.commit_output(3) offset_v = batch.get_output_double(offset_v_id) return cam, expected_edge_image, offset_u, offset_v
def scene_box(scene): batch.init_process("bvxmSceneBoxProcess") batch.set_input_from_db(0, scene) batch.run_process() (id, type) = batch.commit_output(0) lower_left_lon = batch.get_output_double(id) (id, type) = batch.commit_output(1) lower_left_lat = batch.get_output_double(id) (id, type) = batch.commit_output(2) lower_left_elev = batch.get_output_double(id) (id, type) = batch.commit_output(3) upper_right_lon = batch.get_output_double(id) (id, type) = batch.commit_output(4) upper_right_lat = batch.get_output_double(id) (id, type) = batch.commit_output(5) upper_right_elev = batch.get_output_double(id) return lower_left_lon, lower_left_lat, lower_left_elev, upper_right_lon, upper_right_lat, upper_right_elev