# Connect USB Webcam in Perspective

**URL:** <https://forum.inductiveautomation.com/t/connect-usb-webcam-in-perspective/96621>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [September 30, 2024, 5:45pm UTC](https://forum.inductiveautomation.com/t/connect-usb-webcam-in-perspective/96621 "2024-09-30T17:45:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshi.pradnya06](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@joshi.pradnya06](https://forum.inductiveautomation.com/u/joshi.pradnya06)\
**Post date:** [September 30, 2024, 5:45pm UTC](https://forum.inductiveautomation.com/t/connect-usb-webcam-in-perspective/96621/1 "2024-09-30T17:45:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [September 30, 2024, 5:52pm UTC](https://forum.inductiveautomation.com/t/connect-usb-webcam-in-perspective/96621/2 "2024-09-30T17:52:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 30, 2024, 6:08pm UTC](https://forum.inductiveautomation.com/t/connect-usb-webcam-in-perspective/96621/3 "2024-09-30T18:08:28Z")

</div>

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:

> [@Automation Professionals' Image Streamer Driver Module](https://forum.inductiveautomation.com/t/automation-professionals-image-streamer-driver-module/29371):
>
> Automation Professionals is pleased to announce a Release Candidate for its new driver module, supporting the live Network Image transmission format of [Keyence CV-5000](https://www.keyence.com/products/vision/vision-sys/cv-5000/index.jsp) machine vision controllers, plus support for common Network Video streams via [OpenCV](https://opencv.org/). Stream metadata is exposed as OPC items, and the output streams are Motion JPEG. The IP Camera Viewer Component in Vision can consume these streams, making it possible to integrate IP Cameras that don't have MJPEG support or have poor support f…

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.

---

<div class="post-metadata">

**Author:** ![joshi.pradnya06](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@joshi.pradnya06](https://forum.inductiveautomation.com/u/joshi.pradnya06)\
**Post date:** [October 3, 2024, 7:42pm UTC](https://forum.inductiveautomation.com/t/connect-usb-webcam-in-perspective/96621/5 "2024-10-03T19:42:15Z")

</div>

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?

 ![Screenshot 2024-10-03 154127](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/9/a9b74c8463b3f89ad2469b25395d5f7fd74d9329.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 3, 2024, 8:17pm UTC](https://forum.inductiveautomation.com/t/connect-usb-webcam-in-perspective/96621/6 "2024-10-03T20:17:08Z")

</div>

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.

> [@joshi.pradnya06](#):
>
> How can I view that in perspective app using OpenCV commands?

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.
