Linux中的OpenCV错误,但在Windows中有效

2024-04-25 05:41:17 发布

您现在位置:Python中文网/ 问答频道 /正文

当我在Linux中运行这个文件时,我得到了以下错误。但是同样的代码可以在Windows中使用opencv2.4.11

 OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /home/travis/miniconda/conda-bld/work/opencv-2.4.11/modules/imgproc/src/color.cpp, line 3739
    Traceback (most recent call last):
  File "testImplementation.py", line 206, in <module>
    GestureDemo().run()
  File "testImplementation.py", line 200, in run
    super(GestureDemo, self).run()
  File "/home/kathirdrone/Desktop/ARDRONE /GestureDetection/GestureDetection/current_src/eventBasedAnimationClass.py", line 47, in run
    self.onTimerFiredWrapper()
  File "/home/kathirdrone/Desktop/ARDRONE /GestureDetection/GestureDetection/current_src/eventBasedAnimationClass.py", line 30, in onTimerFiredWrapper
    self.onTimerFired()
  File "testImplementation.py", line 125, in onTimerFired
    self.gp.process()
  File "/home/kathirdrone/Desktop/ARDRONE /GestureDetection/GestureDetection/current_src/GesturesApi.py", line 297, in process
    self.threshold()
  File "/home/kathirdrone/Desktop/ARDRONE /GestureDetection/GestureDetection/current_src/GesturesApi.py", line 111, in threshold
    grey = cv2.cvtColor(self.original, cv2.COLOR_BGR2GRAY)
cv2.error: /home/travis/miniconda/conda-bld/work/opencv-2.4.11/modules/imgproc/src/color.cpp:3739: error: (-215) scn == 3 || scn == 4 in function cvtColor

有没有解决这个问题的线索?在


Tags: runinpyselfsrchomelinecurrent