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
gho2.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 : gho2.c
- Purpose : find multiple g-snake by generalized Hough transform
- 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 :
- kflai@iti.gov.sg
- asschan@ntu.ac.sg
- ***************************************************************************/
- #include "gsnake.h"
- #include "xwindow.h"
- void testmain(char *, char *, short, int, short);
- void printhelp();
- void getparam(int ac, char** av, short *, int *, short *);
- main(int argc, char **argv)
- {
- int Magnify = 1;
- short Level = 2;
- short numgsnake = 1;
- char *confile;
- if (argc==1)
- printhelp();
- else {
- getparam(argc,argv, &numgsnake, &Magnify, &Level );
- testmain(argv[1], argv[2], numgsnake, Magnify, Level);
- return(0);
- }
- }
- void testmain( char *imgfile, /* image file */
- char *cfile, /* contour file */
- short numgsnake, /* number of desired snakes */
- int mag, /* magnification factor */
- short level ) /* pyramid level */
- {
- PYRAMID mypyramid; /* PYRAMID object */
- EDGE *edgemap; /* EDGE object */
- CONTOUR mycontour; /* CONTOUR object */
- CONTOUR **localised; /* CONTOUR object */
- SNAXEL *sptr; /* SNAXEL object */
- GHOUGH GHT_OBJ; /* GHOUGH object */
- int row, col; /* image of col x row */
- int ratio;
- if ( mypyramid.putRawImg(imgfile) )
- exit (-1);
- if (cfile) {
- if (mycontour.read(cfile))
- exit(-1);
- }
- else {
- /* Initialise a closed contour in the centre of the test image */
- /* Radius of circle = smaller of row and col divide by 5 */
- /* The values are arbitrary */
- row = mypyramid.rawImg->getRow();
- col = mypyramid.rawImg->getCol();
- mycontour.init(row/2,col/2,(double) MIN(row,col)/5,8);
- }
- /* Generate pyramid in verbose mode to level 3 */
- mypyramid.generate(level, 1);
- mypyramid.show(mag,level);
- printf("nPress enter to continue.");
- getchar();
- printf("nCo-ordinates before transformn ");
- mycontour.print();
- mypyramid.rawImg->show(mag);
- for (sptr=mycontour.getHead();sptr;sptr=sptr->getNext())
- sptr->show( mypyramid.rawImg,
- ROUNDOFF(sptr->getRow())*mag,
- ROUNDOFF(sptr->getCol())*mag );
- printf("nPress enter to continue.");
- getchar();
- /* Use external energy input Edge.The edge object used is the
- highest level one because the search area will be the
- smallest */
- ratio = mypyramid.getLevel()-1;
- /* Reduce contour to size of highest edge */
- mycontour.expand(LEVEL(-ratio));
- /* Get highest level in pyramid */
- edgemap = mypyramid.getEdge(ratio);
- localised = GHT_OBJ.localize( &mycontour, edgemap, numgsnake );
- register short i;
- for ( i=0; i< numgsnake; i++ ) {
- printf("nLocalised contour [%d] on image.n", i );
- /* Get the localised gsnake. */
- /* Contour will be in natural image size */
- localised[i]->expand(LEVEL(ratio));
- localised[i]->print();
- mypyramid.rawImg->show(mag);
- for ( sptr=localised[i]->getHead(); sptr; sptr=sptr->getNext() )
- sptr->show( mypyramid.rawImg,
- ROUNDOFF(sptr->getRow())*mag,
- ROUNDOFF(sptr->getCol())*mag);
- printf("nnPress Enter to Continuen");
- getchar();
- }
- }
- void getparam( int ac,
- char** av,
- short *numgsnake,
- int *mag,
- short *level )
- {
- register int i;
- char *inputstr;
- for (i=1; i<ac; i++) {
- if( *av[i] != '-' )
- continue; /* illegal input */
- inputstr = av[i]+2;
- switch( *(av[i]+1) ) {
- case 'n' :
- *numgsnake = atoi(inputstr);
- break;
- case 'M' :
- *mag=atoi(inputstr);
- break;
- case 'L' :
- *level=atoi(inputstr);
- break;
- }
- }
- }
- void printhelp()
- {
- printf("nnLocalisation of contour on image");
- printf("n Usage :OOgho2 <image> <contour> [ option ]");
- printf("n [ option ]");
- printf("n -n : number of contours to be localized, default 1");
- printf("n -M : Magnification factor, default 1");
- printf("n -L : Level of pyramid, default 2nn");
- }