Exemple #1
0
def get_rational_camera_offsets(cam_in):
    boxm2_batch.init_process('vpglGetRationalCameraOffsetsProcess')
    boxm2_batch.set_input_from_db(0, cam_in)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    offset_u = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    offset_v = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    return (offset_u, offset_v)
Exemple #2
0
def get_rational_camera_offsets(cam_in):
    boxm2_batch.init_process('vpglGetRationalCameraOffsetsProcess');
    boxm2_batch.set_input_from_db(0,cam_in);
    boxm2_batch.run_process();
    (id,type) = boxm2_batch.commit_output(0);
    offset_u = boxm2_batch.get_output_double(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(1);
    offset_v = boxm2_batch.get_output_double(id);
    boxm2_batch.remove_data(id);
    return (offset_u,offset_v);
Exemple #3
0
def register_translational(img0, img0_mask, img1, search_radius=0):
    boxm2_batch.init_process('ihogRegisterTranslationalProcess')
    boxm2_batch.set_input_from_db(0,img0)
    boxm2_batch.set_input_from_db(1,img0_mask)
    boxm2_batch.set_input_from_db(2,img1)
    boxm2_batch.set_input_int(3,search_radius)
    boxm2_batch.run_process()
    (id,type) = boxm2_batch.commit_output(0)
    trans_x = boxm2_batch.get_output_double(id)
    (id,type) = boxm2_batch.commit_output(1)
    trans_y = boxm2_batch.get_output_double(id)
    return (trans_x, trans_y)
Exemple #4
0
def bbox_from_ply(filename):
    minpoint = list()
    maxpoint = list()
    boxm2_batch.init_process('imeshPlyBboxProcess')
    boxm2_batch.set_input_string(0, filename)
    boxm2_batch.run_process()
    for i in (0, 1, 2):
        (id, type) = boxm2_batch.commit_output(i)
        minpoint.append(boxm2_batch.get_output_double(id))
    for i in (3, 4, 5):
        (id, type) = boxm2_batch.commit_output(i)
        maxpoint.append(boxm2_batch.get_output_double(id))
    return (minpoint, maxpoint)
Exemple #5
0
def bbox_from_ply(filename):
  minpoint = list();
  maxpoint = list();
  boxm2_batch.init_process('imeshPlyBboxProcess')
  boxm2_batch.set_input_string(0,filename)
  boxm2_batch.run_process()
  for i in (0,1,2):
    (id,type) = boxm2_batch.commit_output(i)
    minpoint.append(boxm2_batch.get_output_double(id));
  for i in (3,4,5):
    (id,type) = boxm2_batch.commit_output(i)
    maxpoint.append(boxm2_batch.get_output_double(id));
  return (minpoint, maxpoint)
Exemple #6
0
def load_perspective_camera_from_kml_file(NI, NJ, kml_file):
    boxm2_batch.init_process("vpglLoadPerspCameraFromKMLFileProcess")
    boxm2_batch.set_input_unsigned(0, NI)
    boxm2_batch.set_input_unsigned(1, NJ)
    boxm2_batch.set_input_string(2, kml_file)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    cam = dbvalue(id, type)
    (id, type) = boxm2_batch.commit_output(1)
    longitude = boxm2_batch.get_output_double(id)
    (id, type) = boxm2_batch.commit_output(2)
    latitude = boxm2_batch.get_output_double(id)
    (id, type) = boxm2_batch.commit_output(3)
    altitude = boxm2_batch.get_output_double(id)
    return cam, longitude, latitude, altitude
Exemple #7
0
def load_perspective_camera_from_kml_file(NI, NJ, kml_file) :
  boxm2_batch.init_process("vpglLoadPerspCameraFromKMLFileProcess");
  boxm2_batch.set_input_unsigned(0, NI);
  boxm2_batch.set_input_unsigned(1, NJ);
  boxm2_batch.set_input_string(2, kml_file);
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  cam = dbvalue(id,type);
  (id,type) = boxm2_batch.commit_output(1);
  longitude = boxm2_batch.get_output_double(id);
  (id,type) = boxm2_batch.commit_output(2);
  latitude = boxm2_batch.get_output_double(id);
  (id,type) = boxm2_batch.commit_output(3);
  altitude = boxm2_batch.get_output_double(id);
  return cam, longitude, latitude, altitude;
Exemple #8
0
def convert_local_to_global_coordinates(lvcs, x, y, z):
    boxm2_batch.init_process('vpglConvertLocalToGlobalCoordinatesProcess')
    boxm2_batch.set_input_from_db(0, lvcs)
    boxm2_batch.set_input_double(1, x)
    boxm2_batch.set_input_double(2, y)
    boxm2_batch.set_input_double(3, z)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    lat = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    lon = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    el = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    return (lat, lon, el)
Exemple #9
0
def img_sum(img, plane_index=0):
  boxm2_batch.init_process("vilImageSumProcess")
  boxm2_batch.set_input_from_db(0,img)
  boxm2_batch.set_input_unsigned(1,plane_index)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  value = boxm2_batch.get_output_double(id)
  return value
Exemple #10
0
def box_2d_intersection(in_kml, out_kml=""):
    boxm2_batch.init_process("bvgl2DBoxIntersectionProcess")
    boxm2_batch.set_input_string(0,  in_kml)
    boxm2_batch.set_input_string(1, out_kml)
    status = boxm2_batch.run_process()
    if status:
        (id, type) = boxm2_batch.commit_output(0)
        ll_lon = boxm2_batch.get_output_double(id)
        (id, type) = boxm2_batch.commit_output(1)
        ll_lat = boxm2_batch.get_output_double(id)
        (id, type) = boxm2_batch.commit_output(2)
        ur_lon = boxm2_batch.get_output_double(id)
        (id, type) = boxm2_batch.commit_output(3)
        ur_lat = boxm2_batch.get_output_double(id)
        return True, ll_lon, ll_lat, ur_lon, ur_lat
    else:
        return False, 0.0, 0.0, 0.0, 0.0
Exemple #11
0
def img_sum(img, plane_index=0):
    boxm2_batch.init_process("vilImageSumProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_unsigned(1, plane_index)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    value = boxm2_batch.get_output_double(id)
    return value
Exemple #12
0
def convert_local_to_global_coordinates(lvcs,x,y,z):
    boxm2_batch.init_process('vpglConvertLocalToGlobalCoordinatesProcess');
    boxm2_batch.set_input_from_db(0,lvcs);
    boxm2_batch.set_input_double(1,x);
    boxm2_batch.set_input_double(2,y);
    boxm2_batch.set_input_double(3,z);
    boxm2_batch.run_process();
    (id,type) = boxm2_batch.commit_output(0);
    lat = boxm2_batch.get_output_double(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(1);
    lon = boxm2_batch.get_output_double(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(2);
    el = boxm2_batch.get_output_double(id);
    boxm2_batch.remove_data(id);
    return (lat,lon,el);
Exemple #13
0
def get_geocam_footprint(geocam, geotiff_filename, out_kml_filename="", write_kml=False):
    boxm2_batch.init_process("vpglGeoFootprintProcess2")
    boxm2_batch.set_input_from_db(0, geocam)
    boxm2_batch.set_input_string(1, geotiff_filename)
    boxm2_batch.set_input_string(2, out_kml_filename)
    boxm2_batch.set_input_string(3, write_kml)
    status = boxm2_batch.run_process()
    if status:
      (id, type) = boxm2_batch.commit_output(0)
      ll_lon     = boxm2_batch.get_output_double(id)
      (id, type) = boxm2_batch.commit_output(1)
      ll_lat     = boxm2_batch.get_output_double(id)
      (id, type) = boxm2_batch.commit_output(2)
      ur_lon     = boxm2_batch.get_output_double(id)
      (id, type) = boxm2_batch.commit_output(3)
      ur_lat     = boxm2_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_bbox(scene):
    boxm2_batch.init_process("boxm2SceneBboxProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.run_process()
    out = []
    for outIdx in range(6):
        (id, type) = boxm2_batch.commit_output(outIdx)
        pt = boxm2_batch.get_output_double(id)
        out.append(pt)
    minPt = (out[0], out[1], out[2])
    maxPt = (out[3], out[4], out[5])
    return (minPt, maxPt)
Exemple #15
0
def get_generic_cam_ray(cam, u, v):
  boxm2_batch.init_process("vpglGetGenericCamRayProcess");
  boxm2_batch.set_input_from_db(0, cam);
  boxm2_batch.set_input_unsigned(1, u);
  boxm2_batch.set_input_unsigned(2, v);
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  orig_x = boxm2_batch.get_output_double(id);
  boxm2_batch.remove_data(id);
  (id,type) = boxm2_batch.commit_output(1);
  orig_y = boxm2_batch.get_output_double(id);
  boxm2_batch.remove_data(id);
  (id,type) = boxm2_batch.commit_output(2);
  orig_z = boxm2_batch.get_output_double(id);
  boxm2_batch.remove_data(id);
  (id,type) = boxm2_batch.commit_output(3);
  dir_x = boxm2_batch.get_output_double(id);
  boxm2_batch.remove_data(id);
  (id,type) = boxm2_batch.commit_output(4);
  dir_y = boxm2_batch.get_output_double(id);
  boxm2_batch.remove_data(id);
  (id,type) = boxm2_batch.commit_output(5);
  dir_z = boxm2_batch.get_output_double(id);
  boxm2_batch.remove_data(id);
  return orig_x, orig_y, orig_z, dir_x, dir_y, dir_z;
Exemple #16
0
def get_generic_cam_ray(cam, u, v):
    boxm2_batch.init_process("vpglGetGenericCamRayProcess")
    boxm2_batch.set_input_from_db(0, cam)
    boxm2_batch.set_input_unsigned(1, u)
    boxm2_batch.set_input_unsigned(2, v)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    orig_x = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    orig_y = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    orig_z = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(3)
    dir_x = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(4)
    dir_y = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(5)
    dir_z = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    return orig_x, orig_y, orig_z, dir_x, dir_y, dir_z
Exemple #17
0
def get_geocam_footprint(geocam,
                         geotiff_filename,
                         out_kml_filename="",
                         write_kml=False):
    boxm2_batch.init_process("vpglGeoFootprintProcess2")
    boxm2_batch.set_input_from_db(0, geocam)
    boxm2_batch.set_input_string(1, geotiff_filename)
    boxm2_batch.set_input_string(2, out_kml_filename)
    boxm2_batch.set_input_string(3, write_kml)
    status = boxm2_batch.run_process()
    if status:
        (id, type) = boxm2_batch.commit_output(0)
        ll_lon = boxm2_batch.get_output_double(id)
        (id, type) = boxm2_batch.commit_output(1)
        ll_lat = boxm2_batch.get_output_double(id)
        (id, type) = boxm2_batch.commit_output(2)
        ur_lon = boxm2_batch.get_output_double(id)
        (id, type) = boxm2_batch.commit_output(3)
        ur_lat = boxm2_batch.get_output_double(id)
        return ll_lon, ll_lat, ur_lon, ur_lat
    else:
        return 0.0, 0.0, 0.0, 0.0
Exemple #18
0
def image_mutual_info(image1, image2, min_val, max_val, n_bins):
  boxm2_batch.init_process("bripImageMutualInfoProcess")
  boxm2_batch.set_input_from_db(0, image1)
  boxm2_batch.set_input_from_db(1, image2)
  boxm2_batch.set_input_double(2, min_val)
  boxm2_batch.set_input_double(3, max_val)
  boxm2_batch.set_input_unsigned(4, n_bins)
  status = boxm2_batch.run_process()
  if status:
    (id, type) = boxm2_batch.commit_output(0)
    mutual_info = boxm2_batch.get_output_double(id)
    return mutual_info
  else:
    return -1.0
Exemple #19
0
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
Exemple #20
0
def get_single_nitf_footprint(nitf_filename, out_kml_filename="",isKml = False, metafolder =""):
    boxm2_batch.init_process('vpglNITFFootprintProcess2');
    boxm2_batch.set_input_string(0,nitf_filename);
    boxm2_batch.set_input_string(1,out_kml_filename);
    boxm2_batch.set_input_bool(2,isKml);
    boxm2_batch.set_input_string(3,metafolder);
    boxm2_batch.run_process();
    (id,type) = boxm2_batch.commit_output(0);
    llon = boxm2_batch.get_output_double(id);
    (id,type) = boxm2_batch.commit_output(1);
    llat = boxm2_batch.get_output_double(id);
    (id,type) = boxm2_batch.commit_output(2);
    lele = boxm2_batch.get_output_double(id);
    (id,type) = boxm2_batch.commit_output(3);
    rlon = boxm2_batch.get_output_double(id);
    (id,type) = boxm2_batch.commit_output(4);
    rlat = boxm2_batch.get_output_double(id);
    (id,type) = boxm2_batch.commit_output(5);
    rele = boxm2_batch.get_output_double(id);
    boxm2_batch.remove_data(id);
    return llon, llat, lele, rlon, rlat, rele
Exemple #21
0
def get_single_nitf_footprint(nitf_filename,
                              out_kml_filename="",
                              isKml=False,
                              metafolder=""):
    boxm2_batch.init_process('vpglNITFFootprintProcess2')
    boxm2_batch.set_input_string(0, nitf_filename)
    boxm2_batch.set_input_string(1, out_kml_filename)
    boxm2_batch.set_input_bool(2, isKml)
    boxm2_batch.set_input_string(3, metafolder)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    llon = boxm2_batch.get_output_double(id)
    (id, type) = boxm2_batch.commit_output(1)
    llat = boxm2_batch.get_output_double(id)
    (id, type) = boxm2_batch.commit_output(2)
    lele = boxm2_batch.get_output_double(id)
    (id, type) = boxm2_batch.commit_output(3)
    rlon = boxm2_batch.get_output_double(id)
    (id, type) = boxm2_batch.commit_output(4)
    rlat = boxm2_batch.get_output_double(id)
    (id, type) = boxm2_batch.commit_output(5)
    rele = boxm2_batch.get_output_double(id)
    boxm2_batch.remove_data(id)
    return llon, llat, lele, rlon, rlat, rele
Exemple #22
0
from boxm2_register import boxm2_batch, dbvalue

############################################################
# obtain intersection of multiple 2d rectangular boxes
############################################################
def box_2d_intersection(in_kml, out_kml=""):
  boxm2_batch.init_process("bvgl2DBoxIntersectionProcess")
  boxm2_batch.set_input_string(0,  in_kml)
  boxm2_batch.set_input_string(1, out_kml)
  status = boxm2_batch.run_process();
  if status;
    (id, type) = boxm2_batch.commit_output(0);
    ll_lon = boxm2_batch.get_output_double(id);
    (id, type) = boxm2_batch.commit_output(1);
    ll_lat = boxm2_batch.get_output_double(id);
    (id, type) = boxm2_batch.commit_output(2);
    ur_lon = boxm2_batch.get_output_double(id);
    (id, type) = boxm2_batch.commit_output(3);
    ur_lat = boxm2_batch.get_output_double(id);
    boxm2_batch.remove(id)
    return ll_lon, ll_lat, ur_lon, ur_lat
  else
    return 0.0, 0.0, 0.0, 0.0