pym1.c
Upload User: shhuayu888
Upload Date: 2013-03-28
Package Size: 1788k
Code Size: 3k
Category:

Windows Develop

Development Platform:

Unix_Linux

  1. /****************************************************************************
  2.  File Name  : pym1.c
  3.  Purpose    : pyramid generation
  4.  Date     : Aug 31,1995
  5. GSNAKE API is jointly developed by the Information Technology Institute (ITI), Singapore, and the School of Applied Science, Nanyang Technological
  6. University (NTU), Singapore. 
  7. 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.
  8. 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 :
  9. kflai@iti.gov.sg
  10. asschan@ntu.ac.sg
  11. ***************************************************************************/
  12. #include "xwindow.h"
  13. #include "gsnake.h"
  14. void testmain(char *,int,int );
  15. void printhelp();
  16. void getparam(int, char **, int *, int *);
  17. main(int argc,char **argv)
  18. {
  19. int level,magnify;
  20. magnify =1;
  21. level = 2;
  22. if (argc==1) printhelp();
  23. else {
  24. getparam(argc,argv,&magnify,&level);
  25. testmain(argv[1], level,magnify);
  26. return(0);
  27. }
  28. }
  29. void testmain( char *imgfile, /* image file */
  30.        int level, /* Gaussian pyramid level */
  31.        int mag) /* magnification factor */
  32. {
  33. PYRAMID mypyramid;
  34. if ( mypyramid.putRawImg( imgfile ) ) {
  35. printf("Unable to read image file.");
  36. exit(-1);
  37. }
  38. else {    
  39. /* generating pyramid to default conditioning parameters */
  40. /* in verbose mode */
  41. mypyramid.generate( level, 1 );
  42. mypyramid.show( mag, level );
  43. getchar();
  44. xwin_close();
  45. }
  46. }
  47. void getparam(int ac, char **av, int *Mfactor,int *lev)
  48. {   
  49. register int i;
  50. char *inputstr;
  51. for (i=2; i<ac; i++) {
  52. if (*(av[i]) != '-') continue;
  53. inputstr = av[i]+2;
  54. switch( *(av[i]+1) ) {
  55.    case 'M' :
  56. *Mfactor=atoi(inputstr);
  57. break;
  58.    case 'L' :
  59.      *lev=atoi(inputstr);
  60.  break;
  61.     default: break;
  62. }
  63. }
  64. }
  65. void printhelp()
  66. {
  67. printf("nnCreation of pyramid");
  68. printf("n Usage :OOpym1 <image> [ option ] ");
  69. printf("n [ option] ");
  70. printf("n -M    :Magnification factor, default 1 ");
  71. printf("n -L    :Level of pyramid, default 2nn");
  72. }