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
00013 CHIRP (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   )
00019 {
00020   register short j, k;
00021   char msg[SLEN];
00022   double x, y;
00023 
00024   if (TIMES)
00025     TIMING (T_CHIRP);
00026   if (NAMES)
00027     {
00028       MESSAGE ('I', "");
00029       MESSAGE ('I', "CHIRP");
00030       MESSAGE ('I', "");
00031       sprintf (msg, " Image size: lines:           %d", nlin);
00032       MESSAGE ('I', msg);
00033       sprintf (msg, "             pixels:          %d", npix);
00034       MESSAGE ('I', msg);
00035       sprintf (msg, " Period:                    %12.4e", period);
00036       MESSAGE ('I', msg);
00037       MESSAGE ('I', " ...............");
00038     }
00039 
00040   /* create image of appropriate size */
00041   if (!CHECKIMG (*out))
00042     GETMEM (1, nlin, npix, out);
00043 
00044   /* create chirp test pattern */
00045   period = PI / period;
00046   for (j = 0; j < nlin; j++)
00047     {
00048       y = (double) (j - nlin / 2) * (j - nlin / 2);
00049       for (k = 0; k < npix; k++)
00050         {
00051           x = sqrt ((double) (k - npix / 2) * (double) (k - npix / 2) + y);
00052           (*out)->data[0][j][k] = (PIXEL) cos (x * x * period);
00053         }
00054     }
00055 
00056 the_end:
00057   if (TIMES)
00058     TIMING (T_EXIT);
00059 }

Generated on Sun May 18 15:36:07 2003 for tclSadie by doxygen1.3