Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failed (scn == 3 || scn == 4) #45

Closed
feakuru opened this issue Sep 7, 2017 · 4 comments
Closed

Assertion failed (scn == 3 || scn == 4) #45

feakuru opened this issue Sep 7, 2017 · 4 comments
Labels

Comments

@feakuru
Copy link

feakuru commented Sep 7, 2017

I am currently experiencing this on a Mi 13.3 laptop when trying to run a basic example like:

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()

Complete output:

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 "main.py", line 11, 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

I have checked this from two distributions: a Ubuntu 17.04 and a Kali from a Live USB.

@skvark
Copy link
Member

skvark commented Sep 7, 2017

Did you read the package description? It very clearly states:

IMPORTANT NOTE

MacOS and Linux packages do not support video related functionality (not compiled with FFmpeg).

Unfortunately you'll have to compile OpenCV manually until I get an FFmpeg enabled build working on Linux.

@skvark skvark closed this as completed Sep 7, 2017
@skvark skvark added the invalid label Sep 7, 2017
@feakuru
Copy link
Author

feakuru commented Sep 7, 2017

@skvark sorry, totally missed that. Where do I get instructions to compile opencv manually?

@skvark
Copy link
Member

skvark commented Sep 7, 2017

@feakuru
Copy link
Author

feakuru commented Sep 8, 2017

@skvark thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants