Open sleebapaul opened 6 years ago
If you are up for python, you can do these changes https://github.com/pjreddie/darknet/issues/289#issuecomment-342448358
I've managed to get it to work with android ip camera and added this code, I'm running this in a parallel process which have a shared dictionary with the main process, in the main process there is a loop which takes the next image in the dictionary and loads it in the network just like I did in the comment i linked. I've got the idea from this paste https://pastebin.com/7izkYjRx but converted it to python3 which is seen below.
from urllib.request import urlopen
url = path
while True:
# Use urllib to get the image and convert into a cv2 usable format
with urlopen(url) as imgResp:
imgNp = np.array(bytearray(imgResp.read()), dtype=np.uint8)
img = cv2.imdecode(imgNp, -1)
img_load_dict[str(ix)] = img
ix += 1
We've two inputs for real time detection, from webcam and from a video file. I have an H.264 stream coming from an IP cam. I tried two ways to use it as an input for detection.
Reading stream using OpenCV, and tried to pass each frame for detection. This fails as detector works only on an
Image
class object. The inbuilt function reads only from a filename and thus build anImage
instance.Using the command line prompt, I tried to input a video file which was stored from the stream. There is a real struggle in using Command line wild cards since I was not able to find the docs for that.
I would like to set up an input stream from my IP cam and stream the output to another stream. How to deal with this problem?