⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opencvref_cvaux.htm

📁 Simple example of using video accumulator on C++Builder6 + OpenCV1.0
💻 HTM
📖 第 1 页 / 共 3 页
字号:
</dl><p>
The function <code>cvEigenProjection</code> calculates an object projection to the eigen
sub-space or, in other words, restores an object using previously calculated
eigen objects basis, averaged object, and decomposition coefficients of the
restored object. Depending on <code>io_flags</code> parameter it may be used either in direct
access or callback mode.</p>

<hr><h2><a name="aux_hmm">Embedded Hidden Markov Models Functions</a></h2>

<p>
In order to support embedded models the user must define structures to represent
1D HMM and 2D embedded HMM model.
</p>
<hr><h3><a name="decl_CvHMM">CvHMM</a></h3>
<p class="Blurb">Embedded HMM Structure</p>
<pre>
    typedef struct _CvEHMM 
    {
        int level; 
        int num_states; 
        float* transP; 
        float** obsProb; 
        union 
        { 
            CvEHMMState* state;
            struct _CvEHMM* ehmm; 
        } u;
    } CvEHMM; 
</pre><p><dl>
<dt>level<dd>Level of embedded HMM. If <code>level ==0</code>, HMM is most external. In 2D HMM
there are two types of HMM: 1 external and several embedded. External HMM has
<code>level ==1</code>, embedded HMMs have <code>level ==0</code> .
<dt>num_states<dd>Number of states in 1D HMM.
<dt>transP<dd>State-to-state transition probability, square matrix <code>(num_state&times;num_state )</code>.
<dt>obsProb<dd>Observation probability matrix.
<dt>state<dd>Array of HMM states. For the last-level HMM, that is, an HMM without
embedded HMMs, HMM states are real.
<dt>ehmm<dd>Array of embedded HMMs. If HMM is not last-level, then HMM states are not
real and they are HMMs.
</dl></p>
<p>For representation of observations the following structure is defined:</p>

<hr><h3><a name="decl_CvImgObsInfo">CvImgObsInfo</a></h3>
<p class="Blurb">Image Observation Structure</p>
<pre>
    typedef struct CvImgObsInfo
    {
        int obs_x;
        int obs_y;
        int obs_size;
        float** obs;
        int* state;
        int* mix;
    } CvImgObsInfo;
</pre><p><dl>
<dt>obs_x<dd>Number of observations in the horizontal direction.
<dt>obs_y<dd>Number of observations in the vertical direction.
<dt>obs_size<dd>Length of every observation vector.
<dt>obs<dd>Pointer to observation vectors stored consequently. Number of vectors is
<code>obs_x*obs_y</code> .
<dt>state<dd>Array of indices of states, assigned to every observation vector.
<dt>mix<dd>Index of mixture component, corresponding to the observation vector within
an assigned state.
</dl></p> 


<hr><h3><a name="decl_cvCreate2DHMM">Create2DHMM</a></h3>
<p class="Blurb">Creates 2D embedded HMM</p>
<pre>
CvEHMM* cvCreate2DHMM( int* stateNumber, int* numMix, int obsSize );
</pre><p><dl>
<dt>stateNumber<dd>Array, the first element of the which specifies the number of
superstates in the HMM. All subsequent elements specify the number of states in
every embedded HMM, corresponding to each superstate. So, the length of the
array is <code>stateNumber [0]+1</code> .
<dt>numMix<dd>Array with numbers of Gaussian mixture components per each internal
state. The number of elements in the array is equal to number of internal states
in the HMM, that is, superstates are not counted here.
<dt>obsSize<dd>Size of observation vectors to be used with created HMM.
</dl><p>
The function <code>cvCreate2DHMM</code> returns the created structure of the type <a href="#decl_CvEHMM">CvEHMM</a> with
specified parameters.

</p><hr><h3><a name="decl_cvRelease2DHMM">Release2DHMM</a></h3>
<p class="Blurb">Releases 2D embedded HMM</p>
<pre>
void cvRelease2DHMM(CvEHMM** hmm );
</pre><p><dl>
<dt>hmm<dd>Address of pointer to HMM to be released.
</dl><p>
The function <code>cvRelease2DHMM</code> frees all the memory used by HMM and clears the
pointer to HMM.

