vuba.BaseGUI.run

BaseGUI.run()[source]

Launch the interface.

Examples

Note that you can access any variables from the class that you added/manipulated through the trackbars attribute. This contains a dict of the trackbars, with each key containing associated variables in a dataclass:

>>> import vuba
>>> import numpy as np
>>> import cv2
>>> img = np.random.randint(low=0, high=255, size=(500, 500), dtype=np.uint8)
>>> gui = vuba.BaseGUI('Binary threshold viewer')
>>> @gui.method
>>> def threshold(gui):
...     frame = img.copy()
...     thresh_val = gui['thresh_val']
...     _, thresh = cv2.threshold(frame, thresh_val, 255, cv2.THRESH_BINARY)
...     return thresh
>>> gui.trackbar('Threshold', id='thresh_val', min=0, max=255)(None)
>>> gui.run()
>>> name, min, max, method, last_value = gui.trackbars['thresh_val']

This can be useful for retrieving the ideal parameters for an image analysis method after adjusting them in an interface for example.

Return type

BaseGUI