Hello everyone,
I am facing a problem with object detection using ESP32-CAM. I tried to run the object detection code but nothing is happening and no window is popping up for detecting objects. I have tried many troubleshooting techniques but nothing seems to be working. However, when I use IP Webcam app in my mobile and use that URL for OpenCV, it's working perfectly fine.
I have tried object detection with ESP32-CAM and it was not working, so I wanted to check with Mobile IP Webcam to see if object detection is working or not with the mobile app. After running the Python program, it was able to identify the objects and it was working fine but when I run the same code and change the URL with ESP32-CAM, nothing is happening. I have bought another ESP32-CAM and even with that, it's not working.
I am very confused and frustrated as I have seen in YouTube videos that it's working for them. I thought there was a problem with my system, so I used another system, but even there, it's not working.
Here is the code that I am using:
import cv2
import cvlib as cv
from cvlib.object_detection import draw_bbox
import numpy as np
import urllib.request
url = 'http://192.168.0.0:0/video'
while True:
try:
with urllib.request.urlopen(url) as url_response:
break
except urllib.error.URLError:
continue
cap = cv2.VideoCapture(url)
cv2.namedWindow("Object Detection", cv2.WINDOW_NORMAL)
while True:
ret, frame = cap.read()
if not ret:
break
bbox, label, conf = cv.detect_common_objects(frame)
output_image = draw_bbox(frame, bbox, label, conf)
cv2.imshow("Object Detection", output_image)
if cv2.waitKey(1) == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Please note that I have replaced the IP address with zeroes for privacy reasons.
If anyone can help me with this issue, I would be very grateful. Thank you in advance