ImageProcessing.identify_subpixel_limbs

giant.image_processing:

ImageProcessing.identify_subpixel_limbs(image, illum_dir, num_objs=1)[source]

This method identifies illuminated limbs in an image to sub-pixel accuracy.

The input to this method is the image to have the limbs extracted from, the illumination direction in the image, and the number of objects that limbs are to be extracted from in the image. The output is a list of arrays or subpixel limb points with each element of the list being a 2d array of the limb points for the ith object. The limb arrays are 2xn where n is the number of limb points and the first row corresponds to the x locations of the limb points in the image and the second row corresponds to the y locations of the limb points in the image.

This method works by first thresholding the image to extract the foreground objects from the background using the otsu() function, and then identifying complete objects using connected components. For each connected object up to num_objs objects, the limb points are extracted by scanning along the illum_dir vector to the first edge pixel encountered. Then the edge level pixels are refined to subpixel accuracy using one of the subpixel edge detection routines.

Parameters:
  • image (ndarray) – The image to have the limbs extracted from

  • illum_dir (Sequence | ndarray) – The direction of the incoming sunlight in the image

  • num_objs (int) – The number of objects to extract limbs from

Returns:

A list of 2D arrays containing the xy subpixel limb points for each object in the image

Return type:

List[ndarray]