I wanted to take photos of people or animals as they passed a camera as training material for Azure Cognitive Services Vision applications. I wrote Windows 10 IoT Core Universal Windows Platform (UWP) background task to capture images when a digital input was strobed and store them on the local file system of a Raspberry Pi or DragonBoard 410C device.
Like my Windows 10 IoT Core Timelapse Camera projects the first version was pretty rough so for the next version I moved all the configuration to an appsettings file and added the ability to format image file and folder names.
By changing the image\folder name format strings I could "bucket" the images by hour\day\month etc. to make management and searching easier.
I found the position of the infrared, proximity, or beam break sensor to be critical as there was a small delay taking the photo and/or saving the image. Quite a bit of trial and error was necessary to get useful pictures.
{
"AzureStorageConnectionString": "",
"InterruptPinNumber": 115,
"interruptTriggerOn": "RisingEdge",
"AzureContainerNameFormatLatest": "current",
"AzureImageFilenameFormatLatest": "{0}.jpg",
"AzureContainerNameFormatHistory": "historic",
"AzureImageFilenameFormatHistory": "{0}/{2:yyMMddHHmmss}.jpg",
"DebounceTimeout": "00:00:30"
}
When the application starts up for the first time it creates an empty appsettings file that you can download using either Powershell or the file explorer in the Windows device portal.
The first version used a passive infrared sensor which was pretty useless. It was not terribly sensitive and slow to trigger.
After some field trials I found an infrared proximity or beam break sensor worked pretty well and was easy to mount by/across the door. I also experimented with different types of camera to see which ones worked well if the subjects were moving quickly and in low light conditions.
After running the program for a while I found managing many files and folders on the device was painfull so I cloned the application and built a new application which uploaded the images to Azure Storage.
As a result the configuration file gained a few extra settings. The DebounceTimeout specifies the minimum time between photos, I found a couple of the sensors I tested would briefly trigger a couple of times as the subject entered and exited sensing range. (The sensor equivalent of contact bounce.)
{
"AzureStorageConnectionString": "",
"InterruptPinNumber": 115,
"interruptTriggerOn": "RisingEdge",
"AzureContainerNameFormatLatest": "current",
"AzureImageFilenameFormatLatest": "{0}.jpg",
"AzureContainerNameFormatHistory": "historic",
"AzureImageFilenameFormatHistory": "{0}/{2:yyMMddHHmmss}.jpg",
"DebounceTimeout": "00:00:30"
}
The client application creates containers and files as required.
This project doesn't include details of the installation and configuration of Windows 10 IoT Core or the deployment of applications as this has been covered by other authors.
Make sure to test your configuration as the rules for naming storage containers, folders and files have tripped me up.
These applications are the basis for my Azure Cognitive Services Vision Computer Vision, Face and Custom Vision Windows 10 IoT Core client applications.
Comments