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_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_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 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 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 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 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 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); return img, time
def bae_raw_stream(file_path,ni=0,nj=0,pixelsize=0) : boxm2_batch.init_process("bilCreateRawImageIstreamProcess") boxm2_batch.set_input_string(0,file_path); boxm2_batch.set_input_int(1,ni); boxm2_batch.set_input_int(2,nj); boxm2_batch.set_input_int(3,pixelsize); 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 bae_raw_stream(file_path, ni=0, nj=0, pixelsize=0): boxm2_batch.init_process("bilCreateRawImageIstreamProcess") boxm2_batch.set_input_string(0, file_path) boxm2_batch.set_input_int(1, ni) boxm2_batch.set_input_int(2, nj) boxm2_batch.set_input_int(3, pixelsize) 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 load_image(file_path): boxm2_batch.init_process("vilLoadImageViewProcess") boxm2_batch.set_input_string(0, file_path) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) (ni_id, ni_type) = boxm2_batch.commit_output(1) (nj_id, nj_type) = boxm2_batch.commit_output(2) ni = boxm2_batch.get_output_unsigned(ni_id) nj = boxm2_batch.get_output_unsigned(nj_id) img = dbvalue(id, type) boxm2_batch.remove_data(ni_id) boxm2_batch.remove_data(nj_id) return img, ni, nj
def detect_shadow_ridge(region_img,blob_size_t, sun_angle) : boxm2_batch.init_process("vilShadowRidgeDetectionProcess"); boxm2_batch.set_input_from_db(0,region_img) boxm2_batch.set_input_int(1, blob_size_t); boxm2_batch.set_input_float(2, sun_angle); boxm2_batch.run_process(); (o_id,o_type) = boxm2_batch.commit_output(0); region_img = dbvalue(o_id,o_type); (o_id,o_type) = boxm2_batch.commit_output(1); out_img = dbvalue(o_id,o_type); (o_id,o_type) = boxm2_batch.commit_output(2); dist_img = dbvalue(o_id,o_type); return region_img, out_img, dist_img;
def load_image(file_path) : boxm2_batch.init_process("vilLoadImageViewProcess"); boxm2_batch.set_input_string(0, file_path); boxm2_batch.run_process(); (id,type) = boxm2_batch.commit_output(0); (ni_id, ni_type) = boxm2_batch.commit_output(1); (nj_id, nj_type) = boxm2_batch.commit_output(2); ni = boxm2_batch.get_output_unsigned(ni_id); nj = boxm2_batch.get_output_unsigned(nj_id); img = dbvalue(id,type); boxm2_batch.remove_data(ni_id) boxm2_batch.remove_data(nj_id) return img, ni, nj;
def detect_shadow_ridge(region_img, blob_size_t, sun_angle): boxm2_batch.init_process("vilShadowRidgeDetectionProcess") boxm2_batch.set_input_from_db(0, region_img) boxm2_batch.set_input_int(1, blob_size_t) boxm2_batch.set_input_float(2, sun_angle) boxm2_batch.run_process() (o_id, o_type) = boxm2_batch.commit_output(0) region_img = dbvalue(o_id, o_type) (o_id, o_type) = boxm2_batch.commit_output(1) out_img = dbvalue(o_id, o_type) (o_id, o_type) = boxm2_batch.commit_output(2) dist_img = dbvalue(o_id, o_type) return region_img, out_img, dist_img
def gradient(img) : boxm2_batch.init_process('vilGradientProcess') boxm2_batch.set_input_from_db(0,img) boxm2_batch.run_process() #x image (id,type) = boxm2_batch.commit_output(0) dIdx = dbvalue(id,type) #y image (id,type) = boxm2_batch.commit_output(1) dIdy = dbvalue(id,type) #mag image (id,type) = boxm2_batch.commit_output(2) magImg = dbvalue(id,type) return dIdx, dIdy, magImg
def gradient(img): boxm2_batch.init_process('vilGradientProcess') boxm2_batch.set_input_from_db(0, img) boxm2_batch.run_process() #x image (id, type) = boxm2_batch.commit_output(0) dIdx = dbvalue(id, type) #y image (id, type) = boxm2_batch.commit_output(1) dIdy = dbvalue(id, type) #mag image (id, type) = boxm2_batch.commit_output(2) magImg = dbvalue(id, type) return dIdx, dIdy, magImg
def nitf_date_time(image_filename): boxm2_batch.init_process("vilNITFDateTimeProcess"); boxm2_batch.set_input_string(0,image_filename); boxm2_batch.run_process(); (id,type)=boxm2_batch.commit_output(0); year = boxm2_batch.get_output_int(id); (id,type)=boxm2_batch.commit_output(1); month = boxm2_batch.get_output_int(id); (id,type)=boxm2_batch.commit_output(2); day = boxm2_batch.get_output_int(id); (id,type)=boxm2_batch.commit_output(3); hour = boxm2_batch.get_output_int(id); (id,type)=boxm2_batch.commit_output(4); minute = boxm2_batch.get_output_int(id); return year, month, day, hour, minute
def nitf_date_time(image_filename): boxm2_batch.init_process("vilNITFDateTimeProcess") boxm2_batch.set_input_string(0, image_filename) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) year = boxm2_batch.get_output_int(id) (id, type) = boxm2_batch.commit_output(1) month = boxm2_batch.get_output_int(id) (id, type) = boxm2_batch.commit_output(2) day = boxm2_batch.get_output_int(id) (id, type) = boxm2_batch.commit_output(3) hour = boxm2_batch.get_output_int(id) (id, type) = boxm2_batch.commit_output(4) minute = boxm2_batch.get_output_int(id) return year, month, day, hour, minute
def probe_intensities(scene, cpu_cache, str_cache, point): batch.init_process("boxm2CppBatchProbeIntensitiesProcess") batch.set_input_from_db(0, scene) batch.set_input_from_db(1, cpu_cache) batch.set_input_from_db(2, str_cache) batch.set_input_float(3, point[0]) batch.set_input_float(4, point[1]) batch.set_input_float(5, point[2]) batch.run_process() (id, type) = batch.commit_output(0) intensities = batch.get_bbas_1d_array_float(id) batch.remove_data(id) (id, type) = batch.commit_output(1) visibilities = batch.get_bbas_1d_array_float(id) 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 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 render_expected_albedo_normal(self, camera, ni, nj): batch.init_process("boxm2OclRenderExpectedAlbedoNormalProcess") batch.set_input_from_db(0, self.device) batch.set_input_from_db(1, self.scene) batch.set_input_from_db(2, self.opencl_cache) batch.set_input_from_db(3, camera) batch.set_input_unsigned(4, ni) batch.set_input_unsigned(5, nj) batch.run_process() (id, type) = batch.commit_output(0) exp_albedo = dbvalue(id, type) (id, type) = batch.commit_output(1) exp_normal = dbvalue(id, type) (id, type) = batch.commit_output(2) mask_image = dbvalue(id, type) return (exp_albedo, exp_normal, mask_image)
def load_mesh(filename): batch.init_process("boxm2LoadMeshProcess") batch.set_input_string(0, filename) batch.run_process() (id, type) = batch.commit_output(0) mesh = dbvalue(id, type) return mesh
def BGR_to_RGB(inimg): boxm2_batch.init_process("vilBGRToRGBProcess") boxm2_batch.set_input_from_db(0, inimg) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) out_img = dbvalue(id,type) return out_img
def render_expected_albedo_normal(self, camera, ni, nj): batch.init_process("boxm2OclRenderExpectedAlbedoNormalProcess") batch.set_input_from_db(0, self.device) batch.set_input_from_db(1, self.scene) batch.set_input_from_db(2, self.opencl_cache) batch.set_input_from_db(3, camera) batch.set_input_unsigned(4, ni) batch.set_input_unsigned(5, nj) batch.run_process() (id, type) = batch.commit_output(0) exp_albedo = dbvalue(id, type) (id, type) = batch.commit_output(1) exp_normal = dbvalue(id, type) (id, type) = batch.commit_output(2) mask_image = dbvalue(id, type) return(exp_albedo, exp_normal, mask_image)
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 create_stream_cache(self, imgs, interval=1, types="", max_gb=6.0): # write image identifiers to file # imgRange = range(0, len(imgs), interval); # num_imgs = len(imgRange); image_id_fname = self.model_dir + "/image_list.txt" fd = open(image_id_fname, "w") print >> fd, len(imgs) # for i in imgRange: # print >>fd, "img_%05d"%i for img in imgs: fname, fextension = os.path.splitext(img) bname = os.path.basename(fname) print >> fd, bname fd.close() # write type identifiers into file type_id_fname = self.model_dir + "/type_names_list.txt" fd2 = open(type_id_fname, "w") print >> fd2, 4 print >> fd2, "aux0" print >> fd2, "aux1" print >> fd2, "aux2" print >> fd2, "aux3" fd2.close() # open the stream cache, this is a read-only cache batch.init_process("boxm2CreateStreamCacheProcess") batch.set_input_from_db(0, self.scene) batch.set_input_string(1, type_id_fname) batch.set_input_string(2, image_id_fname) batch.set_input_float(3, max_gb) batch.run_process() (cache_id, cache_type) = batch.commit_output(0) self.str_cache = dbvalue(cache_id, cache_type)
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) return n_planes;
def histogram_equalize(img): boxm2_batch.init_process("vilHistogramEqualizeProcess"); boxm2_batch.set_input_from_db(0, img); boxm2_batch.run_process(); (id, type) = boxm2_batch.commit_output(0); img_equalized = dbvalue(id, type); return img_equalized;
def create_stream_cache(self, imgs, interval=1, types="", max_gb=6.0): # write image identifiers to file # imgRange = range(0, len(imgs), interval); # num_imgs = len(imgRange); image_id_fname = self.model_dir + "/image_list.txt" fd = open(image_id_fname, "w") print >> fd, len(imgs) # for i in imgRange: # print >>fd, "img_%05d"%i for img in imgs: fname, fextension = os.path.splitext(img) bname = os.path.basename(fname) print >> fd, bname fd.close() # write type identifiers into file type_id_fname = self.model_dir + "/type_names_list.txt" fd2 = open(type_id_fname, "w") print >>fd2, 4 print >>fd2, "aux0" print >>fd2, "aux1" print >>fd2, "aux2" print >>fd2, "aux3" fd2.close() # open the stream cache, this is a read-only cache batch.init_process("boxm2CreateStreamCacheProcess") batch.set_input_from_db(0, self.scene) batch.set_input_string(1, type_id_fname) batch.set_input_string(2, image_id_fname) batch.set_input_float(3, max_gb) batch.run_process() (cache_id, cache_type) = batch.commit_output(0) self.str_cache = dbvalue(cache_id, cache_type)
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 createScene(self, stepNum): bundleFile = os.path.abspath(self.config.NVMFileName) imgDir = os.path.abspath(self.config.SRCImageDirName) outDir = os.path.abspath(self.config.NVMOutputDirName) if False == os.path.isfile(bundleFile): log("Step %d - SceneCreation cannot begin because the NVM file %s is missing." % (stepNum, bundleFile)) log("Processing will not proceed.") return -stepNum if False == os.path.isdir(imgDir): log("Step %d - SceneCreation cannot beging because the image directory %s cannot be found." % (stepNum, imgDir)) log("Processing will not proceed.") return -stepNum log("Creating scene with bundleFile %s." % (bundleFile)) log("Output will be written to %s." % (outDir)) boxm2_batch.not_verbose() boxm2_batch.register_processes() boxm2_batch.register_datatypes() # class used for python/c++ pointers in database class dbvalue: def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string # run process boxm2_batch.init_process("boxm2BundleToSceneProcess") boxm2_batch.set_input_string(0, bundleFile) boxm2_batch.set_input_string(1, imgDir) boxm2_batch.set_input_string(2, self.config.NVMAppModel) boxm2_batch.set_input_string(3, self.config.NVMNobsModel) boxm2_batch.set_input_int(4, 8) boxm2_batch.set_input_string(5, outDir) boxm2_batch.run_process() (scene_id, scene_type) = boxm2_batch.commit_output(0) uscene = dbvalue(scene_id, scene_type) (scene_id, scene_type) = boxm2_batch.commit_output(1) rscene = dbvalue(scene_id, scene_type) return 0
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 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
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 img_sum(img, plane_index=0): boxm2_batch.init_process("vilImageSumProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.set_input_unsigned(1, plane_index) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) value = boxm2_batch.get_output_double(id) return value
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 render_expected_image_naa( self, camera, ni, nj, metadata, atmospheric_params): batch.init_process("boxm2OclRenderExpectedImageNAAProcess") batch.set_input_from_db(0, self.device) batch.set_input_from_db(1, self.scene) batch.set_input_from_db(2, self.opencl_cache) batch.set_input_from_db(3, camera) batch.set_input_unsigned(4, ni) batch.set_input_unsigned(5, nj) batch.set_input_from_db(6, metadata) batch.set_input_from_db(7, atmospheric_params) batch.run_process() (id, type) = batch.commit_output(0) exp_image = dbvalue(id, type) (id, type) = batch.commit_output(1) mask_image = dbvalue(id, type) return(exp_image, mask_image)
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 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 img_sum(img, plane_index=0): boxm2_batch.init_process("vilImageSumProcess") boxm2_batch.set_input_from_db(0,img) boxm2_batch.set_input_unsigned(1,plane_index) boxm2_batch.run_process() (id,type) = boxm2_batch.commit_output(0) value = boxm2_batch.get_output_double(id) return value
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 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
def render_expected_image_naa(self, camera, ni, nj, metadata, atmospheric_params): batch.init_process("boxm2OclRenderExpectedImageNAAProcess") batch.set_input_from_db(0, self.device) batch.set_input_from_db(1, self.scene) batch.set_input_from_db(2, self.opencl_cache) batch.set_input_from_db(3, camera) batch.set_input_unsigned(4, ni) batch.set_input_unsigned(5, nj) batch.set_input_from_db(6, metadata) batch.set_input_from_db(7, atmospheric_params) batch.run_process() (id, type) = batch.commit_output(0) exp_image = dbvalue(id, type) (id, type) = batch.commit_output(1) mask_image = dbvalue(id, type) return (exp_image, mask_image)
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 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 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 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 get_3d_point_from_index(scene, cache, block_index, index): # Warning, you probably shouldn't be doing this! batch.init_process("boxm2CppGet3dPointFromIndexProcess") batch.set_input_from_db(0, scene) batch.set_input_from_db(1, cache) batch.set_input_int(2, block_index[0]) batch.set_input_int(3, block_index[1]) batch.set_input_int(4, block_index[2]) batch.set_input_int(5, index) batch.run_process() (id, type) = batch.commit_output(0) x = batch.get_output_float(id) batch.remove_data(id) (id, type) = batch.commit_output(1) y = batch.get_output_float(id) batch.remove_data(id) (id, type) = batch.commit_output(2) z = batch.get_output_float(id) batch.remove_data(id) (id, type) = batch.commit_output(3) xs = batch.get_output_float(id) batch.remove_data(id) (id, type) = batch.commit_output(4) ys = batch.get_output_float(id) batch.remove_data(id) (id, type) = batch.commit_output(5) zs = batch.get_output_float(id) batch.remove_data(id) (id, type) = batch.commit_output(6) leaf = batch.get_output_int(id) batch.remove_data(id) return ((x, y, z), (xs, ys, zs), leaf)
def binary_img_op(img1, img2, operation="sum"): boxm2_batch.init_process("vilBinaryImageOpProcess") boxm2_batch.set_input_from_db(0, img1) boxm2_batch.set_input_from_db(1, img2) boxm2_batch.set_input_string(2, operation) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) out = dbvalue(id, type) return out
def mask_image_using_id(img, id_img, input_id): boxm2_batch.init_process("vilMaskImageUsingIDsProcess") boxm2_batch.set_input_from_db(0, img) boxm2_batch.set_input_from_db(1, id_img) boxm2_batch.set_input_unsigned(2, input_id) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) masked_img = dbvalue(id, type) return masked_img
def combine_planes(img_red, img_green, img_blue): boxm2_batch.init_process("vilCombinePlanesProcess") boxm2_batch.set_input_from_db(0, img_red) boxm2_batch.set_input_from_db(1, img_green) boxm2_batch.set_input_from_db(2, img_blue) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) img_out = dbvalue(id, type) return img_out
def combine_planes(img_red, img_green, img_blue): boxm2_batch.init_process("vilCombinePlanesProcess"); boxm2_batch.set_input_from_db(0, img_red); boxm2_batch.set_input_from_db(1, img_green); boxm2_batch.set_input_from_db(2, img_blue); boxm2_batch.run_process(); (id, type) = boxm2_batch.commit_output(0); img_out = dbvalue(id, type); return img_out;