~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/vision/improc/im_zeropad.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #include <math.h>
  2 #include <tina/sys.h>
  3 #include <tina/sysfuncs.h>
  4 #include <tina/math.h>
  5 #include <tina/mathfuncs.h>
  6 #include <tina/vision.h>
  7 #include <tina/visionfuncs.h>
  8 #include <tina/hist_funcs.h>
  9 #define FOR_IM(_roi,_row,_col) for ((_row)=(_roi)->ly; (_row)<(_roi)->uy; (_row)++) \
 10                                  for ((_col)=(_roi)->lx; (_col)<(_roi)->ux; (_col)++)
 11 /* SC's loop macro gone mad! */
 12 
 13 Imrect *im_zeropad(Imrect *im, int auto_pad_depth)
 14 {
 15   Imrect *new_im = NULL; /* new image store */
 16   Imregion roi;          /* new image roi */
 17   int row, col;          /* loop variables */
 18  
 19   /* create the new and larger image */
 20  
 21   roi = *(im->region);
 22   roi.lx -= auto_pad_depth;
 23   roi.ly -= auto_pad_depth;
 24   roi.ux += auto_pad_depth;
 25   roi.uy += auto_pad_depth;
 26  
 27   new_im = im_alloc(im->height, im->width, &roi, im->vtype);
 28  
 29   switch (im->vtype)
 30   {
 31       case uchar_v:
 32          FOR_IM(im->region, row, col) IM_UCHAR(new_im, row, col) = IM_UCHAR(im, row, col);
 33       break;
 34       case short_v:
 35          FOR_IM(im->region, row, col) IM_SHORT(new_im, row, col) = IM_SHORT(im, row, col);
 36       break;
 37       case int_v:
 38          FOR_IM(im->region, row, col) IM_INT(new_im, row, col) = IM_INT(im, row, col);
 39       break;
 40       case float_v:
 41          FOR_IM(im->region, row, col) IM_FLOAT(new_im, row, col) = IM_FLOAT(im, row, col);
 42       break;
 43   }
 44   im_free(im);
 45   return (new_im);
 46 }
 47 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.