Example #1
0
def get_3d_from_cams( cams, points ):
    assert( len(cams) == len(points) and len(cams) > 1 );
    #list of points will just be [u1,v1,u2,v2...];
    ptlist = [];
    for p in points:
        ptlist.append(p[0]);
        ptlist.append(p[1]);
    #list of cam ids (type will be checked in C++);
    camlist = [];
    for cam in cams:
        camlist.append(cam.id);
    boxm2_batch.init_process("vpglGenerate3dPointFromCamsProcess");
    boxm2_batch.set_input_unsigned_array(0, camlist);
    boxm2_batch.set_input_int_array(1, ptlist);
    boxm2_batch.run_process();
    (id, type) = boxm2_batch.commit_output(0);
    x=boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    (id, type) = boxm2_batch.commit_output(1);
    y=boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    (id, type) = boxm2_batch.commit_output(2);
    z=boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    return x,y,z;
Example #2
0
def get_3d_from_cams(cams, points):
    assert (len(cams) == len(points) and len(cams) > 1)
    #list of points will just be [u1,v1,u2,v2...];
    ptlist = []
    for p in points:
        ptlist.append(p[0])
        ptlist.append(p[1])
    #list of cam ids (type will be checked in C++);
    camlist = []
    for cam in cams:
        camlist.append(cam.id)
    boxm2_batch.init_process("vpglGenerate3dPointFromCamsProcess")
    boxm2_batch.set_input_unsigned_array(0, camlist)
    boxm2_batch.set_input_int_array(1, ptlist)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return x, y, z
Example #3
0
def estimate_radiance_values(image,
                             sun_el,
                             sun_dist,
                             sensor_el,
                             solar_irrad=None,
                             downwelled_irrad=None,
                             optical_depth=None):
    boxm2_batch.init_process("bradEstimateRadianceValuesProcess")
    boxm2_batch.set_input_from_db(0, image)
    boxm2_batch.set_input_float(1, sun_el)
    boxm2_batch.set_input_float(2, sun_dist)
    boxm2_batch.set_input_float(3, sensor_el)
    if solar_irrad != None:
        boxm2_batch.set_input_float(4, solar_irrad)
    if downwelled_irrad != None:
        boxm2_batch.set_input_float(5, downwelled_irrad)
    if optical_depth != None:
        boxm2_batch.set_input_float(6, optical_depth)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    airlight = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    ref_horizontal = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    ref_sun_facing = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return (airlight, ref_horizontal, ref_sun_facing)
Example #4
0
def image_range(img):
    boxm2_batch.init_process('vilImageRangeProcess')
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    minVal = boxm2_batch.get_output_float(id)
    (id, type) = boxm2_batch.commit_output(1)
    maxVal = boxm2_batch.get_output_float(id)
    return minVal, maxVal
Example #5
0
def image_range(img):
    boxm2_batch.init_process('vilImageRangeProcess')
    boxm2_batch.set_input_from_db(0,img)
    boxm2_batch.run_process()
    (id,type) = boxm2_batch.commit_output(0)
    minVal = boxm2_batch.get_output_float(id)
    (id,type) = boxm2_batch.commit_output(1)
    maxVal = boxm2_batch.get_output_float(id)
    return minVal, maxVal
Example #6
0
def get_sun_angles(mdata):
  boxm2_batch.init_process("bradGetSunAnglesProcess")
  boxm2_batch.set_input_from_db(0,mdata)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  sun_az = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  (id,type) = boxm2_batch.commit_output(1)
  sun_el = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  return sun_az, sun_el
Example #7
0
def get_sun_angles(mdata):
    boxm2_batch.init_process("bradGetSunAnglesProcess")
    boxm2_batch.set_input_from_db(0, mdata)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    sun_az = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    sun_el = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return sun_az, sun_el
