How to show a web cam output instead of a video on Vizi-AI

Reading Time: 5 minutes

After successfully registering your Vizi-Ai using the ADLINK vizi-ai-starter-kit template from the Edge Profile Builder, you will be able to view the stock video playing with inferenced results. If you want to record real-world content, you’ll need to switch to using a web cam. As standard we support most generics USB web cams, however in this article we’ll be using the Logitech c720.

How do I enable my web cam and use it?

The guide below will comprehensively show you how to set everything up and ensure it is configured perfectly, however here is a short video that also provides you with a how to guide, for further information please refer to the detailed instructions below.

Below is an example device, my-vizi-ai, in the devices tab of the Edge Profile Builder. This device has been registered and deployed with the vizi-ai-starter-kit template profile.

To make changes to the template profile, you’ll first need to create a project and download the profile to your local Edge Profile Builder environment. Browse to the Projects tab, and select Create Project.

Enter a Project title and Description and click Create.

In the Projects tab, click Download profile.

Scroll and select the ‘vizi-ai-starter-kit’ and click Next.

In the Project drop-down choose the project created earlier and click Download.

The download may take some time depending on your internet connection.

When the download is complete click Finish.

Please note:

When your device was originally registered and deployed with the template profile, a copy of this profile was added to your chosen IoT-Hub behind the scenes. This new profile was created specifically for you to use in your IoT Hub, keeping the name of the template profile and adding a suffix of your registered Vizi-Ai device name (E.g. vizi-ai-starter-kit-rb-test-56). This helps you to easily find a device if you’re using multiple Vizi-Ai’s on the same IoT Hub.

Configuring the profile to enable your web cam

Within the Projects tab select the new project and then select the downloaded profile tile to continue.

This profile contains applications that make up the vizi-ai-starter-kit. Select the Frame Streamer application to begin configuration and setup of your web cam.

The configuration page for the Frame Streamer application has a variety of settings that can be edited as required: The default setting for this application uses the video source file, and below this you can see the name of the mp4 that is currently playing on your Vizi-Ai device.

To enable the web cam on your Vizi-Ai, please change the following options: * videoSourceOption to device * identifier to “0”

This options are required, as Debian Linux (which is the base operating system for Linux) gives devices an ID number, which is used to identify and enable devices to be passed to applications for use. After successfully making these changes, select the Save changes button.

The next step is to mount the physical device 0 to our application within the Vizi-Ai. To do this, select the Docker tab within the Frame streamer application.

The Docker tab for the Frame Streamer application should look like the image below:

The Frame Streamer application’s docker container network is set to use the network interface on your Vizi-Ai, E.g. the ethernet port as directed in the getting started guide.

To mount the physical USB camera to the container, change the contents of the docker create options box to the following:

{
	"NetworkingConfig": {
		"EndpointsConfig": {
			"host": {}
		}
	},
	"HostConfig": {
		"NetworkMode": "host",
		"LogConfig": {
			"Type": "json-file",
			"Config": {
				"max-file": "10",
				"max-size": "1m"
			}
		},
		"Devices":[
		   {
		      "PathOnHost": "/dev/video0",
		      "PathInContainer": "/dev/video0",
		      "CgroupPermissions": "rwm"
		}
		   ]
	}
}

The following image shows an example of what your Docker tab should now look like:

Once complete, save your changes and select the Close button.

Deploying the updated profile

After making changes to the Frame Streamer application, we‘re now ready to deploy these changes to our Vizi-Ai. From the project profile page, select Deploy as shown below:

You are then presented with three options to deploy your profile. Select Deploy directly to a device and click Next.

Please note:

If your web cam was not plugged in when you started your Vizi-Ai, we recommend plugging it in to one of the USB3.0 ports and restarting your Vizi-Ai before continuing to the next step.

You are then given the option to select the device that you want to deploy your profile directly too.

Select the device and click deploy.

Once you see the green Success notification at the bottom of the screen this means your profile has successfully been sent to the device, it may take a minute or two for the profile to be deployed, you can now click Close to exit the deployment option.

ADLINK’s Stream Viewer app allows a user to take the frames that have been captured and merge them together into an RTSP stream, commercial tools can be used to view this stream however we have incorporated into Edge Profile Builder the ability to view this stream.

To get started navigate to the Vision tab:

Select the Streams tab.

Select to view the demoStream which is produced by the Vizi software described above.

You may see a spinning icon for a short amount of time, this is while Profile Builder is connecting to the Stream Viewer app and initiating the process of communication with the Data River, we don’t set the Stream Viewer to do this all of the time to save processing on the Data River.

Once your stream has been detected you will be shown the outputs from what we have just provisioned on your Vizi.

Stay in touch

Sign up to our email list to be notified of the latest industry news