pyautocv package

Submodules

pyautocv.segmentation module

class pyautocv.segmentation.Segmentation(directory=None, image_suffix='png', color_mode='rgb')[source]

Bases: object

detect_edges(operator='sobel_vertical', kernel_size=3, optional_mask=None, **kwargs)[source]
Parameters
  • optional_mask – See skimage.filters.scharr_v for details.

  • kernel_size – int size to use for edge detection kernels

  • operator – One of sobel_vertical, sobel_horizontal,prewitt_horizontal,prewitt_vertical or laplace.

Returns

Detected edges

read_images(other_directory=None)[source]
Parameters

other_directory – Use if images exist in sub-folders or another folder. Only for jpg and png suffixes.

Returns

Returns an n-D array of images.

smooth(mask='box', kernel_shape=(5, 5), **kwargs)[source]
Parameters
  • mask – A low pass filter method to use for noise reduction

  • kernel_shape – A tuple specifying the shape of the kernel. Defaults to (3, 3)

Returns

Images convolved with a low pass filter to reduce noise

threshold_images(threshold_method='binary', use_threshold=127, use_max=255)[source]
Parameters
  • threshold_method – Threshold method to use.

  • use_threshold – Threshold value

  • use_max – Maximum value of threshold

Returns

Thresholded images

pyautocv.segmentation.gray_images(images)[source]
Parameters

images – A list of color images that should be grayed/greyed.

Returns

Returns grayed images. Currently supports only blue-green-red to gray conversion

pyautocv.segmentation.plot_hist(input_image=None, lim=None, color_mode='gray')[source]
Parameters
  • input_image – An image representation(array) whose histogram is required.

  • lim – A list to define the range of the x-axis, defaults to [0, 256]

  • color_mode – One of gray or rgb. This determines the number of plots shown.

Returns

A histogram plot

pyautocv.segmentation.reshape_images(image_list=None)[source]
Parameters

image_list – A list of images to reshape for plotting

Returns

Images that can be plotted with show_images

pyautocv.segmentation.resize_images(image_list=None, target_size=None)[source]
Parameters
  • image_list – A list of images or image that needs to be resized

  • target_size – New target image size

Returns

Image or list of images that have been resized.

pyautocv.segmentation.show_images(original_images=None, processed_images=None, cmap='gray', number=None, figure_size=(20, 20), custom_titles=None)[source]
Parameters
  • custom_titles – A list of length 2 for titles to use. Defaults to [‘original’,’processed’]

  • figure_size – Size of the plot shown. Defaults to (20,20)

  • original_images – Original Images from read_images()

  • processed_images – Images that have been converted eg from detect_edges()

  • cmap – Color cmap from matplotlib. Defaults to gray

  • number – optional Number of images to show

Returns

A matplotlib plot of images

pyautocv.segmentation.stack_images(list_one=None, list_two=None, direction='horizontal')[source]
Parameters
  • list_one – List containing image arrays to stack together

  • list_two – Another list of image arrays

  • direction – Stacking direction. One of horizontal and vertical,defaults to horizontal

Returns

Returns a list of images stacked together as requested.

pyautocv.version module

Module contents

(Semi) Automated Image Processing