Table of Contents


margrabber - program to display signal from crystal camera of the mardtb (desktop beamline)


margrabber [ OPTION ]


margrabber is a Motif-based graphical user interface for displaying the crystal as recorded by the video camera of the dtb. The program allows to record single photos. The program relies on the v4l2 (Video for Linux 2) interface. Hence, the program is available only for Linux. Program version 2 also cooperates with program mar345dtb.


-a, --avg N
When shooting photos, average N images before writing photo to disk.
Default: --avg 1

-c, --color RGB|GREY|YUV420|UYVY|YUYV
This refers to the format of the frame grabber signal. To watch TV in color, choose RGB (32 bits per pixel) or YUV420 (16 bits per pixel). GREY means 8-bits/pixel and needs less data from the frame grabber card. When using RGB, pixels can be copied directly onto the display. For GREY and YUV420 pixel data need to be rearranged producing some CPU load. Modes UYVY and YUYV are other types of packed pixel information. The following shortcuts are available:
-grey = --color GREY
-rgb = --color RGB
-yuv = --color YUV420
-uyvy = --color UYVY
-yuyv = --color YUYV
Default: --color RGB

Do not read configuration file ($MARTABLEDIR/mardtb.$MAR_DTB_NO).
Default: Try to read configuration file.

--dev DEVICE
Video device name.
Default: --dev /dev/video

-d, --debug
Turn on program debugging information
Default: turned off

-f, --format JPG|PNG|PGM
Write photos in either jpg, png or pgm format. File format JPG is smaller then png due to (lossy) compression. PGM is uncompressed grey-scale only. The following shortcuts are available:
-jpg = --format jpg
-png = --format png
-pgm = --format pgm
Default: --format jpg

-geo, --geometry WIDTHxHEIGHT[+X+Y]
Width and height and location of the main window at program startup.
Default: leave to window manager

-h, --help
Prints usage summary

-gui, -x
Run program without GUI. In this mode, the program only grabs frames from the frame grabber card and puts them into a shared memory. This segment of shared memory can be accessed by other programs, e.g. program mar345dtb.
Default: Do not run program without GUI.

--host NAME
Name of host running program mar345dtb (see option --server below).
Default: localhost

Only set parameters for TV-norm (PAL, NTSC, etc.) and input channel (TV, Composite, etc.) and exit.

-i, --input Television|Composite0,1,2,3|S-Video
Source of TV input. Frame grabber may have multiple Composite inputs (0,1,2,3), a S-Video input and/or a TV-tuner. The choices for SOURCE are: Television, Composite0|1|2|3 and S-Video. The following shortcuts are allowed:
-tv = --input Television
-0|1|2|3 = --input Composite0|1|2|3
-svideo = --input S-Video
Default: --input Composite1.

Norm of TV signal. For European market should be PAL, for US-market NTSC. The following shortcuts are allowed:
-pal = --norm PAL
-pal-bg = --norm PAL-BG
-pal-nc = --norm PAL-Nc
-ntsc = --norm NTSC
-ntsc-m = --norm NTSC-M
-secam = --norm SECAM
Default: --norm PAL

--port NUMBER
Port number of TCP/IP-server used by program mar345dtb (see option --server below).
Default: none

-r, --fps FRAMERATE
Frame rate of video stream in frames per second.
Default: Taken from configuration file (25).

-s, --size WIDTH HEIGHT
Width and height of the actual video frame.
Default: -s 720 576

--server NAME PORT
Host name and port to use for exchanging information with program mar345dtb. NAME is the host name of the PC where program mar345dtb is running and PORT is the port number used by the TCP/IP-server built into program mar345dtb. For use with program margrabber, that port number MUST be in the range 9000 to 9010. To configure program mar345dtb to use TCP/IP-port 9000, the line "COMMAND PORT 9000" must be added to the mar345dtb configuration file. Please see "INTERACTION WITH MAR345DTB" for more details.
Default: taken from mardtb configuration file, otherwise no connection

to mar345dtb

[Do not] use the XShm extension for drawing frames.
Default: +shm
-v, --verbose
Increase verbosity

-xy X Y
x,y-Coordinates of origin of crosshair
Default: -xy WIDTH/2 HEIGHT/2

Interaction with Mar345dtb

While program mar345dtb features a built-in TV-window in the GUI on page "Crystal", sometimes it may be useful to leave the task of displaying the crystal and interacting with motors for crystal centering to the stand-alone program margrabber. To do so, program mar345dtb can communicate with program margrabber either via a TCP/IP-socket or via plain ASCII command files. This feature is controller by keyword "COMMAND PORT xxxx" in the configuration file of program mar345dtb. When added to the configuration file, mar345dtb offers a TCP/IP-socket on port xxxx. For cooperation with program margrabber the port number MUST be in the range 9000 to 9010! Otherwise, if only keyword "COMMAND xxxx" is used, program mar345dtb evaluates the contents of file $MARLOGDIR/ every xxxx milliseconds. Program margrabber reads the configuration file at startup the program will connect to TCP/IP-port xxxx (if configured) on the host running program mar345dtb (typically: localhost) or write data into $MARLOGDIR/ (if configured). In either case, the program margrabber adds an additional menu entry to the menu bar: "Commands". As of version 2.0, the such commands are "Center xtal" and "Drive PHI +/-90" and "Drive PHI 180". I.e. program margrabber can be used to actually center a crystal with mardtb’s featuring an automatic PHI-axis with x,y-translations. Before you hit "Center xtal" button or use the corresponding short-cut Alt+x, you should select the point to drive to with the left hand mouse button.
Please note, that when using margrabber together with mar345dtb the program margrabber will automatically disable the TV display within program mar345dtb, since it is NOT possible to display the TV stream simultaneously within program mar345dtb and program margrabber. Please note also, that the communication via ASCII-files does not work the same way as using the TCP/IP-socket. The response time is somewhat slower. Also, when using file communication, program margrabber does not read instructions to save images but for the TCP/IP-socket it does!


The program requires logical names only for reading configuration files and for loading man pages. If the names are not defined, the program will still run, but without trying to read configuration files and man pages. The following logical names may be used by the program:

The Help button will display the manual as html page from $MARMANDIR/html/margrabber.html.

Serial number of mardtb.

Serial number of mar345 scanner.

Location of the mardtb configuration files.

Location of the mardtb log files.

Input Files

The program accepts the following input files:
Configuration file of mardtb as used by program mar345dtb.
If the file mardtb.$MAR_DTB_NO does not exist, the program tries to read config.$MAR_SCANNER_NO.

Output Files

The program can shoot photos in the following formats: png, jpg or pgm. The latter one is grey-scale only. When used with the mar345dtb file communication interface, output file $MARLOGDIR/ is produced to send commands to the mar345dtb program.

See Also



Claudio Klein, marXperts GmbH, Norderstedt, Germany


© Copyright 2011 marXperts GmbH, Norderstedt, Germany


marXperts GmbHPhone: +49 - (40) - 529 884-0
Werkstr. 3 FAX: +49 - (40) - 529 884-20
D-22844 Norderstedt - GERMANYE-mail:

Table of Contents