python and cv2 error Announcing the arrival of Valued Associate #679: Cesar Manara ...

Grounding PCB Within Aluminum Enclosure

How to mute a string and play another at the same time

Why is ArcGIS Pro not symbolizing my entire range of values?

Can a Knight grant Knighthood to another?

Converting a text document with special format to Pandas DataFrame

A journey... into the MIND

Why does my GNOME settings mention "Moto C Plus"?

Does using the Inspiration rules for character defects encourage My Guy Syndrome?

Why did Israel vote against lifting the American embargo on Cuba?

Can the van der Waals coefficients be negative in the van der Waals equation for real gases?

Kepler's 3rd law: ratios don't fit data

Reflections in a Square

xkeyval -- read keys from file

Does GDPR cover the collection of data by websites that crawl the web and resell user data

Can Deduction Guide have an explicit(bool) specifier?

Unix AIX passing variable and arguments to expect and spawn

Etymology of 見舞い

How to break 信じようとしていただけかも知れない into separate parts?

Putting Ant-Man on house arrest

BV functions and wave equation

Meaning of "Not holding on that level of emuna/bitachon"

Does the Pact of the Blade warlock feature allow me to customize the properties of the pact weapon I create?

Do chord progressions usually move by fifths?

Why do people think Winterfell crypts is the safest place for women, children & old people?



python and cv2 error



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Error while installing python setuptoolsPython error In linuxError running Python program: Demystify error messagelINUX PYTHON not found errorPython importing modules errorPip/Python six.add_metaclass errorPython 3 installing by source code errorInstalling Python Torch and Style Transfer Errorpython/276/bin/python: Exec format error. Wrong ArchitectureFatal Python Error: Segmentation Fault





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















this is my code



import cv2
import time

#point to the haar cascade file in the directory
cascPath = "haarcascade.xml"
faceCascade = cv2.CascadeClassifier(cascPath)

#start the camera
video_capture = cv2.VideoCapture(0)

#give camera time to warm up
time.sleep(0.1)

#start video frame capture loop
while True:
# take the frame, convert it to black and white, and look for facial features
ret, frame = video_capture.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# use appropriate flag based on version of OpenCV
if int(cv2.__version__.split('.')[0]) >= 3:
cv_flag = cv2.CASCADE_SCALE_IMAGE
else:
cv_flag = cv2.cv.CV_HAAR_SCALE_IMAGE

faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=5,
minSize=(30, 30),
flags=cv_flag
)

#for each face, draw a green rectangle around it and append to the image
for (x, y, w, h) in faces:
cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)

#display the resulting image
cv2.imshow('Video', frame)

#set "q" as the key to exit the program when pressed
if cv2.waitKey(1) & 0xFF == ord('q'):
break

# clear the stream capture
video_capture.release()
cv2.destroyAllWindows()


and this is the error I get



Traceback (most recent call last):
File "assets/scripts/face.py", line 31, in <module>
flags=cv_flag
cv2.error: OpenCV(4.1.0) /io/opencv/modules/objdetect/src/cascadedetect.cpp:1658: error: (-215:Assertion failed) !empty() in function 'detectMultiScale'


any ideas anyone










share|improve this question







New contributor




