Example #1
0
def region_wise_roc_analysis(in_img, in_cam, positive_kml, negative_kml):
  bvxm_batch.init_process("volmDetectionRateROCProcess")
  bvxm_batch.set_input_from_db(0, in_img)
  bvxm_batch.set_input_from_db(1, in_cam)
  bvxm_batch.set_input_string(2, positive_kml)
  bvxm_batch.set_input_string(3, negative_kml)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    thres_out = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(1)
    tp = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(2)
    tn = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(3)
    fp = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(4)
    fn = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(5)
    tpr = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(6)
    fpr = bvxm_batch.get_bbas_1d_array_float(id)
    return thres_out, tp, tn, fp, fn, tpr, fpr
  else:
    return None, None, None, None, None, None, None
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
Example #3
0
def correct_ransac_process(cor_file, output_folder, pixel_radius):
    bvxm_batch.init_process("volmCorrectRationalCamerasRANSACProcess")
    bvxm_batch.set_input_string(0, cor_file)
    bvxm_batch.set_input_string(1, output_folder)
    # pixel radius to count for inliers
    bvxm_batch.set_input_float(2, pixel_radius)
    bvxm_batch.run_process()
Example #4
0
def generate_roc3(tclsf, in_prob_img, prefix_for_bin_files, positive_category_name):
  bvxm_batch.init_process("sdetTextureClassifierROCProcess3")
  bvxm_batch.set_input_from_db(0, tclsf)
  bvxm_batch.set_input_from_db(1, in_prob_img)
  bvxm_batch.set_input_string(2, prefix_for_bin_files)
  bvxm_batch.set_input_string(3, positive_category_name)
  status = bvxm_batch.run_process()
  if status:
    (id, type) = bvxm_batch.commit_output(0)
    thres = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(1)
    tp = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(2)
    tn = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(3)
    fp = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(4)
    fn = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(5)
    tpr = bvxm_batch.get_bbas_1d_array_float(id)
    (id, type) = bvxm_batch.commit_output(6)
    fpr = bvxm_batch.get_bbas_1d_array_float(id)
    return thres, tp, tn, fp, fn, tpr, fpr
  else:
    return None, None, None, None, None, None, None
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 #6
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 #7
0
def add_to_filter_bank(tclsf, img_name, plane, filter_folder):
  bvxm_batch.init_process("sdetAddtoFilterBankProcess");
  bvxm_batch.set_input_from_db(0,tclsf);      # classifier instance
  bvxm_batch.set_input_string(1,img_name);
  bvxm_batch.set_input_unsigned(2,plane);  ## pass which plane to extract the gauss response from
  bvxm_batch.set_input_string(3,filter_folder);
  bvxm_batch.run_process();
Example #8
0
def correct_ransac_process(res, cor_file, output_folder, pixel_radius):
  bvxm_batch.init_process("volmCorrectRationalCamerasRANSACProcess");
  bvxm_batch.set_input_from_db(0, res);
  bvxm_batch.set_input_string(1, cor_file);
  bvxm_batch.set_input_string(2, output_folder);
  bvxm_batch.set_input_float(3, pixel_radius);  ## pixel radius to count for inliers
  bvxm_batch.run_process();
Example #9
0
def interpolate_perspective_cameras(cam0,cam1,ncams,outdir):
    bvxm_batch.init_process("vpglInterpolatePerspectiveCamerasProcess");
    bvxm_batch.set_input_from_db(0, cam0);
    bvxm_batch.set_input_from_db(1, cam1);
    bvxm_batch.set_input_unsigned(2, ncams);
    bvxm_batch.set_input_string(3, outdir);
    return bvxm_batch.run_process();
Example #10
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 #11
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 #12
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 #13
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 #14
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 #15
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 #16
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 #17
0
def get_geocam_footprint(geocam, geotiff_filename, out_kml_filename,init_finish=True):
    bvxm_batch.init_process('vpglGeoFootprintProcess');
    bvxm_batch.set_input_from_db(0,geocam);
    bvxm_batch.set_input_string(1,geotiff_filename);
    bvxm_batch.set_input_string(2,out_kml_filename);
    bvxm_batch.set_input_bool(3,init_finish);
    bvxm_batch.run_process();
