Hy devs, im experiencing some kind of video freezing in jetson orin nano 8gb. Initially the video plays, but after some time it freezes saying select timeout warn. I use Sony FCB EV9500L USB Camera. My code in python is like this:
def open_camera_thread(self):
global current_time
flag = 0
# print(self.camera_thread.ident)
while self.cap.isOpened():
if flag:
print(“resumed from:”, datetime.datetime.now().strftime(“%Y-%m-%d %H:%M:%S”))
flag = 0
# print(“active threads =”, threading.active_count() if threading.active_count() > 2 else ‘’)
ret, frame = self.cap.read()
if ret:
frame = cv2.resize(frame, (1280, 750)) # (640,480)
if self.helmet_on:
self.frame_queue.put(frame)
image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
if self.lati is not None and self.longi is not None:
cv2.putText(image, f"LAT:{self.lati}“, (5, 40), cv2.FONT_HERSHEY_SIMPLEX, 0.5,
(0, 255, 255), 2)
cv2.putText(image, f"LON:{self.longi}”, (125, 40), cv2.FONT_HERSHEY_SIMPLEX, 0.5,
(0, 255, 255), 2)
if self.cur_speed is not None and self.cur_distance is not None:
cv2.putText(image, f"{self.cur_speed}kmph", (700, 380), cv2.FONT_HERSHEY_SIMPLEX, 0.6,
(0, 255, 0), 1)
if int(self.cur_speed) > self.maxspeed:
cv2.putText(image, f"{self.cur_speed}kmph", (680, 380), cv2.FONT_HERSHEY_SIMPLEX, 0.6,
(255, 0, 0), 1)
cv2.putText(image, f"Distance: {self.cur_distance}m", (270, 40), cv2.FONT_HERSHEY_SIMPLEX, 0.5,
(0, 255, 255), 2)
# center = (512, 275)
# radius = min(1024, 550) // 64
# cv2.circle(image, center, radius, (255, 0, 0), 1)
cv2.putText(image, ‘+’, (640, 388), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (255, 0, 0), 2)
# cv2.rectangle(image, (499, 262), (525, 288), (255, 0, 0), 2)
# cv2.rectangle(image, (self.rect_x1, self.rect_y1), (self.rect_x2, self.rect_y2), (0, 255, 0), 2)
cv2.putText(image, f"PLACE: {self.display_location}“, (200, 15), cv2.FONT_HERSHEY_SIMPLEX, 0.5,
(0, 255, 255), 2)
current_time = datetime.datetime.now().strftime(”%Y-%m-%d %H:%M:%S")
cv2.putText(image, current_time, (5, 15), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 255), 2)
percentage = self.get_battery_status()
cv2.putText(image, f"{percentage}", (1215, 735), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 9)
img = ImageTk.PhotoImage(Image.fromarray(image))
self.canvas.create_image(0, 0, anchor=tk.NW, image=img)
self.canvas.image = img
else:
print(“suspended”, current_time)
flag = 1
self.cap.release()
pipeline = “gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080,framerate=30/1 ! videoconvert ! appsink”
self.cap = cv2.VideoCapture(pipeline, cv2.CAP_GSTREAMER)
if self.termination_condition:
break
self.cap.release()
please tell me how to solve this freezing. Im using opencv with V4L2 as backend.