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
gsinit.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 : gsinit
- Purpose : to create g-snake template
- Release : Version 1.0
- 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 , char** ,int *, INITMODE *, SNAKEMODE *,int *,char **);
- void printHelp();
- main( int argc, char **argv )
- {
- IMAGE myimage; /* image object */
- GSNAKE mysnake; /* gsnake object */
- int Numpts = 16; /* number of snaxels */
- int level = 2; /* Gaussian pyramid level */
- int mag = 1; /* magnification factor */
- INITMODE Mode = _LOADTEMPLATE;/* contour initialization */
- SNAKEMODE SMode = _CLOSED; /* gsnake mode */
- char *filename = NULL; /* output filename */
- short row, col; /* image size */
- short register i, j;
- if (argc == 1)
- printHelp();
- else {
- getparam(argc, argv, &mag, &Mode, &SMode, &Numpts, &filename);
- if ( !(myimage.read(argv[1])) ) {
- /* generate gsnake */
- row = myimage.getRow();
- col = myimage.getCol();
- printf("nCreate template ... waitnn");
- /* Generating line or circle based on image automatically */
- if (Mode == _LOADTEMPLATE) {
- if ( SMode == _CLOSED )
- mysnake.CONTOUR::init( row/2, col/2,
- (double)MIN(row,col)/4.0,Numpts );
- else
- mysnake.CONTOUR::init(
- (short)(col/4), (short)(row/4),
- (short)(3*col/4), (short)(row/2),
- Numpts );
- }
- /* Generating template using either click or drag */
- if (Mode != _LOADTEMPLATE)
- /* Initialising level 0 image */
- mysnake.CONTOUR::init( &myimage, mag, Mode,SMode);
- if ( !filename )
- filename = strdup("contour");
- if ( mysnake.write(filename) )
- printf("nUnable to write to file %sn", filename);
- }
- }
- xwin_close();
- }
- void getparam( int ac, char** av,
- int *Mfactor, /* magnification factor */
- INITMODE *mode, /* contour initialization mode */
- SNAKEMODE *smode, /* gsnake mode */
- int *Numpt, /* number of snaxels */
- char **outfile ) /* output filename */
- {
- register short i;
- char *inputstr;
- for (i=2; i<ac; i++) {
- if( *av[i] != '-' )
- continue; /* illegal input */
- inputstr = av[i]+2;
- switch( *(av[i]+1) ) {
- case 'I' :
- switch (*(av[i]+2)) {
- case 'c': *mode = _CLICKMOUSE; break;
- case 'd': *mode = _DRAGMOUSE;break;
- case 'a': *mode = _LOADTEMPLATE;break;
- }
- break;
- case 'S' :
- switch (*(av[i]+2)) {
- case 'c': *smode = _CLOSED; break;
- case 'o': *smode = _OPENED;break;
- }
- break;
- case 'M' :
- *Mfactor=atoi(inputstr);
- break;
- case 'N' :
- *Numpt=atoi(inputstr);
- break;
- case 'O' :
- *outfile = inputstr;
- break;
- default: break;
- }
- }
- }
- void printHelp()
- {
- printf("nnCreation of GSNAKE template");
- printf("nnUsage: gsinit <image> -[option] ");
- printf("n [ option ]n ");
- printf("n M : Magnification factor, default 1");
- printf("n N : Number of points in SNAKE, default 16");
- printf("n I d/c : Snake initialisation, default a");
- printf("n : d - Drag c - Click a - Automatic ");
- printf("n S o/c : Type of snake to be formed, default c");
- printf("n : o - Open ended c - Closed");
- printf("n O : Output contour filename,");
- printf("n : default filename <contour>nn");
- }