opencv / opencv-python

Automated CI toolchain to produce precompiled opencv-python, opencv-python-headless, opencv-contrib-python and opencv-contrib-python-headless packages.
https://pypi.org/project/opencv-python/
MIT License
4.54k stars 850 forks source link

IMShow No Window - 4.4.0.46 MacOS Big Sur #423

Closed markwimpory closed 3 years ago

markwimpory commented 3 years ago

Expected behaviour

imshow should open a window

Actual behaviour

python process running but no window shows

Steps to reproduce

def show_image(image): cv2.imshow(mat=image, winname="tt")

Wait for a key press to exit

cv2.waitKey()
# Close all windows
cv2.destroyAllWindows()

Mac OS Big Sur 11.0.1 opencv-python 4.4.0.46

Tested with 4.4.0.44 - OK Tested with 4.4.0.40 - OK

skvark commented 3 years ago

Please post the output of cv2.getBuildInformation().

Hook12aaa commented 3 years ago

Same issue here on my end.

`'\nGeneral configuration for OpenCV 4.4.0 =====================================\n
 Version control:               4.4.0-dirty\n\n
 Platform:\n
   Timestamp:                   2020-11-02T22:28:03Z\n
   Host:                        Darwin 17.7.0 x86_64\n
   CMake:                       3.18.2\n
   CMake generator:             Unix Makefiles\n
   CMake build tool:            /usr/bin/make\n
   Configuration:               Release\n\n
 CPU/HW features:\n
   Baseline:                    SSE SSE2 SSE3 SSSE3 SSE4_1\n
     requested:                 DETECT\n
   Dispatched code generation:  SSE4_2 FP16 AVX AVX2 AVX512_SKX\n
     requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX\n
     SSE4_2 (1 files):          + POPCNT SSE4_2\n
     FP16 (0 files):            + POPCNT SSE4_2 FP16 AVX\n
     AVX (4 files):             + POPCNT SSE4_2 AVX\n
     AVX2 (29 files):           + POPCNT SSE4_2 FP16 FMA3 AVX AVX2\n
     AVX512_SKX (4 files):      + POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX\n\n
 C/C++:\n
   Built as dynamic libs?:      NO\n
   C++ standard:                11\n
   C++ Compiler:                /usr/local/opt/ccache/libexec/clang++  (ver 9.1.0.9020039)\n
   C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG\n
   C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG\n
   C Compiler:                  /usr/local/opt/ccache/libexec/clang\n
   C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG\n
   C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG\n
   Linker flags (Release):      -Wl,-dead_strip  \n
   Linker flags (Debug):        -Wl,-dead_strip  \n
   ccache:                      YES\n
   Precompiled headers:         NO\n
   Extra dependencies:          -framework OpenCL /Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Accelerate.framework -lm -ldl ade Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent openjp2\n
   3rdparty dependencies:       ittnotify libprotobuf zlib libjpeg-turbo libwebp libpng libtiff IlmImf quirc ippiw ippicv\n\n
 OpenCV modules:\n
   To be built:                 calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching video videoio\n
   Disabled:                    world\n
   Disabled by dependency:      -\n
   Unavailable:                 java js python2 ts\n
   Applications:                -\n
   Documentation:               NO\n
   Non-free algorithms:         NO\n\n
 GUI: \n
   QT:                          YES (ver 5.13.2)\n
     QT OpenGL support:         NO\n
   Cocoa:                       YES\n
   VTK support:                 NO\n\n
 Media I/O: \n
   ZLib:                        build (ver 1.2.11)\n
   JPEG:                        build-libjpeg-turbo (ver 2.0.5-62)\n
   WEBP:                        build (ver encoder: 0x020f)\n
   PNG:                         build (ver 1.6.37)\n
   TIFF:                        build (ver 42 - 4.0.10)\n
   JPEG 2000:                   OpenJPEG (ver 2.3.1)\n
   OpenEXR:                     build (ver 2.3.0)\n
   HDR:                         YES\n
   SUNRASTER:                   YES\n
   PXM:                         YES\n
   PFM:                         YES\n\n
 Video I/O:\n
   DC1394:                      NO\n
   FFMPEG:                      YES\n
     avcodec:                   YES (58.91.100)\n
     avformat:                  YES (58.45.100)\n
     avutil:                    YES (56.51.100)\n
     swscale:                   YES (5.7.100)\n
     avresample:                YES (4.0.0)\n
   GStreamer:                   NO\n
   AVFoundation:                YES\n\n
 Parallel framework:            GCD\n\n
 Trace:                         YES (with Intel ITT)\n\n
 Other third-party libraries:\n
   Intel IPP:                   2020.0.0 Gold [2020.0.0]\n
          at:                   /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-b4ibzwe2/_skbuild/macosx-10.13-x86_64-3.8/cmake-build/3rdparty/ippicv/ippicv_mac/icv\n
   Intel IPP IW:                sources (2020.0.0)\n
             at:                /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-b4ibzwe2/_skbuild/macosx-10.13-x86_64-3.8/cmake-build/3rdparty/ippicv/ippicv_mac/iw\n
   Lapack:                      YES (/Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Accelerate.framework -lm -ldl)\n
   Eigen:                       YES (ver 3.3.8)\n
   Custom HAL:                  NO\n
   Protobuf:                    build (3.5.1)\n\n
 OpenCL:                        YES (no extra features)\n
   Include path:                NO\n
   Link libraries:              -framework OpenCL\n\n
 Python 3:\n
   Interpreter:                 /Users/travis/build/skvark/opencv-python/venv/bin/python (ver 3.8.6)\n
   Libraries:                   /Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib (ver 3.8.6)\n
   numpy:                       /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-build-env-gccf63s_/overlay/lib/python3.8/site-packages/numpy/core/include (ver 1.17.3)\n
   install path:                python\n\n
 Python (for build):            /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7\n\n
 Java:                          \n
   ant:                         NO\n
   JNI:                         /Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/JavaVM.framework/Headers /Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/JavaVM.framework/Headers /Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/JavaVM.framework/Headers\n
   Java wrappers:               NO\n
   Java tests:                  NO\n\n
 Install to:                    /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-b4ibzwe2/_skbuild/macosx-10.13-x86_64-3.8/cmake-install\n-----------------------------------------------------------------\n\n'`
