DULMEN.net   Follow me on Facebook Contact DULMEN.net  

ProductImage - Programming@DULMEN.net

ProductImage
Webcam application for taking product photos. Images are saved in a predefined folder with the entered product identification followed with a date/time stamp as file name.
The program needs Escapi30.dll (by Jari Komppa, Copyright 2015, http://iki.fi/sol) for accessing the webcam.
 
Features
-Simple GUI with webcam preview
-Capture button only available if a valid SKU number is entered
-Optimized to work in conjunction with the Logitech Webcam Controller and the WMImage tool
-Date, SKU number and a predefined UnitID are stored as metadata inside the photos
-Supports almost all webcam's althoug just a few are capable of focussing on close range
-Tested with SJCAM4000 (J1455), Logitech HD Pro Webcam C920, Asus USB2.0 Webcam
-Can be used in conjunction with WMImage for handling of images
 
Description
For internal use only we needed a simple setup to take pictures of a warehouse inventory with products varying in size from aprox 1cm to 50cm. For this we had a wifi capable touchscreen computer mounted on a mobile workbench available. Previous experiences learned that the Logitech HD Pro Webcam C920 is capable of shooting at close range so even the small products can be framed big enough.
All we needed now was a simple interface allowing the user to scan the products identification code, frame the product and take the picture. These requirements resulted in ProductImage.

It is written to work in conjunction with the WMImage tool wich a.o. can handle local images and send them to a FTP server. The trickiest part was to communicate with a webcam, something I haven't done before.
After some dissapointing tests with AutoHotKey using the Windows avicap32.dll, I found an example written in another scripting language (AutoIt) which used Escapi.dll.
I was used to write AutoHotKey scripts and allthough AutoIt has similar functionality it is also completely different. Luckily there are lots of examples to find in the AutoIt forum and it is very well documented on its wiki pages.

The resulting program can be adjusted within the boundaries of the webcam's specifications and the size of the screen on which it is showed (see the configuration file settings). We needed a full screen interface on a 1280x1024px sized screen which was rotated on its side. This way there was enough room below the webcam frame and the controls for an on-screen keyboard.

The capture button is disabled as long as the text box for the product identification number is empty. After capturing an image and it is saved in a predefined folder the text box is cleared automatically. In our setup we use a barcode scanner for entering the product identification number.

Depending on the capacity of the used computer you can adjust the CameraDelay option in the configuration file. A lower number results in a higher frame rate of the on-screen webcam picture but also uses more rescources. The CameraTimeOut setting is depending strongly on the camera and can be set higher if needed. It only takes a bit longer before a time out error appears when the camera is e.g. disconnected.
 
Screenshots
ProductImage screenshot without zoom slider ProductImage screenshot with zoom slider and zoomed in
 
Commandline options
No command-line options available.
 
Configuration file settings
[ApplicationOptions]
StartMaximized Starts the application full screen (1 = yes/default, 0 = no)
UnitID Unit reference ID (e.g. PU001)
DisplayWidth Width of the image display area in pixels (640 = default)
DisplayHeight Height of the image display area in pixels (480 = default)
[ImageOptions]
ImageWidth Width of the output image in pixels (640 = default)
ImageHeight Height of the output image in pixels (480 = default)
ImageFolder Folder for saving the images (c:\Data\Images = default)
[CameraOptions]
CameraDelay Loop delay between camera request and showing picture in milli seconds (50 = default)
CameraTimeOut Maximum number of loops between camera request and showing picture
CameraNumber Webcam number if more than 1 webcam is available (0 = 1st camera/default)
CameraWidth Width of the camera image in pixels. If bigger than ImageWidth it enables zoom (640 = default)
CameraHeight Height of the camera image in pixels. If bigger than ImageHeight it enables zoom (480 = default)
 
Version history
v1.0 Initial setup (using escapi21.dll)
v1.1 Set focus on SKU input at startup and after capture
v1.1b Experimental camera control functions (using escapi30.dll)
v1.2 Option for displayed picture size
Bugfix 01: camera time-out set from 10 to 25
v1.3 Bugfix 02: Updated webcam control to escapi30.dll
Added camera picture size
Added zoom control when camera image size is bigger than output image size
Improved loop delay (now only a delay between camera request and image show)
Added camera time-out setting
v1.4 Bugfix 03: Changed title from message box to "Error on ProductImage" since the AHK SetTitleMatchMode in WMImage is set to 1 (A window's title must start with the specified WinTitle to be a match)
 
Known bugs
Bug no. Version Fixed in Description
01 v1.1 v1.2 Camera time-out using other webcams than Logitech
02 v1.2 v1.3 Choosing higher image size than 640x480 resulted in upscaled images
03 v1.2 v1.4 When working in conjuction with WMImage and WMImage is set to keep source application maximized also ProductImage error pop-up get maximized.
 
Future enhancements
Maybe add camera controls, allthough this is very depending on the used camera.
 
Download
Please read the legal notice first, allthough you probably heard it before :)


Copyright 2018 DULMEN.net. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY DULMEN.net ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL DULMEN.net OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of DULMEN.net.


You can download ProductImage as a compressed folder containing all files needed. No need to install the software, just unzip, adapt the configuration file ProductImage.ini and run ProductImage.exe.
ProductImage is free for personal and bussiness use and is free to distribute as is as long as the program is not altered and accompanied with the ProductImage text file.

VersionFileSize
v1.4ProductImage_v1.4.zip732,27 KB (749849 bytes)
v1.4ProductImage_v1.4.7z623,99 KB (638969 bytes)
v1.3ProductImage_v1.3.zip734,91 KB (752552 bytes)
v1.3ProductImage_v1.3.7z625,59 KB (640605 bytes)
v1.2ProductImage_v1.2.zip741,78 KB (759583 bytes)
v1.2ProductImage_v1.2.7z649,19 KB (664775 bytes)
 
 
DULMEN.net © v8 2018 - Designed & written by Arno van Dulmen