Example #18
0
def save_occupancy_raw(world, filename, app_model, scale=0):
  bvxm_batch.init_process("bvxmSaveOccupancyRawProcess");
  bvxm_batch.set_input_from_db(0,world);
  bvxm_batch.set_input_string(1,filename);
  bvxm_batch.set_input_unsigned(2, scale);
  bvxm_batch.set_input_string(3, app_model);
  bvxm_batch.run_process();
Example #19
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 #20
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 #21
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 #22
0
def find_seed_sat_resources(res, poly_kml, downsample_factor, sat_res_file):
  bvxm_batch.init_process("volmFindOverlappingSatResourcesProcess")
  bvxm_batch.set_input_from_db(0,res);             # satellite resource
  bvxm_batch.set_input_string(1,poly_kml);         # kml polygon filename
  bvxm_batch.set_input_float(2,downsample_factor); # factor by which to downsample resource footprints when 
                                                   # computing the raster (smaller factor takes more time & memory)
  bvxm_batch.set_input_string(3,sat_res_file);     # output file to print the list (this will also save a kml version)
  bvxm_batch.run_process();
Example #23
0
def save_lvcs(lat,lon,hae,lvcs_filename):
    bvxm_batch.init_process("vpglSaveLVCSProcess");
    bvxm_batch.set_input_float(0,lat);
    bvxm_batch.set_input_float(1,lon);
    bvxm_batch.set_input_float(2,hae);
    bvxm_batch.set_input_string(3,lvcs_filename);
    bvxm_batch.run_process();
    return;
Example #24
0
def get_nitf_footprint(nitf_list_filename, out_kml_filename, r = 255, g = 255, b = 255):
    bvxm_batch.init_process('vpglNITFFootprintProcess');
    bvxm_batch.set_input_string(0,nitf_list_filename);
    bvxm_batch.set_input_string(1,out_kml_filename);
    bvxm_batch.set_input_unsigned(2,r)
    bvxm_batch.set_input_unsigned(3,g)
    bvxm_batch.set_input_unsigned(4,b)
    bvxm_batch.run_process();
Example #25
0
def create_local_rational_camera(rational_cam_fname, lvcs_fname):
    bvxm_batch.init_process('vpglCreateLocalRationalCameraProcess');
    bvxm_batch.set_input_string(0,rational_cam_fname);
    bvxm_batch.set_input_string(1,lvcs_fname);
    bvxm_batch.run_process();
    (id,type) = bvxm_batch.commit_output(0);
    cam = dbvalue(id,type);
    return cam;
Example #26
0
def load_affine_camera(file_path, viewing_dist=1000) :
  bvxm_batch.init_process("vpglLoadAffineCameraProcess");
  bvxm_batch.set_input_string(0, file_path);
  bvxm_batch.set_input_double(1, viewing_dist);
  bvxm_batch.run_process();
  (id,type) = bvxm_batch.commit_output(0);
  cam = dbvalue(id,type);
  return cam;
Example #27
0
def read_nitf_metadata(nitf_filename, imd_folder=""):
  bvxm_batch.init_process("bradNITFReadMetadataProcess")
  bvxm_batch.set_input_string(0, nitf_filename)  # requires full path and name
  bvxm_batch.set_input_string(1, imd_folder)  # pass empty if meta is in img folder
  bvxm_batch.run_process()
  (id, type) = bvxm_batch.commit_output(0)
  meta = dbvalue(id, type)
  return meta
Example #28
0
def volm_id_color_img(id_img, id_to_color_txt=""):
  bvxm_batch.init_process("volmGenerateColorClassMapProcess")
  bvxm_batch.set_input_from_db(0,id_img);
  bvxm_batch.set_input_string(1,id_to_color_txt)
  bvxm_batch.run_process();
  (id, type) = bvxm_batch.commit_output(0);
  out_img = dbvalue(id, type);
  return out_img;
Example #29
0
def find_sun_dir_bin(metadata, output_file):
  bvxm_batch.init_process("bradSunDirBinProcess");
  bvxm_batch.set_input_from_db(0,metadata)
  bvxm_batch.set_input_string(1,output_file);
  bvxm_batch.run_process();
  (bin_id,bin_type)=bvxm_batch.commit_output(0);
  bin = bvxm_batch.get_output_int(bin_id);
  return bin