skvark commented 3 years ago

Thanks, that looks ok. I'm pretty sure this issue has something to do with the Qt version. Qt 5.13.2 ships with current wheels, and based on some fast research, also other projects have had similar issues with it on Big Sur.

To fix this problem, Qt needs to be probably upgraded to 5.15. However, 5.15 has another issue that I cannot fix easily because I do not own a Mac. For more information, see https://github.com/skvark/opencv-python/issues/376. I have asked for help on that issue but nobody seems to be interested so don't hold on your breath waiting for a fix. If there isn't enough interest I will probably drop Qt support from the macOS builds because maintaining it is such a PITA.

Temporary solution is to use opencv-python-headless. Despite its name, it has Cocoa-based GUI functionality enabled since it cannot be disabled in OpenCV macOS builds. Please note that the Cocoa backend is more limited so you can't use all GUI methods which you can use with Qt.

Edit: To add, I have no idea why 4.4.0.40 and 4.4.0.44 work and 46 doesn't. 4.4.0.40 should not be working (at least not on Catalina) unless Apple fixed something in Big Sur.

lambdamoses commented 3 years ago

I also got this problem, but seemed to have solved it on Mac. I compiled OpenCV 4.5.0 from source and made sure to build the Python binding for Python 3. It was quite a pain to make sure that OpenCV doesn't instead build binding for Python 2.7 that comes with MacOS. Here is how to make sure that a Python 3 binding is built:

  1. After you unzip the source, in the terminal
    cd opencv-4.5.0 # Or whichever other version
    mkdir build
    cd build
  2. Now the build directory is empty. If the config log says Python 2 is used, then delete the build directory and make a new one. It has to be empty when you start configuring it.
  3. In the CMake GUI, select the build directory and the source directory. Enter these entries (the thing between : and = is the type of variable that CMake GUI asks for when you enter the variable. It's not part of the variable name):
    BUILD_opencv_python3:BOOL=ON
    BUILD_opencv_python2:BOOL=OFF
    PYTHON3_EXECUTABLE:FILEPATH=/Users/<username>/anaconda3/bin/python3
    PYTHON3_INCLUDE_DIR:PATH=/Users/<username>/anaconda3/include/python3.8
    PYTHON3_NUMPY_INCLUDE_DIRS:PATH=/Users/<username>/anaconda3/lib/python3.8/site-packages/numpy/core/include
    PYTHON3_DEFAULT_EXECUTABLE:FILEPATH=/Users/<username>/anaconda3/bin/python3

    Then click "Configure". CMake will fill in many other variables. It will find Python 2, but you should see that it uses Python 3. If it does use the Python 3 you specified, then click "Generate".

  4. In the terminal
    sudo make -j3 # j is for number of processes; there are many files to compile so multithreading helps
    sudo make install

These really helped: https://docs.opencv.org/4.5.0/d0/db2/tutorial_macos_install.html https://answers.opencv.org/question/221044/option-build_opencv_python3-missing-from-cmake-gui/ https://stackoverflow.com/questions/42638342/cannot-install-opencv-3-1-0-with-python3-cmake-not-including-or-linking-python

The problem seems to be with Qt. With pip's precompiled OpenCV 4.4.0.46, I got an error like this You might be loading two sets of Qt binaries into the same process (plus more words in a little paragraph) in the Python console when calling cv2.imshow when running Python in the terminal and no window would show (nothing responds when it's run in PyCharm). I have compiled OpenCV from source for C++ before though without caring about the Python binding (which I installed with pip instead) and the equivalent C++ code worked totally fine. When I compiled OpenCV from source, it was probably able to identify the correct Qt or Cocoa.

