Use NPU with USB Webcam?

I have cloned and can successfully run test.py from the RKNN-Toolkit2 GitHub repo, but all of the samples perform inferencing on a static image (dog_224x224.jpg for instance in the TFLite folder). Has anyone stumbled upon some python that instead opens a webcam stream for inferencing on the NPU? Thanks!

Yes, I have lots. IIRC, that test.py uses opencv correct? Use cv2.videocapture(X) where X is the index of your usb webcam. Using Armbian, mine comes up as index 1. So it looks like

cap = cv2.VideoCapture(1)
ret, frame = cap.read()

I currently have .py files for running facial detection and QR code processing on the NPU. Both 1080p at 30fps (my camera doesnt go any higher than 30, hoping I can get more with a better camera)

Forgot to reply on this one @Dbenton …are your USB Webcam projects open source on GitHub? It’s been a while, so I don’t recall exactly what error I faced, but I couldn’t get it to work. (I can understand if it’s not on GitHub, I don’t expect everything to be free.)

It is not but i don’t mind helping. Mine have been created for my job so, unsure if I can just put it out there.

It’s pretty straight forward though, if you can get an opencv stream working with the NPU, all you need is to change the input to opencv from the video file you’re using to where your webcam is (mine is /dev/video1)