Viewer

class imagepypelines.Viewer(window_name=None, size=None, FFT=False, normalize=False, interpolation=0, enable_frame_counter=False)[source]

Bases: object

Class to simplify displaying images using opencv windows. Also has functionality to resize images automatically if desired

On some systems (or opencv builds), openCV requires a waitkey to be called before displaying the image. This functionality is built in the view function with the argument ‘force_waitkey’

Parameters:
  • window_name (str) – the name of the window
  • size (2 element tuple, None) – (height, width) to resize image to
  • interpolation (cv2 constant) – cv2 interpolation flag for resizing
  • enable_frame_counter (bool) – whether or not to enable frame counter
window_name

name of the cv2 window

size

size the images are being resized to

interpolation

type of interpolation being usef for resizing

enable_frame_counter[source]

whether or not the frame counter is enabled

frame_counter

index of the frame currently displayed

Methods Summary

close() closes the image viewing window
disable_frame_counter() disable the frame counter
enable_frame_counter() enable the frame counter
open() opens the image viewer, automatically called in __init__
view(frame[, force_waitkey]) displays the frame passed into it, reopens itself if it

Methods Documentation

close()[source]

closes the image viewing window

Parameters:None
Returns:None
disable_frame_counter()[source]

disable the frame counter

enable_frame_counter()[source]

enable the frame counter

open()[source]

opens the image viewer, automatically called in __init__

Parameters:None
Returns:None
view(frame, force_waitkey=True)[source]

displays the frame passed into it, reopens itself if it

Parameters:frame (np.ndarray) – image to be displayed
Returns:if greater than zero, then call a waitkey for the duration of the time given. this is required on some systems to display the image properly.
Return type:force_waitkey (int) = 1