By default, OpenCV is installed into /usr/local. I tried to get it to install into /Users/<username>/anaconda3, while import cv2 would work, this interfered with compiling C++ code that uses OpenCV. So I still installed it into /usr/local and copied the cv2 directory of the Python binding (you will see where it is in the make install output in the terminal) into /Users/<username>/anaconda3/lib/python3.8/site-packages. Then both import cv2 and the C++ interface would work. I got cv2.imshow to show the image in a window when running Python in the terminal. For PyCharm projects, I made the global packages available to the virtual env like this: https://stackoverflow.com/questions/52921165/make-a-pycharm-project-inheriting-global-site-packages-after-creating-the-proje (Mac has different interface; go to PyCharm > Preferences) Well, maybe that defeated the purpose of virtual env. Manually copying cv2 to the site-packages of the virtual env also works. Not the most elegant solution, but it worked.

skvark commented 3 years ago

@lambdamoses This repository exists to avoid all that manual stuff you did... If you read the manual build section in README, you can do all that with just a few commands: https://github.com/skvark/opencv-python#manual-builds

For 4.5.0:

  1. git clone --recursive https://github.com/skvark/opencv-python.git
  2. cd opencv-python
  3. pip wheel . --verbose

For 4.4.0 which is the latest release in PyPI:

  1. pip install --no-binary opencv-python opencv-python

These commands will compile this package from sources. Just make sure you use correct pip, Python version is decided via it.

But the easiest way is probably pip install opencv-python-headless if you can stay at 4.4.0.

debaghtk commented 3 years ago

I was facing the same issue. @skvark's solution for 4.5.0 worked for me

skvark commented 3 years ago

The most recent release (4.5.1.48) drops Qt support on macOS and should fix this issue. If you need Qt support, consider contributing.

rririanto commented 3 years ago

@skvark's solution for 4.5.0 worked for me too! Thank you!

asmorkalov commented 3 years ago

Tested with OpenCV-Python 4.5.1, works without issues.

karansingla007 commented 1 year ago

Image window is not appearing in MacOS.

MacOS :- Version 13.2.1 (22D68) OpenCV version:- 4.6.0

print(cv2.getBuildInformation())

