Display
Display Stream
- class imutils.display.displaystream.DisplayStream(screen: bool = True, port: int = 8080)
- clear()
Removes the display content
- show(name, frame)
Displays an image on the display
- Args:
frame (array): Image bitmap
- stream(name: str, frame)
Sends image to the frame-streamer
- Args:
name (str): Stream identifier name frame (array): Current frame that needs to be enqueued
- waitForKey(delay: int = 0)
Blocks until a key is pressed
Screen Output
- class imutils.display.screenoutput.ScreenOutput
Concrete class that implements a multimedia output that requires a screen. For this purpose, the ScreenOutput class uses the OpenCV API to display windows, which is already based on GTK (or Qt, depending on how OpenCV is built)
- clear()
Closes all images and streams that are visible during the runtime
- show(name: str, frame)
Displays on screen the frame. Subsequent calls of this method results in a window refresh. It can be used to display motion video
- Args:
name (str): Title of the frame to show frame (array): Bitmap image
- stream(name: str, frame)
Sends a frame to screen. Subsequent calls of this method results in a video stream. For this concrete implementation of the ScreenOutput, a stream can be achieved by calling the show method
- Args:
name (str): Title of the frame to show frame (array): Bitmap image
- waitForKey(delay: int = 0)
Waits for a pressed key. Waits indefinitely when delay is <= 0, and it waits delay millseconds
- Args:
delay (int): Delay in milliseconds. 0 is the special value that means “forever”.
Web Output
- class imutils.display.weboutput.CameraHandler(request, client_address, server)
Handles HTTP requests from the clients. For this particular case, server will return an image stream (.mjpg) when a client sends a GET request
- do_GET()
Function called when the web browser generates a GET request
- image_queue = {}
- populate_files()
Creates an HTML list where each element corresponds to an image or video output
- Returns:
HTML formatted string with the list with elements
- put_image(image)
Enqueues a frame that will be shown on the HTTP server
- Args:
frame (array): Bitmap image
- stream_images(image)
Enqueues a frame in the video stream that will be shown on the HTTP server
- Args:
name (str): Title of the stream to show frame (array): Bitmap image
- stream_queue = {}
- class imutils.display.weboutput.HttpStreamOutput(address: str = '0.0.0.0', port: int = 8080)
Helper class that implements a HTTP server. It wraps methods around the CameraHandler static class to ease the interaction between the WebOutput and the static class
- DEFAULT_HOST_ADDRESS = '0.0.0.0'
- DEFAULT_PORT = 8080
- putImage(name, frame)
Sends a frame to the HTTP image display
- Args:
name (str): Title of the frame to show frame (array): Bitmap image
- startServer()
Starts serving
- stopServer()
Stops serving
- streamImage(name, frame)
Sends a frame to the HTTP video stream
- Args:
name (str): Title of the stream to show frame (array): Bitmap image
- class imutils.display.weboutput.ThreadedHTTPServer(server_address, RequestHandlerClass, bind_and_activate=True)
ThreadedHTTPServer integrates the Threading mixin, meaning that now the HTTP server can serve multiple clients, each one handled by a separated thread from the pool.
- class imutils.display.weboutput.WebOutput(port: int)
Concrete class that implements a media output for devices that doesn’t support visual screen output, but count with LAN connection. For this purpose, the WebOutput class uses an HTTP server that renders both, images and video stream using a fixed address and port.
- clear()
Remove all images and video stream entries on the webserver
- show(name: str, frame)
Displays on server the frame. This method creates a new list entry that can be accesed in the HTTP server. By clicking in this list entry, the image will be displayed in the web browser.
- Args:
name (str): Title of the frame to show frame (array): Bitmap image
- stream(name: str, frame)
Sends a frame to the web server video stream. This method creates a new list entry that can be accesed in the HTTP server. The name will serve as a reference to the video stream queue, and the frames will be enqueued to the video stream queue.
- Args:
name (str): Title of the stream to show frame (array): Bitmap image
- waitForKey(delay: int = 0)
Waits for a pressed key. Waits indefinitely when delay is = 0, and it waits delay millseconds
- Args:
delay (int): Delay in milliseconds. 0 is the special value that means “forever”.