Example #1
0
def crop_image_using_3d_box_dem(img_res, camera, ll_lon, ll_lat, ur_lon, ur_lat, dem_folder, extra_height, uncertainty, lvcs=0):
    bvxm_batch.init_process("vpglCropImgUsing3DboxDemProcess")
    bvxm_batch.set_input_from_db(0, img_res)
    bvxm_batch.set_input_from_db(1, camera)
    bvxm_batch.set_input_double(2, ll_lon)
    bvxm_batch.set_input_double(3, ll_lat)
    bvxm_batch.set_input_double(4, ur_lon)
    bvxm_batch.set_input_double(5, ur_lat)
    bvxm_batch.set_input_string(6, dem_folder)
    bvxm_batch.set_input_double(7, extra_height)
    bvxm_batch.set_input_double(8, uncertainty)
    if lvcs != 0:
        bvxm_batch.set_input_from_db(9, lvcs)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        local_cam = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(1)
        i0 = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(2)
        j0 = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(3)
        ni = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(4)
        nj = bvxm_batch.get_output_unsigned(id)
        return status, local_cam, i0, j0, ni, nj
    else:
        return status, dbvalue(0, ""), 0.0, 0.0, 0.0, 0.0
Example #2
0
def affine_rectify_images2(img1, affine_cam1, local_rational_cam1, img2, affine_cam2, local_rational_cam2, min_x, min_y, min_z, max_x, max_y, max_z, output_path_H1, output_path_H2, local_ground_plane_height=5, n_points=100):
    bvxm_batch.init_process("vpglAffineRectifyImagesProcess2")
    bvxm_batch.set_input_from_db(0, img1)
    bvxm_batch.set_input_from_db(1, affine_cam1)
    bvxm_batch.set_input_from_db(2, local_rational_cam1)
    bvxm_batch.set_input_from_db(3, img2)
    bvxm_batch.set_input_from_db(4, affine_cam2)
    bvxm_batch.set_input_from_db(5, local_rational_cam2)
    bvxm_batch.set_input_double(6, min_x)
    bvxm_batch.set_input_double(7, min_y)
    bvxm_batch.set_input_double(8, min_z)
    bvxm_batch.set_input_double(9, max_x)
    bvxm_batch.set_input_double(10, max_y)
    bvxm_batch.set_input_double(11, max_z)
    bvxm_batch.set_input_unsigned(12, n_points)
    bvxm_batch.set_input_double(13, local_ground_plane_height)
    bvxm_batch.set_input_string(14, output_path_H1)
    bvxm_batch.set_input_string(15, output_path_H2)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_img1 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_cam1 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(2)
    out_img2 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(3)
    out_cam2 = dbvalue(id, type)
    return out_img1, out_cam1, out_img2, out_cam2
Example #3
0
def rpc_registration(world,
                     cropped_cam,
                     cropped_edge_image,
                     uncertainty,
                     shift_3d_flag=0,
                     scale=0,
                     is_uncertainty_float=0):
    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, shift_3d_flag)
    if is_uncertainty_float == 1:
        print "uncertainty = ", uncertainty
        bvxm_batch.set_input_float(4, uncertainty)
    else:
        bvxm_batch.set_input_from_db(4, uncertainty)
    bvxm_batch.set_input_unsigned(5, scale)
    bvxm_batch.run_process()
    (cam_id, cam_type) = bvxm_batch.commit_output(0)
    cam = dbvalue(cam_id, cam_type)
    (expected_edge_image_id,
     expected_edge_image_type) = bvxm_batch.commit_output(1)
    expected_edge_image = dbvalue(expected_edge_image_id,
                                  expected_edge_image_type)
    (offset_u_id, offset_u_type) = bvxm_batch.commit_output(2)
    offset_u = bvxm_batch.get_output_double(offset_u_id)
    (offset_v_id, offset_v_type) = bvxm_batch.commit_output(3)
    offset_v = bvxm_batch.get_output_double(offset_v_id)
    return cam, expected_edge_image, offset_u, offset_v
Example #4
0
def generate_ndsm(ll_lon, ll_lat, ur_lon, ur_lat, img_size_ni, img_size_nj, geo_index_txt, h_map_folder, grd_map_folder, window_size = 20, max_h_limit = 254.0):
  bvxm_batch.init_process("volmNdsmGenearationProcess")
  bvxm_batch.set_input_double(0, ll_lon)
  bvxm_batch.set_input_double(1, ll_lat)
  bvxm_batch.set_input_double(2, ur_lon)
  bvxm_batch.set_input_double(3, ur_lat)
  bvxm_batch.set_input_unsigned(4, img_size_ni)
  bvxm_batch.set_input_unsigned(5, img_size_nj)
  bvxm_batch.set_input_string(6, geo_index_txt)
  bvxm_batch.set_input_string(7, h_map_folder)
  bvxm_batch.set_input_string(8, grd_map_folder)
  bvxm_batch.set_input_unsigned(9, window_size)
  bvxm_batch.set_input_float(10, max_h_limit)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    out_ndsm = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_dsm = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(2)
    grd_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(3)
    out_cam = dbvalue(id, type)
    return out_ndsm, out_dsm, grd_img, out_cam
  else:
    return None, None, None, None
