Connect USB Webcam in Perspective

I am looking to connect a USB webcam into perspective using OpenCV. The moto is to build a application which captures live video stream from the camera and detect part present, part count for moving parts on a conveyor. I am kind of exploring different cost friendly ways of getting this accomplished for a customer. Any thoughts/ideas are greatly appreciated.
Thanks.

Since you asked for ideas, one other option would be to add camera/sensor to detect whether a part is present at the automation/controls layer and then add a Boolean tag which can be read from Ignition. That is what I usually see customers expose when they need this kind of functionality. Of course, this depends on whether you have any existing controls in that area - I know you're trying to minimize costs so what I'm suggesting could be completely stupid.

1 Like

Be aware that you won't be able to access a webcam connected to the Perspective client machine. But if you mean to connect to a gateway machine, then you want this:

When OpenCV and FFmpeg are installed properly on the gateway, this module will load the Java versions of OpenCV's libraries as system.cv2. Unfortunately, OpenCV's use of numpy doesn't translate--you have to use OpenCV's Mat types.

1 Like

This is the log file image after adding camera as the OPC device. Not sure whether its getting any camera feed. How can I view that in perspective app using OpenCV commands?

The web-based gateway log is insufficient for troubleshooting this module, due to DLLs not cooperating with java logging. Please show the lines from the actual wrapper.log text file from shortly after starting the module through the first few camera connection attempts.

Directly, you cannot. If you set up a restreamer device, you'll have access to MJPEG in a Perspective video player component. (You'll have to script player restart any time it ends.)

If you want to call OpenCV itself, you will be responsible for processing all images yourself, and delivering to image components. You may want the WebDev module to help deliver to web clients like Perspective.