Solution for the window - not responding problem with cv2.imshow()
Project description
Solution for the "window - not responding" problem with cv2.imshow()
pip install a_cv2_imshow_thread
Usage:
import glob
import os
from a_cv2_imshow_thread import add_imshow_thread_to_cv2 #if you saved this file as z_imshow.py
add_imshow_thread_to_cv2() #monkey patching
import cv2
image_background_folder=r'C:\yolovtest\backgroundimages'
pics=[cv2.imread(x) for x in glob.glob(f'{image_background_folder}{os.sep}*.png')]
cv2.imshow_thread( image=pics[0], window_name='screen1',sleep_time=None, quit_key='q') #single picture
cv2.imshow_thread( image=pics, window_name='screen1',sleep_time=.2, quit_key='e') #sequence of pics like a video clip
Parameters:
image: Union[list, np.ndarray]
You can pass a list of images or a single image
window_name: str
Window title
(default = "")
sleep_time: Union[float, int, None] = None
Useful if you have an image sequence.
If you pass None, you will have to press the quit_key to continue
(default = None)
quit_key: str = "q"
key to close the window
Returns:
None
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file a_cv2_imshow_thread-0.1.tar.gz
.
File metadata
- Download URL: a_cv2_imshow_thread-0.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d42aac9342177b6a2ab9f989bab5342d55f1bab0c51c09b344d7bebb251ebfa2 |
|
MD5 | 34f31fd56410e6202b40a95b3752ce0c |
|
BLAKE2b-256 | 24ff5bfcdf416b2a5671f874b40011ab3039bca007bf2364274bef5c449e4f58 |
File details
Details for the file a_cv2_imshow_thread-0.1-py3-none-any.whl
.
File metadata
- Download URL: a_cv2_imshow_thread-0.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ee40677e6fcd6ba8880d5715e8cf16ee86fb47ffd6772bf5f144c6347857ab0 |
|
MD5 | 64b657fbbe23acdb0d0b40dd41a16244 |
|
BLAKE2b-256 | e21c72b17a6fc686c50b6eedc86fec9311dd651498e3cd41f4774d628b1a28ce |