Logo Search packages:      
Sourcecode: libgphoto2 version File versions

static int get_diffs_row2 ( unsigned char *  hom_buffer_h,
unsigned char *  hom_buffer_v,
unsigned char *  buffer_h,
unsigned char *  buffer_v,
int  w 
) [static]

Differences are assigned scores across row 2 of buffer_v, buffer_h.

Parameters:
hom_buffer_h tabulation of scores for buffer_h
hom_buffer_v tabulation of scores for buffer_v
buffer_h three-row window, scores assigned for pixels in row 2
buffer_v three-row window, scores assigned for pixels in row 2
w pixel width of image and buffers

Definition at line 328 of file ahd_bayer.c.

References dRGB(), and GP_OK.

Referenced by gp_ahd_interpolate().

{
      int i,j;
      int RGBeps;
      unsigned char Usize_h, Usize_v;

      for (j = 1; j < w-1; j++) {
            i=3*j+9*w;
            Usize_h=0;
            Usize_v=0;

            /* 
             * Data collected here for adaptive estimates. First we take 
             * at the given pixel vertical diffs if working in window_v;
             * left and right diffs if working in window_h. We then choose
             * of these two diffs as a permissible epsilon-radius within 
             * which to work. Checking within this radius, we will 
             * compute scores for the various possibilities. The score 
             * added in each step is either 1, if the directional change 
             * is within the prescribed epsilon, or 0 if it is not. 
             */
             
            RGBeps=MIN(
                  MAX(dRGB(i,i-3,buffer_h),dRGB(i,i+3,buffer_h)),
                  MAX(dRGB(i,i-3*w,buffer_v),dRGB(i,i+3*w,buffer_v))
                  );
            /*
             * The scores for the homogeneity mapping. These will be used 
             * in the choice algorithm to choose the best value.
             */

            if (dRGB(i,i-3,buffer_h) <= RGBeps)
                  Usize_h++;
            if (dRGB(i,i-3,buffer_v) <= RGBeps)
                  Usize_v++;
            if (dRGB(i,i+3,buffer_h) <= RGBeps)
                  Usize_h++;
            if (dRGB(i,i+3,buffer_v) <= RGBeps)
                  Usize_v++;
            if (dRGB(i,i-3*w,buffer_h)<= RGBeps)
                  Usize_h++;
            if (dRGB(i,i-3*w,buffer_v) <= RGBeps)
                  Usize_v++;
            if (dRGB(i,i+3*w,buffer_h) <= RGBeps)
                  Usize_h++;
            if (dRGB(i,i+3*w,buffer_v) <= RGBeps)
                  Usize_v++;
            hom_buffer_h[j+2*w]=Usize_h;
            hom_buffer_v[j+2*w]=Usize_v;
      }
      return GP_OK;
}


Generated by  Doxygen 1.6.0   Back to index