imshowtk.imshowtk module

A class to bring up a debugging window

class imshowtk.imshowtk.ImshowTk(in_use=True, subsample=1)[source]

Bases: object

Creates a window using TkInter, into which we can place an opencv image. Conceived as a zero dependency alternative to opencv’s imshow window, for when we want to use opencv-headless or avoid conflict with Qt.

imshow(frame)[source]

Shows the image

setup_window(frame)[source]

Do this after init as we need a frame of video to set the window size

imshowtk.imshowtk.bitmap_to_photo(bitmap, subsample=1)[source]

converts a 3 channel numpy array image into a tkinter photoImage suitable for putting into tk widget https://stackoverflow.com/questions/1581799/ how-to-draw-a-bitmap-real-quick-in-python-using-tk-only

Parameters:
  • bitmap – The bitmap image, taken from opencv as a 3 channel numpy array

  • subsample – You can optionally subsample the image which might be useful if you want it to run faster. A value of n will give an nxn speed up as we use 2 loops to convert the image.

imshowtk.imshowtk.rgb2hex(red, green, blue)[source]

converts an rgb code to hex