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
imglearn.c
Package: gsnake.rar [view]
Upload User: shhuayu888
Upload Date: 2013-03-28
Package Size: 1788k
Code Size: 4k
Category:
Windows Develop
Development Platform:
Unix_Linux
- /****************************************************************************
- File Name : imglearn.c
- Purpose : to train shape matrix and deformation variance
- Date : Aug 31,1995
- GSNAKE API is jointly developed by the Information Technology Institute (ITI), Singapore, and the School of Applied Science, Nanyang Technological
- University (NTU), Singapore.
- These software programs are available to the user without any license or royalty fees. Permission is hereby granted to use, copy, modify, and distribute this software and its documentation for any purpose. ITI and NTU gives no warranty, express, implied, or statuary for the software and/or documentation provided, including, without limitation, waranty of merchantibility and warranty of fitness for a particular purpose. The software provided hereunder is on an "as is" basis, and ITI and NTU has no obligation to provide maintenance, support, updates, enhancements, or modifications.
- GSNAKE API is available for any UNIX compatible system. User feedback, bugs, or software and manual suggestions should be sent via electronic mail to one of the following, who may or may not act on them as he/she desires :
- asschan@ntu.ac.sg
- kflai@iti.gov.sg
- ***************************************************************************/
- #include "gsnake.h"
- #include "xwindow.h"
- void help();
- main( int argc, char **argv )
- {
- MODEL model; /* to store results of learning */
- GSNAKE sample(_EDGE); /* sample will use _EDGE as external energy */
- char *outfile; /* output contour file */
- char **imgsamples; /* image samples */
- short level = 2; /* pyramid level */
- register short i;
- if (argc < 3) {
- help();
- exit( -1 );
- }
- imgsamples = &argv[2] ;
- outfile = argv[1] ;
- for(i=0; *imgsamples ; i++, imgsamples++) {
- printf("Using Sample %s to Learn SHAPEnn", *imgsamples);
- sample.putRawImg(*imgsamples);
- if( i==0 ) {
- /* use manually selected feature points to
- estimate the shape matrix */
- sample.CONTOUR::init( sample.rawImg );
- model.LearnShape( &sample );
- }
- /* Using the initial shape matrix and minimiax regularization,
- the total energy of gsnake is minimize and then the shape
- matrix is updated */
- model.duplicate(&sample);
- sample.generate(level, 1); /* generate pyramid */
- sample.localize(5, 5, 1, 0.25, 3); /* localize the contour */
- sample.minimize(5, 5, 0); /* minimize energy */
- sample.deform(); /* manually adjust */
- model.LearnShape( &sample ); /* average out the shape coef */
- if(i) model.regenerate() ; /* regenerate the shape based on mtx */
- }
- /* deformation and noise variance are done only after the
- shape matrix has been properly trained */
- for(imgsamples = &argv[2]; *imgsamples; imgsamples++) {
- printf("Using Sample %s to Learn DEFORMATIONnn", *imgsamples);
- sample.putRawImg(*imgsamples);
- model.duplicate(&sample);
- sample.generate(level, 1);
- sample.localize(5, 5, 1, 0.25, 3);
- sample.putGLambda(_LOCAL_MINMAX);
- sample.minimize(5, 5, 0);
- sample.deform();
- model.LearnDeform( &sample ); /* average out the deform param */
- }
- model.computeZ() ; /* compute normalizing constant using monte_carlo
- estimation */
- model.CONTOUR::print() ;
- model.CONTOUR::write( outfile ); /* write it to file */
- }
- void help()
- {
- printf("n Image learn Utility n");
- printf(" Usage : imglearn <contour> <image samples>n");
- printf(" Images can be of type bin or SUN raster. nn");
- }