Describe Leaf

Script to provide descriptive information on images of leaves (in the project format)

src.helpers.describe_leaf.get_embolism_percent(image)[source]

Returns the % of the image that are embolisms

Parameters

image (array) – np.array of a mask

Return type

int

Returns

percentage of embolisms

src.helpers.describe_leaf.get_unique_range(image)[source]

Gets the unique list of pixel intensities for an image

Parameters

image (array) – np.array of a mask

Return type

array

Returns

an array of unique pixel intensities

src.helpers.describe_leaf.get_unique_leaf_range(images)[source]

Gets the unique list of pixel intensities from a list of images

Parameters

images (List[array]) – np.array of a mask

Return type

array

Returns

an array of unique pixel intensities

src.helpers.describe_leaf.binarise_image(image, lower_bound_255=200, upper_bound_0=55)[source]

Converts all pixels intensities within range of (lower_bound_255; 255) to 255 and all pixels intensities between (0; upper_bound_0) to 0. The aim is to binarise the image but this depends on the correct choice of boundary parameters.

Parameters
  • image (array) – np.array of a mask

  • lower_bound_255 (int) – lower bound of the range of values to be casted to 255

  • upper_bound_0 (int) – upper bound of the range of values to be casted to 0

Return type

array

Returns

an np.array of a mask with only two pixel intensities: 0 and 255

src.helpers.describe_leaf.get_intersection(image, combined_image)[source]

Calculates the intersection between the current mask and all embolisms contained in previous masks

Parameters
  • image (array) – np.array of a mask

  • combined_image (array) – np.array of a combined mask

Return type

Tuple[int, array]

Returns

intersection as a % of the image size and an updated combined image