⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pym2.c

📁 图像中非刚性曲线的蛇形检测算法
💻 C
字号:
/****************************************************************************
 File Name  : pym1.c
 Purpose    : Getting gaussian image and edge map
 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 testmain(char *,int,int, int );
void printhelp();
void getparam(int, char **, int *, int *, int *);


main(int argc,char **argv)
{
	int plevel=2;
	int i_level=0;
	int magnify =1;

	if (argc==1) printhelp();
	else {
		getparam(argc,argv,&plevel,&i_level,&magnify);
		testmain(argv[1],plevel,i_level,magnify);		
		return(0);
	}
}			


void testmain( char *imgfile,	/* image file */
	       int pymlevel,	/* pyramid levels */
	       int i_level,	/* level of interest */
	       int mag)		/* maginification factor */
{
	IMAGE myimage1,
	      *myimage2;	/* IMAGE object */
	PYRAMID mypyramid;	/* PYRAMID object */
	EDGE *myedge;		/* EDGE object */

	if ( myimage1.read( imgfile ) ) {
		printf("\nUnable to get image.\n");
		exit(-1);
	}
	
	/* Placing image into pyramid object by using another image */
	mypyramid.putRawImg( &myimage1 );
	
	/* generating pyramid by default conditioning parameters */
	mypyramid.generate( pymlevel, 1 );
	
	if ( !i_level ) 
		i_level = mypyramid.getLevel() - 1;

	/* get edge map and Guassian images of interest */
	myimage2 = mypyramid.getGauss( i_level );
	myedge = mypyramid.getEdge( i_level );
	
	/* Showing gaussian image at level */
	if ( myimage2 && myedge) {	

		printf("\nShowing level %d Gaussian image", i_level);
		myimage2->show( mag*i_level );
		printf("\nPress enter to continue .");
		getchar();
	
		printf("\nShowing level %d edge map", i_level);
		myedge->show( mag*i_level );
		printf("\nPress enter to continue.");	
		getchar();
	}
	else 
		printf("\nLevel specified is invalid.");
	
	printf("\nEnd of test\n");
}


void getparam(int ac, char **av,int *plev, int *lev,int *Mfactor)
{   
	register int i;
	char *inputstr;

	for (i=2; i<ac; i++) {

		if (*(av[i]) != '-') continue;
		
		inputstr = av[i]+2;

		switch( *(av[i]+1) ) {
				
		   case 'M' :
			*Mfactor=atoi(inputstr);
			break;

		   case 'L' :
		   	 *plev=atoi(inputstr);
			 break;

		   case 'l' :
		   	 *lev = atoi(inputstr);
		   	 break;	

		    default: break;
		}
	}
}


void printhelp()
{
	printf("\n\nCreation of pyramid");
	printf("\n Usage :OOpym2 <image> [ option ]");
	printf("\n [ option ] ");
	printf("\n -M    : Magnification factor, default 1 ");
	printf("\n -L    : Level of pyramid, default 2");
	printf("\n -l    : Level of image to take. Default top level\n\n");
}

⌨️ 快捷键说明

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