def offset_cam_using_3d_box(camera, lower_left_lon, lower_left_lat, lower_left_elev, upper_right_lon, upper_right_lat, upper_right_elev, uncertainty, lvcs=None): boxm2_batch.init_process("vpglOffsetCamUsing3DboxProcess"); boxm2_batch.set_input_from_db(0, camera); boxm2_batch.set_input_double(1, lower_left_lon); boxm2_batch.set_input_double(2, lower_left_lat); boxm2_batch.set_input_double(3, lower_left_elev); boxm2_batch.set_input_double(4, upper_right_lon); boxm2_batch.set_input_double(5, upper_right_lat); boxm2_batch.set_input_double(6, upper_right_elev); boxm2_batch.set_input_double(7, uncertainty); if lvcs: boxm2_batch.set_input_from_db(8, lvcs); status = boxm2_batch.run_process(); if status: (id, type) = boxm2_batch.commit_output(0); local_cam = dbvalue(id, type); (id, type) = boxm2_batch.commit_output(1); i0 = boxm2_batch.get_output_unsigned(id) boxm2_batch.remove_data(id); (id, type) = boxm2_batch.commit_output(2); j0 = boxm2_batch.get_output_unsigned(id) boxm2_batch.remove_data(id); (id, type) = boxm2_batch.commit_output(3); ni = boxm2_batch.get_output_unsigned(id) boxm2_batch.remove_data(id); (id, type) = boxm2_batch.commit_output(4); nj = boxm2_batch.get_output_unsigned(id) boxm2_batch.remove_data(id); return status, local_cam, i0, j0, ni, nj; else: return status, dbvalue(0, ""), 0, 0, 0, 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): boxm2_batch.init_process("vpglCropImgUsing3DboxProcess") boxm2_batch.set_input_from_db(0, img_res) boxm2_batch.set_input_from_db(1, camera) boxm2_batch.set_input_double(2, lower_left_lon) boxm2_batch.set_input_double(3, lower_left_lat) boxm2_batch.set_input_double(4, lower_left_elev) boxm2_batch.set_input_double(5, upper_right_lon) boxm2_batch.set_input_double(6, upper_right_lat) boxm2_batch.set_input_double(7, upper_right_elev) boxm2_batch.set_input_double(8, uncertainty) if lvcs: boxm2_batch.set_input_from_db(9, lvcs) status = boxm2_batch.run_process() if status: (id, type) = boxm2_batch.commit_output(0) local_cam = dbvalue(id, type) (id, type) = boxm2_batch.commit_output(1) i0 = boxm2_batch.get_output_unsigned(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(2) j0 = boxm2_batch.get_output_unsigned(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(3) ni = boxm2_batch.get_output_unsigned(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(4) nj = boxm2_batch.get_output_unsigned(id) boxm2_batch.remove_data(id) return status, local_cam, i0, j0, ni, nj else: return status, dbvalue(0, ""), 0, 0, 0, 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;
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): boxm2_batch.init_process("vpglCropImgUsing3DboxProcess"); boxm2_batch.set_input_from_db(0, img_res); boxm2_batch.set_input_from_db(1, camera); boxm2_batch.set_input_double(2, lower_left_lon); boxm2_batch.set_input_double(3, lower_left_lat); boxm2_batch.set_input_double(4, lower_left_elev); boxm2_batch.set_input_double(5, upper_right_lon); boxm2_batch.set_input_double(6, upper_right_lat); boxm2_batch.set_input_double(7, upper_right_elev); boxm2_batch.set_input_double(8, uncertainty); status = boxm2_batch.run_process(); if status: (id, type) = boxm2_batch.commit_output(0); local_cam = dbvalue(id, type); (id, type) = boxm2_batch.commit_output(1); i0 = boxm2_batch.get_output_unsigned(id) (id, type) = boxm2_batch.commit_output(2); j0 = boxm2_batch.get_output_unsigned(id) (id, type) = boxm2_batch.commit_output(3); ni = boxm2_batch.get_output_unsigned(id) (id, type) = boxm2_batch.commit_output(4); nj = boxm2_batch.get_output_unsigned(id) return status, local_cam, i0, j0, ni, nj; else: return status, dbvalue(0, ""), 0, 0, 0, 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
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
def arf_stream(file_path) : boxm2_batch.init_process("bilCreateArfImageIstreamProcess") boxm2_batch.set_input_string(0,file_path); boxm2_batch.run_process(); (id, type) = boxm2_batch.commit_output(0); stream = dbvalue(id, type); (id, type) = boxm2_batch.commit_output(1); numImgs = boxm2_batch.get_output_int(id); return stream, numImgs
def image_size(img): boxm2_batch.init_process('vilImageSizeProcess') boxm2_batch.set_input_from_db(0,img) boxm2_batch.run_process() (id,type) = boxm2_batch.commit_output(0) ni = boxm2_batch.get_output_unsigned(id) (id,type) = boxm2_batch.commit_output(1) nj = boxm2_batch.get_output_unsigned(id) return ni,nj
def arf_next_frame(rawStream) : boxm2_batch.init_process("bilArfReadFrameProcess") boxm2_batch.set_input_from_db(0,rawStream); boxm2_batch.run_process(); (id, type) = boxm2_batch.commit_output(0); img = dbvalue(id,type); (id, type) = boxm2_batch.commit_output(1); time = boxm2_batch.get_output_unsigned(id); return img, time
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
def arf_seek_frame(rawStream, frame): boxm2_batch.init_process("bilArfSeekFrameProcess") boxm2_batch.set_input_from_db(0, rawStream) boxm2_batch.set_input_unsigned(1, frame) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) img = dbvalue(id, type) (id, type) = boxm2_batch.commit_output(1) time = boxm2_batch.get_output_unsigned(id) boxm2_batch.remove_data(id) return img, time
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;
def geo_cam_global_to_img(geocam, lon, lat): boxm2_batch.init_process("vpglGeoGlobalToImgProcess"); boxm2_batch.set_input_from_db(0, geocam); boxm2_batch.set_input_double(1, lon); boxm2_batch.set_input_double(2, lat); boxm2_batch.run_process(); (id, type) = boxm2_batch.commit_output(0); u = boxm2_batch.get_output_int(id); (id, type) = boxm2_batch.commit_output(1); v = boxm2_batch.get_output_int(id); return u, v;
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 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)
def get_rational_camera_offsets(cam_in): boxm2_batch.init_process('vpglGetRationalCameraOffsetsProcess'); boxm2_batch.set_input_from_db(0,cam_in); boxm2_batch.run_process(); (id,type) = boxm2_batch.commit_output(0); offset_u = boxm2_batch.get_output_double(id); boxm2_batch.remove_data(id); (id,type) = boxm2_batch.commit_output(1); offset_v = boxm2_batch.get_output_double(id); boxm2_batch.remove_data(id); return (offset_u,offset_v);
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)
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);
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;
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); (angle_id,angle_type)=boxm2_batch.commit_output(1); angle = boxm2_batch.get_output_float(angle_id); return bin, angle
def register_translational(img0, img0_mask, img1, search_radius=0): boxm2_batch.init_process('ihogRegisterTranslationalProcess') boxm2_batch.set_input_from_db(0,img0) boxm2_batch.set_input_from_db(1,img0_mask) boxm2_batch.set_input_from_db(2,img1) boxm2_batch.set_input_int(3,search_radius) boxm2_batch.run_process() (id,type) = boxm2_batch.commit_output(0) trans_x = boxm2_batch.get_output_double(id) (id,type) = boxm2_batch.commit_output(1) trans_y = boxm2_batch.get_output_double(id) return (trans_x, trans_y)
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)
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)
def blobwise_kl_div(p_img, q_img, blob_img, thresh=.1) : boxm2_batch.init_process("bripBlobwiseKLDivProcess") boxm2_batch.set_input_from_db(0, p_img); boxm2_batch.set_input_from_db(1, q_img); boxm2_batch.set_input_from_db(2, blob_img); boxm2_batch.set_input_float(3, thresh); boxm2_batch.run_process(); (id,type) = boxm2_batch.commit_output(0); kl_img = dbvalue(id,type); (id,type) = boxm2_batch.commit_output(1); thresh_img = dbvalue(id,type); return kl_img, thresh_img;
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;
def bbox_from_ply(filename): minpoint = list(); maxpoint = list(); boxm2_batch.init_process('imeshPlyBboxProcess') boxm2_batch.set_input_string(0,filename) boxm2_batch.run_process() for i in (0,1,2): (id,type) = boxm2_batch.commit_output(i) minpoint.append(boxm2_batch.get_output_double(id)); for i in (3,4,5): (id,type) = boxm2_batch.commit_output(i) maxpoint.append(boxm2_batch.get_output_double(id)); return (minpoint, maxpoint)
def geo_cam_global_to_img(geocam, lon, lat): boxm2_batch.init_process("vpglGeoGlobalToImgProcess") boxm2_batch.set_input_from_db(0, geocam) boxm2_batch.set_input_double(1, lon) boxm2_batch.set_input_double(2, lat) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) u = boxm2_batch.get_output_int(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(1) v = boxm2_batch.get_output_int(id) boxm2_batch.remove_data(id) return u, v
def test_classifier(tclsf, block_size, category_id_file=""): boxm2_batch.init_process("sdetTextureClassifierProcess2"); boxm2_batch.set_input_from_db(0, tclsf); boxm2_batch.set_input_unsigned(1, block_size); boxm2_batch.set_input_string(2, category_id_file); boxm2_batch.run_process(); (out_id, out_type)=boxm2_batch.commit_output(0); out = dbvalue(out_id, out_type); (out_id, out_type)=boxm2_batch.commit_output(1); out_color = dbvalue(out_id, out_type); (out_id, out_type)=boxm2_batch.commit_output(2); out_id = dbvalue(out_id, out_type); return out, out_color, out_id
def get_xyz_from_depth_image(cam,depth_img): boxm2_batch.init_process("vpglGenerateXYZFromDepthImageProcess"); boxm2_batch.set_input_from_db(0,cam); # perspective or generic camera boxm2_batch.set_input_from_db(1,depth_img); boxm2_batch.run_process(); (id,type) = boxm2_batch.commit_output(0); x_img = dbvalue(id,type); (id,type) = boxm2_batch.commit_output(1); y_img = dbvalue(id,type); (id,type) = boxm2_batch.commit_output(2); z_img = dbvalue(id,type); return x_img,y_img,z_img;
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
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
def convert_local_rational_perspective_camera(local_cam): boxm2_batch.init_process("vpglConvertLocalRationalToPerspectiveProcess") boxm2_batch.set_input_from_db(0, local_cam) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) cam = dbvalue(id, type) return cam
def load_projective_camera(file_path): boxm2_batch.init_process("vpglLoadProjCameraProcess") boxm2_batch.set_input_string(0, file_path) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) cam = dbvalue(id, type) return cam
def blob_intersection(mp_img, gt_img): boxm2_batch.init_process("bripBlobIntersectionProcess") boxm2_batch.set_input_from_db(0, mp_img) boxm2_batch.set_input_from_db(1, gt_img) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) tp = boxm2_batch.get_output_int(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(1) fp = boxm2_batch.get_output_int(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(2) numBlobs = boxm2_batch.get_output_int(id) boxm2_batch.remove_data(id) return (tp, fp, numBlobs)
def load_image_metadata(filename): boxm2_batch.init_process("bradLoadImageMetadataProcess") boxm2_batch.set_input_string(0, filename) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) mdata = dbvalue(id, type) return mdata
def load_perspective_camera(file_path) : boxm2_batch.init_process("vpglLoadPerspectiveCameraProcess"); boxm2_batch.set_input_string(0, file_path); boxm2_batch.run_process(); (id,type) = boxm2_batch.commit_output(0); cam = dbvalue(id,type); return cam;
def load_local_rational_camera(file_path) : boxm2_batch.init_process("vpglLoadLocalRationalCameraProcess"); boxm2_batch.set_input_string(0, file_path); boxm2_batch.run_process(); (id,type) = boxm2_batch.commit_output(0); cam = dbvalue(id,type); return cam;
def load_atmospheric_parameters(filename): boxm2_batch.init_process("bradLoadAtmosphericParametersProcess") boxm2_batch.set_input_string(0, filename) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) atm_params = dbvalue(id, type) return atm_params
def probe_intensities(scene, cpu_cache, str_cache, point): boxm2_batch.init_process("boxm2CppBatchProbeIntensitiesProcess") boxm2_batch.set_input_from_db(0, scene) boxm2_batch.set_input_from_db(1, cpu_cache) boxm2_batch.set_input_from_db(2, str_cache) boxm2_batch.set_input_float(3, point[0]) boxm2_batch.set_input_float(4, point[1]) boxm2_batch.set_input_float(5, point[2]) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) intensities = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(1) visibilities = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) return intensities, visibilities
def debayer(img): boxm2_batch.init_process("vilDebayerBGGRToRGBProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) outimg = dbvalue(id, type) return outimg
def load_dictionary(dictionary_name): boxm2_batch.init_process("sdetLoadTextureDictionaryProcess") boxm2_batch.set_input_string(0, dictionary_name) boxm2_batch.run_process() (tclsf_id, tclsf_type) = boxm2_batch.commit_output(0) tclsf = dbvalue(tclsf_id, tclsf_type) return tclsf
def load_rational_camera_nitf(file_path): boxm2_batch.init_process("vpglLoadRationalCameraNITFProcess") boxm2_batch.set_input_string(0, file_path) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) cam = dbvalue(id, type) return cam
def initialize_rng(seed=0): boxm2_batch.init_process("bstaInitializeRandomSeedProcess") boxm2_batch.set_input_unsigned(0, seed) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) rng = dbvalue(id, type) return rng
def load_mesh(filename): boxm2_batch.init_process("boxm2LoadMeshProcess") boxm2_batch.set_input_string(0, filename) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) mesh = dbvalue(id, type) return mesh
def load_lvcs(lvcs_filename): boxm2_batch.init_process("vpglLoadLVCSProcess") boxm2_batch.set_input_string(0, lvcs_filename) boxm2_batch.run_process() (lvcs_id, lvcs_type) = boxm2_batch.commit_output(0) lvcs = dbvalue(lvcs_id, lvcs_type) return lvcs
def texture_classifier_kernel_margin(dictionary): boxm2_batch.init_process("sdetTextureClassifierKernelMarginProcess") boxm2_batch.set_input_string(0, dictionary) boxm2_batch.run_process() (m_id, m_type) = boxm2_batch.commit_output(0) margin = boxm2_batch.get_output_int(m_id) return margin
def load_joint_hist3d(filename): boxm2_batch.init_process("bstaLoadJointHist3dProcess") boxm2_batch.set_input_string(0, filename) boxm2_batch.run_process() (h_id, h_type) = boxm2_batch.commit_output(0) h = dbvalue(h_id, h_type) return h
def load_eigenspace(filename): boxm2_batch.init_process("bradLoadEigenspaceProcess") boxm2_batch.set_input_string(0, filename) boxm2_batch.run_process() (eig_id, eig_type) = boxm2_batch.commit_output(0) eig = dbvalue(eig_id, eig_type) return eig
def fill_holes(img): boxm2_batch.init_process("vilFillHolesInRegionsProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) outimg = dbvalue(id, type) return outimg
def load_classifier(classifier_name): boxm2_batch.init_process("sdetLoadTextureClassifierProcess") boxm2_batch.set_input_string(0, classifier_name) boxm2_batch.run_process() (tclsf_id, tclsf_type) = boxm2_batch.commit_output(0) tclsf = dbvalue(tclsf_id, tclsf_type) return tclsf
def atmospheric_correct(image, sun_z): boxm2_batch.init_process('bbasAtmosphericCorrProcess') boxm2_batch.set_input_from_db(0, image) boxm2_batch.set_input_float(1, sun_z) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) image_corrected = dbvalue(id, type) return image_corrected
def max_threshold_image(img, threshold): boxm2_batch.init_process("vilThresholdMaxImageProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.set_input_float(1, threshold) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) mask = dbvalue(id, type) return mask
def prob_as_expected(image, atomicity): boxm2_batch.init_process("bslExpectedImageProcess") boxm2_batch.set_input_from_db(0, image) boxm2_batch.set_input_float(1, atomicity) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) image_prob = dbvalue(id, type) return image_prob
def median_filter_image(img, neighborhood_radius): boxm2_batch.init_process("vilMedianFilterProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.set_input_int(1, neighborhood_radius) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) filt_img = dbvalue(id, type) return filt_img
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
def get_number_of_planes(img): boxm2_batch.init_process("vilGetNumberOfPlanesProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) n_planes = boxm2_batch.get_output_unsigned(id) boxm2_batch.remove_data(id) return n_planes
def get_plane(img, plane_id): boxm2_batch.init_process("vilGetPlaneProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.set_input_unsigned(1, plane_id) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) img_plane = dbvalue(id, type) return img_plane
def convert_image(img, type="byte"): boxm2_batch.init_process("vilConvertPixelTypeProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.set_input_string(1, type) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) cimg = dbvalue(id, type) return cimg
def detect_shadow_rgb(img, threshold): boxm2_batch.init_process("vilShadowDetectionProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.set_input_float(1, threshold) boxm2_batch.run_process() (o_id, o_type) = boxm2_batch.commit_output(0) region_img = dbvalue(o_id, o_type) return region_img
def combine_eo_ir(eo_img, ir_img): boxm2_batch.init_process("vilEOIRCombineProcess") boxm2_batch.set_input_from_db(0, eo_img) boxm2_batch.set_input_from_db(1, ir_img) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) img_out = dbvalue(id, type) return img_out