</p><hr><h3><a name="decl_cvCreateObsInfo">CreateObsInfo</a></h3>
<p class="Blurb">Creates structure to store image observation vectors</p>
<pre>
CvImgObsInfo* cvCreateObsInfo( CvSize numObs, int obsSize );
</pre><p><dl>
<dt>numObs<dd>Numbers of observations in the horizontal and vertical directions. For
the given image and scheme of extracting observations the parameter can be
computed via the macro <code>CV_COUNT_OBS( roi, dctSize, delta, numObs )</code>, where <code>roi,
dctSize, delta, numObs</code> are the pointers to structures of the type <a href="#decl_CvSize ">CvSize </a>. The
pointer <code>roi</code> means size of <code>roi</code> of image observed, <code>numObs</code> is the output parameter
of the macro.
<dt>obsSize<dd>Size of observation vectors to be stored in the structure.
</dl><p>
The function <code>cvCreateObsInfo</code> creates new structures to store image observation
vectors. For definitions of the parameters <code>roi, dctSize</code>, and <code>delta</code> see the
specification of The function <code>cvImgToObs_DCT</code>.

</p><hr><h3><a name="decl_cvReleaseObsInfo">ReleaseObsInfo</a></h3>
<p class="Blurb">Releases observation vectors structure</p>
<pre>
void cvReleaseObsInfo( CvImgObsInfo** obsInfo );
</pre><p><dl>
<dt>obsInfo<dd>Address of the pointer to the structure <a href="#decl_CvImgObsInfo">CvImgObsInfo</a> .
</dl><p>
The function <code>cvReleaseObsInfo</code> frees all memory used by observations and clears
pointer to the structure <a href="#decl_CvImgObsInfo">CvImgObsInfo</a> .

</p><hr><h3><a name="decl_cvImgToObs_DCT">ImgToObs_DCT</a></h3>
<p class="Blurb">Extracts observation vectors from image</p>
<pre>
void cvImgToObs_DCT( IplImage* image, float* obs, CvSize dctSize,
                     CvSize obsSize, CvSize delta );
</pre><p><dl>
<dt>image<dd>Input image.
<dt>obs<dd>Pointer to consequently stored observation vectors.
<dt>dctSize<dd>Size of image blocks for which DCT (Discrete Cosine Transform)
coefficients are to be computed.
<dt>obsSize<dd>Number of the lowest DCT coefficients in the horizontal and vertical
directions to be put into the observation vector.
<dt>delta<dd>Shift in pixels between two consecutive image blocks in the horizontal and
vertical directions.
</dl><p>
The function <code>cvImgToObs_DCT</code> extracts observation vectors, that is, DCT
coefficients, from the image. The user must pass <code>obsInfo.obs</code> as the parameter
<code>obs</code> to use this function with other HMM functions and use the structure <code>obsInfo</code>
of the <a href="#decl_CvImgObsInfo">CvImgObsInfo</a> type.
</p><p>
<code>Calculating Observations for HMM</code>
<pre>
    CvImgObsInfo* obs_info;

        ...

        cvImgToObs_DCT( image,obs_info->obs, //!!!

        dctSize, obsSize, delta );
</pre>

</p><hr><h3><a name="decl_cvUniformImgSegm">UniformImgSegm</a></h3>
<p class="Blurb">Performs uniform segmentation of image observations by HMM states</p>
<pre>
void cvUniformImgSegm( CvImgObsInfo* obsInfo, CvEHMM* hmm );
</pre><p><dl>
<dt>obsInfo<dd>Observations structure.
<dt>hmm<dd>HMM structure.
</dl><p>
The function <code>cvUniformImgSegm</code> segments image observations by HMM states uniformly
(see <u><font color=blue>Initial Segmentation</font></u> for 2D Embedded HMM for 2D embedded HMM with 5
superstates and 3, 6, 6, 6, 3 internal states of every corresponding
superstate).
<p>
<font color=blue>  Initial Segmentation for 2D Embedded HMM </font>
</p>
<p>
<img align=center src="pics/face.png">  
</p>

