|
RoboCarts
|
Functions | |
| def | flip (img) |
| def | rotate (img, count) |
| def | resize (img, scale) |
| def | frame_adjustment (img, scale_resize, num_rotate, num_flip) |
| def | cut_image (img, left_corn, right_corn) |
| def | morph_open (binary_img, kernel_size=15) |
| def | morph_close (binary_img, kernel_size=15) |
| def | morph_close_open (binary_img, kernel_size=25) |
| def | get_canny (img, lower=50, upper=200) |
| def | draw_edges (edges, img) |
| def | turn_to_hsv (img, blur_kernel_size=7) |
| def | mask_img (img, mask) |
| def | convex_hull (cnt) |
| def | find_contours (mask, ret_mode="tree", rgb_input=False) |
| def | draw_contours (contours, frame, centre=False) |
| def | diff_rgb (img1, img2) |
| def | diff_hsv (img1, img2) |
| def | binary_threshold (diff, t_value) |
| def | make_histogram_bgr (img) |
| def | adjust_cropped_rectangles_to_orig_img (rectangles, original_rectangle) |
@file frame_processing.py @brief This file contains functions for various operations with individual frames
| def frame_processing.adjust_cropped_rectangles_to_orig_img | ( | rectangles, | |
| original_rectangle | |||
| ) |
Adjusts the positions of cut out image parts relatively to the original image :param rectangles: cut out rectangles :param original_rectangle: original rectangular image :return: adjusted rectangles
| def frame_processing.binary_threshold | ( | diff, | |
| t_value | |||
| ) |
Function for binary thresholding of a grayscale image :param diff: greyscale source image :param t_value: threshold value :return: thresholded binary image
| def frame_processing.convex_hull | ( | cnt | ) |
Makes a convex hull from a contour :param cnt: original contour :return: convex hull
| def frame_processing.cut_image | ( | img, | |
| left_corn, | |||
| right_corn | |||
| ) |
Crops a rectangle from an image :param img: source image :param left_corn: left corner of the cropping rectangle :param right_corn: right corner of the cropping rectangle :return: cropped rectangle
| def frame_processing.diff_hsv | ( | img1, | |
| img2 | |||
| ) |
Makes an image difference of two HSV images :param img1: HSV image 1 :param img2: HSV image 2 :return: grayscale image difference
| def frame_processing.diff_rgb | ( | img1, | |
| img2 | |||
| ) |
Makes an image difference of two RGB images :param img1: RGB image 1 :param img2: RGB image 2 :return: grayscale image difference
| def frame_processing.draw_contours | ( | contours, | |
| frame, | |||
centre = False |
|||
| ) |
Draws contours on an image :param contours: contours :param frame: source image :param centre: option to draw contour centroids :return: -
| def frame_processing.draw_edges | ( | edges, | |
| img | |||
| ) |
Draws edges to an image :param edges: image edges :param img: image on which the edges will be displayed on :return: image with contours
| def frame_processing.find_contours | ( | mask, | |
ret_mode = "tree", |
|||
rgb_input = False |
|||
| ) |
Finds contours in a binary image with a specific mode
:param mask: source binary image
:param ret_mode: mode for the contours output ("external", "list", "tree")
:param rgb_input: flag for binary/rgb source image
:return: list of contours
| def frame_processing.flip | ( | img | ) |
Flips an image orientation alongside the horizontal axes :param img: source image :return: flipped img
| def frame_processing.frame_adjustment | ( | img, | |
| scale_resize, | |||
| num_rotate, | |||
| num_flip | |||
| ) |
Function for resizing and rotating frames :param num_flip: how many times to flip :param num_rotate: how many times to rotate :param scale_resize: resizing scale :param img: source image :return: adjusted frame
| def frame_processing.get_canny | ( | img, | |
lower = 50, |
|||
upper = 200 |
|||
| ) |
Function for finding edges in a grayscale image using the Canny detection algorithm :param img: source image :param lower: lower threshold value for Canny algorithm :param upper: upper threshold value for Canny algorithm :return: binary image with detected edges
| def frame_processing.make_histogram_bgr | ( | img | ) |
Makes a normalized histogram from an RGB image :param img: source RGB image :return: histogram
| def frame_processing.mask_img | ( | img, | |
| mask | |||
| ) |
Masks regions on an image based on a binary mask :param img: source image :param mask: binary mask :return: masked image
| def frame_processing.morph_close | ( | binary_img, | |
kernel_size = 15 |
|||
| ) |
Function for morphological closing of a binary image with ellipsoidal structuring element/kernel :param binary_img: source binary image :param kernel_size: kernel size :return: morphed img
| def frame_processing.morph_close_open | ( | binary_img, | |
kernel_size = 25 |
|||
| ) |
Function for morphological opening and closing of a binary image with ellipsoidal structuring element/kernel :param binary_img: source binary image :param kernel_size: kernel size :return: morphed img
| def frame_processing.morph_open | ( | binary_img, | |
kernel_size = 15 |
|||
| ) |
Function for morphological opening of a binary image with ellipsoidal structuring element/kernel :param binary_img: source binary image :param kernel_size: kernel size :return: morphed image
| def frame_processing.resize | ( | img, | |
| scale | |||
| ) |
Resizes an image's width and height based on the scale :param img: source image :param scale: scale in range 0.0 - inf :return: resized img
| def frame_processing.rotate | ( | img, | |
| count | |||
| ) |
Rotates an image for 90° to the right (clockwise) :param count: how many time should be the source image rotated :param img: source image :return: rotated img
| def frame_processing.turn_to_hsv | ( | img, | |
blur_kernel_size = 7 |
|||
| ) |
Auxiliary function to blur and turn an RGB image to an HSV image :param blur_kernel_size: size of the kernel for blurring :param img: source RGB image :return: HSV image
1.8.13