Another Filter Test

In this example, the program applies filters to an image whose intesity is a "variable-frequency sine function of the radius". Rings of varying width in the image help you visually perceive the effect of filters applied.

To run the example from the command line, type:
>filter -t2 -f<filter>

The source:

void testFilterJaehne( const char* filter ) {
   IplROI roi = { 0, 0, 0, Width/2, Height/2 };
   IplImage* imgA = iplCreateImageJaehne( IPL_DEPTH_8U, Width, Height );
   IplImage* imgB = iplCloneImage( imgA );
   imgA->roi = &roi;
   // filter the image
   switch( toupper(filter[0]) ) {
   case 'S' :
      iplFixedFilter( imgB, imgA, IPL_SOBEL_3x3_H );
      iplFixedFilter( imgA, imgB, IPL_SOBEL_3x3_V );
      ipView( imgB,"Sobel", is_modal );
      break;
   case 'N' :
      iplMinFilter( imgA, imgB, 3,3, 1,1 );
      ipView( imgB,"MinFilter", is_modal );
      break;
   }
   imgA->roi = NULL;   /// roi was in stack
   iplDeallocate( imgA, IPL_IMAGE_ALL );
   iplDeallocate( imgB, IPL_IMAGE_ALL );
}

* Legal Information © 1998-2000, Intel Corporation