cv2报错:Problematic frame:  C  [cv2.cpython-36m-x86_64-linux-gnu.so+0xcd0696]

python使用模块cv2过程中,报错:A fatal error has been detected by the Java Runtime Environment:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fe9ef5e3696, pid=25302, tid=0x00007fea12c4c740
#
# JRE version: Java(TM) SE Runtime Environment (8.0_201-b09) (build 1.8.0_201-b09)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.201-b09 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [cv2.cpython-36m-x86_64-linux-gnu.so+0xcd0696]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

错误发生点定位在这两行:

 Problematic frame:
 C  [cv2.cpython-36m-x86_64-linux-gnu.so+0xcd0696]

1、说明是在使用cv2这个模块过程中发生的错误。

 

通过谷歌搜索这个错误,有个帖子写道,在使用cv2模块的cv2.VideoCapture()时候报错:SIGSEGV (0xb) at pc=0x00007fffbe7d605d, pid=922, tid=0x0000000000000307。

里面提到是cv2调用视频捕捉方法时报错。

https://stackoverflow.com/questions/43664709/opencv-java-cant-open-the-webcam

2、说明可能是cv2.VideoCapture()这个方法过程中发生错误。

 

在代码中屏蔽cv2.VideoCapture()方法

cap = cv2.VideoCapture(content)
num = int(cap.get(6))
cap.set(cv2.CAP_PROP_POS_FRAMES, num)  # 设置要获取的帧号
a, img = cap.read()  # read方法返回一个布尔值和一个视频帧。若帧读取成功,则返回True

3、运行后,不再报错。证明问题确实在:cv2.VideoCapture()。至于为何调用cv2.VideoCapture()会发生这个error,且待后续。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值