Example #30
0
def load_geotiff_from_header(filename, lvcs=0):
    bvxm_batch.init_process("vpglLoadGeotiffCamFromHeaderProcess");
    bvxm_batch.set_input_string(0, filename);
    if lvcs != 0:
      bvxm_batch.set_input_from_db(1, lvcs);
    bvxm_batch.run_process();
    (c_id,c_type) = bvxm_batch.commit_output(0);
    cam = dbvalue(c_id,c_type);
    return cam;
Example #31
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)
    # set bin index to be 0 for all images
    bvxm_batch.set_input_unsigned(4, bin_index)
    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 #32
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 #33
0
def generate_xyz_from_dem_multi(world,
                                img_folder,
                                geoid_height,
                                fill_in_value=-1.0):
    bvxm_batch.init_process("bvxmDemToXYZProcess2")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_string(1, img_folder)
    bvxm_batch.set_input_double(2, geoid_height)
    bvxm_batch.set_input_float(3, fill_in_value)
    result = bvxm_batch.run_process()
    if result:
        (xi_id, xi_type) = bvxm_batch.commit_output(0)
        x_img = dbvalue(xi_id, xi_type)
        (yi_id, yi_type) = bvxm_batch.commit_output(1)
        y_img = dbvalue(yi_id, yi_type)
        (zi_id, zi_type) = bvxm_batch.commit_output(2)
        z_img = dbvalue(zi_id, zi_type)
    else:
        x_img = 0
        y_img = 0
        z_img = 0
    return x_img, y_img, z_img
Example #34
0
def roi_init(image_filename,
             cam,
             world,
             roi_init_params_xml,
             is_all_bits=False):
    bvxm_batch.init_process("bvxmRoiInitProcess")
    bvxm_batch.set_input_string(0, image_filename)
    bvxm_batch.set_input_from_db(1, cam)
    bvxm_batch.set_input_from_db(2, world)
    bvxm_batch.set_input_bool(3, is_all_bits)
    bvxm_batch.set_params_process(roi_init_params_xml)
    ##"bvxmRoiInitProcess.xml");
    statuscode = bvxm_batch.run_process()
    if statuscode:
        (cropped_cam_id, cropped_cam_type) = bvxm_batch.commit_output(0)
        cropped_cam = dbvalue(cropped_cam_id, cropped_cam_type)
        (cropped_image_id, cropped_image_type) = bvxm_batch.commit_output(1)
        cropped_image = dbvalue(cropped_image_id, cropped_image_type)
        (uncertainty_id, uncertainty_type) = bvxm_batch.commit_output(2)
        uncertainty = dbvalue(uncertainty_id, uncertainty_type)
        return statuscode, cropped_cam, cropped_image, uncertainty
    else:
        return statuscode, dbvalue(0, ""), dbvalue(0, ""), dbvalue(0, "")
Example #35
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 #36
0
def generate_roc2(image, gt_pos_file, pos_sign="low"):
    bvxm_batch.init_process("sdetTextureClassifierROCProcess2")
    bvxm_batch.set_input_from_db(0, image)
    bvxm_batch.set_input_string(1, gt_pos_file)
    bvxm_batch.set_input_string(2, pos_sign)
    status = bvxm_batch.run_process()
    if status:
        (id, type) = bvxm_batch.commit_output(0)
        threshold = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(1)
        tp = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(2)
        tn = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(3)
        fp = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(4)
        fn = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(5)
        tpr = bvxm_batch.get_bbas_1d_array_float(id)
        (id, type) = bvxm_batch.commit_output(6)
        fpr = bvxm_batch.get_bbas_1d_array_float(id)
        return threshold, tp, tn, fp, fn, tpr, fpr
    else:
        return 0, 0, 0, 0, 0, 0, 0
