Main Page   Data Structures   File List   Data Fields   Globals  

chirp.c

Go to the documentation of this file.
00001 #include        "sadie.h"
00002 
00003 /*-Copyright Information------------------------------------------------------*/
00004 /* Copyright (c) 1993 by the University of Arizona Digital Image Analysis Lab */
00005 /*----------------------------------------------------------------------------*/
00006 /*-General Information--------------------------------------------------------*/
00007 /*                                                                            */
00008 /*   This function creates a chirp test pattern.                              */
00009 /*                                                                            */
00010 /*----------------------------------------------------------------------------*/
00011 /*-Interface Information------------------------------------------------------*/
00012 void CHIRP (
00013 short  nlin,    /*  I   Number of lines in the output image.                  */
00014 short  npix,    /*  I   Number of pixels/line in the output image.            */
00015 double period,  /*  I   Period of the chirp in pixels.                        */
00016 IMAGE  **out    /*  O   Address of a pointer to the output image.             */
00017 /*----------------------------------------------------------------------------*/
00018 ) { register short j, k;
00019     char   msg[SLEN];
00020     double x, y;
00021 
00022     if (TIMES) TIMING(T_CHIRP);
00023     if (NAMES) {
00024         MESSAGE('I',"");
00025         MESSAGE('I',"CHIRP");
00026         MESSAGE('I',"");
00027         sprintf(msg," Image size: lines:           %d",nlin);
00028         MESSAGE('I',msg);
00029         sprintf(msg,"             pixels:          %d",npix);
00030         MESSAGE('I',msg);
00031         sprintf(msg," Period:                    %12.4e",period);
00032         MESSAGE('I',msg);
00033         MESSAGE('I'," ...............");
00034     }
00035 
00036     /* create image of appropriate size */
00037     if (!CHECKIMG(*out)) GETMEM(1,nlin,npix,out);
00038 
00039     /* create chirp test pattern */
00040         period = PI / period;
00041     for (j=0; j<nlin; j++) {
00042         y = (double)(j-nlin/2)*(j-nlin/2);
00043         for (k=0; k<npix; k++) {
00044                 x = sqrt((double)(k-npix/2)*(double)(k-npix/2) + y);
00045             (*out)->data[0][j][k] = (PIXEL)cos(x*x*period);
00046         }
00047     }
00048 
00049     the_end:
00050     if (TIMES) TIMING(T_EXIT);
00051 }

Generated on Wed Apr 9 08:56:04 2003 for TREES by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002