QuadTree Decomposition analysis

This file contains class and functions to perform a Quadratic Tree decomposition of an image and to visually inspect it.

Created on Mon Apr 16 11:49:45 2018

@author: giulio

class quadTreeDecomposition.quadTree(img, minStd, minSize)

This class is used to perfrom a QuadTree decomposition of an image.

During initialization, QuadTree decomposition is done and result are store in self.blocks as a list containing [x,y,height, width,Std].

To visualize the results, use plot().

plot(edgecolor='red', facecolor='none', linewidth=1)

This function is used to generate a graphical representation of the QuadTree decomposition.

Parameters:
  • edgecolor (string) – color of the rectangles, default is red
  • facecolor (string) – color used for rectangles fills. Default is none.
  • linewidth – width in px of the rectangles’ borders. Default is 1.
Returns:

plot with image and leaves of the quadTree Decomposition

quadTreeDecomposition(img, x, y, minStd, minSize)

This function evaluate the mean and std of an image, and decides Whether to perform or not other 2 splits of the leave.

Parameters:
  • img (numpy.ndarray) – img to analyze
  • x (int) – x offset of the leaves to analyze
  • Y (int) – Y offset of the leaves to analyze
MinStd:

Std threshold for subsequent splitting

MinSize:

Size threshold for subsequent splitting, in pixel