Example #37
0
def scene_resources(res,
                    lower_left_lon,
                    lower_left_lat,
                    upper_right_lon,
                    upper_right_lat,
                    scene_res_file,
                    band="PAN",
                    pick_seeds=0,
                    n_seeds=0):
    bvxm_batch.init_process("volmQuerySatelliteResourcesProcess")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_double(1, lower_left_lon)
    bvxm_batch.set_input_double(2, lower_left_lat)
    bvxm_batch.set_input_double(3, upper_right_lon)
    bvxm_batch.set_input_double(4, upper_right_lat)
    bvxm_batch.set_input_string(5, scene_res_file)
    bvxm_batch.set_input_string(6, band)
    bvxm_batch.set_input_bool(7, pick_seeds)
    ## of 0, it returns all resources that intersect the box, otherwise, it picks n_seeds among these resources
    bvxm_batch.set_input_int(8, n_seeds)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cnt = bvxm_batch.get_output_unsigned(id)
    return cnt
Example #38
0
def add_responses_to_filter_bank(tclsf, img_name, img, filter_folder,
                                 filter_name):
    bvxm_batch.init_process("sdetAddResponsestoFilterBankProcess")
    bvxm_batch.set_input_from_db(0, tclsf)  # classifier instance
    bvxm_batch.set_input_string(1, img_name)
    bvxm_batch.set_input_from_db(2, img)
    bvxm_batch.set_input_string(3, filter_folder)
    # pass a unique name to be used to write to filter_folder
    bvxm_batch.set_input_string(4, filter_name)
    bvxm_batch.run_process()
Example #39
0
def combine_height_map(height_map_folder,
                       poly_roi,
                       out_folder,
                       size_in_degree=0.0625,
                       leaf_id=-1):
    bvxm_batch.init_process("volmCombineHeightMapProcess")
    bvxm_batch.set_input_string(0, height_map_folder)
    bvxm_batch.set_input_string(1, poly_roi)
    bvxm_batch.set_input_string(2, out_folder)
    bvxm_batch.set_input_float(3, size_in_degree)
    bvxm_batch.set_input_int(4, leaf_id)
    bvxm_batch.run_process()
Example #40
0
def find_stereo_pairs2(res, poly_roi, GSD_threshold, scene_res_file,
                       satellite_name):
    bvxm_batch.init_process("volmFindSatellitePairsPolyProcess")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_string(1, poly_roi)
    bvxm_batch.set_input_string(2, scene_res_file)
    bvxm_batch.set_input_string(3, satellite_name)
    bvxm_batch.set_input_float(4, GSD_threshold)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cnt = bvxm_batch.get_output_unsigned(id)
    return cnt
Example #41
0
def project_osm_category_to_ortho_img(img_byte, ortho_cam, osm_file,
                                      osm_category_name,
                                      output_vsol_binary_name):
    bvxm_batch.init_process("volmMapOSMontoImageProcess3")
    bvxm_batch.set_input_from_db(0, img_byte)
    bvxm_batch.set_input_from_db(1, ortho_cam)
    bvxm_batch.set_input_string(2, osm_file)
    bvxm_batch.set_input_string(3, osm_category_name)
    bvxm_batch.set_input_string(4, output_vsol_binary_name)
    # process returns true if any osm objects hit the image area in this tile
    hit = bvxm_batch.run_process()
    return hit
Example #42
0
def isfm_rational_camera_seed(track_file, out_folder, dem_folder, ll_lon=0.0, ll_lat=0.0, ur_lon=0.0, ur_lat=0.0, height_diff=20.0, pixel_radius=2.0, enforce_existing=False):
    bvxm_batch.init_process("vpglIsfmRationalCameraSeedProcess")
    bvxm_batch.set_input_string(0, track_file)
    bvxm_batch.set_input_string(1, out_folder)
    bvxm_batch.set_input_string(2, dem_folder)
    bvxm_batch.set_input_float(3, ll_lon)
    bvxm_batch.set_input_float(4, ll_lat)
    bvxm_batch.set_input_float(5, ur_lon)
    bvxm_batch.set_input_float(6, ur_lat)
    bvxm_batch.set_input_double(7, height_diff)
    bvxm_batch.set_input_float(8, pixel_radius)
    bvxm_batch.set_input_bool(9, enforce_existing)
    status = bvxm_batch.run_process()
    return status
