concepts.gui.opencv.simple_text_visualizer.CV2SimpleTextVisualizer#
- class CV2SimpleTextVisualizer[source]#
Bases:
object
A simple visualizer for text. The class should be initialized with a callback function, which takes the image and the mouse position as input, and returns the text to be displayed. The visualizer will display the image and the text.
Example
def callback(image, x, y): return f'Pixel value: {image[y, x]} (x={x}, y={y})' visualizer = SimpleTextVisualizer(callback) visualizer.run(image)
Methods
on_mouse_event
(event, x, y, flags, param)run
(image)Attributes
- __init__(callback, title=None, font=cv2.FONT_HERSHEY_SIMPLEX, font_scale=1, font_thickness=2)[source]#
Initialize the visualizer.
- __new__(**kwargs)#