Beruflich Dokumente
Kultur Dokumente
fswebcam is a small and simple webcam app. It can capture images from
a number of different sources and
perform
simple manipulation on
the captured image. The image can be saved as one or more PNG or JPEG
files.
Installing fswebcam
Firstly, we need to update the system
> sudo apt-get update
>sudo apt-get upgrade
Now installing fswebcam from ubuntu base repository
>sudo apt-get install -y fswebcam
Checking available Camera
> ls -ltrh /dev/video*
it will show all the camera present on you BeagleBoneBlack or ubuntu pc
Testing fswebcam
> fswebcam -r 320x240 -d /dev/video0 capture.jpg
# saturation=32
# contrast=32
# gain=16
# exec uvccapture -v -m -t$((interval)) \
# -B$brightness -S$saturation -C$contrast -G$gain \
# -c$capture \
# -x$width -y$height -o$output
#
# Comment out the following lines if using uvccapture.
#
font=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
exec fswebcam --quiet --skip 14 \
--font $font \--timestamp '%d %b %y %H:%M:%S (%Z)' \
--no-title -r $height\x$width \
--banner-colour '#FF000000' \
--line-colour '#FF000000' \
--exec $capture \
--loop $interval $output
#renaming
timestamp=$(date -u +"%y%m%d-%H:%M:%S")
image=/home/ubuntu32/Desktop/fswebcam/inprocess.jpg
output=/home/ubuntu32/Desktop/fswebcam/capture-$timestamp.jpg
cp $image $output
>chmod +x script_name.su
>./script_name.su
You can even remove #tag from script to change the preferences of capturing
frame and also can include following predefine function in library of
fswebcam to edit the script.
Configuration File
Config files use the long version of options without the "--" prefix.
Comments start with a # symbol at the beginning of the line.
General Options
-?, --help
Show a usage summary.
-c, --config
Load options from a file. You can load more than one config
file, and can mix them with command-line arguments.
Note: This option can not be used from
file.
within
configuration
-q, --quiet
Hides all messages except errors.
-v, --verbose
Print extra information during the capture process.
--version
Print the version number and exit.
-l, --loop <frequency>
Continually capture images. The time between images is specified
in seconds.
Default behaviour is to capture a single image and exit.
Note: The time to capture the next image is calculated relative
to the epoch, so an image will not be captured immediately when
the program is first started.
--offset <seconds>
Sets the offset to use when calculating when the next
due in loop mode. Value can be positive or negative.
image
is
-b, --background
Run in the background. In this mode stdout and console logging
are unavailable.
--pid <filename>
Saves the PID of the background process to the
Ignored when not using background mode.
specified
file.
--log [file/syslog:]<filename>
Redirect log messages to a file or syslog. For example
--log output.log
--log file:output.log
--log syslog
--gmt
Use GMT instead of the local timezone when formatting text with
strftime.
Capture Options
-d, --device [<prefix>:]<device name>
Set the source or device to use. The source module
automatically unless specified in the prefix.
is
selected
Default is /dev/video0.
Available source modules, in order of preference:
V4L2 - Capture images from a V4L2 compatible video device.
V4L1 - Capture images from a V4L1 compatible video device.
FILE - Capture an image from a JPEG or PNG image file.
RAW - Reads images straight from a device or file.
TEST - Draws colour bars.
-i, --input <input number or name>
Set the input to use. You may select an input by either its
number or name.
Default is "0".
--list-inputs
List available inputs for the selected source or device.
fswebcam -d v4l2:/dev/video1 --list-inputs
-t, --tuner <tuner number>
Set the tuner to use.
-f, --frequency <frequency>
Set the frequency of the selected input or tuner. The value
be read as KHz or MHz depending on the input or tuner.
may
BGR24
YUYV
UYVY
YUV420P
BAYER
RGB565
RGB555
GREY
-r, --resolution <dimensions>
Set the image resolution of the source
resolution used may differ if the
capture at the specified resolution.
Default is "384x288".
--list-framesizes
Lists the supported resolutions for the selected source.
--list-framerates
Lists the supported frame rates
resolution.
for
the
selected
source
and
vary
more
--list-controls
List available controls and their current values
selected source module and device. For example:
for
the
information.
Default is "#00FF0000".
--text-colour <#AARRGGBB>
Set the colour of
information.
the
text.
See
--banner-colour
for
more
Default is "#00FFFFFF".
--font <[file or font name]:[font size]>
Set the font used in the banner. If no path is specified the
path in the GDFONTPATH environment variable is searched for the
font.
If no font size is specified the default of "10" will be used.
Default is "luxisr:10".
--no-shadow
Disable the text shadow.
--shadow
Enable the text shadow.
This is the default behaviour.
--title <text>
Set the main text, located in the top left of the banner.
--no-title
Clear the main text.
--subtitle <text>
Set the sub-title
banner.
text,
located
in
the
--no-subtitle
Clear the sub-title text.
--timestamp <text>
Set the timestamp text, located in the top right of the
This string is formatted by strftime.
banner.
and
is
--no-underlay
Clear the underlay image.
--overlay <filename>
Load a PNG image and overlay on the image, above the banner. The
image is aligned to the top left.
Note: The overlay is only applied when saving an image
not modified by any of the image options or effects.
and
is
--no-overlay
Remove the overlay image.
--jpeg <factor>
Set JPEG as the output image format. The compression factor is a
value between 0 and 95, or -1 for automatic.
This is the default format, with a factor of "-1".
--png <factor>
Set PNG as the output image format. The compression
be a value between 0 and 9, or -1 for automatic.
factor
can
--save <filename>
Saves the image to the specified filename.
Note: This isnt necessary on the command-line where a filename
alone is enough to save an image.
--revert
Revert to the original captured image and
undoes all previous effects on the image.
resolution.
This
Note: This only reverts the image itself, and not options such
as font, colours and overlay.
--flip <direction[,direction]>
Flips the image. Direction can be
Example:
--flip h
--flip h,v
(h)orizontal
or
(v)ertical.
--crop <dimensions[,offset]>
Crop the image. With no offset the cropped area will be the
center of the image. Example:
--crop 320x240
--crop 10x10,0x0
the image.
--scale <dimensions>
"--scale
640x480"
scales
the
image
up
or down to
image
90
or
270
degrees
will
swap
the
--deinterlace
Apply a simple deinterlacer to the image.
--invert
Invert all the colours in the image, creating a negative.
--exec <command>
Executes the specified command and waits for it to complete
before continuing. The command line is formatted by strftime.