C++/openCV - 为啥显示图像会产生 linux 分段错误? (openCV 错误?)

Posted

技术标签:

【中文标题】C++/openCV - 为啥显示图像会产生 linux 分段错误? (openCV 错误?)【英文标题】:C++/openCV - why does showing an image create a linux segmentation fault? (openCV bug?)C++/openCV - 为什么显示图像会产生 linux 分段错误? (openCV 错误?) 【发布时间】:2017-05-23 10:40:08 【问题描述】:

我正在做一些图像处理工作,但是当我尝试显示来自我的网络摄像头的图像时,我的终端得到以下输出:

debug end of loop
debug 1
*** Error in `./mySoftware': corrupted double-linked list: 0x0917db00 ***
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x67257)[0xb6975257]
/lib/i386-linux-gnu/libc.so.6(+0x6d577)[0xb697b577]
/lib/i386-linux-gnu/libc.so.6(+0x6d854)[0xb697b854]
/lib/i386-linux-gnu/libc.so.6(+0x6f37f)[0xb697d37f]
/lib/i386-linux-gnu/libc.so.6(__libc_malloc+0xc5)[0xb697ee05]
/usr/lib/i386-linux-gnu/libstdc++.so.6(_Znwj+0x27)[0xb6ba7187]
/usr/lib/i386-linux-gnu/libQtGui.so.4(+0x33596d)[0xb609296d]
/usr/lib/i386-linux-gnu/libQtGui.so.4(_ZN8QPainter5beginEP12QPaintDevice+0x17a)[0xb600b2aa]
/usr/lib/i386-linux-gnu/libQtGui.so.4(_ZN8QPainterC2EP12QPaintDevice+0xf9)[0xb600be49]
/usr/lib/i386-linux-gnu/libQtGui.so.4(_ZN14QWidgetPrivate10drawWidgetEP12QPaintDeviceRK7QRegionRK6QPointiP8QPainterP19QWidgetBackingStore+0x549)[0xb5eec1e9]
/usr/lib/i386-linux-gnu/libQtGui.so.4(+0x3842fe)[0xb60e12fe]
/usr/lib/i386-linux-gnu/libQtGui.so.4(_ZN14QWidgetPrivate16syncBackingStoreEv+0xa7)[0xb5ede057]
/usr/lib/i386-linux-gnu/libQtGui.so.4(_ZN7QWidget5eventEP6QEvent+0x536)[0xb5ef2626]
/usr/lib/i386-linux-gnu/libQtGui.so.4(_ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent+0x9a)[0xb5e9364a]
/usr/lib/i386-linux-gnu/libQtGui.so.4(_ZN12QApplication6notifyEP7QObjectP6QEvent+0x2e1)[0xb5e9a951]
/usr/lib/i386-linux-gnu/libQtCore.so.4(_ZN16QCoreApplication14notifyInternalEP7QObjectP6QEvent+0x8a)[0xb5bb457a]
/usr/lib/i386-linux-gnu/libQtCore.so.4(_ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData+0x3a6)[0xb5bb8266]
/usr/lib/i386-linux-gnu/libQtCore.so.4(_ZN16QCoreApplication16sendPostedEventsEP7QObjecti+0x25)[0xb5bb8595]
/usr/lib/i386-linux-gnu/libQtCore.so.4(+0x1b6f91)[0xb5be6f91]
/lib/i386-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x299)[0xb58bced9]
/lib/i386-linux-gnu/libglib-2.0.so.0(+0x47179)[0xb58bd179]
/lib/i386-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x34)[0xb58bd244]
/usr/lib/i386-linux-gnu/libQtCore.so.4(_ZN20QEventDispatcherGlib13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x75)[0xb5be70f5]
/usr/lib/i386-linux-gnu/libQtGui.so.4(+0x1f3b66)[0xb5f50b66]
/usr/lib/i386-linux-gnu/libQtCore.so.4(_ZN16QCoreApplication13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE+0x47)[0xb5bb85e7]
/usr/local/lib/libopencv_highgui.so.3.1(cvWaitKey+0x7e)[0xb729a90e]
/usr/local/lib/libopencv_highgui.so.3.1(_ZN2cv7waitKeyEi+0x1b)[0xb729662b]
./mySoftware[0x804c68f]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf7)[0xb6926637]
./mySoftware[0x804a851]
======= Memory map: ========
08048000-0805e000 r-xp 00000000 08:01 4194822    /home/John/mySoftware
0805e000-0805f000 r--p 00015000 08:01 4194822    /home/John/mySoftware
0805f000-08060000 rw-p 00016000 08:01 4194822    /home/John/mySoftware
09109000-0973d000 rw-p 00000000 00:00 0          [heap]
ac628000-ac688000 rw-s 00000000 00:05 57147463   /SYSV00000000 (deleted)
ac688000-ac693000 r-xp 00000000 08:01 5250432    /usr/lib/i386-linux-gnu/libjbig.so.0
ac693000-ac694000 r--p 0000a000 08:01 5250432    /usr/lib/i386-linux-gnu/libjbig.so.0
ac694000-ac697000 rw-p 0000b000 08:01 5250432    /usr/lib/i386-linux-gnu/libjbig.so.0
ac697000-ac70d000 r-xp 00000000 08:01 5250908    /usr/lib/i386-linux-gnu/libtiff.so.5.2.4
ac70d000-ac70e000 r--p 00075000 08:01 5250908    /usr/lib/i386-linux-gnu/libtiff.so.5.2.4
ac70e000-ac710000 rw-p 00076000 08:01 5250908    /usr/lib/i386-linux-gnu/libtiff.so.5.2.4
ac710000-ac711000 rw-p 00000000 00:00 0 
ac711000-ac765000 r-xp 00000000 08:01 5249612    /usr/lib/i386-linux-gnu/libQtSvg.so.4.8.7
ac765000-ac766000 ---p 00054000 08:01 5249612    /usr/lib/i386-linux-gnu/libQtSvg.so.4.8.7
ac766000-ac767000 r--p 00054000 08:01 5249612    /usr/lib/i386-linux-gnu/libQtSvg.so.4.8.7
ac767000-ac768000 rw-p 00055000 08:01 5249612    /usr/lib/i386-linux-gnu/libQtSvg.so.4.8.7
ac768000-ac7c3000 r-xp 00000000 08:01 5250461    /usr/lib/i386-linux-gnu/liblcms2.so.2.0.6
ac7c3000-ac7c4000 r--p 0005a000 08:01 5250461    /usr/lib/i386-linux-gnu/liblcms2.so.2.0.6
ac7c4000-ac7c8000 rw-p 0005b000 08:01 5250461    /usr/lib/i386-linux-gnu/liblcms2.so.2.0.6
ac7c8000-ac843000 r-xp 00000000 08:01 5250536    /usr/lib/i386-linux-gnu/libmng.so.2.0.2
ac843000-ac844000 r--p 0007b000 08:01 5250536    /usr/lib/i386-linux-gnu/libmng.so.2.0.2
ac844000-ac845000 rw-p 0007c000 08:01 5250536    /usr/lib/i386-linux-gnu/libmng.so.2.0.2
ac865000-ac8c2000 r-xp 00000000 08:01 5250436    /usr/lib/i386-linux-gnu/libjpeg.so.8.0.2
ac8c2000-ac8c3000 r--p 0005c000 08:01 5250436    /usr/lib/i386-linux-gnu/libjpeg.so.8.0.2
ac8c3000-ac8c4000 rw-p 0005d000 08:01 5250436    /usr/lib/i386-linux-gnu/libjpeg.so.8.0.2
ac8cd000-ac8d4000 r-xp 00000000 08:01 5378249    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqtiff.so
ac8d4000-ac8d5000 r--p 00006000 08:01 5378249    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqtiff.so
ac8d5000-ac8d6000 rw-p 00007000 08:01 5378249    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqtiff.so
ac8d6000-ac8db000 r-xp 00000000 08:01 5378247    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqsvg.so
ac8db000-ac8dc000 r--p 00004000 08:01 5378247    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqsvg.so
ac8dc000-ac8dd000 rw-p 00005000 08:01 5378247    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqsvg.so
ac8dd000-ac8e2000 r-xp 00000000 08:01 5378246    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqmng.so
ac8e2000-ac8e3000 r--p 00004000 08:01 5378246    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqmng.so
ac8e3000-ac8e4000 rw-p 00005000 08:01 5378246    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqmng.so
ac8e4000-aca2e000 rw-s 00000000 00:05 57114694   /SYSV00000000 (deleted)
aca2e000-aca39000 r-xp 00000000 08:01 8652185    /lib/i386-linux-gnu/libnss_files-2.23.so
aca39000-aca3a000 r--p 0000a000 08:01 8652185    /lib/i386-linux-gnu/libnss_files-2.23.so
aca3a000-aca3b000 rw-p 0000b000 08:01 8652185    /lib/i386-linux-gnu/libnss_files-2.23.so
aca3b000-aca41000 rw-p 00000000 00:00 0 
aca41000-aca4c000 r-xp 00000000 08:01 8652195    /lib/i386-linux-gnu/libnss_nis-2.23.so
aca4c000-aca4d000 r--p 0000a000 08:01 8652195    /lib/i386-linux-gnu/libnss_nis-2.23.so
aca4d000-aca4e000 rw-p 0000b000 08:01 8652195    /lib/i386-linux-gnu/libnss_nis-2.23.so
aca4e000-aca65000 r-xp 00000000 08:01 8652179    /lib/i386-linux-gnu/libnsl-2.23.so
aca65000-aca66000 r--p 00016000 08:01 8652179    /lib/i386-linux-gnu/libnsl-2.23.so
aca66000-aca67000 rw-p 00017000 08:01 8652179    /lib/i386-linux-gnu/libnsl-2.23.so
aca67000-aca69000 rw-p 00000000 00:00 0 
aca69000-aca71000 r-xp 00000000 08:01 8652181    /lib/i386-linux-gnu/libnss_compat-2.23.so
aca71000-aca72000 r--p 00007000 08:01 8652181    /lib/i386-linux-gnu/libnss_compat-2.23.so
aca72000-aca73000 rw-p 00008000 08:01 8652181    /lib/i386-linux-gnu/libnss_compat-2.23.so
aca73000-acb55000 rw-p 00000000 00:00 0 
acb55000-acba0000 r--p 00000000 08:01 6426266    /usr/share/fonts/truetype/noto/NotoSans-Regular.ttf
acba0000-accf5000 r-xp 00000000 08:01 5249597    /usr/lib/i386-linux-gnu/libQtNetwork.so.4.8.7
accf5000-accf6000 ---p 00155000 08:01 5249597    /usr/lib/i386-linux-gnu/libQtNetwork.so.4.8.7
accf6000-accf9000 r--p 00155000 08:01 5249597    /usr/lib/i386-linux-gnu/libQtNetwork.so.4.8.7
accf9000-accfa000 rw-p 00158000 08:01 5249597    /usr/lib/i386-linux-gnu/libQtNetwork.so.4.8.7
accfa000-ad11a000 r-xp 00000000 08:01 5249624    /usr/lib/i386-linux-gnu/libQtXmlPatterns.so.4.8.7
ad11a000-ad11b000 ---p 00420000 08:01 5249624    /usr/lib/i386-linux-gnu/libQtXmlPatterns.so.4.8.7
ad11b000-ad136000 r--p 00420000 08:01 5249624    /usr/lib/i386-linux-gnu/libQtXmlPatterns.so.4.8.7
ad136000-ad137000 rw-p 0043b000 08:01 5249624    /usr/lib/i386-linux-gnu/libQtXmlPatterns.so.4.8.7
ad137000-ad176000 r-xp 00000000 08:01 5249609    /usr/lib/i386-linux-gnu/libQtSql.so.4.8.7
ad176000-ad177000 r--p 0003e000 08:01 5249609    /usr/lib/i386-linux-gnu/libQtSql.so.4.8.7
ad177000-ad178000 rw-p 0003f000 08:01 5249609    /usr/lib/i386-linux-gnu/libQtSql.so.4.8.7
ad178000-ad410000 r-xp 00000000 08:01 5249603    /usr/lib/i386-linux-gnu/libQtScript.so.4.8.7
ad410000-ad419000 r--p 00297000 08:01 5249603    /usr/lib/i386-linux-gnu/libQtScript.so.4.8.7
ad419000-ad41a000 rw-p 002a0000 08:01 5249603    /usr/lib/i386-linux-gnu/libQtScript.so.4.8.7
ad41a000-ad42a000 rw-p 00000000 00:00 0 
ad42a000-ad7c8000 r-xp 00000000 08:01 5249582    /usr/lib/i386-linux-gnu/libQtDeclarative.so.4.8.7
ad7c8000-ad7c9000 ---p 0039e000 08:01 5249582    /usr/lib/i386-linux-gnu/libQtDeclarative.so.4.8.7
ad7c9000-ad7d8000 r--p 0039e000 08:01 5249582    /usr/lib/i386-linux-gnu/libQtDeclarative.so.4.8.7
ad7d8000-ad7da000 rw-p 003ad000 08:01 5249582    /usr/lib/i386-linux-gnu/libQtDeclarative.so.4.8.7
ad7da000-ad827000 r-xp 00000000 08:01 5378229    /usr/lib/i386-linux-gnu/qt4/plugins/accessible/libqtaccessiblewidgets.so
ad827000-ad82a000 r--p 0004c000 08:01 5378229    /usr/lib/i386-linux-gnu/qt4/plugins/accessible/libqtaccessiblewidgets.so
ad82a000-ad82b000 rw-p 0004f000 08:01 5378229    /usr/lib/i386-linux-gnu/qt4/plugins/accessible/libqtaccessiblewidgets.so
ad82b000-ad86d000 r-xp 00000000 08:01 5249621    /usr/lib/i386-linux-gnu/libQtXml.so.4.8.7
ad86d000-ad86e000 ---p 00042000 08:01 5249621    /usr/lib/i386-linux-gnu/libQtXml.so.4.8.7
ad86e000-ad86f000 r--p 00042000 08:01 5249621    /usr/lib/i386-linux-gnu/libQtXml.so.4.8.7
ad86f000-ad870000 rw-p 00043000 08:01 5249621    /usr/lib/i386-linux-gnu/libQtXml.so.4.8.7
ad870000-ad8f5000 r-xp 00000000 08:01 5249579    /usr/lib/i386-linux-gnu/libQtDBus.so.4.8.7
ad8f5000-ad8f6000 r--p 00084000 08:01 5249579    /usr/lib/i386-linux-gnu/libQtDBus.so.4.8.7
ad8f6000-ad8f7000 rw-p 00085000 08:01 5249579    /usr/lib/i386-linux-gnu/libQtDBus.so.4.8.7
ad8f7000-ad934000 r-xp 00000000 08:01 5378230    /usr/lib/i386-linux-gnu/qt4/plugins/accessiblebridge/libqspiaccessiblebridge.so
ad934000-ad935000 r--p 0003c000 08:01 5378230    /usr/lib/i386-linux-gnu/qt4/plugins/accessiblebridge/libqspiaccessiblebridge.so
ad935000-ad936000 rw-p 0003d000 08:01 5378230    /usr/lib/i386-linux-gnu/qt4/plugins/accessiblebridge/libqspiaccessiblebridge.so
ad936000-ad981000 r--p 00000000 08:01 6426266    /usr/share/fonts/truetype/noto/NotoSans-Regular.ttf
ad981000-ad9b6000 r-xp 00000000 08:01 5375962    /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/engines/libmurrine.so
ad9b6000-ad9b7000 r--p 00034000 08:01 5375962    /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/engines/libmurrine.so
ad9b7000-ad9b8000 rw-p 00035000 08:01 5375962    /usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/engines/libmurrine.so
ad9b8000-ad9e6000 r-xp 00000000 08:01 5249751    /usr/lib/i386-linux-gnu/libatspi.so.0.0.1
ad9e6000-ad9e8000 r--p 0002d000 08:01 5249751    /usr/lib/i386-linux-gnu/libatspi.so.0.0.1
ad9e8000-ad9e9000 rw-p 0002f000 08:01 5249751    /usr/lib/i386-linux-gnu/libatspi.so.0.0.1
ad9e9000-ada1a000 r-xp 00000000 08:01 5249745    /usr/lib/i386-linux-gnu/libatk-bridge-2.0.so.0.0.0
ada1a000-ada1b000 r--p 00030000 08:01 5249745    /usr/lib/i386-linux-gnu/libatk-bridge-2.0.so.0.0.0
ada1b000-ada1c000 rw-p 00031000 08:01 5249745    /usr/lib/i386-linux-gnu/libatk-bridge-2.0.so.0.0.0
ada1c000-ada1d000 rw-p 00000000 00:00 0 
ada1d000-ada21000 r-xp 00000000 08:01 5378248    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqtga.so
ada21000-ada22000 r--p 00003000 08:01 5378248    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqtga.so
ada22000-ada23000 rw-p 00004000 08:01 5378248    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqtga.so
ada23000-ada2a000 r-xp 00000000 08:01 5378245    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqjpeg.so
ada2a000-ada2b000 r--p 00006000 08:01 5378245    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqjpeg.so
ada2b000-ada2c000 rw-p 00007000 08:01 5378245    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqjpeg.so
ada2c000-ada33000 r-xp 00000000 08:01 5378244    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqico.so
ada33000-ada34000 r--p 00006000 08:01 5378244    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqico.so
ada34000-ada35000 rw-p 00007000 08:01 5378244    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqico.so
ada35000-ada3b000 r-xp 00000000 08:01 5378243    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqgif.so
ada3b000-ada3c000 r--p 00005000 08:01 5378243    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqgif.so
ada3c000-ada3d000 rw-p 00006000 08:01 5378243    /usr/lib/i386-linux-gnu/qt4/plugins/imageformats/libqgif.so
ada3d000-ada97000 r-xp 00000000 08:01 5375984    /usr/lib/i386-linux-gnu/gtk-2.0/modules/libgail.so
ada97000-ada98000 r--p 00059000 08:01 5375984    /usr/lib/i386-linux-gnu/gtk-2.0/modules/libgail.so
ada98000-ada99000 rw-p 0005a000 08:01 5375984    /usr/lib/i386-linux-gnu/gtk-2.0/modules/libgail.so
ada99000-adaad000 r-xp 00000000 08:01 8652132    /lib/i386-linux-gnu/libgpg-error.so.0.17.0
adaad000-adaae000 r--p 00013000 08:01 8652132    /lib/i386-linux-gnu/libgpg-error.so.0.17.0
adaae000-adaaf000 rw-p 00014000 08:01 8652132    /lib/i386-linux-gnu/libgpg-error.so.0.17.0
adaaf000-adb5a000 r-xp 00000000 08:01 8652128    /lib/i386-linux-gnu/libgcrypt.so.20.0.5
adb5a000-adb5b000 r--p 000aa000 08:01 8652128    /lib/i386-linux-gnu/libgcrypt.so.20.0.5
adb5b000-adb5e000 rw-p 000ab000 08:01 8652128    /lib/i386-linux-gnu/libgcrypt.so.20.0.5
adb5e000-adbe8000 r-xp 00000000 08:01 5250174    /usr/lib/i386-linux-gnu/libgmp.so.10.3.0
adbe8000-adbe9000 r--p 00089000 08:01 5250174    /usr/lib/i386-linux-gnu/libgmp.so.10.3.0
adbe9000-adbea000 rw-p 0008a000 08:01 5250174    /usr/lib/i386-linux-gnu/libgmp.so.10.3.0
adbea000-adc1d000 r-xp 00000000 08:01 5250349    /usr/lib/i386-linux-gnu/libhogweed.so.4.2
adc1d000-adc1e000 r--p 00032000 08:01 5250349    /usr/lib/i386-linux-gnu/libhogweed.so.4.2
adc1e000-adc1f000 rw-p 00033000 08:01 5250349    /usr/lib/i386-linux-gnu/libhogweed.so.4.2
adc1f000-adc59000 r-xp 00000000 08:01 5250586    /usr/lib/i386-linux-gnu/libnettle.so.6.2
adc59000-adc5a000 r--p 00039000 08:01 5250586    /usr/lib/i386-linux-gnu/libnettle.so.6.2
adc5a000-adc5b000 rw-p 0003a000 08:01 5250586    /usr/lib/i386-linux-gnu/libnettle.so.6.2
adc5b000-adc6e000 r-xp 00000000 08:01 5250885    /usr/lib/i386-linux-gnu/libtasn1.so.6.5.1
adc6e000-adc6f000 r--p 00012000 08:01 5250885    /usr/lib/i386-linux-gnu/libtasn1.so.6.5.1
adc6f000-adc70000 rw-p 00013000 08:01 5250885    /usr/lib/i386-linux-gnu/libtasn1.so.6.5.1
adc70000-adca2000 r-xp 00000000 08:01 5250389    /usr/lib/i386-linux-gnu/libidn.so.11.6.15
adca2000-adca3000 r--p 00031000 08:01 5250389    /usr/lib/i386-linux-gnu/libidn.so.11.6.15
adca3000-adca4000 rw-p 00032000 08:01 5250389    /usr/lib/i386-linux-gnu/libidn.so.11.6.15
adca4000-adcff000 r-xp 00000000 08:01 5250650    /usr/lib/i386-linux-gnu/libp11-kit.so.0.1.0
adcff000-add00000 ---p 0005b000 08:01 5250650    /usr/lib/i386-linux-gnu/libp11-kit.so.0.1.0
add00000-add05000 r--p 0005b000 08:01 5250650    /usr/lib/i386-linux-gnu/libp11-kit.so.0.1.0
add05000-add06000 rw-p 00060000 08:01 5250650    /usr/lib/i386-linux-gnu/libp11-kit.so.0.1.0
add06000-add91000 r-xp 00000000 08:01 8652254    /lib/i386-linux-gnu/libsystemd.so.0.14.0
add91000-add93000 r--p 0008a000 08:01 8652254    /lib/i386-linux-gnu/libsystemd.so.0.14.0
add93000-add94000 rw-p 0008c000 08:01 8652254    /lib/i386-linux-gnu/libsystemd.so.0.14.0
add94000-addb8000 r-xp 00000000 08:01 8652155    /lib/i386-linux-gnu/liblzma.so.5.0.0
addb8000-addb9000 r--p 00023000 08:01 8652155    /lib/i386-linux-gnu/liblzma.so.5.0.0
addb9000-addba000 rw-p 00024000 08:01 8652155    /lib/i386-linux-gnu/liblzma.so.5.0.0
addba000-addcc000 r-xp 00000000 08:01 5249755    /usr/lib/i386-linux-gnu/libavahi-client.so.3.2.9
addcc000-addcd000 r--p 00011000 08:01 5249755    /usr/lib/i386-linux-gnu/libavahi-client.so.3.2.9
addcd000-addce000 rw-p 00012000 08:01 5249755    /usr/lib/i386-linux-gnu/libavahi-client.so.3.2.9
addce000-addda000 r-xp 00000000 08:01 5249757    /usr/lib/i386-linux-gnu/libavahi-common.so.3.5.3
addda000-adddb000 r--p 0000b000 08:01 5249757    /usr/lib/i386-linux-gnu/libavahi-common.so.3.5.3
adddb000-adddc000 rw-p 0000c000 08:01 5249757    /usr/lib/i386-linux-gnu/libavahi-common.so.3.5.3
adddc000-adf2b000 r-xp 00000000 08:01 5250194    /usr/lib/i386-linux-gnu/libgnutls.so.30.6.2
adf2b000-adf2c000 ---p 0014f000 08:01 5250194    /usr/lib/i386-linux-gnu/libgnutls.so.30.6.2
adf2c000-adf32000 r--p 0014f000 08:01 5250194    /usr/lib/i386-linux-gnu/libgnutls.so.30.6.2
adf32000-adf33000 rw-p 00155000 08:01 5250194    /usr/lib/i386-linux-gnu/libgnutls.so.30.6.2
adf33000-adf34000 rw-p 00000000 00:00 0 
adf34000-adf8b000 r-xp 00000000 08:01 8652104    /lib/i386-linux-gnu/libdbus-1.so.3.14.6
adf8b000-adf8c000 ---p 00057000 08:01 8652104    /lib/i386-linux-gnu/libdbus-1.so.3.14.6
adf8c000-adf8d000 r--p 00057000 08:01 8652104    /lib/i386-linux-gnu/libdbus-1.so.3.14.6
adf8d000-adf8e000 rw-p 00058000 08:01 8652104    /lib/i386-linux-gnu/libdbus-1.so.3.14.6
adf8e000-adfb7000 r-xp 00000000 08:01 5249911    /usr/lib/i386-linux-gnu/libdbus-glib-1.so.2.3.3
adfb7000-adfb8000 ---p 00029000 08:01 5249911    /usr/lib/i386-linux-gnu/libdbus-glib-1.so.2.3.3
adfb8000-adfb9000 r--p 00029000 08:01 5249911    /usr/lib/i386-linux-gnu/libdbus-glib-1.so.2.3.3
adfb9000-adfba000 rw-p 0002a000 08:01 5249911    /usr/lib/i386-linux-gnu/libdbus-glib-1.so.2.3.3
adfba000-ae191000 r-xp 00000000 08:01 5251112    /usr/lib/i386-linux-gnu/libxml2.so.2.9.3
ae191000-ae192000 ---p 001d7000 08:01 5251112    /usr/lib/i386-linux-gnu/libxml2.so.2.9.3
ae192000-ae196000 r--p 001d7000 08:01 5251112    /usr/lib/i386-linux-gnu/libxml2.so.2.9.3
ae196000-ae197000 rw-p 001db000 08:01 5251112    /usr/lib/i386-linux-gnu/libxml2.so.2.9.3
ae197000-ae198000 rw-p 00000000 00:00 0 
ae198000-ae1cb000 r-xp 00000000 08:01 5250108    /usr/lib/i386-linux-gnu/libgconf-2.so.4.1.5
ae1cb000-ae1cc000 r--p 00032000 08:01 5250108    /usr/lib/i386-linux-gnu/libgconf-2.so.4.1.5
ae1cc000-ae1cd000 rw-p 00033000 08:01 5250108    /usr/lib/i386-linux-gnu/libgconf-2.so.4.1.5
ae1cd000-ae23b000 r-xp 00000000 08:01 5250190    /usr/lib/i386-linux-gnu/libgnomevfs-2.so.0.2400.4
ae23b000-ae23d000 r--p 0006d000 08:01 5250190    /usr/lib/i386-linux-gnu/libgnomevfs-2.so.0.2400.4
ae23d000-ae23e000 rw-p 0006f000 08:01 5250190    /usr/lib/i386-linux-gnu/libgnomevfs-2.so.0.2400.4
ae23e000-ae23f000 rw-p 00000000 00:00 0 
ae23f000-ae246000 r-xp 00000000 08:01 5249908    /usr/lib/i386-linux-gnu/libdatrie.so.1.3.3
ae246000-ae247000 ---p 00007000 08:01 5249908    /usr/lib/i386-linux-gnu/libdatrie.so.1.3.3
ae247000-ae248000 r--p 00007000 08:01 5249908    /usr/lib/i386-linux-gnu/libdatrie.so.1.3.3
ae248000-ae249000 rw-p 00008000 08:01 5249908    /usr/lib/i386-linux-gnu/libdatrie.so.1.3.3
ae249000-ae26d000 r-xp 00000000 08:01 5250214    /usr/lib/i386-linux-gnu/libgraphite2.so.3.0.1
ae26d000-ae26e000 ---p 00024000 08:01 5250214    /usr/lib/i386-linux-gnu/libgraphite2.so.3.0.1
ae26e000-ae26f000 r--p 00024000 08:01 5250214    /usr/lib/i386-linux-gnu/libgraphite2.so.3.0.1
ae26f000-ae270000 rw-p 00025000 08:01 5250214    /usr/lib/i386-linux-gnu/libgraphite2.so.3.0.1
ae270000-ae279000 r-xp 00000000 08:01 5250897    /usr/lib/i386-linux-gnu/libthai.so.0.2.4
ae279000-ae27a000 r--p 00008000 08:01 5250897    /usr/lib/i386-linux-gnu/libthai.so.0.2.4
ae27a000-ae27b000 rw-p 00009000 08:01 5250897    /usr/lib/i386-linux-gnu/libthai.so.0.2.4
ae27b000-ae2dd000 r-xp 00000000 08:01 5250125    /usr/lib/i386-linux-gnu/libharfbuzz.so.0.10000.1
ae2dd000-ae2de000 r--p 00061000 08:01 5250125    /usr/lib/i386-linux-gnu/libharfbuzz.so.0.10000.1
ae2de000-ae2df000 rw-p 00062000 08:01 5250125    /usr/lib/i386-linux-gnu/libharfbuzz.so.0.10000.1
ae2df000-ae2f3000 r-xp 00000000 08:01 8652238    /lib/i386-linux-gnu/libresolv-2.23.so
ae2f3000-ae2f4000 ---p 00014000 08:01 8652238    /lib/i386-linux-gnu/libresolv-2.23.so
ae2f4000-ae2f5000 r--p 00014000 08:01 8652238    /lib/i386-linux-gnu/libresolv-2.23.so
ae2f5000-ae2f6000 rw-p 00015000 08:01 8652238    /lib/i386-linux-gnu/libresolv-2.23.so
ae2f6000-ae2f8000 rw-p 00000000 00:00 0 
ae2f8000-ae31a000 r-xp 00000000 08:01 8652244    /lib/i386-linux-gnu/libselinux.so.1
ae31a000-ae31b000 ---p 00022000 08:01 8652244    /lib/i386-linux-gnu/libselinux.so.1
ae31b000-ae31c000 r--p 00022000 08:01 8652244    /lib/i386-linux-gnu/libselinux.so.1
ae31c000-ae31d000 rw-p 00023000 08:01 8652244    /lib/i386-linux-gnu/libselinux.so.1
ae31d000-ae31e000 rw-p 00000000 00:00 0 
ae31e000-ae327000 r-xp 00000000 08:01 5251084    /usr/lib/i386-linux-gnu/libxcb-render.so.0.0.0
ae327000-ae328000 r--p 00008000 08:01 5251084    /usr/lib/i386-linux-gnu/libxcb-render.so.0.0.0
ae328000-ae329000 rw-p 00009000 08:01 5251084    /usr/lib/i386-linux-gnu/libxcb-render.so.0.0.0
ae329000-ae3d2000 r-xp 00000000 08:01 5250690    /usr/lib/i386-linux-gnu/libpixman-1.so.0.33.6
ae3d2000-ae3d8000 r--p 000a8000 08:01 5250690    /usr/lib/i386-linux-gnu/libpixman-1.so.0.33.6
ae3d8000-ae3d9000 rw-p 000ae000 08:01 5250690    /usr/lib/i386-linux-gnu/libpixman-1.so.0.33.6
ae3d9000-ae427000 r-xp 00000000 08:01 5250660    /usr/lib/i386-linux-gnu/libpango-1.0.so.0.3800.1
ae427000-ae428000 ---p 0004e000 08:01 5250660    /usr/lib/i386-linux-gnu/libpango-1.0.so.0.3800.1
ae428000-ae429000 r--p 0004e000 08:01 5250660    /usr/lib/i386-linux-gnu/libpango-1.0.so.0.3800.1
ae429000-ae42a000 rw-p 0004f000 08:01 5250660    /usr/lib/i386-linux-gnu/libpango-1.0.so.0.3800.1
ae42a000-ae5ee000 r-xp 00000000 08:01 5243379    /usr/lib/i386-linux-gnu/libgio-2.0.so.0.4800.1
ae5ee000-ae5ef000 ---p 001c4000 08:01 5243379    /usr/lib/i386-linux-gnu/libgio-2.0.so.0.4800.1
ae5ef000-ae5f1000 r--p 001c4000 08:01 5243379    /usr/lib/i386-linux-gnu/libgio-2.0.so.0.4800.1
ae5f1000-ae5f2000 rw-p 001c6000 08:01 5243379    /usr/lib/i386-linux-gnu/libgio-2.0.so.0.4800.1
ae5f2000-ae5f3000 rw-p 00000000 00:00 0 
ae5f3000-ae61a000 r-xp 00000000 08:01 5250171    /usr/lib/i386-linux-gnu/libgdk_pixbuf-2.0.so.0.3200.2
ae61a000-ae61b000 r--p 00026000 08:01 5250171    /usr/lib/i386-linux-gnu/libgdk_pixbuf-2.0.so.0.3200.2
ae61b000-ae61c000 rw-p 00027000 08:01 5250171    /usr/lib/i386-linux-gnu/libgdk_pixbuf-2.0.so.0.3200.2
ae61c000-ae759000 r-xp 00000000 08:01 5249809    /usr/lib/i386-linux-gnu/libcairo.so.2.11400.6
ae759000-ae75b000 r--p 0013c000 08:01 5249809    /usr/lib/i386-linux-gnu/libcairo.so.2.11400.6
ae75b000-ae75c000 rw-p 0013e000 08:01 5249809    /usr/lib/i386-linux-gnu/libcairo.so.2.11400.6
ae75c000-ae75d000 rw-p 00000000 00:00 0 
ae75d000-ae781000 r-xp 00000000 08:01 5249743    /usr/lib/i386-linux-gnu/libatk-1.0.so.0.21809.1
ae781000-ae783000 r--p 00023000 08:01 5249743    /usr/lib/i386-linux-gnu/libatk-1.0.so.0.21809.1
ae783000-ae784000 rw-p 00025000 08:01 5249743    /usr/lib/i386-linux-gnu/libatk-1.0.so.0.21809.1
ae784000-ae841000 r-xp 00000000 08:01 5250124    /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0.2400.30
ae841000-ae843000 r--p 000bc000 08:01 5250124    /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0.2400.30
ae843000-ae844000 rw-p 000be000 08:01 5250124    /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0.2400.30
ae844000-aed31000 r-xp 00000000 08:01 5250308    /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0.2400.30
aed31000-aed32000 ---p 004ed000 08:01 5250308    /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0.2400.30
aed32000-aed36000 r--p 004ed000 08:01 5250308    /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0.2400.30
aed36000-aed38000 rw-p 004f1000 08:01 5250308    /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0.2400.30
aed38000-aed3a000 rw-p 00000000 00:00 0 Aborted

这是我的代码的样子:

int main(int argc, char** argv)

    while(1)
    
         while(1)
         
           // some algorithms 
           cerr<<"debug end of loop"<<endl;
         

          imshow("imgFrame", imgFrame);
          cerr<<"debug 1"<<endl;
          char c = (char)waitKey(10);
          cerr<<"debug 2"<<endl;

          if( c == 27 ) break;

         cap >> imgFrame;
    
  return 0;

对应的valgrind输出:https://pastebin.com/ch1h2aFL

有人可以解释一下我可能做错了什么吗?这是一个 openCV 错误吗?

正在使用的代码:https://pastebin.com/brtR3eHn

【问题讨论】:

您没有显示所有代码,因此无法确定。第一个猜测:您在实际将图像加载到其中之前使用 imgFrame。 请不要破坏您的帖子。一旦您发布了一个问题,它就属于整个 Stack Overflow 社区(在 CC BY-SA 许可下)。如果您想取消此帖子与您的帐户的关联,请参阅What is the proper route for a disassociation request? 【参考方案1】:

您先致电imshow,然后再致电cap&gt;&gt;imgFrame,这可能是第一次运行时的原因。

【讨论】:

实际上我已经在我的代码中的其他地方做了 cap>>imgFrame(我没有显示的部分),所以这不是问题。

以上是关于C++/openCV - 为啥显示图像会产生 linux 分段错误? (openCV 错误?)的主要内容,如果未能解决你的问题,请参考以下文章

opencv中为啥图像局矩阵是以BGR而不是RGB显示像素的大小?

为啥 OpenCV 的 MSER 的 Python 实现和 Java 实现会产生不同的输出?

Java基于opencv—透视变换矫正图像

OPENcv中把一个图片融合到另一个图像中为啥程序正确不显示图片

为啥在 OpenCv 中调整图像大小会降低相机校准的重投影误差?

使用 opencv 在 GPU 上调整图像大小会产生空输出矩阵