TIBTHINK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    0















    this is my code



    import cv2
    import time

    #point to the haar cascade file in the directory
    cascPath = "haarcascade.xml"
    faceCascade = cv2.CascadeClassifier(cascPath)

    #start the camera
    video_capture = cv2.VideoCapture(0)

    #give camera time to warm up
    time.sleep(0.1)

    #start video frame capture loop
    while True:
    # take the frame, convert it to black and white, and look for facial features
    ret, frame = video_capture.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    # use appropriate flag based on version of OpenCV
    if int(cv2.__version__.split('.')[0]) >= 3:
    cv_flag = cv2.CASCADE_SCALE_IMAGE
    else:
    cv_flag = cv2.cv.CV_HAAR_SCALE_IMAGE

    faces = faceCascade.detectMultiScale(
    gray,
    scaleFactor=1.1,
    minNeighbors=5,
    minSize=(30, 30),
    flags=cv_flag
    )

    #for each face, draw a green rectangle around it and append to the image
    for (x, y, w, h) in faces:
    cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)

    #display the resulting image
    cv2.imshow('Video', frame)

    #set "q" as the key to exit the program when pressed
    if cv2.waitKey(1) & 0xFF == ord('q'):
    break

    # clear the stream capture
    video_capture.release()
    cv2.destroyAllWindows()


    and this is the error I get



    Traceback (most recent call last):
    File "assets/scripts/face.py", line 31, in <module>
    flags=cv_flag
    cv2.error: OpenCV(4.1.0) /io/opencv/modules/objdetect/src/cascadedetect.cpp:1658: error: (-215:Assertion failed) !empty() in function 'detectMultiScale'


    any ideas anyone










    share|improve this question







    New contributor




    TIBTHINK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      this is my code



      import cv2
      import time

      #point to the haar cascade file in the directory
      cascPath = "haarcascade.xml"
      faceCascade = cv2.CascadeClassifier(cascPath)

      #start the camera
      video_capture = cv2.VideoCapture(0)

      #give camera time to warm up
      time.sleep(0.1)

      #start video frame capture loop
      while True:
      # take the frame, convert it to black and white, and look for facial features
      ret, frame = video_capture.read()
      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
      # use appropriate flag based on version of OpenCV
      if int(cv2.__version__.split('.')[0]) >= 3:
      cv_flag = cv2.CASCADE_SCALE_IMAGE
      else:
      cv_flag = cv2.cv.CV_HAAR_SCALE_IMAGE

      faces = faceCascade.detectMultiScale(
      gray,
      scaleFactor=1.1,
      minNeighbors=5,
      minSize=(30, 30),
      flags=cv_flag
      )

      #for each face, draw a green rectangle around it and append to the image
      for (x, y, w, h) in faces:
      cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)

      #display the resulting image
      cv2.imshow('Video', frame)

      #set "q" as the key to exit the program when pressed
      if cv2.waitKey(1) & 0xFF == ord('q'):
      break

      # clear the stream capture
      video_capture.release()
      cv2.destroyAllWindows()


      and this is the error I get



      Traceback (most recent call last):
      File "assets/scripts/face.py", line 31, in <module>
      flags=cv_flag
      cv2.error: OpenCV(4.1.0) /io/opencv/modules/objdetect/src/cascadedetect.cpp:1658: error: (-215:Assertion failed) !empty() in function 'detectMultiScale'


      any ideas anyone










      share|improve this question







      New contributor




      TIBTHINK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      this is my code



      import cv2
      import time

      #point to the haar cascade file in the directory
      cascPath = "haarcascade.xml"
      faceCascade = cv2.CascadeClassifier(cascPath)

      #start the camera
      video_capture = cv2.VideoCapture(0)

      #give camera time to warm up
      time.sleep(0.1)

      #start video frame capture loop
      while True:
      # take the frame, convert it to black and white, and look for facial features
      ret, frame = video_capture.read()
      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
      # use appropriate flag based on version of OpenCV
      if int(cv2.__version__.split('.')[0]) >= 3:
      cv_flag = cv2.CASCADE_SCALE_IMAGE
      else:
      cv_flag = cv2.cv.CV_HAAR_SCALE_IMAGE

      faces = faceCascade.detectMultiScale(
      gray,
      scaleFactor=1.1,
      minNeighbors=5,
      minSize=(30, 30),
      flags=cv_flag
      )

      #for each face, draw a green rectangle around it and append to the image
      for (x, y, w, h) in faces:
      cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)

      #display the resulting image
      cv2.imshow('Video', frame)

      #set "q" as the key to exit the program when pressed
      if cv2.waitKey(1) & 0xFF == ord('q'):
      break

      # clear the stream capture
      video_capture.release()
      cv2.destroyAllWindows()


      and this is the error I get



      Traceback (most recent call last):
      File "assets/scripts/face.py", line 31, in <module>
      flags=cv_flag
      cv2.error: OpenCV(4.1.0) /io/opencv/modules/objdetect/src/cascadedetect.cpp:1658: error: (-215:Assertion failed) !empty() in function 'detectMultiScale'


      any ideas anyone







      linux python






      share|improve this question







      New contributor




      TIBTHINK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      TIBTHINK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      TIBTHINK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 5 hours ago









      TIBTHINKTIBTHINK

      1




      1




      New contributor




      TIBTHINK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      TIBTHINK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      TIBTHINK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          TIBTHINK is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1428330%2fpython-and-cv2-error%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          TIBTHINK is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          TIBTHINK is a new contributor. Be nice, and check out our Code of Conduct.













          TIBTHINK is a new contributor. Be nice, and check out our Code of Conduct.












          TIBTHINK is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1428330%2fpython-and-cv2-error%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Cannot install PyQt5 The Next CEO of Stack OverflowCannot install tcpreplay 3.4.4cannot...

          Kapp-Putsch Acontecimentos | Outros artigos | Menu de navegação

          Why did early computer designers eschew integers? The Next CEO of Stack OverflowWhat register...