wormpose.images.synthetic.synthetic_dataset

Module responsible for drawing the synthetic worm image

class wormpose.images.synthetic.synthetic_dataset.SyntheticDataset(frame_preprocessing: wormpose.dataset.base_dataset.BaseFramePreprocessing, enable_random_augmentations: bool, output_image_shape)[source]

Class responsible for generating synthetic images

Parameters
  • frame_preprocessing – the FramePreprocessing object containing the image preprocessing logic

  • enable_random_augmentations – Adds augmentation to the syntthetic images if set to True: translation, scale, blur

  • output_image_shape – Desired size of the synthetic images

generate(theta: numpy.ndarray, template_frame: numpy.ndarray, template_skeleton: numpy.ndarray, template_measurements: numpy.ndarray, out_image: numpy.ndarray) Tuple[int, numpy.ndarray][source]

Generates a synthetic image

Parameters
  • theta – desired posture (angles)

  • template_frame – reference image

  • template_skeleton – skeleton of the reference image

  • template_measurements – measurements of the reference image (worm width and length)

  • out_image – canvas to draw the synthetic image

Returns

background color and the synthetic worm skeleton coordinates