text:text-webcam-en
Differences
This shows you the differences between two versions of the page.
| — | text:text-webcam-en [2023/01/15 07:46] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Text WebCam Support ====== | ||
| + | [[: | ||
| + | [[: | ||
| + | * **[[: | ||
| + | \\ | ||
| + | |||
| + | =====Introduction===== | ||
| + | {{ http:// | ||
| + | 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 [[http:// | ||
| + | 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; | ||
| + | |||
| + | \\ | ||
| + | |||
| + | =====Text Setup===== | ||
| + | {{: | ||
| + | |||
| + | The content of the text object must point to the WebCam picture.\\ | ||
| + | The __**[[: | ||
| + | Resizing of the text object can be done with the **cx** and **cy** grid values on the General tab.\\ | ||
| + | {{: | ||
| + | \\ | ||
| + | |||
| + | =====Capturing Script===== | ||
| + | Replace < | ||
| + | ====macOS==== | ||
| + | The tool [[http:// | ||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | while : | ||
| + | do | ||
| + | if [ ! -f / | ||
| + | echo " | ||
| + | ./wacaw -d 2 --png / | ||
| + | mv / | ||
| + | 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: | ||
| + | <code bash> | ||
| + | ./wacaw -d 2 -n 5 --png / | ||
| + | </ | ||
| + | |||
| + | \\ | ||
| + | ===Detecting the device number=== | ||
| + | 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**.\\ | ||
| + | |||
| + | \\ | ||
| + | |||
| + | ====Linux==== | ||
| + | Under Linux the **ffmpeg** tool can be used to capture pictures: | ||
| + | < | ||
| + | sudo apt install ffmpeg | ||
| + | </ | ||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | while : | ||
| + | do | ||
| + | if [ ! -f / | ||
| + | echo " | ||
| + | ffmpeg -f video4linux2 -i /dev/video1 -frames 1 / | ||
| + | mv / | ||
| + | fi | ||
| + | sleep 0.25 | ||
| + | done | ||
| + | </ | ||
| + | ===Devices=== | ||
| + | With | ||
| + | < | ||
| + | ls /dev/video* | ||
| + | </ | ||
| + | a list of video devices will be shown.\\ | ||
| + | If the PC/Laptop ha a build-in camera this will show up as **/ | ||
| + | The first external WebCam will be in this case **/ | ||
| + | |||
| + | |||
| + | \\ | ||
| + | |||
| + | ====Windows==== | ||
| + | * https:// | ||
| + | |||
| + | This script has not been tested and uses Irfanview as capture tool.\\ | ||
| + | <code batch> | ||
| + | : | ||
| + | IF NOT exist " | ||
| + | REM Change the Twain Source | ||
| + | REM http:// | ||
| + | REM cscript.exe SetTwainSource.vbs driver | ||
| + | | ||
| + | i_view32.exe /scanhidden / | ||
| + | | ||
| + | ) | ||
| + | ping -n 1 127.0.0.1 > NULL | ||
| + | GOTO startallover</ | ||
| + | ==Alternative== | ||
| + | The folowing Batch script used **commandcam.exe** for grabbing and **bmp2png.exe** for picture converting and was successful tested.\\ | ||
| + | * Download: | ||
| + | * https:// | ||
| + | * http:// | ||
| + | This files require less resources than IrfanView. \\ | ||
| + | <code batch> | ||
| + | echo off | ||
| + | :start | ||
| + | if exist picture.png goto start | ||
| + | commandcam.exe /quiet /filename picture.bmp /delay 10 | ||
| + | bmp2png.exe -Q picture.bmp | ||
| + | goto start | ||
| + | </ | ||
| + | > | ||
| + | Informations to the installed video hardware may so be requested: | ||
| + | < | ||
| + | commandcam.exe / | ||
| + | </ | ||
| + | If multiple video devices are installed, an additional option can select the device. \\ | ||
| + | In this example the device number " | ||
| + | < | ||
| + | ... | ||
| + | commandcam.exe /quiet /filename picture.bmp /delay 10 /devnum 2 | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | |||
| + | =====File Handshake===== | ||
| + | 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.\\ | ||
| + | - The script will capture a picture and store it in the picture.png file. | ||
| + | - Rocview will read and show it. | ||
| + | - Rocview deletes the picture.png. | ||
| + | - The script detect that the picture.png is deleted and will capture the next picture of the WebCam. | ||
| + | - Goto step 2... | ||