Example #43
0
def correct_ransac_with_initial_process(res,
                                        cor_file,
                                        dem_folder,
                                        output_folder,
                                        pixel_radius,
                                        enforce_existing=False):
    bvxm_batch.init_process("volmCorrectRationalCameraRANSACwithIntialProcess")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_string(1, cor_file)
    bvxm_batch.set_input_string(2, dem_folder)
    bvxm_batch.set_input_string(3, output_folder)
    bvxm_batch.set_input_float(4, pixel_radius)
    bvxm_batch.set_input_bool(5, enforce_existing)
    status = bvxm_batch.run_process()
    return status
def train_classifier(tclsf, poly_file, category_name, dictionary_name, compute_category_textons, finish_and_write_dictionary):
  bvxm_batch.init_process("sdetTextureTrainingProcess2");
  bvxm_batch.set_input_from_db(0,tclsf);
  if compute_category_textons:
    bvxm_batch.set_input_bool(1,1);  # compute the textons if this is the last polygon file for the category
  else:
    bvxm_batch.set_input_bool(1,0);
  bvxm_batch.set_input_string(2, poly_file);
  bvxm_batch.set_input_string(3, category_name);
  bvxm_batch.set_input_string(4, dictionary_name);
  bvxm_batch.run_process();
  (tclsf_id, tclsf_type)=bvxm_batch.commit_output(0);
  tclsf = dbvalue(tclsf_id, tclsf_type);
  if finish_and_write_dictionary:
    bvxm_batch.finish_process();
  return tclsf
Example #45
0
def add_to_filter_bank(tclsf,
                       img_name,
                       plane,
                       filter_folder,
                       filter_name,
                       is_gauss_smooth=True):
    bvxm_batch.init_process("sdetAddtoFilterBankProcess")
    bvxm_batch.set_input_from_db(0, tclsf)  # classifier instance
    bvxm_batch.set_input_string(1, img_name)
    # pass which plane to extract the gauss response from
    bvxm_batch.set_input_unsigned(2, plane)
    bvxm_batch.set_input_string(3, filter_folder)
    # pass a unique name to be used to write to filter_folder
    bvxm_batch.set_input_string(4, filter_name)
    bvxm_batch.set_input_bool(5, is_gauss_smooth)
    bvxm_batch.run_process()
Example #46
0
def create_land_map(world, geo_folder, urban_folder, osm_folder, is_osm_pt,
                    is_osm_region, is_osm_line):
    bvxm_batch.init_process("bvxmCreateLandMapProcess")
    bvxm_batch.set_input_from_db(0, world)
    bvxm_batch.set_input_string(1, geo_folder)
    bvxm_batch.set_input_string(2, urban_folder)
    bvxm_batch.set_input_string(3, osm_folder)
    bvxm_batch.set_input_bool(4, is_osm_pt)
    bvxm_batch.set_input_bool(5, is_osm_line)
    bvxm_batch.set_input_bool(6, is_osm_region)
    result = bvxm_batch.run_process()
    if result:
        (img_id, img_type) = bvxm_batch.commit_output(0)
        land_img = dbvalue(img_id, img_type)
    else:
        land_img = 0
    return land_img
Example #47
0
def project_osm_to_crop_img2(crop_img, crop_cam, ortho_img, ortho_cam,
                             osm_bin_file, osm_category_name,
                             vsol_bin_filename):
    bvxm_batch.init_process("volmMapOSMontoImageProcess2")
    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, osm_category_name)
    bvxm_batch.set_input_string(6, vsol_bin_filename)
    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 scene_resources2(res,
                     poly_kml,
                     scene_res_file,
                     band="PAN",
                     GSD_threshold=10.0,
                     pick_seeds=0,
                     n_seeds=0):
    bvxm_batch.init_process("volmQuerySatelliteResourceKmlProcess")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_string(1, poly_kml)
    bvxm_batch.set_input_string(2, scene_res_file)
    bvxm_batch.set_input_string(3, band)
    bvxm_batch.set_input_bool(4, pick_seeds)
    bvxm_batch.set_input_int(5, n_seeds)
    bvxm_batch.set_input_double(6, GSD_threshold)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    cnt = bvxm_batch.get_output_unsigned(id)
    return cnt