Example #5
0
def affine_rectify_images(img1,
                          affine_cam1,
                          img2,
                          affine_cam2,
                          min_x,
                          min_y,
                          min_z,
                          max_x,
                          max_y,
                          max_z,
                          n_points=100):
    bvxm_batch.init_process("vpglAffineRectifyImagesProcess")
    bvxm_batch.set_input_from_db(0, img1)
    bvxm_batch.set_input_from_db(1, affine_cam1)
    bvxm_batch.set_input_from_db(2, img2)
    bvxm_batch.set_input_from_db(3, affine_cam2)
    bvxm_batch.set_input_double(4, min_x)
    bvxm_batch.set_input_double(5, min_y)
    bvxm_batch.set_input_double(6, min_z)
    bvxm_batch.set_input_double(7, max_x)
    bvxm_batch.set_input_double(8, max_y)
    bvxm_batch.set_input_double(9, max_z)
    bvxm_batch.set_input_unsigned(10, n_points)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_img1 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_cam1 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(2)
    out_img2 = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(3)
    out_cam2 = dbvalue(id, type)
    return out_img1, out_cam1, out_img2, out_cam2
Example #6
0
def test_classifier_clouds2(tclsf, dictionary_name, image_resource, i, j, width, height, block_size, percent_cat_name, category_id_file=""):
    bvxm_batch.init_process("sdetTextureClassifySatelliteCloudsProcess2")
    bvxm_batch.set_input_from_db(0, tclsf)
    bvxm_batch.set_input_string(1, dictionary_name)
    bvxm_batch.set_input_from_db(2, image_resource)
    bvxm_batch.set_input_unsigned(3, i)
    bvxm_batch.set_input_unsigned(4, j)
    bvxm_batch.set_input_unsigned(5, width)
    bvxm_batch.set_input_unsigned(6, height)
    bvxm_batch.set_input_unsigned(7, block_size)
    bvxm_batch.set_input_string(8, category_id_file)
    bvxm_batch.set_input_string(9, percent_cat_name)
    status = bvxm_batch.run_process()
    if status:
        (out_id, out_type) = bvxm_batch.commit_output(0)
        out_crop = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(1)
        out_id_map = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(2)
        out_rgb_map = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(3)
        percent = bvxm_batch.get_output_float(out_id)
        bvxm_batch.remove_data(out_id)
        return out_crop, out_id_map, out_rgb_map, percent
    else:
        return 0, 0, 0, 100
Example #7
0
def crop_ortho_image_using_3d_box(img_res, camera, lower_left_lon, lower_left_lat, lower_left_elev, upper_right_lon, upper_right_lat, upper_right_elev):
  bvxm_batch.init_process("vpglCropOrthoUsing3DboxPRocess")
  bvxm_batch.set_input_from_db(0, img_res);
  bvxm_batch.set_input_from_db(1, camera);
  bvxm_batch.set_input_double(2, lower_left_lon);
  bvxm_batch.set_input_double(3, lower_left_lat);
  bvxm_batch.set_input_double(4, lower_left_elev);
  bvxm_batch.set_input_double(5, upper_right_lon);
  bvxm_batch.set_input_double(6, upper_right_lat);
  bvxm_batch.set_input_double(7, upper_right_elev);
  status = bvxm_batch.run_process();
  if status:
    (id, type) = bvxm_batch.commit_output(0);
    local_geo_cam  = dbvalue(id, type);
    (id, type) = bvxm_batch.commit_output(1);
    i0 = bvxm_batch.get_output_unsigned(id)
    (id, type) = bvxm_batch.commit_output(2);
    j0 = bvxm_batch.get_output_unsigned(id)
    (id, type) = bvxm_batch.commit_output(3);
    ni = bvxm_batch.get_output_unsigned(id)
    (id, type) = bvxm_batch.commit_output(4);
    nj = bvxm_batch.get_output_unsigned(id)
    return status, local_geo_cam, i0, j0, ni, nj;
  else:
    return status, dbvalue(0, ""), 0, 0, 0, 0;
