// file: $USFS/class/image_analysis/v6.2/imaga_gabor_02.cc
//

// isip include files
//
#include "image_analysis.h"
#include "image_analysis_constants.h"

// method: gabor_gen_cc
//
// arguments:
//  float_8* gabor_filter: (output) computed system response of the filter
//  float_8 rad_frq: (input) required radial frequency
//  float_8 orient: (input) required orientation
//
// return: a logical_1 value indicating status
//
// this method generates system responses for a gabor filter
//
logical_1 Image_analysis::gabor_gen_cc(float_8* gabor_filter_a,
				       float_8 rad_frq_a, float_8 orient_a) {
  
  for (int_4 m = 0; m < gabor_num_col_d; m++) {
    for (int_4 n = 0; n < gabor_num_row_d; n++) {
      gabor_filter_a[n * gabor_num_col_d + m]
	= exp(-0.5 * (m * m / pow(gabor_sigma_x_d, 2)
	    + n * n / pow(gabor_sigma_y_d, 2))
	      * cos(2 * PI * rad_frq_a * (m * cos(orient_a)
		- n * sin(orient_a))));
    }			  
  }
    
  // exit gracefully
  //
  return ISIP_TRUE;
}
