Before reading this article, please review Getting Started with Vision to get an understanding of Vision's functionalities & requirements, and for instructions on how to setup your camera.
Change Detector Overview
Using the change detector, you can monitor pre-defined regions on your camera's stream for changes occurring in real-time. You can then use these changes, or events, to build logic within your app.
In this article you will learn...
- How to setup a Change Detector
- Using the Change Detector in an app
- How to adjust the Settings of a Change Detector
Setting up the Change Detector
After completing your camera configuration setup, you should see the video stream of a station like this:
To set-up the change detector, you'll want to select the region that you want to monitor for changes. To do this, click and drag you mouse to define your region:
Then you'll want to give the region a name.
Next, try to make a change in this region, for example by putting your hand inside it.
As seen above, the Change Detector Region has changed color, showing that the detector has recorded as a change.
The region will turn green based on the "Begin changes threshold". If this threshold is 50%, then there must be a detected change in at least 50% of the region for the color to turn from red to green. It's as this point that an event will triggered in the app that is using this Camera Configuration.
Try adjusting the "Begin changes threshold" and the size of the region, so that the region turns green when your hand is inside the region.
Using the Change Detector in an App
Switch over to your app editor, and create a new Device Output Trigger.
All Camera Configurations will appear under the sub-list of Specific device. Please select your Camera Configuration from the dropdown.
Note, that the Specific device section allows you to use multiple cameras in the same app. Any station that runs this app must have the specific Camera Configuration that you selected for the camera. Otherwise, a warning will be shown when the app runs.
Now you will see a dropdown of various events to run the trigger off of:
For this example, select Changes Began from the list of events.
Next, add a trigger action to Show Message, when the Change Detector detects the event. The Device Output data will hold the name you gave to the region:
Please save your trigger now. Before running the app, let's add a Vision Camera Widget to show the video stream for your Camera Configuration from within the app.
To do this select Camera, then Vision Camera:
Click and drag to adjust the size and placement of the widget:
On the right side panel please select your Camera Configuration. Note: The "Show Overlay" option allows you to disable showing the regions on top of the video. Please keep this enabled for now.
It's finally time to run your app. Please run it at the station to which you assigned your Camera Configuration.
When opening the step with the Vision Camera Widget in your Player, you will see the video stream of the camera:
When you move your hand inside the region, the region will turn green, and the message with the region name will be shown:
Change Detector Region Settings
You will likely need to adjust a region's settings to yield results that fit your use case appropriately. To edit your region's settings, click on your Camera Configuration and select the regions you wish to adjust.
The following settings are available:
Begin Changes Threshold
This is the percentage of the region area that is required to change for a 'Changes Began' event to occur. If, for example, you have a smaller region and your hand is expected to fully cover the region, you may set this value to a higher value like 70%.
Upper & Lower Threshold
This defines the depth range you'd like to monitor.
The Surface is what the depth camera captures inside your region. In our sample images above, it's the yellow bin. The Upper & Lower Threshold are both set relative to this surface.
Objects closer to the camera than the Upper Threshold will be ignored by the Change Detector. (Ex: If an operator's arm that is moving above the region, no event will be triggered.)
Similarly, objects -- and more importantly noise -- father way from the camera then the Lower Threshold will also be ignored. Due to technical limitations, there is noise in the data reported by the depth camera. The further away the region is from the camera the higher the noise will be. If you see flickering in your region, increase the Lower Threshold.
How quickly the region adapts to noise and changes which are too small to trigger 'Changes Began' events. Note, with the 'No adaptation' setting, noise and small changes will accumulate over time.
Reset When Changes End
When enabled, this makes detecting subsequent changes more robust incase the region content remains changed, even after a 'Changes Ended' event occurs.
The time it takes to reset the region. No 'Changes Began' events can occur while resetting is in progress.