wormpose.images.scoring.image_scoring

Functions that deal with the image similarity

wormpose.images.scoring.image_scoring.calculate_similarity(source_image: numpy.ndarray, template_image: numpy.ndarray)[source]

Calculate how similar a template image is to a source image

Parameters
  • source_image – image to be compared to

  • template_image – image to compare to the source_image

Returns

similarity score and position of the best match

wormpose.images.scoring.image_scoring.fit_bounding_box_to_worm(worm_image: numpy.ndarray, background_color: int, padding: int = 2) Tuple[slice, slice][source]

Calculates the bounding box of a worm in a real processed or a synthetic image: it should contain a worm object in the center and have a uniform background color The bounding box will be a little bigger than the worm (padding param)

Parameters
  • worm_image – image containing a worm

  • background_color – the color of the background (should be uniform)

  • padding – extra padding that will be added around the worm bounding box

Returns

coordinates (Numpy slice) of the bounding box of the worm