Update to 2.0.0 tree from current Fremantle build
[opencv] / doc / HighGui.tex
1 \chapter{HighGui}
2
3 \subsection{HighGUI overview}
4
5 While OpenCV was designed for use in production level
6 applications, HighGUI was designed soley as an addendum for quick software prototypes
7 and experimental setups. The general idea behind HighGUI's design was to
8 have a small set of directly useable functions allowing your computer's
9 vision code to interact with the environment.
10
11 Simple methods to display
12 images on screen and to allow (limited) user input are provided, as these are common 
13 HighGUI tasks.
14
15 Note: None of the methods implemented in HighGUI allow for building
16 sleek user interfaces with production level error handling. Because of
17 this, HighGUI is not the tool to build end-user applications. For
18 example: camera input methods in HighGUI are designed to be easily
19 useable, but there are no means to react to cameras being plugged
20 in or out during run time.
21
22 \subsection{Simple GUI}
23
24 \cvfunc{NamedWindow}
25
26 Creates a window.
27
28 \cvexp{
29 int cvNamedWindow( const char* name, int flags );
30
31 }{CPP}{NamedWindow(name,flags=CV\_WINDOW\_AUTOSIZE)-> None}
32
33 \begin{description}
34 \cvarg{ name}{Name of the window in the window caption that may be used as a window identifier.}
35 \cvarg{ flags}{Flags of the window. Currently the only supported flag is \texttt{CV\_WINDOW\_AUTOSIZE}. If this is set, window size is automatically adjusted to fit the displayed image (see \cross{ShowImage}), and the user can not change the window size manually.}
36 \end{description}
37
38 The function \texttt{cvNamedWindow} creates a window which can be used as a placeholder for images and trackbars. Created windows are referred to by their names.
39
40 If a window with the same name already exists, the function does nothing.
41
42 \cvfunc{DestroyWindow}
43
44 Destroys a window.
45
46 \cvexp{
47 void cvDestroyWindow( const char* name );
48
49 }{CPP}{DestroyWindow(name)-> None}
50
51 \begin{description}
52 \cvarg{ name}{Name of the window to be destroyed.}
53 \end{description}
54
55 The function \texttt{cvDestroyWindow} destroys the window with the given name.
56
57 \cvfunc{DestroyAllWindows} 
58
59 Destroys all of the HighGUI windows.
60
61 \cvexp{
62 void cvDestroyAllWindows(void);
63
64 }{CPP}{DestroyAllWindows()-> None}
65
66 The function \texttt{cvDestroyAllWindows} destroys all of the opened HighGUI windows.
67
68 \cvfunc{ResizeWindow} 
69
70 Sets the window size.
71
72 \cvexp{
73 void cvResizeWindow( const char* name, int width, int height );
74
75 }{CPP}{ResizeWindow(name,width,height)-> None}
76
77 \begin{description}
78 \cvarg{ name}{Name of the window to be resized.}
79 \cvarg{ width}{New width}
80 \cvarg{ height}{New height}
81 \end{description}
82
83 The function \texttt{cvResizeWindow} changes the size of the window.
84
85 \cvfunc{MoveWindow} 
86
87 Sets the position of the window.
88
89 \cvexp{
90 void cvMoveWindow( const char* name, int x, int y );
91
92 }{CPP}{MoveWindow(name,x,y)-> None}
93
94 \begin{description}
95 \cvarg{ name}{Name of the window to be resized.}
96 \cvarg{ x}{New x coordinate of the top-left corner}
97 \cvarg{ y}{New y coordinate of the top-left corner}
98 \end{description}
99
100 The function \texttt{cvMoveWindow} changes the position of the window.
101
102 \ifC
103 \cvfunc{GetWindowHandle}
104
105 Gets the window's handle by its name.
106
107 \cvexp{
108 void* cvGetWindowHandle( const char* name );
109
110 }{CPP}{PYTHON}
111
112 \begin{description}
113 \cvarg{ name}{Name of the window}.
114 \end{description}
115
116 The function \texttt{cvGetWindowHandle} returns the native window handle (HWND in case of Win32 and GtkWidget in case of GTK+).
117
118 \cvfunc{GetWindowName} 
119
120 Gets the window's name by its handle.
121
122 \cvexp{
123 const char* cvGetWindowName( void* window\_handle );
124
125 }{CPP}{PYTHON}
126
127 \begin{description}
128 \cvarg{ window\_handle}{Handle of the window.}
129 \end{description}
130
131 The function \texttt{cvGetWindowName} returns the name of the window given its native handle (HWND in case of Win32 and GtkWidget in case of GTK+).
132 \fi
133
134 \cvfunc{ShowImage} 
135
136 Displays the image in the specified window
137
138 \cvexp{
139 void cvShowImage( const char* name, const CvArr* image );
140
141 }{CPP}{ShowImage(name,image)-> None}
142
143 \begin{description}
144 \cvarg{ name}{Name of the window.}
145 \cvarg{ image}{Image to be shown.}
146 \end{description}
147
148 The function \texttt{cvShowImage} displays the image in the specified window. If the window was created with the \texttt{CV\_WINDOW\_AUTOSIZE} flag then the image is shown with its original size, otherwise the image is scaled to fit in the window. The function may scale the image, depending on its depth:
149 \begin{itemize}
150     \item If the image is 8-bit unsigned, it is displayed as is.
151     \item If the image is 16-bit unsigned or 32-bit integer, the pixels are divided by 256. That is, the value range [0,255*256] is mapped to [0,255].
152     \item If the image is 32-bit floating-point, the pixel values are multiplied by 255. That is, the value range [0,1] is mapped to [0,255].
153 \end{itemize}
154
155 \cvfunc{CreateTrackbar} 
156
157 Creates a trackbar and attaches it to the specified window
158
159 \cvexp{
160 int cvCreateTrackbar( \par const char* trackbar\_name, \par const char* window\_name,
161                       \par int* value, \par int count, \par CvTrackbarCallback on\_change );
162
163 }{CPP}{
164 CreateTrackbar(trackbar\_name, window\_name, value, count, on\_change)
165 }
166 \begin{lstlisting}
167 CV_EXTERN_C_FUNCPTR( void (*CvTrackbarCallback)(int pos) );
168 \end{lstlisting}
169
170 \begin{description}
171 \cvarg{ trackbar\_name}{Name of the created trackbar.}
172 \cvarg{ window\_name}{Name of the window which will be used as a parent for created trackbar.}
173 \cvarg{ value}{Pointer to an integer variable, whose value will reflect the position of the slider. Upon creation, the slider position is defined by this variable.}
174 \cvarg{ count}{Maximal position of the slider. Minimal position is always 0.}
175 \cvarg{ on\_change}{Pointer to the function to be called every time the slider changes position. This function should be prototyped as \texttt{void Foo(int);}Can be NULL if callback is not required.}
176 \end{description}
177
178 The function \texttt{cvCreateTrackbar} creates a trackbar (a.k.a. slider or range control) with the specified name and range, assigns a variable to be syncronized with trackbar position and specifies a callback function to be called on trackbar position change. The created trackbar is displayed on the top of the given window.
179
180 \cvfunc{GetTrackbarPos} 
181
182 Returns the trackbar position.
183
184 \cvexp{
185 int cvGetTrackbarPos( \par const char* trackbar\_name, \par const char* window\_name );
186
187 }{CPP}{GetTrackbarPos(trackbar\_name,window\_name)-> None}
188
189 \begin{description}
190 \cvarg{ trackbar\_name}{Name of the trackbar.}
191 \cvarg{ window\_name}{Name of the window which is the parent of the trackbar.}
192 \end{description}
193
194 The function \texttt{cvGetTrackbarPos} returns the current position of the specified trackbar.
195
196 \cvfunc{SetTrackbarPos} 
197
198 Sets the trackbar position.
199
200 \cvexp{
201 void cvSetTrackbarPos( \par const char* trackbar\_name, \par const char* window\_name, \par int pos );
202
203 }{CPP}{SetTrackbarPos(trackbar\_name,window\_name)-> None}
204
205 \begin{description}
206 \cvarg{ trackbar\_name}{Name of the trackbar.}
207 \cvarg{ window\_name}{Name of the window which is the parent of trackbar.}
208 \cvarg{ pos}{New position.}
209 \end{description}
210
211 The function \texttt{cvSetTrackbarPos} sets the position of the specified trackbar.
212
213 \cvfunc{SetMouseCallback} %XXX Weird URL Formatting
214
215 Assigns callback for mouse events.
216
217 \cvexp{
218 void cvSetMouseCallback( const char* window\_name, CvMouseCallback on\_mouse, void* param=NULL );
219 }{CPP}{SetMouseCallback(window\_name, on\_mouse, param) -> None}
220
221 \begin{lstlisting}
222 #define CV_EVENT_MOUSEMOVE      0
223 #define CV_EVENT_LBUTTONDOWN    1
224 #define CV_EVENT_RBUTTONDOWN    2
225 #define CV_EVENT_MBUTTONDOWN    3
226 #define CV_EVENT_LBUTTONUP      4
227 #define CV_EVENT_RBUTTONUP      5
228 #define CV_EVENT_MBUTTONUP      6
229 #define CV_EVENT_LBUTTONDBLCLK  7
230 #define CV_EVENT_RBUTTONDBLCLK  8
231 #define CV_EVENT_MBUTTONDBLCLK  9
232
233 #define CV_EVENT_FLAG_LBUTTON   1
234 #define CV_EVENT_FLAG_RBUTTON   2
235 #define CV_EVENT_FLAG_MBUTTON   4
236 #define CV_EVENT_FLAG_CTRLKEY   8
237 #define CV_EVENT_FLAG_SHIFTKEY  16
238 #define CV_EVENT_FLAG_ALTKEY    32
239
240 CV_EXTERN_C_FUNCPTR( void (*CvMouseCallback )(int event, 
241                                               int x, 
242                                               int y, 
243                                               int flags, 
244                                               void* param) );
245 \end{lstlisting}
246
247 \begin{description}
248 \cvarg{ window\_name}{Name of the window.}
249 \cvarg{ on\_mouse}{Pointer to the function to be called every time a mouse event occurs in the specified window. This function should be prototyped as
250
251 \cvexp{
252 void Foo(int event, int x, int y, int flags, void* param);
253 }{CPP}{Foo(event,x,y,flags,param)-> None}
254
255 where \texttt{event} is one of \texttt{CV\_EVENT\_*}, \texttt{x} and \texttt{y} are the coordinates of the mouse pointer in image coordinates (not window coordinates), \texttt{flags} is a combination of \texttt{CV\_EVENT\_FLAG}, and \texttt{param} is a user-defined parameter passed to the \texttt{cvSetMouseCallback} function call.}
256 \cvarg{param}{User-defined parameter to be passed to the callback function.}
257 \end{description}
258
259 The function \texttt{cvSetMouseCallback} sets the callback function for mouse events occuring within the specified window. To see how it works, look at 
260
261 \url{http://opencvlibrary.sourceforge.net/../../samples/c/ffilldemo.c|opencv/samples/c/ffilldemo.c} 
262
263 \cvfunc{WaitKey} 
264
265 Waits for a pressed key.
266
267 \cvexp{
268 int cvWaitKey( int delay=0 );
269
270 }{CPP}{WaitKey(delay=0)-> int}
271
272 \begin{description}
273 \cvarg{ delay}{Delay in milliseconds.}
274 \end{description}
275
276 The function \texttt{cvWaitKey} waits for key event infinitely ($ \texttt{delay} <= 0$) or for \texttt{delay} milliseconds. Returns the code of the pressed key or -1 if no key was pressed before the specified time had elapsed.
277
278 \textbf{Note:} This function is the only method in HighGUI that can fetch and handle events, so it needs to be called periodically for normal event processing, unless HighGUI is used within some environment that takes care of event processing.
279
280 \subsection{Loading and Saving Images}
281
282 \cvfunc{LoadImage} % XXX:Doesn't match manual
283
284 Loads an image from a file.
285
286 \cvexp{
287 IplImage* cvLoadImage( \par const char* filename, \par int iscolor=CV\_LOAD\_IMAGE\_COLOR );
288 }{CPP}{LoadImage(filename, iscolor=CV\_LOAD\_IMAGE\_COLOR)}
289
290 \begin{lstlisting}
291 #define CV_LOAD_IMAGE_COLOR       1
292 #define CV_LOAD_IMAGE_GRAYSCALE   0
293 #define CV_LOAD_IMAGE_UNCHANGED  -1
294 \end{lstlisting}
295
296 \begin{description}
297 \cvarg{filename}{Name of file to be loaded.}
298 \cvarg{iscolor}{Specific color type of the loaded image: if $ > 0 $, the loaded image is forced to be a 3-channel color image; if 0, the loaded image is forced to be grayscale; if $ < 0 $, the loaded image will be loaded as is (note that in the current implementation the alpha channel, if any, is stripped from the output image, e.g. 4-channel RGBA image will be loaded as RGB).}
299 \end{description}
300
301 The function \texttt{cvLoadImage} loads an image from the specified file and returns the pointer to the loaded image. Currently the following file formats are supported:
302 \begin{itemize}
303 \item Windows bitmaps - BMP, DIB
304 \item JPEG files - JPEG, JPG, JPE
305 \item Portable Network Graphics - PNG
306 \item Portable image format - PBM, PGM, PPM
307 \item Sun rasters - SR, RAS
308 \item TIFF files - TIFF, TIF
309 \end{itemize}
310
311 \cvfunc{SaveImage} 
312
313 Saves an image to a specified file.
314
315 \cvexp{
316 int cvSaveImage( const char* filename, const CvArr* image );
317
318 }{CPP}{SaveImage(filename,image)-> None}
319
320 \begin{description}
321 \cvarg{ filename}{Name of the file.}
322 \cvarg{ image}{Image to be saved.}
323 \end{description}
324
325 The function \texttt{cvSaveImage} saves the image to the specified file. The image format is chosen based on the \texttt{filename} extension, see \cross{LoadImage}. Only 8-bit single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function. If the format, depth or channel order is different, use \texttt{cvCvtScale} and \texttt{cvCvtColor} to convert it before saving, or use universal \texttt{cvSave} to save the image to XML or YAML format.
326
327 \subsection{Video I/O functions}
328
329 \cvstruct{CvCapture}\label{CvCapture}
330
331 Video capturing structure.
332
333 \ifC
334 \cvexp{
335 typedef struct CvCapture CvCapture;
336
337 }{CPP}{PYTHON}
338 \fi
339
340 The structure \texttt{CvCapture} does not have a public interface and is used only as a parameter for video capturing functions.
341
342 \cvfunc{CaptureFromFile} % XXX:Called cvCreateFileCapture in manual
343
344 Initializes capturing a video from a file.
345
346 \cvexp{
347 CvCapture* cvCaptureFromFile( const char* filename );
348
349 }{CPP}{CaptureFromFile(filename) -> CvCapture}
350
351 \begin{description}
352 \cvarg{ filename}{Name of the video file.}
353 \end{description}
354
355 The function \texttt{cvCaptureFromFile} allocates and initializes the CvCapture structure for reading the video stream from the specified file. Which codecs and file formats are supported depends on the back end library. On Windows HighGui uses Video for Windows (VfW), on Linux ffmpeg is used and on Mac OS X the back end is QuickTime. See VideoCodecs for some discussion on what to expect and how to prepare your video files.
356
357 After the allocated structure is not used any more it should be released by the \cross{ReleaseCapture} function.
358
359 \cvfunc{CaptureFromCAM} % XXX:Called cvCreateCameraCapture in manual
360
361 Initializes capturing a video from a camera.
362
363 \cvexp{
364 CvCapture* cvCaptureFromCAM( int index );
365
366 }{CPP}{CaptureFromCAM(index) -> CvCapture}
367
368 \begin{description}
369 \cvarg{ index}{Index of the camera to be used. If there is only one camera or it does not matter what camera is used -1 may be passed.}
370 \end{description}
371
372 The function \texttt{cvCaptureFromCAM} allocates and initializes the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used on Windows: Video for Windows (VFW) and Matrox Imaging Library (MIL); and two on Linux: V4L and FireWire (IEEE1394).
373
374 To release the structure, use \cross{ReleaseCapture}.
375
376 \ifC
377 \cvfunc{ReleaseCapture} 
378
379 Releases the CvCapture structure.
380
381 \cvexp{
382 void cvReleaseCapture( CvCapture** capture );
383
384 }{CPP}{PYTHON}
385
386 \begin{description}
387 \cvarg{ capture}{Pointer to video the capturing structure.}
388 \end{description}
389
390 The function \texttt{cvReleaseCapture} releases the CvCapture structure allocated by \cross{CaptureFromFile} or \cross{CaptureFromCAM}.
391 \fi
392
393 \cvfunc{GrabFrame} 
394
395 Grabs the frame from a camera or file.
396
397 \cvexp{
398 int cvGrabFrame( CvCapture* capture );
399
400 }{CPP}{GrabFrame(capture) -> int}
401
402 \begin{description}
403 \cvarg{ capture}{video capturing structure.}
404 \end{description}
405
406 The function \texttt{cvGrabFrame} grabs the frame from a camera or file. The grabbed frame is stored internally. The purpose of this function is to grab the frame \emph{quickly} so that syncronization can occur if it has to read from several cameras simultaneously. The grabbed frames are not exposed because they may be stored in a compressed format (as defined by the camera/driver). To retrieve the grabbed frame, \cross{RetrieveFrame} should be used.
407
408 \cvfunc{RetrieveFrame} % XXX:Different than manual
409
410 Gets the image grabbed with cvGrabFrame.
411
412 \cvexp{
413 IplImage* cvRetrieveFrame( CvCapture* capture );
414
415 }{CPP}{RetrieveFrame(capture) -> iplimage}
416
417 \begin{description}
418 \cvarg{ capture}{video capturing structure.}
419 \end{description}
420
421 The function \texttt{cvRetrieveFrame} returns the pointer to the image grabbed with the \cross{GrabFrame} function. The returned image should not be released or modified by the user.  In the event of an error, the return value may be NULL.
422
423 \cvfunc{QueryFrame} 
424
425 Grabs and returns a frame from a camera or file.
426
427 \cvexp{
428 IplImage* cvQueryFrame( CvCapture* capture );
429
430 }{CPP}{QueryFrame(capture) -> iplimage}
431
432 \begin{description}
433 \cvarg{ capture}{video capturing structure.}
434 \end{description}
435
436 The function \texttt{cvQueryFrame} grabs a frame from a camera or video file, decompresses it and returns it. This function is just a combination of \cross{GrabFrame} and \cross{RetrieveFrame}, but in one call. The returned image should not be released or modified by the user.  In the event of an error, the return value may be NULL.
437
438 \cvfunc{GetCaptureProperty}
439
440 Gets video capturing properties.
441
442 \cvexp{
443 double cvGetCaptureProperty( CvCapture* capture, int property\_id );
444
445 }{CPP}{GetCaptureProperty(capture, property\_id)->double}
446
447 \begin{description}
448 \cvarg{capture}{video capturing structure.}
449 \cvarg{property\_id}{Property identifier. Can be one of the following:
450 \begin{description}
451 \cvarg{CV\_CAP\_PROP\_POS\_MSEC}{Film current position in milliseconds or video capture timestamp}
452 \cvarg{CV\_CAP\_PROP\_POS\_FRAMES}{0-based index of the frame to be decoded/captured next}
453 \cvarg{CV\_CAP\_PROP\_POS\_AVI\_RATIO}{Relative position of the video file (0 - start of the film, 1 - end of the film)}
454 \cvarg{CV\_CAP\_PROP\_FRAME\_WIDTH}{Width of the frames in the video stream}
455 \cvarg{CV\_CAP\_PROP\_FRAME\_HEIGHT}{Height of the frames in the video stream}
456 \cvarg{CV\_CAP\_PROP\_FPS}{Frame rate}
457 \cvarg{CV\_CAP\_PROP\_FOURCC}{4-character code of codec}
458 \cvarg{CV\_CAP\_PROP\_FRAME\_COUNT}{Number of frames in the video file}
459 \cvarg{CV\_CAP\_PROP\_BRIGHTNESS}{Brightness of the image (only for cameras)}
460 \cvarg{CV\_CAP\_PROP\_CONTRAST}{Contrast of the image (only for cameras)}
461 \cvarg{CV\_CAP\_PROP\_SATURATION}{Saturation of the image (only for cameras)}
462 \cvarg{CV\_CAP\_PROP\_HUE}{Hue of the image (only for cameras)}
463 \end{description} }
464 \end{description}
465
466 The function \texttt{cvGetCaptureProperty} retrieves the specified property of the camera or video file.
467
468 \cvfunc{SetCaptureProperty} 
469
470 Sets video capturing properties.
471
472 \cvexp{
473 int cvSetCaptureProperty( \par CvCapture* capture, \par int property\_id, \par double value );
474
475 }{CPP}{SetCaptureProperty(capture, property\_id,double)}
476
477 \begin{description}
478 \cvarg{ capture}{video capturing structure.}
479 \cvarg{ property\_id}{property identifier. Can be one of the following:
480
481 \begin{description}
482 \cvarg{CV\_CAP\_PROP\_POS\_MSEC}{Film current position in milliseconds or video capture timestamp}
483 \cvarg{CV\_CAP\_PROP\_POS\_FRAMES}{0-based index of the frame to be decoded/captured next}
484 \cvarg{CV\_CAP\_PROP\_POS\_AVI\_RATIO}{Relative position of the video file (0 - start of the film, 1 - end of the film)}
485 \cvarg{CV\_CAP\_PROP\_FRAME\_WIDTH}{Width of the frames in the video stream}
486 \cvarg{CV\_CAP\_PROP\_FRAME\_HEIGHT}{Height of the frames in the video stream}
487 \cvarg{CV\_CAP\_PROP\_FPS}{Frame rate}
488 \cvarg{CV\_CAP\_PROP\_FOURCC}{4-character code of codec}
489 \cvarg{CV\_CAP\_PROP\_BRIGHTNESS}{Brightness of the image (only for cameras)}
490 \cvarg{CV\_CAP\_PROP\_CONTRAST}{Contrast of the image (only for cameras)}
491 \cvarg{CV\_CAP\_PROP\_SATURATION}{Saturation of the image (only for cameras)}
492 \cvarg{CV\_CAP\_PROP\_HUE}{Hue of the image (only for cameras)}
493 \end{description} }
494
495 \cvarg{ value}{value of the property.}
496 \end{description}
497
498 The function \texttt{cvSetCaptureProperty} sets the specified property of video capturing. Currently the function supports only video files: \texttt{CV\_CAP\_PROP\_POS\_MSEC, CV\_CAP\_PROP\_POS\_FRAMES, CV\_CAP\_PROP\_POS\_AVI\_RATIO}.
499
500 NB This function currently does nothing when using the latest CVS download on linux with FFMPEG (the function contents are hidden if 0 is used and returned).
501
502 \cvfunc{CreateVideoWriter} % XXX Different than manual
503
504 Creates the video file writer.
505
506 \cvexp{
507 typedef struct CvVideoWriter CvVideoWriter;
508 CvVideoWriter* cvCreateVideoWriter( \par const char* filename, \par int fourcc, \par double fps, \par CvSize frame\_size, \par int is\_color=1 );
509
510 }{CPP}{CreateVideoWriter(filename, fourcc, fps, frame\_size, is\_color) -> CvVideoWriter}
511
512 \begin{description}
513 \cvarg{ filename}{Name of the output video file.}
514 \cvarg{ fourcc}{4-character code of codec used to compress the frames. For example,
515 \texttt{CV\_FOURCC('P','I','M,'1')} is a MPEG-1 codec,
516 \texttt{CV\_FOURCC('M','J','P','G')} is a motion-jpeg codec etc.
517 Under Win32 it is possible to pass -1 in order to choose compression method and additional compression parameters from dialog. Under Win32 if 0 is passed while using an avi filename it will create a video writer that creates an uncompressed avi file.}
518 \cvarg{ fps}{Framerate of the created video stream.}
519 \cvarg{ frame\_size}{Size of the  video frames.}
520 \cvarg{ is\_color}{If it is not zero, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only).}
521 \end{description}
522
523 The function \texttt{cvCreateVideoWriter} creates the video writer structure.
524
525 Which codecs and file formats are supported depends on the back end library. On Windows HighGui uses Video for Windows (VfW), on Linux ffmpeg is used and on Mac OS X the back end is QuickTime. See VideoCodecs for some discussion on what to expect.
526
527 \ifC
528 \cvfunc{ReleaseVideoWriter}
529
530 Releases the AVI writer.
531
532 \cvexp{
533 void cvReleaseVideoWriter( CvVideoWriter** writer );
534
535 }{CPP}{PYTHON}
536
537 \begin{description}
538 \cvarg{ writer}{Pointer to the video file writer structure.}
539 \end{description}
540
541 The function \texttt{cvReleaseVideoWriter} finishes writing to the video file and releases the structure.
542 \fi
543
544 \cvfunc{WriteFrame} 
545
546 Writes a frame to a video file.
547
548 \cvexp{
549 int cvWriteFrame( CvVideoWriter* writer, const IplImage* image );
550
551 }{CPP}{WriteFrame(writer, image)->int}
552
553 \begin{description}
554 \cvarg{ writer}{Video writer structure}
555 \cvarg{ image}{The written frame}
556 \end{description}
557
558 The function \texttt{cvWriteFrame} writes/appends one frame to a video file.
559
560 \ifC
561 \subsection{Utility and System Functions}
562
563 \cvfunc{InitSystem}
564
565 Initializes HighGUI.
566
567 \cvexp{
568 int cvInitSystem( int argc, char** argv );
569
570 }{CPP}{PYTHON}
571
572 \begin{description}
573 \cvarg{ argc}{Number of command line arguments}
574 \cvarg{ argv}{Array of command line arguments}
575 \end{description}
576
577 The function \texttt{cvInitSystem} initializes HighGUI. If it wasn't
578 called explicitly by the user before the first window was created, it is
579 called implicitly then with \texttt{argc=0}, \texttt{argv=NULL}. Under
580 Win32 there is no need to call it explicitly. Under X Window the arguments
581 may be used to customize a look of HighGUI windows and controls.
582
583 \cvfunc{ConvertImage} % XXX:TBD
584
585 Converts one image to another with an optional vertical flip.
586
587 \cvexp{
588 void cvConvertImage( const CvArr* src, CvArr* dst, int flags=0 );
589
590 }{CPP}{PYTHON}
591
592 \begin{description}
593 \cvarg{ src}{Source image.}
594 \cvarg{ dst}{Destination image. Must be single-channel or 3-channel 8-bit image.}
595 \cvarg{ flags}{The operation flags:
596 \begin{description}
597 \cvarg{CV\_CVTIMG\_FLIP}{Flips the image vertically}
598 \cvarg{CV\_CVTIMG\_SWAP\_RB}{Swaps the red and blue channels. In OpenCV color images have \texttt{BGR} channel order, however on some systems the order needs to be reversed before displaying the image (\cross{ShowImage} does this automatically).}
599 \end{description}}
600 \end{description}
601
602 The function \texttt{cvConvertImage} converts one image to another and flips the result vertically if desired. The function is used by \cross{ShowImage}.
603 \fi