This functionality is especially of interest for monitoring invisible spots on the layout, for example shadow stations.
USB WebCams can be used and are low priced; High Definition WebCams are not needed for this purpose. For testing purpose a Logitech C170 has been used which comes for about €20,-.
Rocview will not show the WebCam as a movie but as still pictures with a definable refresh interval which is OK to see what is happening.
An external capturing program is needed to provide the still pictures to make this functionality for Rocrail Operating System independent; See the Script paragraph.
The content of the text object must point to the WebCam picture.
The Refresh time in ms must have a value of at least 100. A good value is 500.
Resizing of the text object can be done with the cx and cy grid values on the General tab.
The tool WACAW is used on a Mac to capture a still picture of a WebCam.
#!/bin/bash while : do if [ ! -f /Users/rob/webcam1/picture.png ]; then echo "Snapping a new picture of the webcam..." ./wacaw -d 2 --png /Users/rob/webcam1/_picture mv /Users/rob/webcam1/_picture.png /Users/rob/webcam1/picture.png fi sleep 0.25 done
(Do not forget to make this new script executable with chmod +x webcam1.sh.)
If the color of the captured pictures is bad the -n parameter must be used:
./wacaw -d 2 -n 5 --png /Users/rob/webcam1/picture
With the -L command line option the device list ist shown:
./wacaw -L There are 3 devices in the list. The current selection is 2. 0 - DV Video [is available] [has no inputs] 1 - IIDC FireWire Video [is available] [has no inputs] 2 - USB Video Class Video [is available] [has inputs] There are 1 inputs for this device (2). The current selection is 0. 0 - Webcam C170 [is available]
In this example the device number to use is 2: -d 2.
Under Linux the avconv tool can be used to capture pictures:
sudo apt-get install libav-tools
#!/bin/bash while : do if [ ! -f /home/rob/webcam1/picture.png ]; then echo "Snapping a new picture of the webcam..." avconv -f video4linux2 -i /dev/video1 -frames 1 /home/rob/webcam1/_picture.png mv /home/rob/webcam1/_picture.png /home/rob/webcam1/picture.png fi sleep 0.25 done
a list of video devices will be shown.
If the PC/Laptop ha a build-in camera this will show up as /dev/video0.
The first external WebCam will be in this case /dev/video1.
This script has not been tested and uses Irfanview as capture tool.
:startallover IF NOT exist "C:\webcam1\picture.png"\ ( REM Change the Twain Source REM http://www.gssezisoft.com/Products/CmdTwain/Download/SetTwainSource.zip REM cscript.exe SetTwainSource.vbs driver i_view32.exe /scanhidden /dpi=(150,150) /convert="C:\webcam1\picture.png" ) ping -n 1 127.0.0.1 > NULL GOTO startallover
The folowing Batch script used commandcam.exe for grabbing and bmp2png.exe for picture converting and was successful tested.
This files require less resources than IrfanView.
echo off :start if exist picture.png goto start commandcam.exe /quiet /filename picture.bmp /delay 10 bmp2png.exe -Q picture.bmp goto start
Remark: The code above need that all files are placed in the same folder.
Otherwise, the path information corresponding to the different directories have to be supplemented.
Informations to the installed video hardware may so be requested:
If multiple video devices are installed, an additional option can select the device.
In this example the device number "2":
... commandcam.exe /quiet /filename picture.bmp /delay 10 /devnum 2 ...
Only one at a time of both programs, wacaw (or any other capturing program) and Rocview, should access the picture file to avoid invalid images.