You are not logged in.
Pages: 1
I was testing my opencv installation by running the first code in https://docs.opencv.org/3.3.1/dd/d43/tu … splay.html
mpf.py
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) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
On running
python mfp.py
I get this error
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /io/opencv/modules/imgproc/src/color.cpp, line 10638
Traceback (most recent call last):
File "mfp.py", line 8, in <module>
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.error: /io/opencv/modules/imgproc/src/color.cpp:10638: error: (-215) scn == 3 || scn == 4 in function cvtColor
OpenCV Version = 3.3.1
I am a complete newbie to openCV and python .
Note to Moderators : It is my first thread in arch forum . If i posted in the wrong section please move this to the right section.
Last edited by hellraise007 (2017-11-08 06:27:40)
Offline
This section is fine. I installed opencv, opened a python shell and entered lines 2,3,6,and 8 from your script and it worked fine here. Well, no assertion anyway.
I note that there were many optional dependencies for opencv. I already had them all installed with the exception of vcdimager, which I did not install.
Please verify how you installed opencv. Also, what optional dependencies you have.
I know nothing of opencv (but it looks interesting). I don't imagine it care what GPU you have, but mine is Intel. As to video sources, I have a USB webcam built into my HP Envy Laptop. What are your video sources?
Edit: Oh, Welcome to the Arch Linux forums
Last edited by ewaller (2017-11-08 15:08:38)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
This section is fine. I installed opencv, opened a python shell and entered lines 2,3,6,and 8 from your script and it worked fine here. Well, no assertion anyway.
I note that there were many optional dependencies for opencv. I already had them all installed with the exception of vcdimager, which I did not install.
Please verify how you installed opencv. Also, what optional dependencies you have.I know nothing of opencv (but it looks interesting). I don't imagine it care what GPU you have, but mine is Intel. As to video sources, I have a USB webcam built into my HP Envy Laptop. What are your video sources?
Edit: Oh, Welcome to the Arch Linux forums
Thank you for the warm welcome
As for installing python , i reinstalled it with all the optional dependencies .
$ glxinfo|egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
When runnning the code from shell , as i reach line 8 i get this error:
>> gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /io/opencv/modules/imgproc/src/color.cpp, line 10638
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cv2.error: /io/opencv/modules/imgproc/src/color.cpp:10638: error: (-215) scn == 3 || scn == 4 in function cvtColor
Am i doing anything wrong?
Offline
When I had been helping you before I was ssh'ing into my box from work, thus I could not actually run your program.
I am at home today and was able to try your program. When I run it, I get a grey-scale picture of an ugly Arch Linux Moderator.
ewaller@turing ~ 1001 %glxinfo|egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
ewaller@turing ~ 1002 %
Curious. What are the output of :
pacman -Q opencv
uname -a
pacman -Q linux
Are you running this from a console, Xorg or Wayland? I am running inside Xorg under i3wm
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
When I had been helping you before I was ssh'ing into my box from work, thus I could not actually run your program.
I am at home today and was able to try your program. When I run it, I get a grey-scale picture of an ugly Arch Linux Moderator.ewaller@turing ~ 1001 %glxinfo|egrep "OpenGL vendor|OpenGL renderer" OpenGL vendor string: Intel Open Source Technology Center OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile ewaller@turing ~ 1002 %
Curious. What are the output of :
pacman -Q opencv
uname -a
pacman -Q linuxAre you running this from a console, Xorg or Wayland? I am running inside Xorg under i3wm
➜ ~ pacman -Q opencv
opencv 3.3.1-2
➜ ~ uname -a
Linux Matrix 4.13.11-1-ARCH #1 SMP PREEMPT Thu Nov 2 10:25:56 CET 2017 x86_64 GNU/Linux
➜ ~ pacman -Q linux
linux 4.13.11-1
Running in deepin-terminal in deepin desktop manager
➜ ~ loginctl show-session c2 -p Type
Type=x11
Running form tty2 also result in same errors
Last edited by hellraise007 (2017-11-10 17:38:11)
Offline
Problem solved after I installed everything clean from source . Does this mean arch repositories are hosting out dated packages?
Offline
Don't think so. One thing we had not explored; was your system fully up to date (pacman -Syu) ?
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Pages: 1