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

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

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

  1 /**@(#)
  2 **/
  3 #include <math.h>
  4 #include <tina/sys.h>
  5 #include <tina/sysfuncs.h>
  6 #include <tina/math.h>
  7 #include <tina/mathfuncs.h>
  8 #include <tina/vision.h>
  9 #include <tina/visionfuncs.h>
 10 
 11 Imrect *im_tsmooth(Imrect * im1)
 12 {
 13     Imrect *im2;
 14     int     ix, iy;
 15     Imregion *roi;
 16 
 17     if (im1 == NULL)
 18         return (NULL);
 19 
 20     im2 = im_alloc(im1->height, im1->width, im1->region, im1->vtype);
 21     roi = im1->region;
 22     for (ix = roi->lx; ix < roi->ux; ix++)
 23         for (iy = roi->ly; iy < roi->uy; iy++)
 24         {
 25             double  v0, v2, nx, ny, n;
 26             double  x = ix + 0.5;
 27             double  y = iy + 0.5;
 28 
 29             nx = im_sub_pixf(im1, y, x + 0.5) - im_sub_pixf(im1, y, x - 0.5);
 30             ny = im_sub_pixf(im1, y + 0.5, x) - im_sub_pixf(im1, y - 0.5, x);
 31             n = sqrt(nx * nx + ny * ny);
 32             if (n == 0.0)
 33                 n = 1.0;
 34             else
 35             {
 36                 nx /= n;
 37                 ny /= n;
 38             }
 39             v0 = im_sub_pixf(im1, y + nx, x - ny);
 40             v2 = im_sub_pixf(im1, y - nx, x + ny);
 41             IM_PIX_SET(im2, iy, ix, 0.5 * (v0 + v2));
 42         }
 43     return (im2);
 44 }
 45 

~ [ 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.