cla1.c

来自「图像中非刚性曲线的蛇形检测算法」· C语言 代码 · 共 69 行

C
69
字号
/****************************************************************************
 File Name  : cla1.c
 Purpose    : to classify various templates
 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"

void printhelp();
void testmain( char **imgsample );

main( int argc, char **argv )
{
	char **imgsamples ;

	imgsamples = &argv[1] ;

	if( argc < 2 )
		printhelp();
	else 
		testmain( imgsamples );
}

void testmain( char **imgsamples ) /* image samples */
{
	register short i ;
	CLASSIFY shape(_EDGE) ;

	shape.Nrxy = 3 ;    /* allow some stretching in diagonal direction */
	
	if( shape.read("ellip.con") != NOERROR ||
	    shape.read("rect.con") != NOERROR  ) {
	    	printf("cannot find contour files\n") ;
	    	exit(-1) ;
	}

	
	for(i=0; *imgsamples; i++, imgsamples++) {
	
		IMAGE myImage ;
		if( myImage.read(*imgsamples) != NOERROR )
			break ;
			
		int id = shape.classify(&myImage, _MARGIN_PROB) ;
		
		printf("%s : %s\n", *imgsamples, shape.getLabel(id) ) ;
		
		shape.dump(*imgsamples) ;
	}
	exit(0) ;
}

void printhelp()
{
        printf("\n To classify various templates");
        printf("\n Usage : OOcla1 <image samples>\n\n");
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?