Skip to main content

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 

    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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a_cv2_imshow_thread-0.11.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

a_cv2_imshow_thread-0.11-py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page