Example #49
0
def pick_nadir_resource(res,
                        lower_left_lon,
                        lower_left_lat,
                        upper_right_lon,
                        upper_right_lat,
                        satellite_name,
                        band_name="PAN",
                        non_cloud_folder=""):
    bvxm_batch.init_process("volmPickNadirResProcess")
    bvxm_batch.set_input_from_db(0, res)
    bvxm_batch.set_input_double(1, lower_left_lon)
    bvxm_batch.set_input_double(2, lower_left_lat)
    bvxm_batch.set_input_double(3, upper_right_lon)
    bvxm_batch.set_input_double(4, upper_right_lat)
    bvxm_batch.set_input_string(5, band_name)
    bvxm_batch.set_input_string(6, satellite_name)
    bvxm_batch.set_input_string(7, non_cloud_folder)
    bvxm_batch.run_process()
    (id, type) = bvxm_batch.commit_output(0)
    sat_path = bvxm_batch.get_output_string(id)
    return sat_path
Example #50
0
def test_classifier_clouds(tclsf,
                           dictionary_name,
                           image_resource,
                           i,
                           j,
                           width,
                           height,
                           block_size,
                           percent_cat_name,
                           category_id_file=""):
    bvxm_batch.init_process("sdetTextureClassifySatelliteCloudsProcess")
    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)
        (percent_id, percent_type) = bvxm_batch.commit_output(3)
        percent = bvxm_batch.get_output_float(percent_id)
        bvxm_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 #51
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 #52
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):
    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_string(12, path_H1)
    bvxm_batch.set_input_string(13, 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)
    (id, type) = bvxm_batch.commit_output(2)
    ortho_disp_map = dbvalue(id, type)
    return out_map, disparity_map, ortho_disp_map
Example #53
0
def convert_perspective_to_nvm(cams_dir, imgs_dir, output_nvm):
    bvxm_batch.init_process("vpglExportCamerasToNvmProcess")
    bvxm_batch.set_input_string(0, cams_dir)
    bvxm_batch.set_input_string(1, imgs_dir)
    bvxm_batch.set_input_string(2, output_nvm)
    return bvxm_batch.run_process()
Example #54
0
def get_nitf_footprint(nitf_list_filename, out_kml_filename):
    bvxm_batch.init_process('vpglNITFFootprintProcess')
    bvxm_batch.set_input_string(0, nitf_list_filename)
    bvxm_batch.set_input_string(1, out_kml_filename)
    bvxm_batch.run_process()
Example #55
0
def save_geocam_to_tfw(cam, tfw_filename):
    bvxm_batch.init_process("vpglSaveGeoCameraTFWProcess")
    bvxm_batch.set_input_from_db(0, cam)
    bvxm_batch.set_input_string(1, tfw_filename)
    bvxm_batch.run_process()
Example #56
0
def camera_dir_planar_bbox(dir_name):
    bvxm_batch.init_process("vpglGetBoundingBoxProcess")
    bvxm_batch.set_input_string(0, dir_name)
    bvxm_batch.run_process()
Example #57
0
def write_generic_to_vrml(cam, out_file_name, level=0):
    bvxm_batch.init_process("vpglWriteGenericCameraProcess")
    bvxm_batch.set_input_from_db(0, cam)
    bvxm_batch.set_input_string(1, out_file_name)
    bvxm_batch.set_input_unsigned(2, level)
    bvxm_batch.run_process()
Example #58
0
def save_proj_camera(camera, path):
    bvxm_batch.init_process("vpglSaveProjectiveCameraProcess")
    bvxm_batch.set_input_from_db(0, camera)
    bvxm_batch.set_input_string(1, path)
    bvxm_batch.run_process()
Example #59
0
def save_perspective_cameras_vrml(camerafolder, path):
    bvxm_batch.init_process("vpglSavePerspectiveCamerasVrmlProcess")
    bvxm_batch.set_input_string(0, camerafolder)
    bvxm_batch.set_input_string(1, path)
    bvxm_batch.set_input_float(2, 5.0)
    bvxm_batch.run_process()
Example #60
0
def save_perspective_camera_vrml(camera, path):
    bvxm_batch.init_process("vpglSavePerspectiveCameraVrmlProcess")
    bvxm_batch.set_input_from_db(0, camera)
    bvxm_batch.set_input_string(1, path)
    bvxm_batch.set_input_float(2, 5.0)
    bvxm_batch.run_process()