PAESubpixelEdgeDetector

class giant.image_processing.edge_detection.PAESubpixelEdgeDetector(options)[source]

This class can be used to identify and refine to the subpixel location of edges in an image using the partial area effect method.

Edges are defined as places in the image where the illumination values abruptly transition from light to dark or dark to light. The algorithms in this method are based off of the Partial Area Effect as discussed in http://www.sciencedirect.com/science/article/pii/S0262885612001850

First edges are detected at the pixel level by using a gradient based edge detection method. The edges are then refined to subpixel accuracy using the PAE. Tests have shown that the PAE achieves accuracy better than 0.1 pixels in most cases.

There are three tuning parameters for the PAE technique. The first tuning parameter is the order, which specifies whether a linear or quadratic fit is used to refine the edge location. It should have a value of 1 or 2. The second and third are the a01 and :att:`.a11` attributes. These specify the upper middle and upper right coeficients of the expected 3x3 Gaussian PSF that described how edges are blurred in the image.

Parameters:
  • options_type – The type of the UserOptions to use

  • options (PAESubpixelEdgeDetectorOptions | None) – An optional oinstance of options_type preconfigured.

refine_edges(image, edges)[source]

This method refines pixel level edges to subpixel level using the PAE method.

The PAE method is explained at https://www.sciencedirect.com/science/article/pii/S0262885612001850 and is not discussed in detail here. In brief, a linear or parabolic function is fit to the edge data based off of the intensity data in the pixels surrounding the edge locations.

To use this method, you must input the image, as well as a 2xn array of [[x], [y]] edges to be refined.

The edges are refined and returned as a 2D array with the x locations in the first row and the y locations in the second row.

Parameters:
  • image (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – The image the edges are being extracted from

  • edges (ndarray[tuple[Any, ...], dtype[int64]]) – The pixel level edges from the image as a 2D array with x in the first row and y in the second row

Returns:

The subpixel edge locations as a 2d array with the x values in the first row and the y values in the second row (col [x], row [y])

Return type:

ndarray[tuple[Any, …], dtype[float64]]

identify_edges(image)[source]

This method identifies pixel level edges in the image and then refines them to the subpixel locations using the PAE method.

The pixel edges are detected using the PixelEdgeDetector. They are then refined using refine_edges().

Parameters:

image (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – The image to detect the edges in.

Returns:

The subpixel edges as a 2xn array with x (column) components in the first axis and y (row) components in the second axis

Return type:

ndarray[tuple[Any, …], dtype[float64]]

Methods

identify_edges

This method identifies pixel level edges in the image and then refines them to the subpixel locations using the PAE method.

refine_edges

This method refines pixel level edges to subpixel level using the PAE method.

Inherited Attributes

  • horizontal_mask

  • vertical_mask

  • horizontal_gradient

  • vertical_gradient

  • gradient_magnitude