ImageProcessing.refine_edges_pae

giant.image_processing:

ImageProcessing.refine_edges_pae(image, pixel_edges=None, horizontal_mask=None, vertical_mask=None, horizontal_gradient=None, vertical_gradient=None)[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 function, you can either input just an image, in which case the pixel level edges will be detected using the identify_pixel_edges() method, or you can also specify the pixel level edges, the mask specifying which edges are horizontal, the mask specifying which edges are vertical, and the horizontal and vertical gradient arrays for the image. 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) – The image the edges are being extracted from

  • pixel_edges (ndarray | None) – The pixel level edges from the image as a 2D array with x in the first row and y in the second row

  • horizontal_mask (ndarray | None) – A binary mask which selects the horizontal edges from the pixel_edges parameter

  • vertical_mask (ndarray | None) – A binary mask which selects the vertical edges from the pixel_edges parameter

  • horizontal_gradient (ndarray | None) – The horizontal image gradient

  • vertical_gradient (ndarray | None) – The vertical image gradient

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