Example #8
0
def generate_ndsm(land_geocam,
                  land_img_file,
                  geo_index_txt,
                  h_map_folder,
                  ground_txt,
                  dem_folder,
                  max_h_limit=254.0,
                  window_size=30):
    bvxm_batch.init_process("volmNdsmGenearationProcess")
    bvxm_batch.set_input_from_db(0, land_geocam)
    bvxm_batch.set_input_string(1, land_img_file)
    bvxm_batch.set_input_string(2, geo_index_txt)
    bvxm_batch.set_input_string(3, h_map_folder)
    bvxm_batch.set_input_unsigned(4, window_size)
    bvxm_batch.set_input_float(5, max_h_limit)
    bvxm_batch.set_input_string(6, ground_txt)
    bvxm_batch.set_input_string(7, dem_folder)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        out_ndsm = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(1)
        out_dsm = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(2)
        out_cam = dbvalue(id, type)
        return out_ndsm, out_dsm, out_cam
    else:
        return None, None, None
Example #9
0
def crop_image_using_3d_box(img_res, camera, lower_left_lon, lower_left_lat, lower_left_elev, upper_right_lon, upper_right_lat, upper_right_elev, uncertainty, lvcs=0):
    bvxm_batch.init_process("vpglCropImgUsing3DboxProcess")
    bvxm_batch.set_input_from_db(0, img_res)
    bvxm_batch.set_input_from_db(1, camera)
    bvxm_batch.set_input_double(2, lower_left_lon)
    bvxm_batch.set_input_double(3, lower_left_lat)
    bvxm_batch.set_input_double(4, lower_left_elev)
    bvxm_batch.set_input_double(5, upper_right_lon)
    bvxm_batch.set_input_double(6, upper_right_lat)
    bvxm_batch.set_input_double(7, upper_right_elev)
    bvxm_batch.set_input_double(8, uncertainty)
    if lvcs != 0:
        bvxm_batch.set_input_from_db(9, lvcs)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        local_cam = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(1)
        i0 = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(2)
        j0 = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(3)
        ni = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(4)
        nj = bvxm_batch.get_output_unsigned(id)
        return status, local_cam, i0, j0, ni, nj
    else:
        return status, dbvalue(0, ""), 0, 0, 0, 0
Example #10
0
def crop_image_using_3d_box_dem(img_res, camera, ll_lon, ll_lat, ur_lon, ur_lat, dem_folder, extra_height, uncertainty, lvcs=0):
    bvxm_batch.init_process("vpglCropImgUsing3DboxDemProcess")
    bvxm_batch.set_input_from_db(0, img_res)
    bvxm_batch.set_input_from_db(1, camera)
    bvxm_batch.set_input_double(2, ll_lon)
    bvxm_batch.set_input_double(3, ll_lat)
    bvxm_batch.set_input_double(4, ur_lon)
    bvxm_batch.set_input_double(5, ur_lat)
    bvxm_batch.set_input_string(6, dem_folder)
    bvxm_batch.set_input_double(7, extra_height)
    bvxm_batch.set_input_double(8, uncertainty)
    if lvcs != 0:
        bvxm_batch.set_input_from_db(9, lvcs)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        local_cam = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(1)
        i0 = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(2)
        j0 = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(3)
        ni = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(4)
        nj = bvxm_batch.get_output_unsigned(id)
        return status, local_cam, i0, j0, ni, nj
    else:
        return status, dbvalue(0, ""), 0.0, 0.0, 0.0, 0.0
Example #11
0
def generate_layers(land_img,
                    land_cam,
                    height_img,
                    height_cam,
                    land_txt,
                    min_h,
                    max_h,
                    beta=10.0):
    bvxm_batch.init_process("volmLayerExtractionProcess")
    bvxm_batch.set_input_from_db(0, land_img)
    bvxm_batch.set_input_from_db(1, land_cam)
    bvxm_batch.set_input_from_db(2, height_img)
    bvxm_batch.set_input_from_db(3, height_cam)
    bvxm_batch.set_input_string(4, land_txt)
    bvxm_batch.set_input_float(5, min_h)
    bvxm_batch.set_input_float(6, max_h)
    bvxm_batch.set_input_double(7, beta)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        out_prob_img = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(1)
        out_img = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(2)
        mask_img = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(3)
        out_cam = dbvalue(id, type)
        return out_prob_img, out_img, mask_img, out_cam
    else:
        return None, None, None, None
