def get_number_of_planes(img): bvxm_batch.init_process("vilGetNumberOfPlanesProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) n_planes = bvxm_batch.get_output_unsigned(id) return n_planes
def histogram_equalize(img): bvxm_batch.init_process("vilHistogramEqualizeProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) img_equalized = dbvalue(id, type) return img_equalized
def rgb_to_grey(img): bvxm_batch.init_process("vilRGBToGreyProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) outimg = dbvalue(id, type) return outimg
def fill_holes(img): bvxm_batch.init_process("vilFillHolesInRegionsProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) outimg = dbvalue(id, type) return outimg
def scene_local_box(scene): batch.init_process("bvxmSceneLocalBoxProcess") batch.set_input_from_db(0, scene) batch.run_process() (id, type) = batch.commit_output(0) lower_left_x = batch.get_output_double(id) batch.remove_data(id) (id, type) = batch.commit_output(1) lower_left_y = batch.get_output_double(id) batch.remove_data(id) (id, type) = batch.commit_output(2) upper_right_x = batch.get_output_double(id) batch.remove_data(id) (id, type) = batch.commit_output(3) upper_right_y = batch.get_output_double(id) batch.remove_data(id) (id, type) = batch.commit_output(4) voxel_size = batch.get_output_double(id) batch.remove_data(id) (id, type) = batch.commit_output(5) lower_left_z = batch.get_output_double(id) # min z batch.remove_data(id) (id, type) = batch.commit_output(6) upper_right_z = batch.get_output_double(id) # max z batch.remove_data(id) return lower_left_x, lower_left_y, upper_right_x, upper_right_y, voxel_size, lower_left_z, upper_right_z
def save_occupancy_raw(world, filename, app_model, scale=0): batch.init_process("bvxmSaveOccupancyRawProcess") batch.set_input_from_db(0, world) batch.set_input_string(1, filename) batch.set_input_unsigned(2, scale) batch.set_input_string(3, app_model) batch.run_process()
def fill_holes(img): bvxm_batch.init_process("vilFillHolesInRegionsProcess") bvxm_batch.set_input_from_db(0,img) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) outimg = dbvalue(id, type); return outimg
def model_dir(scene): batch.init_process("bvxmSceneModelDirProcess") batch.set_input_from_db(0, scene) batch.run_process() (id, type) = batch.commit_output(0) model_dir = batch.get_output_string(id) return model_dir
def get_number_of_planes(img): bvxm_batch.init_process("vilGetNumberOfPlanesProcess"); bvxm_batch.set_input_from_db(0, img); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); n_planes = bvxm_batch.get_output_unsigned(id) return n_planes;
def rgb_to_grey(img): bvxm_batch.init_process("vilRGBToGreyProcess"); bvxm_batch.set_input_from_db(0,img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) outimg = dbvalue(id, type); return outimg
def debayer(img): bvxm_batch.init_process("vilDebayerBGGRToRGBProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) outimg = dbvalue(id, type) return outimg
def histogram_equalize(img): bvxm_batch.init_process("vilHistogramEqualizeProcess"); bvxm_batch.set_input_from_db(0, img); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); img_equalized = dbvalue(id, type); return img_equalized;
def scale_and_offset_values(img, scale, offset): bvxm_batch.init_process("vilScaleAndOffsetValuesProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_float(1, scale) bvxm_batch.set_input_float(2, offset) bvxm_batch.run_process() return
def debayer(img): bvxm_batch.init_process("vilDebayerBGGRToRGBProcess") bvxm_batch.set_input_from_db(0,img); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); outimg = dbvalue(id,type); return outimg;
def scale_and_offset_values(img,scale,offset): bvxm_batch.init_process("vilScaleAndOffsetValuesProcess") bvxm_batch.set_input_from_db(0,img) bvxm_batch.set_input_float(1,scale) bvxm_batch.set_input_float(2,offset) bvxm_batch.run_process() return
def image_mean(img): bvxm_batch.init_process("vilImageMeanProcess") bvxm_batch.set_input_from_db(0,img) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) mean_val = bvxm_batch.get_output_float(id) bvxm_batch.remove_data(id) return mean_val
def median_filter(img, operator_half_size): bvxm_batch.init_process("vilMedianFilterProcess") bvxm_batch.set_input_from_db(0,img) bvxm_batch.set_input_int(1, operator_half_size) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) img_out = dbvalue(id,type) return img_out
def create_ortho_camera(world, is_utm=False): batch.init_process("bvxmCreateOrthoCameraProcess") batch.set_input_from_db(0, world) batch.set_input_bool(1, is_utm) batch.run_process() (id, type) = batch.commit_output(0) ortho_cam = dbvalue(id, type) return ortho_cam
def bvxm_detect_edges(cropped_image, edge_params_xml): batch.init_process("bvxmDetectEdgesProcess") batch.set_input_from_db(0, cropped_image) batch.set_params_process(edge_params_xml) batch.run_process() (cropped_edge_image_id, cropped_edge_image) = batch.commit_output(0) cropped_edge_image = dbvalue(cropped_edge_image_id, cropped_edge_image) return cropped_edge_image
def convert_image(img, type="byte"): bvxm_batch.init_process("vilConvertPixelTypeProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_string(1, type) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) cimg = dbvalue(id, type) return cimg
def detect_shadow_rgb(img,threshold) : bvxm_batch.init_process("vilShadowDetectionProcess"); bvxm_batch.set_input_from_db(0,img) bvxm_batch.set_input_float(1, threshold); bvxm_batch.run_process(); (o_id,o_type) = bvxm_batch.commit_output(0); region_img = dbvalue(o_id,o_type); return region_img;
def img_sum(img, plane_index=0): bvxm_batch.init_process("vilImageSumProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_unsigned(1, plane_index) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) value = bvxm_batch.get_output_double(id) return value
def image_entropy(img, block_size = 5): bvxm_batch.init_process("vilBlockEntropyProcess"); bvxm_batch.set_input_from_db(0, img); bvxm_batch.set_input_unsigned(1, block_size); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); entropy_img = dbvalue(id, type); return entropy_img;
def detect_shadow_rgb(img, threshold): bvxm_batch.init_process("vilShadowDetectionProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_float(1, threshold) bvxm_batch.run_process() (o_id, o_type) = bvxm_batch.commit_output(0) region_img = dbvalue(o_id, o_type) return region_img
def get_plane(img, plane_id): bvxm_batch.init_process("vilGetPlaneProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_unsigned(1, plane_id) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) img_plane = dbvalue(id, type) return img_plane
def image_mean(img): bvxm_batch.init_process("vilImageMeanProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) mean_val = bvxm_batch.get_output_float(id) bvxm_batch.remove_data(id) return mean_val
def img_sum(img, plane_index=0): bvxm_batch.init_process("vilImageSumProcess") bvxm_batch.set_input_from_db(0,img) bvxm_batch.set_input_unsigned(1,plane_index) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) value = bvxm_batch.get_output_double(id) return value
def median_filter(img, operator_half_size): bvxm_batch.init_process("vilMedianFilterProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_int(1, operator_half_size) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) img_out = dbvalue(id, type) return img_out
def combine_eo_ir(eo_img,ir_img): bvxm_batch.init_process("vilEOIRCombineProcess") bvxm_batch.set_input_from_db(0,eo_img) bvxm_batch.set_input_from_db(1,ir_img) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) img_out = dbvalue(id,type) return img_out
def combine_eo_ir(eo_img, ir_img): bvxm_batch.init_process("vilEOIRCombineProcess") bvxm_batch.set_input_from_db(0, eo_img) bvxm_batch.set_input_from_db(1, ir_img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) img_out = dbvalue(id, type) return img_out
def convert_image(img, type="byte") : bvxm_batch.init_process("vilConvertPixelTypeProcess"); bvxm_batch.set_input_from_db(0, img); bvxm_batch.set_input_string(1, type); bvxm_batch.run_process(); (id,type) = bvxm_batch.commit_output(0); cimg = dbvalue(id,type); return cimg;
def get_plane(img, plane_id): bvxm_batch.init_process("vilGetPlaneProcess"); bvxm_batch.set_input_from_db(0, img); bvxm_batch.set_input_unsigned(1, plane_id); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); img_plane = dbvalue(id, type); return img_plane;
def image_size(img): bvxm_batch.init_process('vilImageSizeProcess') bvxm_batch.set_input_from_db(0,img) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) ni = bvxm_batch.get_output_unsigned(id) (id,type) = bvxm_batch.commit_output(1) nj = bvxm_batch.get_output_unsigned(id) return ni,nj
def bvxm_truncate_image(img, min_value, max_value): bvxm_batch.init_process("vilTruncateImageProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_float(1, min_value) bvxm_batch.set_input_float(2, max_value) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) img_out = dbvalue(id, type) return img_out
def threshold_image(img, value, threshold_above=True): bvxm_batch.init_process("vilThresholdImageProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_float(1, value) bvxm_batch.set_input_bool(2, threshold_above) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) mask = dbvalue(id, type) return mask
def gradient_angle(Ix, Iy): bvxm_batch.init_process('vilGradientAngleProcess') bvxm_batch.set_input_from_db(0, Ix) bvxm_batch.set_input_from_db(1, Iy) bvxm_batch.run_process() #x image (id, type) = bvxm_batch.commit_output(0) angleImg = dbvalue(id, type) return angleImg
def threshold_image(img, value, threshold_above=True): bvxm_batch.init_process("vilThresholdImageProcess") bvxm_batch.set_input_from_db(0,img) bvxm_batch.set_input_float(1,value) bvxm_batch.set_input_bool(2,threshold_above) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) mask = dbvalue(id,type) return mask
def pixel(img, point): bvxm_batch.init_process("vilPixelValueProcess") bvxm_batch.set_input_from_db(0,img) bvxm_batch.set_input_int(1, int(point[0])) bvxm_batch.set_input_int(2, int(point[1])) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) val = bvxm_batch.get_output_float(id) return val
def next_frame(rawStream) : bvxm_batch.init_process("bilReadFrameProcess") bvxm_batch.set_input_from_db(0,rawStream); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); img = dbvalue(id,type); #(id, type) = bvxm_batch.commit_output(1); #time = bvxm_batch.get_output_unsigned(id); return img
def image_range(img): bvxm_batch.init_process('vilImageRangeProcess') bvxm_batch.set_input_from_db(0,img) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) minVal = bvxm_batch.get_output_float(id) (id,type) = bvxm_batch.commit_output(1) maxVal = bvxm_batch.get_output_float(id) return minVal, maxVal
def gradient_angle(Ix, Iy) : bvxm_batch.init_process('vilGradientAngleProcess') bvxm_batch.set_input_from_db(0,Ix) bvxm_batch.set_input_from_db(1,Iy) bvxm_batch.run_process() #x image (id,type) = bvxm_batch.commit_output(0) angleImg = dbvalue(id,type) return angleImg
def mask_image_using_id(img, id_img, input_id): bvxm_batch.init_process("vilMaskImageUsingIDsProcess"); bvxm_batch.set_input_from_db(0, img); bvxm_batch.set_input_from_db(1, id_img); bvxm_batch.set_input_unsigned(2, input_id); bvxm_batch.run_process(); (id, type) = bvxm_batch.commit_output(0); masked_img = dbvalue(id, type); return masked_img;
def undistort_image(img, param_file, iters): bvxm_batch.init_process("vilUndistortImageProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_string(1, param_file) bvxm_batch.set_input_int(2, iters) bvxm_batch.run_process() (o_id, o_type) = bvxm_batch.commit_output(0) out_img = dbvalue(o_id, o_type) return out_img
def binary_img_op(img1, img2, operation="sum"): bvxm_batch.init_process("vilBinaryImageOpProcess") bvxm_batch.set_input_from_db(0, img1) bvxm_batch.set_input_from_db(1, img2) bvxm_batch.set_input_string(2, operation) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) out = dbvalue(id, type) return out
def image_entropy(img, block_size=5, bins=16): bvxm_batch.init_process("vilBlockEntropyProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_unsigned(1, block_size) bvxm_batch.set_input_unsigned(2, bins) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) entropy_img = dbvalue(id, type) return entropy_img
def bvxm_truncate_image(img,min_value,max_value): bvxm_batch.init_process("vilTruncateImageProcess") bvxm_batch.set_input_from_db(0,img) bvxm_batch.set_input_float(1,min_value) bvxm_batch.set_input_float(2,max_value) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) img_out = dbvalue(id,type) return img_out
def pixel(img, point): bvxm_batch.init_process("vilPixelValueProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_int(1, int(point[0])) bvxm_batch.set_input_int(2, int(point[1])) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) val = bvxm_batch.get_output_float(id) return val
def binary_img_op(img1, img2, operation="sum"): bvxm_batch.init_process("vilBinaryImageOpProcess") bvxm_batch.set_input_from_db(0,img1) bvxm_batch.set_input_from_db(1,img2) bvxm_batch.set_input_string(2,operation) bvxm_batch.run_process() (id,type) = bvxm_batch.commit_output(0) out = dbvalue(id, type); return out
def mask_image_using_id(img, id_img, input_id): bvxm_batch.init_process("vilMaskImageUsingIDsProcess") bvxm_batch.set_input_from_db(0, img) bvxm_batch.set_input_from_db(1, id_img) bvxm_batch.set_input_unsigned(2, input_id) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) masked_img = dbvalue(id, type) return masked_img
def image_size(img): bvxm_batch.init_process('vilImageSizeProcess') bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) ni = bvxm_batch.get_output_unsigned(id) (id, type) = bvxm_batch.commit_output(1) nj = bvxm_batch.get_output_unsigned(id) return ni, nj
def image_range(img): bvxm_batch.init_process('vilImageRangeProcess') bvxm_batch.set_input_from_db(0, img) bvxm_batch.run_process() (id, type) = bvxm_batch.commit_output(0) minVal = bvxm_batch.get_output_float(id) (id, type) = bvxm_batch.commit_output(1) maxVal = bvxm_batch.get_output_float(id) return minVal, maxVal
def undistort_image(img, param_file, iters) : bvxm_batch.init_process("vilUndistortImageProcess"); bvxm_batch.set_input_from_db(0,img) bvxm_batch.set_input_string(1, param_file); bvxm_batch.set_input_int(2, iters); bvxm_batch.run_process(); (o_id,o_type) = bvxm_batch.commit_output(0); out_img = dbvalue(o_id,o_type); return out_img;