📄 gho1.c
字号:
/****************************************************************************
File Name : gho1.c
Purpose : find one 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 :
asschan@ntu.ac.sg
kflai@iti.gov.sg
***************************************************************************/
#include "gsnake.h"
#include "xwindow.h"
void testmain(char *, char *, int, short);
void printhelp();
void getparam(int ac, char** av, int *);
main(int argc, char **argv)
{
int Magnify = 1;
short Level = 1;
char *confile;
if (argc < 3)
printhelp();
else {
getparam(argc,argv, &Magnify );
testmain(argv[1], argv[2], Magnify, Level);
return(0);
}
}
void testmain( char *imgfile, /* image file */
char *cfile, /* contour file */
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 */
if ( mypyramid.putRawImg(imgfile) )
exit (-1);
if (mycontour.read(cfile))
exit(-1);
/* Generate pyramid in verbose mode to level 3 */
mypyramid.generate(level, 1);
/* Get highest level in pyramid */
printf("\n Perform localization ... wait\n");
edgemap = mypyramid.getEdge(level - 1);
localised = GHT_OBJ.localize( &mycontour, edgemap );
/* show image */
mypyramid.rawImg->show(mag);
for ( sptr=localised->getHead(); sptr; sptr=sptr->getNext() )
sptr->show( mypyramid.rawImg,
ROUNDOFF(sptr->getRow())*mag,
ROUNDOFF(sptr->getCol())*mag);
printf("\nPress enter to end.");
getchar();
}
void getparam( int ac,
char** av,
int *mag )
{
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 'M' :
*mag=atoi(inputstr);
break;
}
}
}
void printhelp()
{
printf("\n\nLocalisation of contour on image");
printf("\n Usage :OOgho1 <image> <contour> [ option ]");
printf("\n [ option ]");
printf("\n -M : Magnification factor, default 1\n\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -