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

📄 edg1.c

📁 图像中非刚性曲线的蛇形检测算法
💻 C
字号:
/****************************************************************************
 File Name  : edg1.c
 Purpose    : computes 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"
#include "xwindow.h"
   
void testmain(char *,int );
void printhelp();
void getparam(int, char **, char **, int *);



main(int argc, char **argv)
{
	int magnify;
	char *imgfile=NULL;

	magnify =1;

	printhelp();
	getparam(argc,argv,&imgfile,&magnify);
	testmain(imgfile,magnify);		
	return(0);	
}


void testmain( char *imgfile,	/* image file */
	       int mag )	/* magnification factor */
{

   IMAGE myimage;
   EDGE myedge;
  
   if (imgfile) myimage.read(imgfile);
   else {
   	 /* Create a simple image of 3 rows of different intensities */

   	 int i,j,row,col;
   
	 row = 90;
   	 col = 90;
   
  	printf("\nCreating demo image...\n");
  	
  	myimage.init(row,col);
    
   	for(i=0;i<row;i++)
   		for(j=0;j<col;j++)
   	 		myimage.put(i,j,20);
   	 	
	for(i=20;i<70;i++)
   		for(j=20;j<70;j++)
   	 		myimage.put(i,j,70);

	for(i=30;i<60;i++)
   		for(j=30;j<60;j++)
   	 		myimage.put(i,j,150);
   }
   
   myimage.show(mag);
   printf("\nShowing image. Press enter to see edge .");
   getchar();

   /* Computing and showing edge */
   /* Default parameters are used. Verbose mode */
   myedge.compute(&myimage, 1);   
   myedge.show(mag);
   printf("\nPress enter to continue.");   
   getchar();
   printf("End of test.\n");
}

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

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

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

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

		   case 'F' :
		   	 *i_file=inputstr;
			 break;

		    default: break;
		}
	}
}

void printhelp()
{
	printf("\n\nComputation of edge");
	printf("\n Usage :OOedg1 [ option ] ");
	printf("\n [ option ] ");
	printf("\n -M    :Magnification factor, default 1 ");
	printf("\n -F    :Input image file.\n\n");
}

⌨️ 快捷键说明

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