General configuration for OpenCV 4.6.0 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            /private/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/work/opencv_contrib-4.6.0/modules
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2023-02-15T15:08:10Z
    Host:                        Darwin 20.6.0 x86_64
    CMake:                       3.22.1
    CMake generator:             Ninja
    CMake build tool:            /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_build_env/bin/ninja
    Configuration:               Release

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3 SSSE3
      requested:                 DETECT
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (16 files):         + SSE4_1
      SSE4_2 (1 files):          + SSE4_1 POPCNT SSE4_2
      FP16 (0 files):            + SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (3 files):             + SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (29 files):           + SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (3 files):      + SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

  C/C++:
    Built as dynamic libs?:      YES
    C++ standard:                11
    C++ Compiler:                /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_build_env/bin/x86_64-apple-darwin13.4.0-clang++  (ver 14.0.6)
    C++ flags (Release):         -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/include -fdebug-prefix-map=/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/work=/usr/local/src/conda/opencv-suite-4.6.0 -fdebug-prefix-map=/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p=/usr/local/src/conda-prefix -D__STDC_CONSTANT_MACROS   -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/include -fdebug-prefix-map=/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/work=/usr/local/src/conda/opencv-suite-4.6.0 -fdebug-prefix-map=/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p=/usr/local/src/conda-prefix -D__STDC_CONSTANT_MACROS   -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -g  -DDEBUG -D_DEBUG
    C Compiler:                  /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_build_env/bin/x86_64-apple-darwin13.4.0-clang
    C flags (Release):           -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/include -fdebug-prefix-map=/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/work=/usr/local/src/conda/opencv-suite-4.6.0 -fdebug-prefix-map=/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p=/usr/local/src/conda-prefix   -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/include -fdebug-prefix-map=/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/work=/usr/local/src/conda/opencv-suite-4.6.0 -fdebug-prefix-map=/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p=/usr/local/src/conda-prefix   -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -g  -DDEBUG -D_DEBUG
    Linker flags (Release):      -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib -L/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib  -Wl,-dead_strip  
    Linker flags (Debug):        -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib -L/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib  -Wl,-dead_strip  
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 alphamat aruco bgsegm bioinspired calib3d ccalib core cvv datasets dpm face features2d flann freetype fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    world
    Disabled by dependency:      barcode dnn_objdetect dnn_superres mcc text wechat_qrcode
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev dnn java julia matlab ovis python2 sfm ts viz
    Applications:                -
    Documentation:               NO
    Non-free algorithms:         NO

  GUI:                           QT5
    QT:                          YES (ver 5.15.2 )
      QT OpenGL support:         NO
    Cocoa:                       YES

  Media I/O: 
    ZLib:                        /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib/libz.dylib (ver 1.2.13)
    JPEG:                        /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib/libjpeg.dylib (ver 90)
    PNG:                         /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib/libpng.dylib (ver 1.6.37)
    TIFF:                        /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib/libtiff.dylib (ver 42 / 4.1.0)
    JPEG 2000:                   OpenJPEG (ver 2.3.0)
    OpenEXR:                     build (ver 2.3.0)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    GStreamer:                   YES (1.14.0)
    AVFoundation:                YES

  Parallel framework:            GCD

  Trace:                         YES (built-in)

  Other third-party libraries:
    Intel IPP:                   2020.0.0 Gold [2020.0.0]
           at:                   /private/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/work/build/3rdparty/ippicv/ippicv_mac/icv
    Intel IPP IW:                sources (2020.0.0)
              at:                /private/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/work/build/3rdparty/ippicv/ippicv_mac/iw
    Eigen:                       YES (ver 3.3.7)
    Custom HAL:                  NO

  Python 3:
    Interpreter:                 /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/bin/python3 (ver 3.9.16)
    Libraries:                   /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib/libpython3.9.dylib (ver 3.9.16)
    numpy:                       /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/lib/python3.9/site-packages/numpy/core/include (ver 1.16.6)
    install path:                lib/python3.9/site-packages/cv2/python-3.9

  Python (for build):            /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/bin/python

  Java:                          
    ant:                         NO
    JNI:                         /opt/MacOSX10.10.sdk/System/Library/Frameworks/JavaVM.framework/Headers /opt/MacOSX10.10.sdk/System/Library/Frameworks/JavaVM.framework/Headers /opt/MacOSX10.10.sdk/System/Library/Frameworks/JavaVM.framework/Headers
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    /var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_5a1v4y7k9y/croot/opencv-suite_1676472757237/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p
-----------------------------------------------------------------
osssama98 commented 1 year ago

any update? i still have the same problem..

thehamsti commented 1 year ago

I am also having this issue.

Fernadoo commented 12 months ago

The same problem on my side, with macOS Monterey 12.1, python 3.9.18 and OpenCV 4.6.0. The imshow() launched a process but no window is showing and I have to manually kill the process.

joange commented 8 months ago

Same problem with macOS Monterrey 12.7.3, python 3.10.12 and openCV 4.6.0, any idea?

Vivek084c commented 4 months ago

here is the possible solution:

NOTE: the below snippet works when executed with .py file if you use .ipynb and run it it will crash (idk why is it)

x = cv2.imread("data/input/img_0.jpg", cv2.IMREAD_COLOR) cv2.imshow("test" , x)

while True: key = cv2.waitKey(0) if key in [27, ord('q'), ord('Q')]: cv2.destroyAllWindows() break

if you are trying to read multiple files : import cv2 for k in range(5): x = cv2.imread(f"data/input/img_{k}.jpg", cv2.IMREADCOLOR) cv2.imshow(f"test{k}" , x)

while True:
    key = cv2.waitKey(0)
    if key in [27, ord('q'), ord('Q')]:
        cv2.destroyAllWindows()
        break