Example #12
0
def crop_ortho_image_using_3d_box(img_res, camera, lower_left_lon,
                                  lower_left_lat, lower_left_elev,
                                  upper_right_lon, upper_right_lat,
                                  upper_right_elev):
    bvxm_batch.init_process("vpglCropOrthoUsing3DboxPRocess")
    bvxm_batch.set_input_from_db(0, img_res)
    bvxm_batch.set_input_from_db(1, camera)
    bvxm_batch.set_input_double(2, lower_left_lon)
    bvxm_batch.set_input_double(3, lower_left_lat)
    bvxm_batch.set_input_double(4, lower_left_elev)
    bvxm_batch.set_input_double(5, upper_right_lon)
    bvxm_batch.set_input_double(6, upper_right_lat)
    bvxm_batch.set_input_double(7, upper_right_elev)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        local_geo_cam = dbvalue(id, type)
        (id, type) = bvxm_batch.commit_output(1)
        i0 = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(2)
        j0 = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(3)
        ni = bvxm_batch.get_output_unsigned(id)
        (id, type) = bvxm_batch.commit_output(4)
        nj = bvxm_batch.get_output_unsigned(id)
        return status, local_geo_cam, i0, j0, ni, nj
    else:
        return status, dbvalue(0, ""), 0, 0, 0, 0
Example #13
0
def test_classifier_clouds2(tclsf,
                            dictionary_name,
                            image_resource,
                            i,
                            j,
                            width,
                            height,
                            block_size,
                            percent_cat_name,
                            category_id_file=""):
    bvxm_batch.init_process("sdetTextureClassifySatelliteCloudsProcess2")
    bvxm_batch.set_input_from_db(0, tclsf)
    bvxm_batch.set_input_string(1, dictionary_name)
    bvxm_batch.set_input_from_db(2, image_resource)
    bvxm_batch.set_input_unsigned(3, i)
    bvxm_batch.set_input_unsigned(4, j)
    bvxm_batch.set_input_unsigned(5, width)
    bvxm_batch.set_input_unsigned(6, height)
    bvxm_batch.set_input_unsigned(7, block_size)
    bvxm_batch.set_input_string(8, category_id_file)
    bvxm_batch.set_input_string(9, percent_cat_name)
    status = bvxm_batch.run_process()
    if status:
        (out_id, out_type) = bvxm_batch.commit_output(0)
        out_crop = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(1)
        out_id_map = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(2)
        out_rgb_map = dbvalue(out_id, out_type)
        (out_id, out_type) = bvxm_batch.commit_output(3)
        percent = bvxm_batch.get_output_float(out_id)
        bvxm_batch.remove_data(out_id)
        return out_crop, out_id_map, out_rgb_map, percent
    else:
        return 0, 0, 0, 100
Example #14
0
def affine_rectify_images2(img1, affine_cam1, local_rational_cam1, img2, affine_cam2, local_rational_cam2, min_x, min_y, min_z, max_x, max_y, max_z, output_path_H1, output_path_H2, local_ground_plane_height = 5, n_points=100):
  bvxm_batch.init_process("vpglAffineRectifyImagesProcess2");
  bvxm_batch.set_input_from_db(0, img1);
  bvxm_batch.set_input_from_db(1, affine_cam1);
  bvxm_batch.set_input_from_db(2, local_rational_cam1);
  bvxm_batch.set_input_from_db(3, img2);
  bvxm_batch.set_input_from_db(4, affine_cam2);
  bvxm_batch.set_input_from_db(5, local_rational_cam2);
  bvxm_batch.set_input_double(6, min_x);
  bvxm_batch.set_input_double(7, min_y);
  bvxm_batch.set_input_double(8, min_z);
  bvxm_batch.set_input_double(9, max_x);
  bvxm_batch.set_input_double(10, max_y);
  bvxm_batch.set_input_double(11, max_z);
  bvxm_batch.set_input_unsigned(12, n_points);
  bvxm_batch.set_input_double(13, local_ground_plane_height);
  bvxm_batch.set_input_string(14, output_path_H1);
  bvxm_batch.set_input_string(15, output_path_H2);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  out_img1 = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  out_cam1 = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(2);
  out_img2 = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(3);
  out_cam2 = dbvalue(id, type);
  return out_img1, out_cam1, out_img2, out_cam2
Example #15
0
def construct_height_map_from_disparity(img1, img1_disp, min_disparity,
                                        local_rational_cam1, img2,
                                        local_rational_cam2, min_x, min_y,
                                        min_z, max_x, max_y, max_z, path_H1,
                                        path_H2, voxel_size):
    bvxm_batch.init_process("vpglConstructHeightMapProcess")
    bvxm_batch.set_input_from_db(0, img1)
    bvxm_batch.set_input_from_db(1, local_rational_cam1)
    bvxm_batch.set_input_string(2, img1_disp)
    bvxm_batch.set_input_float(3, min_disparity)
    bvxm_batch.set_input_from_db(4, img2)
    bvxm_batch.set_input_from_db(5, local_rational_cam2)
    bvxm_batch.set_input_double(6, min_x)
    bvxm_batch.set_input_double(7, min_y)
    bvxm_batch.set_input_double(8, min_z)
    bvxm_batch.set_input_double(9, max_x)
    bvxm_batch.set_input_double(10, max_y)
    bvxm_batch.set_input_double(11, max_z)
    bvxm_batch.set_input_double(12, voxel_size)
    bvxm_batch.set_input_string(13, path_H1)
    bvxm_batch.set_input_string(14, path_H2)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_map = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    disparity_map = dbvalue(id, type)
    return out_map, disparity_map
