Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
class.tex
Package: gsnake.rar [view]
Upload User: shhuayu888
Upload Date: 2013-03-28
Package Size: 1788k
Code Size: 7k
Category:
Windows Develop
Development Platform:
Unix_Linux
- rhead{class CLASSIFY}
- section{CLASSIFY : Contour Classification}
- {tt CLASSIFY} provides advance routines for detecting and classifying deformable contours directly from noisy image (Chapter 4 of cite{kn:thesis}). It calculates the score of each competitive templates based on marginalization of the distribution ({tt _MARGIN_PROB}), MAP probability ({tt _DEFORM_PROB}), match of deformable template ({tt _DEFORM_MATCH}) and match of rigid template ({tt _RIGID_MATCH}). It has the following structure :
- begin{verbatim}
- class CLASSIFY : public REGION {
- protected :
- int numClass ; /* number of class */
- EEXTTYPE Eexttype ; /* type of external energy */
- CONTOUR **templates ; /* reference templates */
- char **labels ; /* label of templates */
- double *Margin_Prob; /* marginalized probability */
- double *Rigid_Match ; /* rigid match score */
- double *Deform_Match ; /* deform match score */
- double *Deform_Prob ; /* deform match probability */
- /* these localization and minimization parameters are made public so
- that modifying them can be easy */
- public :
- int Qx, Qy ; /* GHT Image Cell Resolutions */
- int NR, Nrxy, Nt, Ndx, Ndy ; /* GHT ranges */
- double QR, Qrxy, Qt, Qdx, Qdy; /* GHT Resolutions */
- double R, THETA ; /* GHT Constants */
- int numSearchSegment ; /* number of search segments */
- int segmentSpacing ; /* spacing between segments */
- int numLevel ; /* number of pyramid levels */
- int verbose ; /* verbose mode */
- int nhoodTangent, nhoodNormal; /* neighborhood used in marginaliz-n */
- end{verbatim}
- It stores a list of competitive templates and their corresponding score. In addition, extra parameters such as GHT range and resolution are used for localizaing and minimizing these templates.
- %
- subsection{CLASSIFY constructor}
- subsubsection*{Synopsis}
- begin{verbatim}
- CLASSIFY(EEXTTYPE _Eexttype = _EDGE);
- end{verbatim}
- subsubsection*{Arguments}
- tb
- {tt _Eexttype} & External energy type.
- te
- subsubsection*{Description}
- The constructor sets the default parameters and initializes all pointer members to NULL.
- %
- subsection{CLASSIFY destructor}
- subsubsection*{Synopsis}
- begin{verbatim}
- ~CLASSIFY(void);
- end{verbatim}
- subsubsection*{Description}
- The destructor frees memory allocated to the pointer members.
- %
- subsection{Loading a template into CLASSIFY}
- subsubsection*{Synopsis}
- begin{verbatim}
- int read( CONTOUR *contour );
- int read( char *filename );
- end{verbatim}
- subsubsection*{Arguments}
- tb
- {tt contour} & Source {tt CONTOUR}. \
- {tt filename} & Contour file.
- te
- subsubsection*{Returns}
- tb
- {tt NOERROR} & Template loaded successfully. \
- {tt MEMORYERROR} & Memory allocation failure or\
- & template initialization error
- te
- subsubsection*{Description}
- These methods read in contour used for classification purpose. Once a contour is read, {tt numContour} is incremented by one, reflecting the total number of contours read.
- %
- subsection{Classifying templates}
- subsubsection*{Synopsis}
- begin{verbatim}
- int classify(IMAGE *testimg, CLASSTYPE ClassType = _MARGIN_PROB) ;
- end{verbatim}
- subsubsection*{Arguments}
- tb
- {tt testimg} & Testing image. \
- {tt ClassType} & Type of classification : \
- & {tt _MARGIN_PROB},
- {tt _DEFORM_PROB}, {tt _DEFORM_MATCH} or {tt _RIGID_MATCH}.
- te
- subsubsection*{Returns}
- Classification score.
- subsubsection*{Description}
- {tt classify} classify rigid and deformable templates directly from the testing image. For each template, it performs localization, minimization and marginalization to compute the classify score.
- %
- subsection{Selecting the best matching contour}
- subsubsection*{Synopsis}
- begin{verbatim}
- int selectMax( ClassTYPE ClassType = _MARGIN_PROB )
- end{verbatim}
- subsubsection*{Arguments}
- tb
- {tt ClassType} & Type of classification : \
- &{tt _MARGIN_PROB},
- {tt _DEFORM_PROB}, {tt _DEFORM_MATCH} or {tt _RIGID_MATCH}.
- te
- subsubsection*{Returns}
- Index to the template which consists of highest score.
- subsubsection*{Description}
- {tt selectMax} compares the classify score of templates of type interest and searches for the highest classify score.
- %
- subsection{Getting the number of templates read}
- subsubsection*{Synopsis}
- begin{verbatim}
- int getNumClass( void )
- end{verbatim}
- subsubsection*{Returns}
- Number of templates read.
- subsubsection*{Description}
- {tt getNumClass} retrieves the number of templates read.
- %
- subsection{Getting the matching score}
- subsubsection*{Synopsis}
- begin{verbatim}
- double getScore( int template_id, CLASSTYPE ClassType = _MARGIN_PROB)
- end{verbatim}
- subsubsection*{Arguments}
- tb
- {tt template_id} & Target template index. \
- {tt ClassType} & Type of classification : \
- & {tt _MARGIN_PROB},
- {tt _DEFORM_PROB}, {tt _DEFORM_MATCH} or {tt _RIGID_MATCH}.
- te
- subsubsection*{Returns}
- Classify score of target template.
- subsubsection*{Description}
- {tt getScore} retrieves the score of template indexed by {tt template_id}.
- %
- subsection{Printing templates score}
- subsubsection*{Synopsis}
- begin{verbatim}
- void dump(char *imgName, FILE *stream = stdout)
- end{verbatim}
- subsubsection*{Description}
- {tt dump} prints onto screen or file the score of each templates.
- %
- subsection{Getting label of template}
- subsubsection*{Synopsis}
- begin{verbatim}
- char *getLabel(short class_id)
- end{verbatim}
- subsubsection*{Arguments}
- tb
- {tt ClassType} & Type of classification : \
- & {tt _MARGIN_PROB},
- {tt _DEFORM_PROB}, {tt _DEFORM_MATCH} or {tt _RIGID_MATCH}.
- te
- subsubsection*{Returns}
- Label of template of interest.
- subsubsection*{Description}
- {getlabel} facilitates the retrieval of template label.
- %
- subsection{Example : Classifying various templates}
- begin{verbatim}
- void testmain( char **imgsamples ) /* image samples */
- {
- register short i ;
- CLASSIFY shape(_EDGE) ;
- shape.Nrxy = 3 ; /* allow some stretching in diagonal direction */
- if( shape.read("ellip.con") != NOERROR ||
- shape.read("rect.con") != NOERROR ) {
- printf("cannot find contour filesn") ;
- exit(-1) ;
- }
- for(i=0; *imgsamples; i++, imgsamples++) {
- IMAGE myImage ;
- if( myImage.read(*imgsamples) != NOERROR )
- break ;
- int id = shape.classify(&myImage, _MARGIN_PROB) ;
- printf("%s : %sn", *imgsamples, shape.getLabel(id) ) ;
- shape.dump(*imgsamples) ;
- }
- exit(0) ;
- end{verbatim}
- This program read in two templates, namely {tt ellip.con} and {tt rect.con}. {tt classify} maginalizes the distribution and returns the matched template. {tt dump} will print on screen the classfy scores of the template.