</p><hr><h3><a name="decl_cvInitMixSegm">InitMixSegm</a></h3>
<p class="Blurb">Segments all observations within every internal state of HMM by state mixture
components</p>
<pre>
void cvInitMixSegm( CvImgObsInfo** obsInfoArray, int numImg, CvEHMM* hmm );
</pre><p><dl>
<dt>obsInfoArray<dd>Array of pointers to the observation structures.
<dt>numImg<dd>Length of above array.
<dt>hmm<dd>HMM.
</dl><p>
The function <code>cvInitMixSegm</code> takes a group of observations from several training
images already segmented by states and splits a set of observation vectors
within every internal HMM state into as many clusters as the number of mixture
components in the state.

</p><hr><h3><a name="decl_cvEstimateHMMStateParams">EstimateHMMStateParams</a></h3>
<p class="Blurb">Estimates all parameters of every HMM state</p>
<pre>
void cvEstimateHMMStateParams( CvImgObsInfo** obsInfoArray, int numImg, CvEHMM* hmm );
</pre><p><dl>
<dt>obsInfoArray<dd>Array of pointers to the observation structures.
<dt>numImg<dd>Length of the array.
<dt>hmm<dd>HMM.
</dl><p>
The function <code>cvEstimateHMMStateParams</code> computes all inner parameters of every HMM
state, including Gaussian means, variances, etc.

</p><hr><h3><a name="decl_cvEstimateTransProb">EstimateTransProb</a></h3>
<p class="Blurb">Computes transition probability matrices for embedded HMM</p>
<pre>
void cvEstimateTransProb( CvImgObsInfo** obsInfoArray, int numImg, CvEHMM* hmm );
</pre><p><dl>
<dt>obsInfoArray<dd>Array of pointers to the observation structures.
<dt>numImg<dd>Length of the above array.
<dt>hmm<dd>HMM.
</dl><p>
The function <code>cvEstimateTransProb</code> uses current segmentation of image observations
to compute transition probability matrices for all embedded and external HMMs.

</p><hr><h3><a name="decl_cvEstimateObsProb">EstimateObsProb</a></h3>
<p class="Blurb">Computes probability of every observation of several images</p>
<pre>
void cvEstimateObsProb( CvImgObsInfo* obsInfo, CvEHMM* hmm );
</pre><p><dl>
<dt>obsInfo<dd>Observation structure.
<dt>hmm<dd>HMM structure.
</dl><p>
The function <code>cvEstimateObsProb</code> computes Gaussian probabilities of each observation
to occur in each of the internal HMM states.

</p><hr><h3><a name="decl_cvEViterbi">EViterbi</a></h3>
<p class="Blurb">Executes Viterbi algorithm for embedded HMM</p>
<pre>
float cvEViterbi( CvImgObsInfo* obsInfo, CvEHMM* hmm );
</pre><p><dl>
<dt>obsInfo<dd>Observation structure.
<dt>hmm<dd>HMM structure.
</dl><p>
The function <code>cvEViterbi</code> executes Viterbi algorithm for embedded HMM. Viterbi
algorithm evaluates the likelihood of the best match between the given image
observations and the given HMM and performs segmentation of image observations
by HMM states. The segmentation is done on the basis of the match found.

</p><hr><h3><a name="decl_cvMixSegmL2">MixSegmL2</a></h3>
<p class="Blurb">Segments observations from all training images by mixture components of newly
assigned states</p>
<pre>
void cvMixSegmL2( CvImgObsInfo** obsInfoArray, int numImg, CvEHMM* hmm );
</pre><p><dl>
<dt>obsInfoArray<dd>Array of pointers to the observation structures.
<dt>numImg<dd>Length of the array.
<dt>hmm<dd>HMM.
</dl><p>
The function <code>cvMixSegmL2</code> segments observations from all training images by mixture
components of newly Viterbi algorithm-assigned states. The function uses
Euclidean distance to group vectors around the existing mixtures centers.
</p>


</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -