<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; 4.4.0</li>
<li>Operating System / Platform =&gt; OSX 10.15.5 (Catalina)</li>
<li>Compiler =&gt; Python 3.8.5, pip 20.2.2</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">Running <code class="notranslate">cv2.imshow()</code> with any graphic caused segfault <a href="https://github.com/opencv/opencv/files/5068321/Python_2020-08-13-173300_Richards-MacBook-Pro-2.crash.txt">Python_2020-08-13-173300_Richards-MacBook-Pro-2.crash.txt</a></p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="% pip freeze
certifi==2020.6.20
chardet==3.0.4
cycler==0.10.0
gluoncv==0.8.0
graphviz==0.8.4
idna==2.10
kiwisolver==1.2.0
matplotlib==3.3.0
mxnet==1.6.0
numpy==1.19.1
opencv-python==4.4.0.40
Pillow==7.2.0
portalocker==2.0.0
pyparsing==2.4.7
python-dateutil==2.8.1
requests==2.24.0
scipy==1.5.2
six==1.15.0
tqdm==4.48.2
urllib3==1.25.10
% brew ls   
aom			giflib			leptonica		libvorbis		openssl@1.1		sqlite
boost			glib			libass			libvpx			opus			srt
cairo			glog			libbluray		libwebsockets		p11-kit			suite-sparse
ceres-solver		gmp			libevent		little-cms2		pandoc			szip
cmake			gnutls			libffi			lzo			pango			tbb
dav1d			gobject-introspection	libidn2			metis			pcre			tesseract
eigen			graphite2		libmpc			mpfr			pixman			theora
ffmpeg			graphviz		libogg			netcdf			pkg-config		unbound
flac			gts			libpng			netpbm			protobuf		webp
fontconfig		harfbuzz		libsamplerate		nettle			python@3.8		x264
freetype		hdf5			libsndfile		nginx			rav1e			x265
frei0r			icu4c			libsoxr			nmap			readline		xvid
fribidi			ilmbase			libtasn1		node			rtmpdump		xz
gcc			iperf3			libtiff			numpy			rubberband
gd			isl			libtool			openblas		sdl2
gdbm			jasper			libunistring		opencore-amr		sip
gettext			jpeg			libuv			openexr			snappy
gflags			lame			libvidstab		openjpeg		speex"><pre class="notranslate">% pip freeze
certifi==2020.6.20
chardet==3.0.4
cycler==0.10.0
gluoncv==0.8.0
graphviz==0.8.4
idna==2.10
kiwisolver==1.2.0
matplotlib==3.3.0
mxnet==1.6.0
numpy==1.19.1
opencv-python==4.4.0.40
Pillow==7.2.0
portalocker==2.0.0
pyparsing==2.4.7
python-dateutil==2.8.1
requests==2.24.0
scipy==1.5.2
six==1.15.0
tqdm==4.48.2
urllib3==1.25.10
% brew ls   
aom			giflib			leptonica		libvorbis		openssl@1.1		sqlite
boost			glib			libass			libvpx			opus			srt
cairo			glog			libbluray		libwebsockets		p11-kit			suite-sparse
ceres-solver		gmp			libevent		little-cms2		pandoc			szip
cmake			gnutls			libffi			lzo			pango			tbb
dav1d			gobject-introspection	libidn2			metis			pcre			tesseract
eigen			graphite2		libmpc			mpfr			pixman			theora
ffmpeg			graphviz		libogg			netcdf			pkg-config		unbound
flac			gts			libpng			netpbm			protobuf		webp
fontconfig		harfbuzz		libsamplerate		nettle			python@3.8		x264
freetype		hdf5			libsndfile		nginx			rav1e			x265
frei0r			icu4c			libsoxr			nmap			readline		xvid
fribidi			ilmbase			libtasn1		node			rtmpdump		xz
gcc			iperf3			libtiff			numpy			rubberband
gd			isl			libtool			openblas		sdl2
gdbm			jasper			libunistring		opencore-amr		sip
gettext			jpeg			libuv			openexr			snappy
gflags			lame			libvidstab		openjpeg		speex</pre></div>
<h5 dir="auto">Steps to reproduce</h5>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import cv2
img = cv2.imread('image.jpg',0) # any jpeg
cv2.imshow('frame',img)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">cv2</span>
<span class="pl-s1">img</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">imread</span>(<span class="pl-s">'image.jpg'</span>,<span class="pl-c1">0</span>) <span class="pl-c"># any jpeg</span>
<span class="pl-s1">cv2</span>.<span class="pl-en">imshow</span>(<span class="pl-s">'frame'</span>,<span class="pl-s1">img</span>)</pre></div>
<h5 dir="auto">Issue submission checklist</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I report the issue, it's not a question

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I checked the problem with documentation, FAQ, open issues,<br>
answers.opencv.org, Stack Overflow, etc and have not found solution

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I updated to latest OpenCV version and the issue is still there

</li>
<li>[?] There is reproducer code and related data files: videos, images, onnx, etc

