Welcome to MATLAB2Py Image Analysis documentation!

MATLAB2Py Image Analysis is a Python library to support some MATLAB functions for Image Analysis in Python.

Function implementation is based on MATLAB Image processing techniques for image analysis documentation.

Note

This project is still in progress.

Image Display

imshow(I, grayscale_filter=None, title=None, figsize=None, cmap='gray', display_grid=False, gridcolor='w', gridwidth=2, linestyle='-')

Display image

Parameters
  • I – image

  • grayscale_filter – grayscale image display range as [low, high]

  • title – title of the figure

  • cmap – cmap of display

  • display_grid – set to True to draw a pixel grid on top of the image

Returns

None

plot_images(images, figsize=(10, 5), cmap='gray', display_grid=False, gridcolor='w', gridwidth=2, linestyle='-')

Plot several images (max 10)

Parameters
  • images – a list of images as [[<image>, <title>]]

  • figsize – the size of final figure

  • cmap – cmap of display

  • display_grid – set to True to draw a pixel grid on top of the image

Returns

None

Image Exploration

imhist(I, n: int = 20, figsize=(15, 5), filename: str = 'Image')

Return and display the histogram of image data

Parameters
  • I – grayscale image

  • n (int) – number of bins, defaults to 20

  • figsize – figsize of figure

  • filename (str) – name of given image, to insert in title

Returns

histogram counts, and bin locations

Image Filtering

fspecial(type: str, hsize: int = 3, sigma: float = 1.0)

Return a predefined 2D filter

Parameters
  • type (str) – type of filter (gaussian, prewitt, sobel)

  • hsize (int, optional) – size of filter, defaults to 3

  • sigma (float, optional) – standard deviation for Gaussian filter, defaults to 1.0

Returns

a 2D filter