forked from robotology/yarp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmd_yarpview.dox
147 lines (104 loc) · 4.69 KB
/
cmd_yarpview.dox
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/**
\page yarpview yarpview: visualize YARP images
\ingroup yarp_guis
\ingroup yarp_tools
\tableofcontents
\section yarpview_intro Introducton
yarpview is a standard graphical interface for viewing images transmitted on the network.
\image html yarpview.png
\image latex yarpview.png "As an example the images above show two instances of yarpview. In this case the port receives data with the framerate of 30Hz while the display runs at 10Hz. Images are from two instances of fakeFrameGrabber." width=5cm
Let's experiment with it. We need to create a source of images. The "fakeFrameGrabber" is a virtual framegrabber which broadcasts images on the network
at a given framerate. Let's start fakeFrameGrabber:
\verbatim
yarpdev --device fakeFrameGrabber --name /grabber
\endverbatim
You can now run yarpview:
\verbatim
yarpview
\endverbatim
By default yarpview uses the port named /yarpview/img:i. You can connect it to the grabber:
\verbatim
yarp connect /grabber /yarpview/img:i
\endverbatim
Let's get accustomed with the GUI. It displays in the main window the images that are received.
To reduce CPU usage yarpview shows these images with a certain refresh (default is 10Hz). You
can change the refresh time using the menu (Image->Change refresh interval).
If you select Image->Synch display all images will be displayed (assuming there is enough CPU time).
Freeze stop the refresh and holds the last images that was displayed.
You can resize and move the window as you like. If you want to restore the size of the GUI to fit
the size of the images (1:1 ratio) you have to select Image->Original Size. If you prefer you can
restore only the original aspect ratio (Image->Original aspect ratio).
From the menu "File" you can also save individual or sequences of frames.
Usually you want to change the port name (especially to execute multiple instances of yarpview):
\verbatim
yarpview --name /portname
\endverbatim
Help is displayed with:
\verbatim
yarpview_help yarpview --help
\endverbatim
Print a simple help with all parameters and their usage. This is available only if yarpview
has access to a console (it depends on the OS).
\section yarpview_stats Debugging connection problems
At its bottom yarpview shows statistics related to the frequency at which it receives
and displays images (respectively Port and Display). The Port statistics helps montoring
the performacen of the network and it is useful for debugging.
As an example the images above show two instances of yarpview. In this case the port receives data with the framerate of 30Hz while the display runs at 10Hz. Images are from two instances of "fakeFrameGrabber".
Notice that the values in Port and Display should be approximately equal when the option "Synch display" is selected.
\section yarpview_getting_clicks Getting image coordinates
You can also get the coordinates of a given point in the image by clicking on it.
To enable ths feature you have to run:
\verbatim
yarpview --name /portname --out /click
\endverbatim
Now yarpview will produce on the port /click a pair of coordinates (column, row) every time the user
clicks on the video stream. The coordinate system is at the top-let (i.e. 0,0 is the topleft corner of the image).
For example, you can display this output with:
\verbatim
yarp read /read /CLICK
yarp: Port /tmp/port/1 active at tcp://192.168.1.185:10007
yarp: Receiving input from /click to /tmp/port/1 using tcp
46 60
46 60
3 6
3 6
38 16
38 16
104 34
104 34
118 30
118 30
yarp: Removing input from /click to /tmp/port/1
\endverbatim
Note that this will only work if at least one image has been shown by
the viewer (the image is needed to establish the scale).
\section yarpview_compact Sparing space on the screen
If you want to spare space on the screen you can remove the menu bar and the widget at the bottom:
\verbatim
yarpview --compact
\endverbatim
If you really want to see only the images, try this:
\verbatim
yarpview --minimal
\endverbatim
\section yarpview_advanced Some advanced options for scripting
The following options allows placing the viewer at specific locations. Ths is useful for scripting:
\verbatim
yarpview_pos yarpview --x X_POSITION --y Y_POSITION
\endverbatim
To change the size:
\verbatim
yarpview_size yarpview --w WIDTH --h HEIGHT
\endverbatim
You can set the framerate at with which the viewer updates the image:
\verbatim
yarpview --p framerate
\endverbatim
Notice that this substitutes the parameter --RefreshTime which is now deprecated.
Otherwise you can ask yarpview to display all images that are received on the port:
\verbatim
yarpview --synch
\endverbatim
In this way (if there is enough CPU time) all images received from the port will be
displayed in the screen. This is useful if you do not want to lose frames.
*/