</li>
</ul>
<p dir="auto"><strong>PIP opencv-python package issue</strong>: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="678693907" data-permission-text="Title is private" data-url="https://github.com/opencv/opencv-python/issues/376" data-hovercard-type="issue" data-hovercard-url="/opencv/opencv-python/issues/376/hovercard" href="https://github.com/opencv/opencv-python/issues/376">opencv/opencv-python#376</a></p>
<h5 dir="auto">System information (version)</h5>
<ul dir="auto">
<li>OpenCV =&gt; <g-emoji class="g-emoji" alias="grey_question" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2754.png">❔</g-emoji></li>
<li>Operating System / Platform =&gt; <g-emoji class="g-emoji" alias="grey_question" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2754.png">❔</g-emoji></li>
<li>Compiler =&gt; ❔</li>
</ul>
<p dir="auto">Model Name:	MacBook Air<br>
Model Identifier:	MacBookAir7,2<br>
Processor Name:	Dual-Core Intel Core i5<br>
Processor Speed:	1.8 GHz<br>
Number of Processors:	1<br>
Total Number of Cores:	2<br>
L2 Cache (per Core):	256 KB<br>
L3 Cache:	3 MB<br>
Hyper-Threading Technology:	Enabled<br>
Memory:	8 GB</p>
<p dir="auto">python --version<br>
Python 3.8.5 [3.7,3.6]</p>
<p dir="auto">❯ pip --version<br>
pip 20.2.2 from /Users/xxx/.pyenv/versions/3.8.5/envs/AI-3.8.5/lib/python3.8/site-packages/pip (python 3.8)</p>
<p dir="auto">Python 3.8.5 (default, Aug 12 2020, 19:20:20)<br>
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin<br>
Type "help", "copyright", "credits" or "license" for more information.</p>
<blockquote>
<blockquote>
<blockquote>
<p dir="auto">import cv2<br>
cv2.<strong>version</strong><br>
'4.4.0'</p>
</blockquote>
</blockquote>
</blockquote>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">Got "[1]    26545 segmentation fault " While running the official OpenCV documentation tutorial code from <a href="https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html" rel="nofollow">https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html</a></p>
<p dir="auto">Tested Code:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
import cv2

cap = cv2.VideoCapture(0)

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()

    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    # Display the resulting frame
    cv2.imshow('frame',gray)
    if cv2.waitKey(1) &amp; 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">cv2</span>

<span class="pl-s1">cap</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-v">VideoCapture</span>(<span class="pl-c1">0</span>)

<span class="pl-k">while</span>(<span class="pl-c1">True</span>):
    <span class="pl-c"># Capture frame-by-frame</span>
    <span class="pl-s1">ret</span>, <span class="pl-s1">frame</span> <span class="pl-c1">=</span> <span class="pl-s1">cap</span>.<span class="pl-en">read</span>()

    <span class="pl-c"># Our operations on the frame come here</span>
    <span class="pl-s1">gray</span> <span class="pl-c1">=</span> <span class="pl-s1">cv2</span>.<span class="pl-en">cvtColor</span>(<span class="pl-s1">frame</span>, <span class="pl-s1">cv2</span>.<span class="pl-v">COLOR_BGR2GRAY</span>)

    <span class="pl-c"># Display the resulting frame</span>
    <span class="pl-s1">cv2</span>.<span class="pl-en">imshow</span>(<span class="pl-s">'frame'</span>,<span class="pl-s1">gray</span>)
    <span class="pl-k">if</span> <span class="pl-s1">cv2</span>.<span class="pl-en">waitKey</span>(<span class="pl-c1">1</span>) <span class="pl-c1">&amp;</span> <span class="pl-c1">0xFF</span> <span class="pl-c1">==</span> <span class="pl-en">ord</span>(<span class="pl-s">'q'</span>):
        <span class="pl-k">break</span>

<span class="pl-c"># When everything done, release the capture</span>
<span class="pl-s1">cap</span>.<span class="pl-en">release</span>()
<span class="pl-s1">cv2</span>.<span class="pl-en">destroyAllWindows</span>()</pre></div>
<p dir="auto">Error message:<br>
"""<br>
python test.py<br>
[1]    60134 segmentation fault  python test.py</p>
<p dir="auto">╭─ ~/Projects/cv2                              ✘ SEGV  AI-3.8.5 3.8.5 21:39:57<br>
"""</p>
<p dir="auto">What I've. tried :</p>
<ol dir="auto">
<li>Used different terminals to run the code. (system terminal app, JetBrains PyCharm terminal, viscose terminal, iterm2, iterm2 is setup for camera access )</li>
<li>Used different Python versions (3.6,3.7,3.8)</li>
<li>Tried to build from source code. (same problem)</li>
</ol>
<h5 dir="auto">Steps to reproduce</h5>

<h5 dir="auto">Issue submission checklist</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I report the issue, it's not a question

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I checked the problem with documentation, FAQ, open issues,<br>
answers.opencv.org, Stack Overflow, etc and have not found solution

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I updated to latest OpenCV version and the issue is still there

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> There is reproducer code and related data files: videos, images, onnx, etc

</li>
</ul>