?? opencvref_highgui.htm
字號:
<h3><a name="decl_cvCreateFileCapture">cvCreateFileCapture</a></h3>
<p class="Blurb">Initializes capturing video from file</p>
<pre>
CvCapture* cvCreateFileCapture( const char* filename );
</pre><dl>
<dt>filename<dd>Name of the video file.
</dl><p>
The function <code>cvCreateFileCapture</code>
allocates and initialized the CvCapture structure for reading the video stream
from the specified file.
</p>
<p>After the allocated structure is not used any more it should be released by
<a href="#decl_cvReleaseCapture">cvReleaseCapture</a> function.
</p>
<hr><h3><a name="decl_cvCreateCameraCapture">cvCreateCameraCapture</a></h3>
<p class="Blurb">Initializes capturing video from camera</p>
<pre>
CvCapture* cvCreateCameraCapture( int index );
</pre><dl>
<dt>index<dd>Index of the camera to be used. If there is only one camera or it
does not matter what camera to use -1 may be passed.
</dl><p>
The function <code>cvCreateCameraCapture</code>
allocates and initialized 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).
</p>
<p>To release the sturtcure, use <a href="#decl_cvReleaseCapture">cvReleaseCapture</a>.</p>
<hr><h3><a name="decl_cvReleaseCapture">cvReleaseCapture</a></h3>
<p class="Blurb">Releases the CvCapture structure</p>
<pre>
void cvReleaseCapture( CvCapture** capture );
</pre><dl>
<dt>capture<dd>pointer to video capturing structure.
</dl><p>
The function <code>cvReleaseCapture</code>
releases the CvCapture structure allocated by <a href="#decl_cvCreateFileCapture">cvCreateFileCapture</a>
or <a href="#decl_cvCreateCameraCapture">cvCreateCameraCapture</a>.
</p>
<hr><h3><a name="decl_cvGrabFrame">cvGrabFrame</a></h3>
<p class="Blurb">Grabs frame from camera or file</p>
<pre>
int cvGrabFrame( CvCapture* capture );
</pre><dl>
<dt>capture<dd>video capturing structure.
</dl><p>
The function <code>cvGrabFrame</code>
grabs the frame from camera or file. The grabbed frame is stored internally.
The purpose of this function is to grab frame <em>fast</em> that is important
for syncronization in case of reading from several cameras simultaneously. The
grabbed frames are not exposed because they may be stored in compressed format
(as defined by camera/driver). To retrieve the grabbed frame,
<a href="#decl_cvRetrieveFrame">cvRetrieveFrame</a> should be used.
</p>
<hr><h3><a name="decl_cvRetrieveFrame">cvRetrieveFrame</a></h3>
<p class="Blurb">Gets the image grabbed with cvGrabFrame</p>
<pre>
IplImage* cvRetrieveFrame( CvCapture* capture );
</pre><dl>
<dt>capture<dd>video capturing structure.
</dl><p>
The function <code>cvRetrieveFrame</code>
returns the pointer to the image grabbed with <a href="#decl_cvGrabFrame">cvGrabFrame</a>
function. The returned image should not be released or modified by user.
</p>
<hr><h3><a name="decl_cvQueryFrame">cvQueryFrame</a></h3>
<p class="Blurb">Grabs and returns a frame from camera or file</p>
<pre>
IplImage* cvQueryFrame( CvCapture* capture );
</pre><dl>
<dt>capture<dd>video capturing structure.
</dl><p>
The function <code>cvQueryFrame</code>
grabs a frame from camera or video file, decompresses and returns it.
This function is just a combination of <a href="#decl_cvGrabFrame">cvGrabFrame</a> and
<a href="#decl_cvRetrieveFrame">cvRetrieveFrame</a> in one call. The
returned image should not be released or modified by user.
</p>
<hr><h3><a name="decl_cvGetCaptureProperty">cvGetCaptureProperty</a></h3>
<p class="Blurb">Gets video capturing properties</p>
<pre>
double cvGetCaptureProperty( CvCapture* capture, int property_id );
</pre><dl>
<dt>capture<dd>video capturing structure.
<dt>property_id<dd>property identifier. Can be one of the following:<br>
<code>CV_CAP_PROP_POS_MSEC</code> - film current position in milliseconds or video capture timestamp<br>
<code>CV_CAP_PROP_POS_FRAMES</code> - 0-based index of the frame to be decoded/captured next<br>
<code>CV_CAP_PROP_POS_AVI_RATIO</code> - relative position of video file (0 - start of the film, 1 - end of the film)<br>
<code>CV_CAP_PROP_FRAME_WIDTH</code> - width of frames in the video stream<br>
<code>CV_CAP_PROP_FRAME_HEIGHT</code> - height of frames in the video stream<br>
<code>CV_CAP_PROP_FPS</code> - frame rate<br>
<code>CV_CAP_PROP_FOURCC</code> - 4-character code of codec.
<code>CV_CAP_PROP_FRAME_COUNT</code> - number of frames in video file.
</dl><p>
The function <code>cvGetCaptureProperty</code>
retrieves the specified property of camera or video file.
</p>
<hr><h3><a name="decl_cvSetCaptureProperty">cvSetCaptureProperty</a></h3>
<p class="Blurb">Sets video capturing properties</p>
<pre>
int cvSetCaptureProperty( CvCapture* capture, int property_id, double value );
</pre><dl>
<dt>capture<dd>video capturing structure.
<dt>property_id<dd>property identifier. Can be one of the following:<br>
<code>CV_CAP_PROP_POS_MSEC</code> - position in milliseconds from the file beginning<br>
<code>CV_CAP_PROP_POS_FRAMES</code> - position in frames (only for video files)<br>
<code>CV_CAP_PROP_POS_AVI_RATIO</code> - position in relative units (0 - start of the file, 1 - end of the file)<br>
<code>CV_CAP_PROP_FRAME_WIDTH</code> - width of frames in the video stream (only for cameras)<br>
<code>CV_CAP_PROP_FRAME_HEIGHT</code> - height of frames in the video stream (only for cameras)<br>
<code>CV_CAP_PROP_FPS</code> - frame rate (only for cameras)<br>
<code>CV_CAP_PROP_FOURCC</code> - 4-character code of codec (only for cameras).
<dt>value<dd>value of the property.
</dl><p>
The function <code>cvSetCaptureProperty</code>
sets the specified property of video capturing. Currently the function supports only
video files: <code>CV_CAP_PROP_POS_MSEC, CV_CAP_PROP_POS_FRAMES, CV_CAP_PROP_POS_AVI_RATIO</code>
</p>
<hr><h3><a name="decl_cvCreateVideoWriter">cvCreateVideoWriter</a></h3>
<p class="Blurb">Creates video file writer</p>
<pre>
typedef struct CvVideoWriter CvVideoWriter;
CvVideoWriter* cvCreateVideoWriter( const char* filename, int fourcc, double fps, CvSize frame_size, int is_color=1 );
</pre><dl>
<dt>filename<dd>Name of the output video file.
<dt>fourcc<dd>4-character code of codec used to compress the frames.
For example, <code>CV_FOURCC('P','I','M','1')</code> is MPEG-1 codec,
<code>CV_FOURCC('M','J','P','G')</code> is motion-jpeg codec etc.
Under Win32 it is possible to pass -1 in order
to choose compression method and additional compression parameters
from dialog.
<dt>fps<dd>Framerate of the created video stream.
<dt>frame_size<dd>Size of video frames.
<dt>is_color<dd>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).
</dl><p>
The function <code>cvCreateVideoWriter</code>
creates video writer structure.
</p>
<hr><h3><a name="decl_cvReleaseVideoWriter">cvReleaseVideoWriter</a></h3>
<p class="Blurb">Releases AVI writer</p>
<pre>
void cvReleaseVideoWriter( CvVideoWriter** writer );
</pre><dl>
<dt>writer<dd>pointer to video file writer structure.
</dl><p>
The function <code>cvReleaseVideoWriter</code>
finishes writing to video file and releases the structure.
</p>
<hr><h3><a name="decl_cvWriteFrame">cvWriteFrame</a></h3>
<p class="Blurb">Writes a frame to video file</p>
<pre>
int cvWriteFrame( CvVideoWriter* writer, const IplImage* image );
</pre><dl>
<dt>writer<dd>video writer structure.
<dt>image</dt><dd>the written frame
</dl><p>
The function <code>cvWriteFrame</code>
writes/appends one frame to video file.
</p>
<hr><h2><a name="highgui_utils">Utility and System Functions</a></h2>
<hr><h3><a name="decl_cvInitSystem">cvInitSystem</a></h3>
<p class="Blurb">Initializes HighGUI</p>
<pre>
int cvInitSystem( int argc, char** argv );
</pre><dl>
<dt>argc<dd>Number of command line arguments.
<dt>argv<dd>Array of command line arguments
</dl><p>
The function <code>cvInitSystem</code>
initializes HighGUI. If it wasn't called explicitly by the user before the first window
is created, it is called implicitly then with <code>argc</code>=0, <code>argv</code>=NULL.
Under Win32 there is no need to call it explicitly. Under X Window the arguments may
be used to customize a look of HighGUI windows and controls.
</p>
<hr><h3><a name="decl_cvConvertImage">cvConvertImage</a></h3>
<p class="Blurb">Converts one image to another with optional vertical flip</p>
<pre>
void cvConvertImage( const CvArr* src, CvArr* dst, int flags=0 );
</pre><dl>
<dt>src<dd>Source image.
<dt>dst<dd>Destination image. Must be single-channel or 3-channel 8-bit image.
<dt>flags</dt><dd>The operation flags:<br>
<code>CV_CVTIMG_FLIP</code> - flip the image vertically
<code>CV_CVTIMG_SWAP_RB</code> - swap red and blue channels.
In OpenCV color images have
<code><font color="blue">B</font><font color="green">G</font><font color="red">R</font></code>
channel order, however on some systems the order needs to be reversed
before displaying the image (<a href="#decl_cvShowImage">cvShowImage</a>
does this automatically).
</dl><p>
The function <code>cvConvertImage</code>
converts one image to another and flips the result vertically if required.
The function is used by <a href="#decl_cvShowImage">cvShowImage</a>.</p>
<hr><h1><a name="highgui_func_index">Alphabetical List of Functions</a></h1>
<hr><h3>C</h3>
<table width="100%">
<tr>
<td width="25%"><a href="#decl_cvConvertImage">ConvertImage</a></td>
<td width="25%"><a href="#decl_cvCreateFileCapture">CreateFileCapture</a></td>
<td width="25%"><a href="#decl_cvCreateVideoWriter">CreateVideoWriter</a></td>
</tr>
<tr>
<td width="25%"><a href="#decl_cvCreateCameraCapture">CreateCameraCapture</a></td>
<td width="25%"><a href="#decl_cvCreateTrackbar">CreateTrackbar</a></td>
<td width="25%%"></td>
</tr>
</table>
<hr><h3>D</h3>
<table width="100%">
<tr>
<td width="25%"><a href="#decl_cvDestroyAllWindows">DestroyAllWindows</a></td>
<td width="25%"><a href="#decl_cvDestroyWindow">DestroyWindow</a></td>
<td width="25%%"></td>
</tr>
</table>
<hr><h3>G</h3>
<table width="100%">
<tr>
<td width="25%"><a href="#decl_cvGetCaptureProperty">GetCaptureProperty</a></td>
<td width="25%"><a href="#decl_cvGetWindowHandle">GetWindowHandle</a></td>
<td width="25%"><a href="#decl_cvGrabFrame">GrabFrame</a></td>
</tr>
<tr>
<td width="25%"><a href="#decl_cvGetTrackbarPos">GetTrackbarPos</a></td>
<td width="25%"><a href="#decl_cvGetWindowName">GetWindowName</a></td>
<td width="25%%"></td>
</tr>
</table>
<hr><h3>I</h3>
<table width="100%">
<tr>
<td width="25%"><a href="#decl_cvInitSystem">InitSystem</a></td>
<td width="25%%"></td>
<td width="25%%"></td>
</tr>
</table>
<hr><h3>L</h3>
<table width="100%">
<tr>
<td width="25%"><a href="#decl_cvLoadImage">LoadImage</a></td>
<td width="25%%"></td>
<td width="25%%"></td>
</tr>
</table>
<hr><h3>M</h3>
<table width="100%">
<tr>
<td width="25%"><a href="#decl_cvMoveWindow">MoveWindow</a></td>
<td width="25%%"></td>
<td width="25%%"></td>
</tr>
</table>
<hr><h3>N</h3>
<table width="100%">
<tr>
<td width="25%"><a href="#decl_cvNamedWindow">NamedWindow</a></td>
<td width="25%%"></td>
<td width="25%%"></td>
</tr>
</table>
<hr><h3>Q</h3>
<table width="100%">
<tr>
<td width="25%"><a href="#decl_cvQueryFrame">QueryFrame</a></td>
<td width="25%%"></td>
<td width="25%%"></td>
</tr>
</table>
<hr><h3>R</h3>
<table width="100%">
<tr>
<td width="25%"><a href="#decl_cvReleaseCapture">ReleaseCapture</a></td>
<td width="25%"><a href="#decl_cvResizeWindow">ResizeWindow</a></td>
<td width="25%%"></td>
</tr>
<tr>
<td width="25%"><a href="#decl_cvReleaseVideoWriter">ReleaseVideoWriter</a></td>
<td width="25%"><a href="#decl_cvRetrieveFrame">RetrieveFrame</a></td>
<td width="25%%"></td>
</tr>
</table>
<hr><h3>S</h3>
<table width="100%">
<tr>
<td width="25%"><a href="#decl_cvSaveImage">SaveImage</a></td>
<td width="25%"><a href="#decl_cvSetMouseCallback">SetMouseCallback</a></td>
<td width="25%"><a href="#decl_cvShowImage">ShowImage</a></td>
</tr>
<tr>
<td width="25%"><a href="#decl_cvSetCaptureProperty">SetCaptureProperty</a></td>
<td width="25%"><a href="#decl_cvSetTrackbarPos">SetTrackbarPos</a></td>
<td width="25%%"></td>
</tr>
</table>
<hr><h3>W</h3>
<table width="100%">
<tr>
<td width="25%"><a href="#decl_cvWaitKey">WaitKey</a></td>
<td width="25%"><a href="#decl_cvWriteFrame">WriteFrame</a></td>
<td width="25%%"></td>
</tr>
</table>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -