class cscore.imagewriter.ImageWriter(*, location_root='/media/sda1/camera', capture_period=0.5, image_format='jpg')[source]

Creates a thread that periodically writes images to a specified directory. Useful for looking at images after a match has completed.

The default location is /media/sda1/camera. The folder /media/sda1 is the default location that USB drives inserted into the RoboRIO are mounted at. The USB drive must have a directory in it named camera.


It is recommended to only write images when something useful (such as targeting) is happening, otherwise you’ll end up with a lot of images written to disk that you probably aren’t interested in.

Intended usage is:

self.image_writer = ImageWriter()


while True:

    img = ..

    if self.logging_enabled:
  • location_root – Directory to write images to. A subdirectory with the current time will be created, and timestamped images will be written to the subdirectory.

  • capture_period – How often to write images to disk

  • image_format – File extension of files to write


Call this function when you wish to write the image to disk. Not every image is written to disk. Makes a copy of the image.


img – A numpy array representing an OpenCV image