Example #16
0
def render_height_map(world):
  print("Rendering height map");
  bvxm_batch.init_process("bvxmHeightmapOrthoProcess");
  bvxm_batch.set_input_from_db(0,world);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  out_d_img = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  out_h_img = dbvalue(id, type);
  return out_h_img, out_d_img
Example #17
0
def render_height_map(world):
    print("Rendering height map")
    bvxm_batch.init_process("bvxmHeightmapOrthoProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_d_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_h_img = dbvalue(id, type)
    return out_h_img, out_d_img
Example #18
0
def render_height_map_expected_with_cam(world, input_cam, ni, nj):
    bvxm_batch.init_process("bvxmHeightmapExpectedProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_from_db(1, input_cam)
    bvxm_batch.set_input_unsigned(2, ni)
    bvxm_batch.set_input_unsigned(3, nj)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_h_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_var_img = dbvalue(id, type)
    return out_h_img, out_var_img
Example #19
0
def render_height_map_expected_with_cam(world, input_cam, ni, nj):
    bvxm_batch.init_process("bvxmHeightmapExpectedProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_from_db(1, input_cam)
    bvxm_batch.set_input_unsigned(2, ni)
    bvxm_batch.set_input_unsigned(3, nj)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_h_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_var_img = dbvalue(id, type)
    return out_h_img, out_var_img
def test_classifier(tclsf, block_size, category_id_file=""):
  bvxm_batch.init_process("sdetTextureClassifierProcess2");
  bvxm_batch.set_input_from_db(0, tclsf);
  bvxm_batch.set_input_unsigned(1, block_size);
  bvxm_batch.set_input_string(2, category_id_file);
  bvxm_batch.run_process();
  (out_id, out_type)=bvxm_batch.commit_output(0);
  out = dbvalue(out_id, out_type);
  (out_id, out_type)=bvxm_batch.commit_output(1);
  out_color = dbvalue(out_id, out_type);
  (out_id, out_type)=bvxm_batch.commit_output(2);
  out_id = dbvalue(out_id, out_type);
  return out, out_color, out_id
Example #21
0
def render_exp_edge_img(cam, ni, nj, world, scale=0):
    bvxm_batch.init_process("bvxmExpectedEdgeImageProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_from_db(1, cam)
    bvxm_batch.set_input_unsigned(2, ni)
    bvxm_batch.set_input_unsigned(3, nj)
    bvxm_batch.set_input_unsigned(4, scale)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    exp_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    exp_img_byte = dbvalue(id, type)
    return exp_img, exp_img_byte
Example #22
0
def render_exp_edge_img(cam, ni, nj, world, scale=0):
  bvxm_batch.init_process("bvxmExpectedEdgeImageProcess");
  bvxm_batch.set_input_from_db(0,world);
  bvxm_batch.set_input_from_db(1,cam);
  bvxm_batch.set_input_unsigned(2,ni);
  bvxm_batch.set_input_unsigned(3,nj);
  bvxm_batch.set_input_unsigned(4,scale);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  exp_img = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  exp_img_byte = dbvalue(id, type);
  return exp_img, exp_img_byte
Example #23
0
def classify_image(eig, h_no, h_atmos, input_image_filename, tile_ni, tile_nj):
  bvxm_batch.init_process("bradClassifyImageProcess");
  bvxm_batch.set_input_from_db(0, eig);
  bvxm_batch.set_input_from_db(1, h_no);
  bvxm_batch.set_input_from_db(2, h_atmos);
  bvxm_batch.set_input_string(3, input_image_filename);
  bvxm_batch.set_input_unsigned(4, tile_ni);
  bvxm_batch.set_input_unsigned(5, tile_nj);
  bvxm_batch.run_process();
  (vid, vtype) = bvxm_batch.commit_output(0);
  q_img = dbvalue(vid, vtype);
  (vid, vtype) = bvxm_batch.commit_output(1);
  q_img_orig_size = dbvalue(vid, vtype);
  return q_img, q_img_orig_size
Example #24
0
def classify_image(eig, h_no, h_atmos, input_image_filename, tile_ni, tile_nj):
    bvxm_batch.init_process("bradClassifyImageProcess")
    bvxm_batch.set_input_from_db(0, eig)
    bvxm_batch.set_input_from_db(1, h_no)
    bvxm_batch.set_input_from_db(2, h_atmos)
    bvxm_batch.set_input_string(3, input_image_filename)
    bvxm_batch.set_input_unsigned(4, tile_ni)
    bvxm_batch.set_input_unsigned(5, tile_nj)
    bvxm_batch.run_process()
    (vid, vtype) = bvxm_batch.commit_output(0)
    q_img = dbvalue(vid, vtype)
    (vid, vtype) = bvxm_batch.commit_output(1)
    q_img_orig_size = dbvalue(vid, vtype)
    return q_img, q_img_orig_size
Example #25
0
def extract_building_outlines(height_img, class_img, geocam, csv_file_name, kml_file_name):
  bvxm_batch.init_process("volmExtractBuildinOutlinesProcess")
  bvxm_batch.set_input_from_db(0, height_img)
  bvxm_batch.set_input_from_db(1, class_img)
  bvxm_batch.set_input_from_db(2, geocam)
  bvxm_batch.set_input_string(3, csv_file_name)
  bvxm_batch.set_input_string(4, kml_file_name)
  bvxm_batch.run_process()
  (id, type) = bvxm_batch.commit_output(0);
  binary_img = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  binary_img_e = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(2);
  binary_img_d = dbvalue(id, type);
  return binary_img, binary_img_e, binary_img_d
Example #26
0
def render_ortho_edgemap(world, scale=0):
    print("Rendering ortho edge map")
    bvxm_batch.init_process("bvxmEdgemapOrthoProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_unsigned(1, 0)  # scale
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_e_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    out_e_img_byte = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(2)
    out_h_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(3)
    ortho_cam = dbvalue(id, type)
    return out_e_img, out_e_img_byte, out_h_img, ortho_cam
Example #27
0
def render_exp_image(cam, ni, nj, world, app_model, bin_index=0, scale_index=0):
  bvxm_batch.init_process("bvxmRenderExpectedImageProcess");
  bvxm_batch.set_input_from_db(0,cam);
  bvxm_batch.set_input_unsigned(1,ni);
  bvxm_batch.set_input_unsigned(2,nj);
  bvxm_batch.set_input_from_db(3,world);
  bvxm_batch.set_input_string(4,app_model);
  bvxm_batch.set_input_unsigned(5,bin_index);       ## set bin index to be 0 for all images
  bvxm_batch.set_input_unsigned(6,scale_index);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  out_img = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  out_conf_img = dbvalue(id, type);
  return out_img, out_conf_img
Example #28
0
def render_ortho_edgemap(world, scale=0):
  print("Rendering ortho edge map");
  bvxm_batch.init_process("bvxmEdgemapOrthoProcess");
  bvxm_batch.set_input_from_db(0,world);
  bvxm_batch.set_input_unsigned(1,0);  ## scale
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  out_e_img = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  out_e_img_byte = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(2);
  out_h_img = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(3);
  ortho_cam = dbvalue(id, type);
  return out_e_img, out_e_img_byte, out_h_img, ortho_cam
Example #29
0
def update_appearance(img, cam, world, app_type, bin_index=0, scale_index=0, use_cache = 0):
  bvxm_batch.init_process("bvxmUpdateProcess");
  bvxm_batch.set_input_from_db(0,img);
  bvxm_batch.set_input_from_db(1,cam);
  bvxm_batch.set_input_from_db(2,world);
  bvxm_batch.set_input_string(3,app_type);
  bvxm_batch.set_input_unsigned(4,bin_index);       ## set bin index to be 0 for all images
  bvxm_batch.set_input_unsigned(5,scale_index);
  bvxm_batch.set_input_unsigned(6,use_cache);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  density_img = dbvalue(id, type);
  (id, type) = bvxm_batch.commit_output(1);
  density_mask_img = dbvalue(id, type);
  return density_img, density_mask_img
Example #30
0
def load_image_metadata(filename):
  bvxm_batch.init_process("bradLoadImageMetadataProcess")
  bvxm_batch.set_input_string(0,filename)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  mdata = dbvalue(id,type)
  return mdata
Example #31
0
def map_sdet_to_volm_ids(sdet_color_class_img):
  bvxm_batch.init_process("volmGenerateClassMapProcess");
  bvxm_batch.set_input_from_db(0,sdet_color_class_img);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  out_img = dbvalue(id, type);
  return out_img
Example #32
0
def convert_local_rational_perspective_camera(local_cam):
    bvxm_batch.init_process("vpglConvertLocalRationalToPerspectiveProcess")
    bvxm_batch.set_input_from_db(0, local_cam)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Example #33
0
def load_rational_camera_nitf(file_path):
    bvxm_batch.init_process("vpglLoadRationalCameraNITFProcess")
    bvxm_batch.set_input_string(0, file_path)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Example #34
0
def extract_building_outlines(height_img, class_img, geocam, csv_file_name,
                              kml_file_name):
    bvxm_batch.init_process("volmExtractBuildinOutlinesProcess")
    bvxm_batch.set_input_from_db(0, height_img)
    bvxm_batch.set_input_from_db(1, class_img)
    bvxm_batch.set_input_from_db(2, geocam)
    bvxm_batch.set_input_string(3, csv_file_name)
    bvxm_batch.set_input_string(4, kml_file_name)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    binary_img = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(1)
    binary_img_e = dbvalue(id, type)
    (id, type) = bvxm_batch.commit_output(2)
    binary_img_d = dbvalue(id, type)
    return binary_img, binary_img_e, binary_img_d
Example #35
0
def map_sdet_to_volm_ids(sdet_color_class_img):
    bvxm_batch.init_process("volmGenerateClassMapProcess")
    bvxm_batch.set_input_from_db(0, sdet_color_class_img)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    out_img = dbvalue(id, type)
    return out_img
Example #36
0
def load_projective_camera(file_path):
    bvxm_batch.init_process("vpglLoadProjCameraProcess")
    bvxm_batch.set_input_string(0, file_path)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Example #37
0
def load_lvcs(lvcs_filename):
    bvxm_batch.init_process("vpglLoadLVCSProcess");
    bvxm_batch.set_input_string(0, lvcs_filename);
    bvxm_batch.run_process();
    (lvcs_id, lvcs_type) = bvxm_batch.commit_output(0);
    lvcs = dbvalue(lvcs_id, lvcs_type);
    return lvcs;
Example #38
0
def create_ortho_camera(world):
  bvxm_batch.init_process("bvxmCreateOrthoCameraProcess");
  bvxm_batch.set_input_from_db(0,world);
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  ortho_cam = dbvalue(id, type);
  return ortho_cam
Example #39
0
def load_perspective_camera(file_path) :
  bvxm_batch.init_process("vpglLoadPerspectiveCameraProcess");
  bvxm_batch.set_input_string(0, file_path);
  bvxm_batch.run_process();
  (id,type) = bvxm_batch.commit_output(0);
  cam = dbvalue(id,type);
  return cam;
Example #40
0
def load_rational_camera_from_txt(file_path):
    bvxm_batch.init_process("vpglLoadRationalCameraFromTXTProcess")
    bvxm_batch.set_input_string(0, file_path)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Example #41
0
def load_atmospheric_parameters(filename):
  bvxm_batch.init_process("bradLoadAtmosphericParametersProcess")
  bvxm_batch.set_input_string(0,filename)
  bvxm_batch.run_process()
  (id,type) = bvxm_batch.commit_output(0)
  atm_params = dbvalue(id,type)
  return atm_params
def load_classifier(classifier_name):
  bvxm_batch.init_process("sdetLoadTextureClassifierProcess");
  bvxm_batch.set_input_string(0,classifier_name);
  bvxm_batch.run_process();
  (tclsf_id, tclsf_type)=bvxm_batch.commit_output(0);
  tclsf = dbvalue(tclsf_id, tclsf_type);
  return tclsf
def load_dictionary(dictionary_name):
  bvxm_batch.init_process("sdetLoadTextureDictionaryProcess");
  bvxm_batch.set_input_string(0,dictionary_name);
  bvxm_batch.run_process();
  (tclsf_id, tclsf_type)=bvxm_batch.commit_output(0);
  tclsf = dbvalue(tclsf_id, tclsf_type);
  return tclsf
Example #44
0
def create_scene(scene_params_xml):
  bvxm_batch.init_process("bvxmCreateVoxelWorldProcess");
  bvxm_batch.set_params_process(scene_params_xml);  ## "./bvxmCreateVoxelWorldProcess.xml"
  bvxm_batch.run_process();
  (world_id, world_type) = bvxm_batch.commit_output(0);
  world = dbvalue(world_id, world_type);
  return world
def generate_roc(tclsf, class_out_prob_img, class_out_color_img, orig_img, prefix_for_bin_files, positive_category_name,category_id_file):
  bvxm_batch.init_process("sdetTextureClassifierROCProcess");
  bvxm_batch.set_input_from_db(0, tclsf);
  bvxm_batch.set_input_from_db(1, class_out_prob_img);
  bvxm_batch.set_input_from_db(2, class_out_color_img);
  bvxm_batch.set_input_from_db(3, orig_img);
  bvxm_batch.set_input_string(4, prefix_for_bin_files);
  bvxm_batch.set_input_string(5, positive_category_name);
  bvxm_batch.set_input_string(6, category_id_file);
  bvxm_batch.run_process();
  (id,type) = bvxm_batch.commit_output(0);
  tp = bvxm_batch.get_bbas_1d_array_float(id);
  (id,type) = bvxm_batch.commit_output(1);
  tn = bvxm_batch.get_bbas_1d_array_float(id);
  (id,type) = bvxm_batch.commit_output(2);
  fp = bvxm_batch.get_bbas_1d_array_float(id);
  (id,type) = bvxm_batch.commit_output(3);
  fn = bvxm_batch.get_bbas_1d_array_float(id);
  (id,type) = bvxm_batch.commit_output(4);
  tpr = bvxm_batch.get_bbas_1d_array_float(id);
  (id,type) = bvxm_batch.commit_output(5);
  fpr = bvxm_batch.get_bbas_1d_array_float(id);
  (id,type) = bvxm_batch.commit_output(6);
  outimg = dbvalue(id,type);
  return tp, tn, fp, fn, tpr, fpr, outimg;
Example #46
0
def convert_local_rational_perspective_camera(local_cam) :
  bvxm_batch.init_process("vpglConvertLocalRationalToPerspectiveProcess");
  bvxm_batch.set_input_from_db(0, local_cam);
  bvxm_batch.run_process();
  (id,type) = bvxm_batch.commit_output(0);
  cam = dbvalue(id,type);
  return cam;
Example #47
0
def project_osm_to_crop_img(crop_img,
                            crop_cam,
                            ortho_img,
                            ortho_cam,
                            osm_bin_file,
                            band="r",
                            is_road=True,
                            is_region=False,
                            vsol_bin_filename="",
                            kml_file=""):
    bvxm_batch.init_process("volmMapOSMtoImage")
    bvxm_batch.set_input_from_db(0, crop_img)
    bvxm_batch.set_input_from_db(1, crop_cam)
    bvxm_batch.set_input_from_db(2, ortho_img)
    bvxm_batch.set_input_from_db(3, ortho_cam)
    bvxm_batch.set_input_string(4, osm_bin_file)
    bvxm_batch.set_input_string(5, band)
    bvxm_batch.set_input_bool(6, is_region)
    bvxm_batch.set_input_bool(7, is_road)
    bvxm_batch.set_input_string(8, vsol_bin_filename)
    bvxm_batch.set_input_string(9, kml_file)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        out_img = dbvalue(id, type)
    else:
        out_img = 0
    return out_img
Example #48
0
def load_image_metadata(filename):
    bvxm_batch.init_process("bradLoadImageMetadataProcess")
    bvxm_batch.set_input_string(0, filename)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    mdata = dbvalue(id, type)
    return mdata
Example #49
0
def load_sat_resources(res_file_name):
    bvxm_batch.init_process("volmLoadSatResourcesProcess")
    bvxm_batch.set_input_string(0, res_file_name)
    bvxm_batch.run_process()
    (res2_id, res2_type) = bvxm_batch.commit_output(0)
    res2 = dbvalue(res2_id, res2_type)
    return res2
Example #50
0
def load_atmospheric_parameters(filename):
    bvxm_batch.init_process("bradLoadAtmosphericParametersProcess")
    bvxm_batch.set_input_string(0, filename)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    atm_params = dbvalue(id, type)
    return atm_params
Example #51
0
def load_local_rational_camera(file_path):
    bvxm_batch.init_process("vpglLoadLocalRationalCameraProcess")
    bvxm_batch.set_input_string(0, file_path)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Example #52
0
def load_eigenspace(filename):
    bvxm_batch.init_process("bradLoadEigenspaceProcess")
    bvxm_batch.set_input_string(0, filename)
    bvxm_batch.run_process()
    (eig_id, eig_type) = bvxm_batch.commit_output(0)
    eig = dbvalue(eig_id, eig_type)
    return eig
Example #53
0
def load_lvcs(lvcs_filename):
    bvxm_batch.init_process("vpglLoadLVCSProcess")
    bvxm_batch.set_input_string(0, lvcs_filename)
    bvxm_batch.run_process()
    (lvcs_id, lvcs_type) = bvxm_batch.commit_output(0)
    lvcs = dbvalue(lvcs_id, lvcs_type)
    return lvcs
Example #54
0
def load_local_rational_camera(file_path) :
  bvxm_batch.init_process("vpglLoadLocalRationalCameraProcess");
  bvxm_batch.set_input_string(0, file_path);
  bvxm_batch.run_process();
  (id,type) = bvxm_batch.commit_output(0);
  cam = dbvalue(id,type);
  return cam;
Example #55
0
def load_perspective_camera(file_path):
    bvxm_batch.init_process("vpglLoadPerspectiveCameraProcess")
    bvxm_batch.set_input_string(0, file_path)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cam = dbvalue(id, type)
    return cam
Example #56
0
def load_eigenspace(filename):
  bvxm_batch.init_process("bradLoadEigenspaceProcess");
  bvxm_batch.set_input_string(0, filename);
  bvxm_batch.run_process();
  (eig_id,eig_type)=bvxm_batch.commit_output(0);
  eig = dbvalue(eig_id, eig_type);
  return eig;