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
gsfit.c
Package: gsnake.rar [view]
Upload User: shhuayu888
Upload Date: 2013-03-28
Package Size: 1788k
Code Size: 6k
Category:
Windows Develop
Development Platform:
Unix_Linux
- /****************************************************************************
- File Name : gsfit.c
- Purpose : extract arbitrary contour
- 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 "xwindow.h"
- #include "gsnake.h"
- void getparam(int ac, char** av);
- void printHelp();
- int verbose = 0; /* verbose mode */
- int spacing = 5; /* snaxel spacing */
- int spac = 2; /* search segment spacing */
- int nhood = 2; /* number of search segment */
- double lambda = _LOCAL_MINMAX; /* regularization parameter */
- EEXTTYPE Etype = _EDGE; /* external energy type */
- int level = 2; /* Gaussian pyramid level */
- int mag = 1; /* image magnification factor */
- float low_p = 0.9; /* low percentage range */
- float high_p = 0.95; /* high percentage range */
- float low_v = 0.2; /* low intensity range */
- float high_v = 0.9; /* high intensity range */
- float e_pow = 1; /* exponential power */
- main( int argc, char **argv )
- {
- IMAGE myimage; /* image object */
- GSNAKE mysnake; /* gsnake object */
- short register i, j;
- if (argc==1) printHelp();
- else {
- getparam(argc,argv);
- /* perform gaussian pyramid */
- if ( !(myimage.read(argv[1]))) {
- printf("nHistogram Specification parameters :");
- printf("ntLow Percent:%f tHigh Percent:%f",low_p,high_p);
- printf("ntLow Value :%f tHigh Value :%f",low_v,high_v);
- printf("ntExponent :%f tMagnification:%d",e_pow,mag);
- mysnake.putRawImg( &myimage );
- printf("nnGenerating Gaussian pyramid images ... wait");
- mysnake.generate( level, verbose,
- low_p, high_p,low_v, high_v, e_pow);
- }
- else
- exit( -1 );
- /* generate gsnake */
- short row = myimage.getRow();
- short col = myimage.getCol();
- if ( !mysnake.read( argv[2] ) ) {
- printf("nnGSNAKE performance parameters :");
- printf("ntExternal Energyt: ");
- switch (Etype) {
- case _EDGE : printf("Edge"); break;
- case _EDGEMAG : printf("Edge magnitude"); break;
- case _INTENSITY : printf("Intensity");break;
- default : break;
- }
- printf("ntSearch spacingt: %d",spac);
- printf("ntInsertion spacingt: %d",spacing);
- printf("ntSearch neighbourhoodt: %d",nhood);
- printf("ntRegularization lambdat: %f", lambda );
- printf("nnGeneralized Hough transform ... wait");
- mysnake.localize();
- printf("nEnergy minimization ... waitn");
- mysnake.minimize( spac, nhood, spacing, mag, verbose, lambda );
- mysnake.show( (unsigned char)mag );
- printf("nnEnter to continue ...");
- getchar();
- }
- }
- xwin_close();
- }
- void getparam( int ac, char** av )
- {
- register int i;
- char *inputstr;
- for (i=2; i<ac; i++) {
- if (*av[i] == '/') verbose = 1;
- if( *av[i] != '-' )
- continue; /* illegal input */
- inputstr = av[i]+2;
- switch( *(av[i]+1) ) {
- case 'L' :
- level = atoi(inputstr);
- break;
- case 'M' :
- mag = atoi(inputstr);
- break;
- case 'P' :
- inputstr=av[i]+3;
- switch (*(av[i]+2)) {
- case 'l': low_p=atof(inputstr); break;
- case 'h': high_p=atof(inputstr);break;
- }
- break;
- case 'V' :
- inputstr = av[i]+3;
- switch( *(av[i]+2) ) {
- case 'l' : low_v = atof(inputstr);break;
- case 'h' : high_v = atof(inputstr);break;
- }
- break;
- case 'e' :
- e_pow=atof(inputstr);
- break;
- case 'S' :
- inputstr=av[i]+3;
- switch (*(av[i]+2)) {
- case 's': spacing = atoi(inputstr); break;
- case 'd': spac = atoi(inputstr);break;
- case 'n': nhood = atoi(inputstr);break;
- }
- break;
- case 'R' :
- lambda = atof(inputstr);
- break;
- case 'E' :
- switch (*(av[i]+2)) {
- case 'i': Etype = _INTENSITY; break;
- case 'e': Etype = _EDGE; break;
- case 'm': Etype = _EDGEMAG;break;
- }
- break;
- default : break;
- }
- }
- }
- void printHelp()
- {
- printf("nn Match of a template on an imagen");
- printf("n Usage: gsfit <image> <contour> -[option]<value>");
- printf("n [ option ]:");
- printf("n -L : Level of pyramid to build to, default 2");
- printf("n -M : Magnification factor, default 1");
- printf("n -E : External energy input type, default e");
- printf("n : i - Intensity e - Edge Data");
- printf("n : m - Edge Magnitude only");
- printf("n -S : Stratified Search spacing");
- printf("n : s - snaxel spacing, default 5");
- printf("n : d - search segment spacing, default 2");
- printf("n : n - number of search segment, default 2");
- printf("n -R : Regularization parameter, default _LOCAL_MINMAX");
- printf("n -Pl,Ph : Percentage range for histogram specification, default 0.9-0.95");
- printf("n -Vl,Vh : Intensity range for histogram specification, default 0.2-0.9");
- printf("n -e : Exponential Factor, default 1");
- printf("n / : Activate verbose, default 0nn");
- }