ageitgey / ageitgey/face_recognition

OpenCV(4.2.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgcodecs/src/loadsave.cpp:730: error: (-215:Assertion failed) !buf.empty() in function 'imdecode_'

Open
#1,102 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
56.8k
Forks
13.7k
PR merge metrics
No merged PRs in 30d

Description

  • face_recognition version:
  • Python version:
  • Operating System:

I am trying to Process Android phone live stream using OpenCV and Python

This is my code:
import requests
import cv2
import numpy as np

url = "http://192.168.1.14:8080/shot.jpg"

while True:

img_resp = requests.get(url)
img_array = np.array(bytearray(img_resp.content), dtype=np.uint8)
img = cv2.imdecode(img_array, -1)

cv2.imshow("Wireless Attendance Recorder Cam", img)

if cv2.waitkey(1)==27:
    break

This is my error:

error Traceback (most recent call last)
in
9 img_resp = requests.get(url)
10 img_array = np.array(bytearray(img_resp.content), dtype=np.uint8)
---> 11 img = cv2.imdecode(img_array, -1)
12
13 cv2.imshow("Wireless Attendance Recorder Cam", img)

error: OpenCV(4.2.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgcodecs/src/loadsave.cpp:730: error: (-215:Assertion failed) !buf.empty() in function 'imdecode_'

Please help me!!!!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the requests.get and cv2.imdecode calls shown in the issue, checking whether the Android stream response contains image data before decoding. Reproduce the request against the provided URL and determine whether the response is empty or not an image. The issue is done only when the source of the failed decode is identified and a project-relevant fix or clear reproduction is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, python
Domain
computer-vision
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.