def compute_transformed_box(min_pt, max_pt, matrix_as_array): boxm2_batch.init_process("vpglTransformBoxProcess") boxm2_batch.set_input_double_array(0, min_pt) boxm2_batch.set_input_double_array(1, max_pt) boxm2_batch.set_input_double_array(2, matrix_as_array) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) out_min_pt = boxm2_batch.get_output_double_array(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(1) out_max_pt = boxm2_batch.get_output_double_array(id) boxm2_batch.remove_data(id) return out_min_pt, out_max_pt
def convert_local_to_global_coordinates_array(lvcs,x,y,z): boxm2_batch.init_process('vpglConvertLocalToGlobalCoordinatesArrayProcess'); boxm2_batch.set_input_from_db(0,lvcs); boxm2_batch.set_input_double_array(1,x); boxm2_batch.set_input_double_array(2,y); boxm2_batch.set_input_double_array(3,z); boxm2_batch.run_process(); (id,type) = boxm2_batch.commit_output(0); lat = boxm2_batch.get_output_double_array(id); boxm2_batch.remove_data(id); (id,type) = boxm2_batch.commit_output(1); lon = boxm2_batch.get_output_double_array(id); boxm2_batch.remove_data(id); (id,type) = boxm2_batch.commit_output(2); el = boxm2_batch.get_output_double_array(id); boxm2_batch.remove_data(id); return (lat,lon,el);
def convert_local_to_global_coordinates_array(lvcs, x, y, z): boxm2_batch.init_process('vpglConvertLocalToGlobalCoordinatesArrayProcess') boxm2_batch.set_input_from_db(0, lvcs) boxm2_batch.set_input_double_array(1, x) boxm2_batch.set_input_double_array(2, y) boxm2_batch.set_input_double_array(3, z) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) lat = boxm2_batch.get_output_double_array(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(1) lon = boxm2_batch.get_output_double_array(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(2) el = boxm2_batch.get_output_double_array(id) boxm2_batch.remove_data(id) return (lat, lon, el)
def create_perspective_camera_krt(k, r, t): ''' Take a k(3x3), r(3x3), and t(3) numpy array and returns a database object k, r, t can also be a flattened list ''' if type(k) != list: k = k.flatten().tolist() if type(r) != list: r = r.flatten().tolist() if type(t) != list: t = t.flatten().tolist() boxm2_batch.init_process("vpglCreatePerspectiveCameraProcess5"); boxm2_batch.set_input_double_array(0, k); boxm2_batch.set_input_double_array(1, r); boxm2_batch.set_input_double_array(2, t); boxm2_batch.run_process(); (db_id,db_type) = boxm2_batch.commit_output(0); cam = dbvalue(db_id,db_type); return cam;
def create_perspective_camera_krt(k, r, t): ''' Take a k(3x3), r(3x3), and t(3) numpy array and returns a database object k, r, t can also be a flattened list ''' if type(k) != list: k = k.flatten().tolist() if type(r) != list: r = r.flatten().tolist() if type(t) != list: t = t.flatten().tolist() boxm2_batch.init_process("vpglCreatePerspectiveCameraProcess5") boxm2_batch.set_input_double_array(0, k) boxm2_batch.set_input_double_array(1, r) boxm2_batch.set_input_double_array(2, t) boxm2_batch.run_process() (db_id, db_type) = boxm2_batch.commit_output(0) cam = dbvalue(db_id, db_type) return cam
def compute_transformation(pts0_xs, pts0_ys, pts0_zs, pts1_xs, pts1_ys, pts1_zs, input_cam_folder, output_cam_folder): boxm2_batch.init_process("vpglTransformSpaceProcess") boxm2_batch.set_input_double_array(0, pts0_xs) boxm2_batch.set_input_double_array(1, pts0_ys) boxm2_batch.set_input_double_array(2, pts0_zs) boxm2_batch.set_input_double_array(3, pts1_xs) boxm2_batch.set_input_double_array(4, pts1_ys) boxm2_batch.set_input_double_array(5, pts1_zs) boxm2_batch.set_input_string(6, input_cam_folder) boxm2_batch.set_input_string(7, output_cam_folder) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) matrix_as_array = boxm2_batch.get_output_double_array(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(1) scale = boxm2_batch.get_output_double(id) boxm2_batch.remove_data(id) return matrix_as_array, scale