def scene_illumination_info(scene):
    boxm2_batch.init_process("boxm2SceneIlluminationInfoProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.run_process()
    (lon_id, lon_type) = boxm2_batch.commit_output(0)
    longitude = boxm2_batch.get_output_float(lon_id)
    (lat_id, lat_type) = boxm2_batch.commit_output(1)
    latitude = boxm2_batch.get_output_float(lat_id)
    (nb_id, nb_type) = boxm2_batch.commit_output(2)
    nbins = boxm2_batch.get_output_int(nb_id)
    return longitude, latitude, nbins
Example #9
0
def sun_angles(image_path):
    boxm2_batch.init_process('bbasSunAnglesProcess')
    boxm2_batch.set_input_string(0, image_path)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    sun_el = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    sun_az = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return (sun_az, sun_el)
Example #10
0
def get_perspective_camera_center(cam):
    boxm2_batch.init_process("vpglGetPerspectiveCamCenterProcess")
    boxm2_batch.set_input_from_db(0, cam)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    return x, y, z
Example #11
0
def sun_angles(image_path):
  boxm2_batch.init_process('bbasSunAnglesProcess')
  boxm2_batch.set_input_string(0,image_path)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  sun_el = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  (id,type) = boxm2_batch.commit_output(1)
  sun_az = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  return(sun_az, sun_el)
Example #12
0
def get_perspective_cam_center(pcam):
    boxm2_batch.init_process("vpglGetPerspectiveCamCenterProcess");
    boxm2_batch.set_input_from_db(0, pcam);
    boxm2_batch.run_process();
    (x_id,x_type) = boxm2_batch.commit_output(0);
    x = boxm2_batch.get_output_float(x_id);
    (y_id,type) = boxm2_batch.commit_output(1);
    y = boxm2_batch.get_output_float(y_id);
    (z_id,type) = boxm2_batch.commit_output(2);
    z = boxm2_batch.get_output_float(z_id);
    return x, y, z;
Example #13
0
def get_perspective_cam_center(pcam):
    boxm2_batch.init_process("vpglGetPerspectiveCamCenterProcess")
    boxm2_batch.set_input_from_db(0, pcam)
    boxm2_batch.run_process()
    (x_id, x_type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(x_id)
    (y_id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(y_id)
    (z_id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(z_id)
    return x, y, z
Example #14
0
def project_point(camera,x,y,z):
    boxm2_batch.init_process('vpglProjectProcess');
    boxm2_batch.set_input_from_db(0,camera);
    boxm2_batch.set_input_float(1,x);
    boxm2_batch.set_input_float(2,y);
    boxm2_batch.set_input_float(3,z);
    boxm2_batch.run_process();
    (id,type) = boxm2_batch.commit_output(0);
    u = boxm2_batch.get_output_float(id);
    (id,type) = boxm2_batch.commit_output(1);
    v = boxm2_batch.get_output_float(id);
    return (u,v);
Example #15
0
def project_point(camera, x, y, z):
    boxm2_batch.init_process("vpglProjectProcess")
    boxm2_batch.set_input_from_db(0, camera)
    boxm2_batch.set_input_float(1, x)
    boxm2_batch.set_input_float(2, y)
    boxm2_batch.set_input_float(3, z)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    u = boxm2_batch.get_output_float(id)
    (id, type) = boxm2_batch.commit_output(1)
    v = boxm2_batch.get_output_float(id)
    return (u, v)
Example #16
0
def get_view_at_point(persp_cam,x,y,z):
  boxm2_batch.init_process("vpglGetViewDirectionAtPointProcess");
  boxm2_batch.set_input_from_db(0,persp_cam);
  boxm2_batch.set_input_float(1,x);
  boxm2_batch.set_input_float(2,y);
  boxm2_batch.set_input_float(3,z);
  boxm2_batch.run_process();
  (id,type) = boxm2_batch.commit_output(0);
  theta=boxm2_batch.get_output_float(id);
  (id,type) = boxm2_batch.commit_output(1);
  phi=boxm2_batch.get_output_float(id);
  return theta, phi;
Example #17
0
def camera_angles(camera, x, y, z):
    boxm2_batch.init_process('bbasCameraAnglesProcess')
    boxm2_batch.set_input_from_db(0, camera)
    boxm2_batch.set_input_float(1, x)
    boxm2_batch.set_input_float(2, y)
    boxm2_batch.set_input_float(3, z)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    cam_az = boxm2_batch.get_output_float(id)
    (id, type) = boxm2_batch.commit_output(1)
    cam_el = boxm2_batch.get_output_float(id)
    return (cam_az, cam_el)
Example #18
0
def camera_angles(camera, x,y,z):
  boxm2_batch.init_process('bbasCameraAnglesProcess')
  boxm2_batch.set_input_from_db(0,camera)
  boxm2_batch.set_input_float(1,x)
  boxm2_batch.set_input_float(2,y)
  boxm2_batch.set_input_float(3,z)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  cam_az = boxm2_batch.get_output_float(id)
  (id,type) = boxm2_batch.commit_output(1)
  cam_el = boxm2_batch.get_output_float(id)
  return (cam_az, cam_el)
Example #19
0
def get_view_at_point(persp_cam, x, y, z):
    boxm2_batch.init_process("vpglGetViewDirectionAtPointProcess")
    boxm2_batch.set_input_from_db(0, persp_cam)
    boxm2_batch.set_input_float(1, x)
    boxm2_batch.set_input_float(2, y)
    boxm2_batch.set_input_float(3, z)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    theta = boxm2_batch.get_output_float(id)
    (id, type) = boxm2_batch.commit_output(1)
    phi = boxm2_batch.get_output_float(id)
    return theta, phi
Example #20
0
def project_point(camera, x, y, z):
    boxm2_batch.init_process('vpglProjectProcess')
    boxm2_batch.set_input_from_db(0, camera)
    boxm2_batch.set_input_float(1, x)
    boxm2_batch.set_input_float(2, y)
    boxm2_batch.set_input_float(3, z)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    u = boxm2_batch.get_output_float(id)
    (id, type) = boxm2_batch.commit_output(1)
    v = boxm2_batch.get_output_float(id)
    return (u, v)
Example #21
0
def perturb_camera(cam_in, angle, rng):
    boxm2_batch.init_process('vpglPerturbPerspCamOrientProcess')
    boxm2_batch.set_input_from_db(0, cam_in)
    boxm2_batch.set_input_float(1, angle)
    boxm2_batch.set_input_from_db(2, rng)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    pert_cam = dbvalue(id, type)
    (theta_id, type) = boxm2_batch.commit_output(1)
    (phi_id, type) = boxm2_batch.commit_output(2)
    theta = boxm2_batch.get_output_float(theta_id)
    phi = boxm2_batch.get_output_float(phi_id)
    return pert_cam, theta, phi
Example #22
0
def get_backprojected_ray(cam, u, v):
    boxm2_batch.init_process("vpglGetBackprojectRayProcess")
    boxm2_batch.set_input_from_db(0, cam)
    boxm2_batch.set_input_float(1, u)
    boxm2_batch.set_input_float(2, v)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    return x, y, z
Example #23
0
def get_backprojected_ray( cam,u,v):
  boxm2_batch.init_process("vpglGetBackprojectRayProcess");
  boxm2_batch.set_input_from_db(0, cam);
  boxm2_batch.set_input_float(1, u);
  boxm2_batch.set_input_float(2, v);
  boxm2_batch.run_process();
  (id, type) = boxm2_batch.commit_output(0);
  x=boxm2_batch.get_output_float(id);
  (id, type) = boxm2_batch.commit_output(1);
  y=boxm2_batch.get_output_float(id);
  (id, type) = boxm2_batch.commit_output(2);
  z=boxm2_batch.get_output_float(id);
  return x,y,z;
Example #24
0
def perturb_camera(cam_in, angle, rng):
    boxm2_batch.init_process('vpglPerturbPerspCamOrientProcess');
    boxm2_batch.set_input_from_db(0,cam_in);
    boxm2_batch.set_input_float(1,angle);
    boxm2_batch.set_input_from_db(2,rng);
    boxm2_batch.run_process();
    (id,type) = boxm2_batch.commit_output(0);
    pert_cam = dbvalue(id,type);
    (theta_id,type) = boxm2_batch.commit_output(1);
    (phi_id,type) = boxm2_batch.commit_output(2);
    theta = boxm2_batch.get_output_float(theta_id);
    phi = boxm2_batch.get_output_float(phi_id);
    return pert_cam, theta, phi;
Example #25
0
def perturb_camera_uniform(cam_in, angle, rng):
    boxm2_batch.init_process('vpglPerturbUniformPerspCamOrientProcess')
    boxm2_batch.set_input_from_db(0,cam_in)
    boxm2_batch.set_input_float(1,angle)
    boxm2_batch.set_input_from_db(2,rng)
    boxm2_batch.run_process()
    (id,type) = boxm2_batch.commit_output(0)
    pert_cam = dbvalue(id,type)
    (theta_id,type) = boxm2_batch.commit_output(1)
    (phi_id,type) = boxm2_batch.commit_output(2)
    theta = boxm2_batch.get_output_float(theta_id);
    phi = boxm2_batch.get_output_float(phi_id);
    return pert_cam, theta, phi
Example #26
0
def get_3d_from_depth(persp_cam, u, v, t):
    boxm2_batch.init_process("vpglGenerate3dPointFromDepthProcess")
    boxm2_batch.set_input_from_db(0, persp_cam)
    boxm2_batch.set_input_float(1, u)
    boxm2_batch.set_input_float(2, v)
    boxm2_batch.set_input_float(3, t)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    return x, y, z
Example #27
0
def get_perspective_camera_center( cam):
  boxm2_batch.init_process("vpglGetPerspectiveCamCenterProcess");
  boxm2_batch.set_input_from_db(0, cam);
  boxm2_batch.run_process();
  (id, type) = boxm2_batch.commit_output(0);
  x=boxm2_batch.get_output_float(id);
  boxm2_batch.remove_data(id);
  (id, type) = boxm2_batch.commit_output(1);
  y=boxm2_batch.get_output_float(id);
  boxm2_batch.remove_data(id);
  (id, type) = boxm2_batch.commit_output(2);
  z=boxm2_batch.get_output_float(id);
  boxm2_batch.remove_data(id);
  return x,y,z;
Example #28
0
def get_perspective_cam_center(pcam):
    boxm2_batch.init_process("vpglGetPerspectiveCamCenterProcess")
    boxm2_batch.set_input_from_db(0, pcam)
    boxm2_batch.run_process()
    (x_id, x_type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(x_id)
    boxm2_batch.remove_data(x_id)
    (y_id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(y_id)
    boxm2_batch.remove_data(y_id)
    (z_id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(z_id)
    boxm2_batch.remove_data(z_id)
    return x, y, z
Example #29
0
def get_perspective_camera_center(cam):
    boxm2_batch.init_process("vpglGetPerspectiveCamCenterProcess")
    boxm2_batch.set_input_from_db(0, cam)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return x, y, z
Example #30
0
def get_view_at_point(persp_cam, x, y, z):
    boxm2_batch.init_process("vpglGetViewDirectionAtPointProcess")
    boxm2_batch.set_input_from_db(0, persp_cam)
    boxm2_batch.set_input_float(1, x)
    boxm2_batch.set_input_float(2, y)
    boxm2_batch.set_input_float(3, z)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    theta = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    phi = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return theta, phi
Example #31
0
def get_3d_from_depth(persp_cam,u,v,t) :
  boxm2_batch.init_process("vpglGenerate3dPointFromDepthProcess");
  boxm2_batch.set_input_from_db(0,persp_cam);
  boxm2_batch.set_input_float(1,u);
  boxm2_batch.set_input_float(2,v);
  boxm2_batch.set_input_float(3,t);
  boxm2_batch.run_process();
  (id, type) = boxm2_batch.commit_output(0);
  x=boxm2_batch.get_output_float(id);
  (id, type) = boxm2_batch.commit_output(1);
  y=boxm2_batch.get_output_float(id);
  (id, type) = boxm2_batch.commit_output(2);
  z=boxm2_batch.get_output_float(id);
  return x,y,z;
Example #32
0
def test_classifier_clouds(tclsf, dictionary_name, image_resource, i, j, width, height, block_size, percent_cat_name, category_id_file=""):
  boxm2_batch.init_process("sdetTextureClassifySatelliteCloudsProcess");
  boxm2_batch.set_input_from_db(0, tclsf);
  boxm2_batch.set_input_string(1, dictionary_name);
  boxm2_batch.set_input_from_db(2, image_resource);
  boxm2_batch.set_input_unsigned(3, i);
  boxm2_batch.set_input_unsigned(4, j);
  boxm2_batch.set_input_unsigned(5, width);
  boxm2_batch.set_input_unsigned(6, height);
  boxm2_batch.set_input_unsigned(7, block_size);
  boxm2_batch.set_input_string(8, category_id_file);
  boxm2_batch.set_input_string(9, percent_cat_name);
  status = boxm2_batch.run_process();
  if status:
    (out_id, out_type)=boxm2_batch.commit_output(0);
    out_crop = dbvalue(out_id, out_type);
    (out_id, out_type)=boxm2_batch.commit_output(1);
    out_id_map = dbvalue(out_id, out_type);
    (out_id, out_type)=boxm2_batch.commit_output(2);
    out_rgb_map = dbvalue(out_id, out_type);
    (percent_id, percent_type) = boxm2_batch.commit_output(3);
    percent = boxm2_batch.get_output_float(percent_id);
    boxm2_batch.remove_data(percent_id)
    return out_crop, out_id_map, out_rgb_map, percent
  else:
    out_crop = 0;
    out_id_map = 0;
    out_rgb_map = 0;
    percent = 100;
    return out_crop, out_id_map, out_rgb_map, percent
Example #33
0
def get_backprojected_ray(cam, u, v):
    boxm2_batch.init_process("vpglGetBackprojectRayProcess")
    boxm2_batch.set_input_from_db(0, cam)
    boxm2_batch.set_input_float(1, u)
    boxm2_batch.set_input_float(2, v)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return x, y, z
Example #34
0
def roi_init(NITF_path,
             camera,
             scene,
             convert_to_8bit,
             params_fname,
             margin=0):
    boxm2_batch.init_process("boxm2RoiInitProcess")
    boxm2_batch.set_params_process(params_fname)
    boxm2_batch.set_input_string(0, NITF_path)
    boxm2_batch.set_input_from_db(1, camera)
    boxm2_batch.set_input_from_db(2, scene)
    boxm2_batch.set_input_bool(3, convert_to_8bit)
    boxm2_batch.set_input_int(4, margin)
    result = boxm2_batch.run_process()
    if result:
        (id, type) = boxm2_batch.commit_output(0)
        local_cam = dbvalue(id, type)
        (id, type) = boxm2_batch.commit_output(1)
        cropped_image = dbvalue(id, type)
        (id, type) = boxm2_batch.commit_output(2)
        uncertainty = boxm2_batch.get_output_float(id)
    else:
        local_cam = 0
        cropped_image = 0
        uncertainty = 0
    return result, local_cam, cropped_image, uncertainty
Example #35
0
def convert_to_local_coordinates2(lvcs,lat,lon,el):
    boxm2_batch.init_process('vpglConvertToLocalCoordinatesProcess2');
    boxm2_batch.set_input_from_db(0,lvcs);
    boxm2_batch.set_input_float(1,lat);
    boxm2_batch.set_input_float(2,lon);
    boxm2_batch.set_input_float(3,el);
    boxm2_batch.run_process();
    (id,type) = boxm2_batch.commit_output(0);
    x = boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(1);
    y = boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(2);
    z = boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    return (x,y,z);
Example #36
0
def convert_to_local_coordinates2(lvcs, lat, lon, el):
    boxm2_batch.init_process('vpglConvertToLocalCoordinatesProcess2')
    boxm2_batch.set_input_from_db(0, lvcs)
    boxm2_batch.set_input_float(1, lat)
    boxm2_batch.set_input_float(2, lon)
    boxm2_batch.set_input_float(3, el)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return (x, y, z)
Example #37
0
def get_3d_from_depth(cam, u, v, t):
    boxm2_batch.init_process("vpglGenerate3dPointFromDepthProcess")
    boxm2_batch.set_input_from_db(0, cam)  # perspective or generic camera
    boxm2_batch.set_input_float(1, u)
    boxm2_batch.set_input_float(2, v)
    boxm2_batch.set_input_float(3, t)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return x, y, z
Example #38
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_float(1, x)
    boxm2_batch.set_input_float(2, y)
    boxm2_batch.set_input_float(3, z)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    lat = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    lon = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    el = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return (lat, lon, el)
Example #39
0
def get_3d_from_depth(cam, u, v, t):
    boxm2_batch.init_process("vpglGenerate3dPointFromDepthProcess")
    boxm2_batch.set_input_from_db(0, cam)  # perspective or generic camera
    boxm2_batch.set_input_float(1, u)
    boxm2_batch.set_input_float(2, v)
    boxm2_batch.set_input_float(3, t)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return x, y, z
Example #40
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_float(1,x);
    boxm2_batch.set_input_float(2,y);
    boxm2_batch.set_input_float(3,z);
    boxm2_batch.run_process();
    (id,type) = boxm2_batch.commit_output(0);
    lat = boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(1);
    lon = boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    (id,type) = boxm2_batch.commit_output(2);
    el = boxm2_batch.get_output_float(id);
    boxm2_batch.remove_data(id);
    return (lat,lon,el);
Example #41
0
def convert_to_local_coordinates(lvcs_filename, lat, lon, el):
    boxm2_batch.init_process('vpglConvertToLocalCoordinatesProcess')
    boxm2_batch.set_input_string(0, lvcs_filename)
    boxm2_batch.set_input_float(1, lat)
    boxm2_batch.set_input_float(2, lon)
    boxm2_batch.set_input_float(3, el)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return (x, y, z)
Example #42
0
def perspective_camera_distance(cam1, cam2):
    boxm2_batch.init_process('vpglPerspCamDistanceProcess')
    boxm2_batch.set_input_from_db(0,cam1)
    boxm2_batch.set_input_from_db(1,cam2)
    boxm2_batch.run_process()
    (dist_id,type) = boxm2_batch.commit_output(0)
    dist = boxm2_batch.get_output_float(dist_id);
    return dist
Example #43
0
def image_mean(img):
    boxm2_batch.init_process("vilImageMeanProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    mean_val = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return mean_val
Example #44
0
def convert_to_local_coordinates2(lvcs, lat, lon, el):
    boxm2_batch.init_process("vpglConvertToLocalCoordinatesProcess2")
    boxm2_batch.set_input_from_db(0, lvcs)
    boxm2_batch.set_input_float(1, lat)
    boxm2_batch.set_input_float(2, lon)
    boxm2_batch.set_input_float(3, el)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return (x, y, z)
Example #45
0
def get_sun_angles_date_time(lat, lon, year, month, day, hour, minute):
    boxm2_batch.init_process("bradGetSunAnglesDateTimeProcess")
    boxm2_batch.set_input_float(0, lat)
    boxm2_batch.set_input_float(1, lon)
    boxm2_batch.set_input_int(2, year)
    boxm2_batch.set_input_int(3, month)
    boxm2_batch.set_input_int(4, day)
    boxm2_batch.set_input_int(5, hour)
    boxm2_batch.set_input_int(6, minute)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    sun_az = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    sun_el = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return sun_az, sun_el
Example #46
0
def image_mean(img):
    boxm2_batch.init_process("vilImageMeanProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    mean_val = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return mean_val
Example #47
0
def perspective_camera_distance(cam1, cam2):
    boxm2_batch.init_process('vpglPerspCamDistanceProcess')
    boxm2_batch.set_input_from_db(0, cam1)
    boxm2_batch.set_input_from_db(1, cam2)
    boxm2_batch.run_process()
    (dist_id, type) = boxm2_batch.commit_output(0)
    dist = boxm2_batch.get_output_float(dist_id)
    return dist
Example #48
0
def get_sun_angles_date_time(lat, lon, year, month, day, hour, minute):
  boxm2_batch.init_process("bradGetSunAnglesDateTimeProcess")
  boxm2_batch.set_input_float(0,lat)
  boxm2_batch.set_input_float(1,lon)
  boxm2_batch.set_input_int(2,year)
  boxm2_batch.set_input_int(3,month)
  boxm2_batch.set_input_int(4,day)
  boxm2_batch.set_input_int(5,hour)
  boxm2_batch.set_input_int(6,minute)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  sun_az = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  (id,type) = boxm2_batch.commit_output(1)
  sun_el = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  return sun_az, sun_el
Example #49
0
def pixel(img, point):
    boxm2_batch.init_process("vilPixelValueProcess")
    boxm2_batch.set_input_from_db(0, img)
    boxm2_batch.set_input_int(1, int(point[0]))
    boxm2_batch.set_input_int(2, int(point[1]))
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    val = boxm2_batch.get_output_float(id)
    return val
Example #50
0
def pixel(img, point):
    boxm2_batch.init_process("vilPixelValueProcess") 
    boxm2_batch.set_input_from_db(0,img)
    boxm2_batch.set_input_int(1, int(point[0]))
    boxm2_batch.set_input_int(2, int(point[1]))
    boxm2_batch.run_process()
    (id,type) = boxm2_batch.commit_output(0)
    val = boxm2_batch.get_output_float(id)
    return val
Example #51
0
def mutual_information(img0, img1, mask):
    boxm2_batch.init_process('ihogMutualInformationProcess')
    boxm2_batch.set_input_from_db(0,img0)
    boxm2_batch.set_input_from_db(1,img1)
    boxm2_batch.set_input_from_db(2,mask)
    boxm2_batch.run_process()
    (id,type) = boxm2_batch.commit_output(0)
    minfo = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return minfo
Example #52
0
def get_metadata_info(mdata):
    boxm2_batch.init_process("bradGetMetaDataInfoProcess")
    boxm2_batch.set_input_from_db(0, mdata)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    sun_az = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    sun_el = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    year = boxm2_batch.get_output_int(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(3)
    month = boxm2_batch.get_output_int(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(4)
    day = boxm2_batch.get_output_int(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(5)
    hour = boxm2_batch.get_output_int(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(6)
    minutes = boxm2_batch.get_output_int(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(7)
    seconds = boxm2_batch.get_output_int(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(8)
    gsd = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(9)
    sat_name = boxm2_batch.get_output_string(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(10)
    view_az = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(11)
    view_el = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return sun_az, sun_el, year, month, day, hour, minutes, seconds, gsd, sat_name, view_az, view_el
Example #53
0
def get_metadata_info(mdata):
  boxm2_batch.init_process("bradGetMetaDataInfoProcess")
  boxm2_batch.set_input_from_db(0, mdata)
  boxm2_batch.run_process()
  (id,type) = boxm2_batch.commit_output(0)
  sun_az = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  (id,type) = boxm2_batch.commit_output(1)
  sun_el = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  (id, type) = boxm2_batch.commit_output(2)
  year = boxm2_batch.get_output_int(id)
  boxm2_batch.remove_data(id)
  (id, type) = boxm2_batch.commit_output(3)
  month = boxm2_batch.get_output_int(id)
  boxm2_batch.remove_data(id)
  (id, type) = boxm2_batch.commit_output(4)
  day = boxm2_batch.get_output_int(id)
  boxm2_batch.remove_data(id)
  (id, type) = boxm2_batch.commit_output(5)
  hour = boxm2_batch.get_output_int(id)
  boxm2_batch.remove_data(id)
  (id, type) = boxm2_batch.commit_output(6)
  minutes = boxm2_batch.get_output_int(id)
  boxm2_batch.remove_data(id)
  (id, type) = boxm2_batch.commit_output(7)
  seconds = boxm2_batch.get_output_int(id)
  boxm2_batch.remove_data(id)
  (id, type) = boxm2_batch.commit_output(8)
  gsd = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  (id, type) = boxm2_batch.commit_output(9)
  sat_name = boxm2_batch.get_output_string(id)
  boxm2_batch.remove_data(id)
  (id,type) = boxm2_batch.commit_output(10)
  view_az = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  (id,type) = boxm2_batch.commit_output(11)
  view_el = boxm2_batch.get_output_float(id)
  boxm2_batch.remove_data(id)
  return sun_az, sun_el, year, month, day, hour, minutes, seconds, gsd, sat_name, view_az, view_el
Example #54
0
def estimate_irradiance(image, sun_z, mean_albedo=1.0):
    boxm2_batch.init_process('bbasEstimateIrradianceProcess')
    boxm2_batch.set_input_from_db(0, image)
    boxm2_batch.set_input_float(1, sun_z)
    boxm2_batch.set_input_float(2, mean_albedo)
    boxm2_batch.run_process()
    (id, type) = boxm2_batch.commit_output(0)
    img_float = dbvalue(id, type)
    (id, type) = boxm2_batch.commit_output(1)
    irrad = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    return (img_float, irrad)
Example #55
0
def get_3d_point_from_index(scene, cache, block_index, index):
    #Warning, you probably shouldn't be doing this!
    boxm2_batch.init_process("boxm2CppGet3dPointFromIndexProcess")
    boxm2_batch.set_input_from_db(0, scene)
    boxm2_batch.set_input_from_db(1, cache)
    boxm2_batch.set_input_int(2, block_index[0])
    boxm2_batch.set_input_int(3, block_index[1])
    boxm2_batch.set_input_int(4, block_index[2])
    boxm2_batch.set_input_int(5, index)
    boxm2_batch.run_process()

    (id, type) = boxm2_batch.commit_output(0)
    x = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(1)
    y = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(2)
    z = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)

    (id, type) = boxm2_batch.commit_output(3)
    xs = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(4)
    ys = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(5)
    zs = boxm2_batch.get_output_float(id)
    boxm2_batch.remove_data(id)
    (id, type) = boxm2_batch.commit_output(6)
    leaf = boxm2_batch.get_output_int(id)
    boxm2_batch.remove_data(id)

    return ((x, y, z), (xs, ys, zs), leaf)
Example #56
0
def find_sun_dir_bin(metadata, output_file):
    boxm2_batch.init_process("bradSunDirBinProcess")
    boxm2_batch.set_input_from_db(0, metadata)
    boxm2_batch.set_input_string(1, output_file)
    status = boxm2_batch.run_process()
    bin, angle = None, None
    if status:
        (bin_id, bin_type) = boxm2_batch.commit_output(0)
        bin = boxm2_batch.get_output_int(bin_id)
        boxm2_batch.remove_data(bin_id)
        (angle_id, angle_type) = boxm2_batch.commit_output(1)
        angle = boxm2_batch.get_output_float(angle_id)
        boxm2_batch.remove_data(angle_id)
    return bin, angle