Go to the source code of this file.
|
||||||||||||||||||||||||
|
Definition at line 8 of file im_max.c. Referenced by imf_pixmax().
00009 {
00010 int nmax=0;
00011 float *row, *above, *below, pix;
00012
00013 if (in==NULL) return((float)0.0);
00014
00015 row = in[i];
00016 above = in[i-1];
00017 below = in[i+1];
00018
00019 if ((pix = (float)fabs(row[j])) > thresh)
00020 {
00021 if (pix < fabs(above[j-1]) && ++nmax > num) ;
00022 else if (pix < fabs(above[j]) && ++nmax > num) ;
00023 else if (pix < fabs(above[j+1]) && ++nmax > num) ;
00024 else if (pix < fabs(row [j-1]) && ++nmax > num) ;
00025 else if (pix < fabs(row [j+1]) && ++nmax > num) ;
00026 else if (pix < fabs(below[j-1]) && ++nmax > num) ;
00027 else if (pix < fabs(below[j]) && ++nmax > num) ;
00028 else if (pix < fabs(below[j+1]) && ++nmax > num) ;
00029 }
00030 else
00031 {
00032 return((float)0.0);
00033 }
00034
00035 if (nmax > num) return((float)0.0);
00036 else return(pix);
00037 }
|
|
||||||||||||||||||||||||||||
|
@(#) Definition at line 10 of file canny.c. References EDGE_GET_CONN_MASK, EDGE_NOLINK, er_edge_strings_thres(), er_find_edge_strings(), er_rm_edges(), er_set_row_index(), im_copy(), im_free(), imf_gauss(), imf_grad_h(), imf_grad_v(), imf_sumsq(), Imrect, lowthres, nonmaxsup(), ralloc_end_blocked(), and ralloc_start_blocked(). Referenced by imf_edges(), mono_canny_proc(), and stereo_canny_proc().
00011 {
00012 Imrect *gim;
00013 Imrect *edrect;
00014 Imrect *gradx;
00015 Imrect *grady;
00016 Imrect *gradsq;
00017 unsigned int label; /* for blocked allocation */
00018
00019 if (im == NULL)
00020 return (NULL);
00021
00022 label = ralloc_end_blocked();
00023
00024 if (sigma == 0.0)
00025 gim = im_copy(im);
00026 else
00027 gim = imf_gauss(im, sigma, precision);
00028 gradx = imf_grad_h(gim);
00029 grady = imf_grad_v(gim);
00030 im_free(gim);
00031 gradsq = imf_sumsq(gradx, grady);
00032
00033 if (label) /* allocation was blocked */
00034 (void) ralloc_start_blocked(label); /* re-start blocking */
00035
00036 edrect = nonmaxsup(gradx, grady, gradsq, lowthres);
00037 im_free(gradx);
00038 im_free(grady);
00039 im_free(gradsq);
00040 er_find_edge_strings(edrect);
00041 er_rm_edges(edrect, EDGE_GET_CONN_MASK, EDGE_NOLINK);
00042 er_edge_strings_thres(edrect, lengththres, upthres);
00043 er_set_row_index(edrect);
00044 return (edrect);
00045 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 154 of file smooth_1d.c. References prof1::el, varptr::float_v, fvector_alloc, fvector_free, MAX, MIN, prof1::n1, prof1::n2, Prof1, and prof1::vtype.
00158 {
00159 float sum;
00160 int i, j;
00161 int p1, p2;
00162 int lower, upper;
00163 float *prof;
00164 float *temp;
00165
00166 if (profile == NULL || profile->vtype != float_v)
00167 return;
00168
00169 p1 = profile->n1;
00170 p2 = profile->n2;
00171 lower = MAX(n1 - p2 + 1, 0);
00172 upper = MIN(n2 - p1, n2);
00173 prof = profile->el.float_v;
00174 temp = fvector_alloc(n1, n2);
00175
00176 for (i = n1; i < lower; ++i)
00177 temp[i] = (float)0.0;
00178
00179 for (; i <= upper; ++i) /* most work */
00180 {
00181 for (sum = (float)0.0, j = p1; j < p2; ++j)
00182 sum += prof[j] * line[i - j];
00183 temp[i] = sum;
00184 }
00185
00186 for (; i < n2; ++i)
00187 temp[i] = (float)0.0;
00188
00189 for (i = n1; i < n2; ++i)
00190 line[i] = temp[i];
00191
00192 fvector_free((void *) temp, n1);
00193 }
|
|
||||||||||||||||||||
|
Definition at line 174 of file corner.c. References vec2::el, farray_alloc, farray_free, im_get_pixf(), Imrect, tina_int(), and Vec2. Referenced by corner_locate().
00176 {
00177 int lx,ux,ly,uy;
00178 int i,j;
00179 double meanx=0.0,meany=0.0;
00180 double dx,dy, delx,dely;
00181 double twosigma2 = range*range/2.0; /* set the scale of radial weighting */
00182 double orient;
00183 double weight;
00184 double thresh=0.0;
00185 float **grad;
00186 float pix;
00187
00188 lx = tina_int(pos.el[0]-range)-1;
00189 ux = tina_int(pos.el[0]+range+1)+1;
00190 ly = tina_int(pos.el[1]-range)-1;
00191 uy = tina_int(pos.el[1]+range+1)+1;
00192 grad = farray_alloc(ly,lx,uy,ux);
00193
00194 /* calculate a robust mean with which to threshold the likely edge pixels */
00195 for (i=ly;i<uy;++i)
00196 {
00197 for (j=lx;j<ux;++j)
00198 {
00199 dx = im_get_pixf(gradx,i,j);
00200 dy = im_get_pixf(grady,i,j);
00201 grad[i][j] = dx*dx + dy*dy;
00202 thresh += grad[i][j];
00203 }
00204 }
00205
00206 thresh /= ((ux-lx)*(uy-ly));
00207
00208 /* calculate the orientation from the moments of the thresholded gradient image */
00209 for (i=ly+1;i<uy-1;++i)
00210 {
00211 for (j=lx+1;j<ux-1;++j)
00212 {
00213 if ((pix=grad[i][j]) > thresh)
00214 {
00215 /*
00216 int num = 2;
00217 int nmax = 0;
00218 if (pix<grad[i-1][j-1] && ++nmax > num) continue;
00219 if (pix<grad[i-1][j] && ++nmax > num) continue;
00220 if (pix<grad[i-1][j+1] && ++nmax > num) continue;
00221 if (pix<grad[i][j-1] && ++nmax > num) continue;
00222 if (pix<grad[i][j+1] && ++nmax > num) continue;
00223 if (pix<grad[i+1][j-1] && ++nmax > num) continue;
00224 if (pix<grad[i+1][j] && ++nmax > num) continue;
00225 if (pix<grad[i+1][j+1] && ++nmax > num) continue;
00226 */
00227
00228 delx = j + 0.5 - pos.el[0];
00229 dely = i + 0.5 - pos.el[1];
00230 /* weight = exp((-delx*delx - dely*dely)/twosigma2);
00231 */
00232 if (delx*delx + dely*dely < twosigma2*2.0) weight = 1.0;
00233 else weight = 0.0;
00234 meanx += delx*weight;
00235 meany += dely*weight;
00236 }
00237 }
00238 }
00239
00240
00241 if (meanx ==0) orient = 0; /* ### should be undefined */
00242 else
00243 orient = atan2(meany,meanx);
00244
00245 farray_free(grad,ly,lx,uy,ux);
00246 return(orient);
00247 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 30 of file corner.c. References corner_locate(), cornim(), im_free(), imf_gauss(), imf_grad_h(), imf_grad_v(), imf_nmax(), Imrect, and lowthres. Referenced by corner_calib_proc(), corner_par_proj_3d(), corner_rem_proj_3d(), geom_list_point3(), mono_corner_proc(), set_corner_3d(), and stereo_corner_proc().
00031 {
00032 Imrect *gim,*corn_im;
00033 Imrect *maxim;
00034 Imrect *gradx, *grady;
00035
00036 gradx = imf_grad_h(im);
00037 grady = imf_grad_v(im);
00038
00039 corn_im = cornim(im,sigma,precision,0.05);
00040 gim = imf_gauss(corn_im,sigma,precision);
00041 im_free(corn_im);
00042 maxim = imf_nmax(gim,(float)(1024.0*lowthres),0);
00043 corner_locate(maxim,gim,gradx,grady);
00044 im_free(gim);
00045 im_free(gradx);
00046 im_free(grady);
00047
00048 return(maxim);
00049 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 9 of file corner.c. References corner_locate(), cornim(), im_free(), imf_gauss(), imf_grad_h(), imf_grad_v(), imf_nmax(), Imrect, and lowthres. Referenced by fill_loop().
00010 {
00011 Imrect *gim,*corn_im;
00012 Imrect *maxim;
00013 Imrect *gradx, *grady;
00014
00015 gradx = imf_grad_h(im);
00016 grady = imf_grad_v(im);
00017
00018 gim = imf_gauss(im,sigma,precision);
00019 corn_im = cornim(gim,sigma,precision,0.0);
00020 maxim = imf_nmax(corn_im,(float)(1024.0*lowthres),0);
00021 corner_locate(maxim,corn_im,gradx,grady);
00022 im_free(corn_im);
00023 im_free(gim);
00024 im_free(gradx);
00025 im_free(grady);
00026
00027 return(maxim);
00028 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 140 of file corner.c. References edgel::contrast, cor_orient(), EDGE_GET_CONN_MASK, EDGE_ISOLATED, Edgel, im_get_quadmaxf(), IM_PTR, Imrect, Imregion, imregion::lx, imregion::ly, edgel::orient, edgel::pos, imrect::region, edgel::type, imregion::ux, imregion::uy, and vec2(). Referenced by corner(), and corner2().
00141 {
00142 Imregion *region;
00143 float x,y;
00144 int i,j;
00145 int lx,ux,ly,uy;
00146
00147 if (im==NULL || corner_im==NULL) return;
00148
00149 region = im->region;
00150
00151 lx = region->lx+1;
00152 ux = region->ux-1;
00153 ly = region->ly+1;
00154 uy = region->uy-1;
00155
00156 for (i=ly;i<uy;++i)
00157 {
00158 for (j=lx;j<ux;++j)
00159 {
00160 Edgel *eptr;
00161
00162 if ((eptr=IM_PTR(im, i,j)) == NULL) continue;
00163
00164 eptr->contrast =(float)im_get_quadmaxf(corner_im,(float)j,(float)i,&x,&y);
00165 eptr->pos = vec2(x,y);
00166 eptr->type &= EDGE_GET_CONN_MASK;
00167 eptr->type |= EDGE_ISOLATED;
00168 eptr->orient = (float)cor_orient( eptr->pos, 10.0, gradx,grady);
00169
00170 }
00171 }
00172 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 51 of file corner.c. References cornim2(), im_free(), imf_gauss(), imf_grad_h(), imf_grad_v(), imf_prod(), imf_sum(), and Imrect. Referenced by corner(), corner2(), and cornim2().
00052 {
00053 Imrect *gimx,*gimy,*gimxy,*gimedge;
00054 Imrect *gradx;
00055 Imrect *grady;
00056 Imrect *gradsqx,*gradsqy,*gradsqxy;
00057 Imrect *gradsqxsqy;
00058 Imrect *corn_im;
00059
00060 if (im==NULL)
00061 return(NULL);
00062
00063 gradx = imf_grad_h(im);
00064 grady = imf_grad_v(im);
00065 gradsqx = imf_prod(gradx,gradx);
00066 gradsqy = imf_prod(grady,grady);
00067 gradsqxy = imf_prod(gradx,grady);
00068 im_free(gradx);
00069 im_free(grady);
00070 gradsqxsqy = imf_sum(gradsqx,gradsqy);
00071
00072 gimx = imf_gauss(gradsqx,sigma,precision);
00073 im_free(gradsqx);
00074 gimy = imf_gauss(gradsqy,sigma,precision);
00075 im_free(gradsqy);
00076 gimxy = imf_gauss(gradsqxy,sigma,precision);
00077 im_free(gradsqxy);
00078 gimedge = imf_gauss(gradsqxsqy,1.1*sigma,precision);
00079 im_free(gradsqxsqy);
00080
00081 corn_im = cornim2(gimx,gimy,gimxy,gimedge,edge_sup);
00082 im_free(gimx);
00083 im_free(gimy);
00084 im_free(gimxy);
00085 im_free(gimedge);
00086
00087 return(corn_im);
00088 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Definition at line 90 of file corner.c. References cornim(), fvector_alloc, fvector_free, imrect::height, im_alloc(), IM_FLOAT, im_get_rowf(), Imrect, Imregion, imregion::lx, imregion::ly, imrect::region, imregion::ux, imregion::uy, and imrect::width. Referenced by cornim().
00093 {
00094 Imrect *cornim;
00095 Imregion *roi;
00096 float *line1,*line2,*line3,*line4;
00097 int lx, ux, ly, uy;
00098 int i,j;
00099
00100 if (im1==NULL || im2==NULL || im3==NULL)
00101 return(NULL);
00102
00103 roi = im1->region;
00104
00105 if (roi==NULL)
00106 return(NULL);
00107
00108 cornim = im_alloc(im1->height,im1->width,roi,float_v);
00109
00110 lx = roi->lx;
00111 ux = roi->ux;
00112 ly = roi->ly;
00113 uy = roi->uy;
00114
00115 line1 = fvector_alloc(lx, ux);
00116 line2 = fvector_alloc(lx, ux);
00117 line3 = fvector_alloc(lx, ux);
00118 line4 = fvector_alloc(lx, ux);
00119
00120 for (i=ly;i<uy;++i)
00121 {
00122 im_get_rowf(line1,im1,i,lx,ux);
00123 im_get_rowf(line2,im2,i,lx,ux);
00124 im_get_rowf(line3,im3,i,lx,ux);
00125 im_get_rowf(line4,im4,i,lx,ux);
00126
00127 /* this next line previously used IM_FLOAT_INDEX (sam) */
00128 for (j=lx;j<ux;++j)
00129 IM_FLOAT( cornim, i,j) = (float)(line1[j]*line2[j]-line3[j]*line3[j] -
00130 edge_sup*line4[j]*line4[j]);
00131 }
00132
00133 fvector_free(line1, lx);
00134 fvector_free(line2, lx);
00135 fvector_free(line3, lx);
00136 fvector_free(line4, lx);
00137 return(cornim);
00138 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 20 of file im_gabor.c. References prof1::el, varptr::float_v, Prof1, and prof1_alloc(). Referenced by im_gabor().
00021 {
00022 float *el;
00023 Prof1 *prof;
00024 float k;
00025 int i, n;
00026
00027 if (nsigma <= 0.0)
00028 return (NULL);
00029
00031 n = (int) (nsigma * sigma);
00032 prof = prof1_alloc(-n, n + 1, float_v);
00033 el = prof->el.float_v;
00034
00035 if (n == 0)
00036 {
00038 el[0] = (float) 1.0;
00039 return (prof);
00040 }
00041 k = (float) (1.0 / (2.0 * sigma * sigma));
00042 for (i = -n; i < n + 1; i++)
00043 el[i] = (float) (exp(-k * i * i) * sin(omega * i + phase));
00044
00045 return (prof);
00046 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 176 of file im_add.c. References cmplx(), imc_add(), imf_add(), imi_add(), Imrect, and imz_add(). Referenced by imcalc_add(), imcalc_optf(), and zero_mask().
00179 {
00180 if(im == NULL )
00181 return(NULL);
00182 switch(im->vtype)
00183 {
00184 case uchar_v:
00185 case char_v:
00186 return(imc_add((int)k,im));
00187 case short_v:
00188 case ushort_v:
00189 case int_v:
00190 return(imi_add((int)k,im));
00191 case float_v:
00192 return(imf_add(k,im));
00193 case complex_v: /* im sure this should be cmplx(k,k) NAT */
00194 return(imz_add(cmplx(k,0.0),im));
00195 default:
00196 return(NULL);
00197 }
00198 }
|
Here is the call graph for this function:

|
|
applying functions to images, inplace version, and special cases * Definition at line 14 of file im_apply.c. References Imrect, and imz_arg(). Referenced by imcalc_arg().
00015 {
00016 return (imz_arg(im));
00017 }
|
Here is the call graph for this function:

|
|
Definition at line 166 of file im_sin.c. References imf_asin(), Imrect, imz_asin(), and imrect::vtype. Referenced by imcalc_asin().
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 8 of file im_bshift.c. References imrect::height, im_alloc(), IM_PIX_GET, IM_PIX_SET, Imrect, Imregion, imregion::lx, imregion::ly, pixval, imrect::region, imregion::ux, imregion::uy, imrect::vtype, and imrect::width. Referenced by grimson_proc(), im_corscale2(), imcalc_bshift(), and smooth_slopes().
00009 {
00010 Imrect *im2;
00011 Imregion *roi;
00012 double pixval;
00013 int lx,ux,ly,uy;
00014 int i,j,newx,newy;
00015
00016 roi = im->region;
00017 im2 = im_alloc(im->height,im->width,roi,im->vtype);
00018 lx = roi->lx;
00019 ux = roi->ux;
00020 ly = roi->ly;
00021 uy = roi->uy;
00022
00023 for(i = ly; i < uy; i++)
00024 {
00025 for (j = lx; j < ux;j++)
00026 {
00027 newx = j+x;
00028 if(newx>=ux) newx-=(ux-lx);
00029 if(newx<lx) newx+=(ux-lx);
00030 newy = i+y;
00031 if(newy>=uy) newy-=(uy-ly);
00032 if(newy<ly) newy+=(uy-ly);
00033
00034 IM_PIX_GET(im,i,j,pixval);
00035 IM_PIX_SET(im2,newy,newx,pixval);
00036 }
00037 }
00038 return(im2);
00039 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 314 of file im_thresh.c. References imf_bthresh(), imi_bthresh(), imp_bthresh(), Imrect, imz_bthresh(), and imrect::vtype. Referenced by zero_cut().
00315 {
00316 if(im == NULL )
00317 return(NULL);
00318 switch(im->vtype)
00319 {
00320 case uchar_v:
00321 case char_v:
00322 case short_v:
00323 case ushort_v:
00324 case int_v:
00325 return(imi_bthresh(k,im));
00326 case float_v:
00327 return(imf_bthresh(k,im));
00328 case complex_v:
00329 return(imz_bthresh(k,im));
00330 case ptr_v:
00331 return(imp_bthresh(k,im));
00332 default:
00333 return(NULL);
00334 }
00335 }
|
Here is the call graph for this function:

|
|
Definition at line 512 of file im_apply.c. References cmplx_cis(), Complex, fvector_alloc, fvector_free, imrect::height, im_alloc(), im_get_rowf(), im_put_rowz(), Imrect, Imregion, imregion::lx, imregion::ly, imrect::region, imregion::ux, imregion::uy, imrect::width, zvector_alloc, and zvector_free. Referenced by imcalc_cis().
00513 {
00514 Imrect *im2;
00515 Imregion *roi;
00516 float *row1;
00517 Complex *row2;
00518 int lx, ux, ly, uy;
00519 int i, j;
00520
00521 if (im1 == NULL)
00522 return (NULL);
00523
00524 roi = im1->region;
00525 if (roi == NULL)
00526 return (NULL);
00527 lx = roi->lx;
00528 ux = roi->ux;
00529 ly = roi->ly;
00530 uy = roi->uy;
00531
00532 im2 = im_alloc(im1->height, im1->width, roi, complex_v);
00533 row1 = fvector_alloc(lx, ux);
00534 row2 = zvector_alloc(lx, ux);
00535
00536 for (i = ly; i < uy; ++i)
00537 {
00538 im_get_rowf(row1, im1, i, lx, ux);
00539 for (j = lx; j < ux; ++j)
00540 row2[j] = cmplx_cis(row1[j]);
00541 im_put_rowz(row2, im2, i, lx, ux);
00542 }
00543
00544 fvector_free((void *) row1, lx);
00545 zvector_free((void *) row2, lx);
00546 return (im2);
00547 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
combining two images, general case * Definition at line 13 of file im_combine.c. References imrect::height, im_alloc(), im_get_row(), im_put_row(), Imrect, Imregion, imregion::lx, imregion::ly, MIN, imrect::region, rfree(), roi_inter(), tvector_alloc, tvector_free, imregion::ux, imregion::uy, and imrect::width.
00014 {
00015 Imrect *im3;
00016 Imregion *roi;
00017 int *row1, *row2, *row3;
00018 int lx, ux, ly, uy;
00019 int width, height;
00020 int i, j;
00021
00022 if (im1 == NULL || im2 == NULL)
00023 return (NULL);
00024
00025 roi = roi_inter(im1->region, im2->region);
00026 if (roi == NULL)
00027 return (NULL);
00028 lx = roi->lx;
00029 ux = roi->ux;
00030 ly = roi->ly;
00031 uy = roi->uy;
00032
00033 width = MIN(im1->width, im2->width);
00034 height = MIN(im1->height, im2->height);
00035
00036 im3 = im_alloc(height, width, roi, ptr_v);
00037 row1 = tvector_alloc(lx, ux, int);
00038 row2 = tvector_alloc(lx, ux, int);
00039 row3 = tvector_alloc(lx, ux, int);
00040
00041 for (i = ly; i < uy; ++i)
00042 {
00043 im_get_row(row1, im1, i, lx, ux);
00044 im_get_row(row2, im2, i, lx, ux);
00045 for (j = lx; j < ux; ++j)
00046 row3[j] = (int) (*func) (row1[j], row2[j], data);
00047 im_put_row(row3, im3, i, lx, ux);
00048 }
00049
00050 tvector_free(row1, lx, void *);
00051 tvector_free(row2, lx, void *);
00052 tvector_free(row3, lx, void *);
00053 rfree((void *) roi);
00054 return (im3);
00055 }
|
Here is the call graph for this function:

|
|
Definition at line 684 of file im_apply.c. References cmplx_conj(), Complex, imrect::height, im_alloc(), im_get_rowz(), im_put_rowz(), Imrect, Imregion, imregion::lx, imregion::ly, imrect::region, imregion::ux, imregion::uy, imrect::width, zvector_alloc, and zvector_free. Referenced by imcalc_conj(), and imcalc_optf().
00685 {
00686 Imrect *im2;
00687 Imregion *roi;
00688 Complex *row;
00689 int lx, ux, ly, uy;
00690 int i, j;
00691
00692 if (im1 == NULL)
00693 return (NULL);
00694
00695 roi = im1->region;
00696 if (roi == NULL)
00697 return (NULL);
00698 lx = roi->lx;
00699 ux = roi->ux;
00700 ly = roi->ly;
00701 uy = roi->uy;
00702
00703 im2 = im_alloc(im1->height, im1->width, roi, complex_v);
00704 row = zvector_alloc(lx, ux);
00705
00706 for (i = ly; i < uy; ++i)
00707 {
00708 im_get_rowz(row, im1, i, lx, ux);
00709 for (j = lx; j < ux; ++j)
00710 row[j] = cmplx_conj(row[j]);
00711 im_put_rowz(row, im2, i, lx, ux);
00712 }
00713 zvector_free((void *) row, lx);
00714 return (im2);
00715 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 46 of file im_conv_1d.c. References conv_line(), fvector_alloc, fvector_free, imrect::height, im_alloc(), im_get_rowf(), im_put_rowf(), Imrect, Imregion, imregion::lx, imregion::ly, MAX, MIN, prof1::n1, prof1::n2, Prof1, imrect::region, imregion::ux, imregion::uy, and imrect::width. Referenced by im_conv_separable().
00047 {
00048 Imrect *im2;
00049 Imregion *roi;
00050 float *row1, *row2;
00051 int lx, ux, ly, uy;
00052 int lxn, uxn;
00053 int n1, n2;
00054 int i;
00055
00056 if (im1 == NULL)
00057 return (NULL);
00058 if (prof == NULL)
00059 return (NULL);
00060
00061 if ((roi = im1->region) == NULL)
00062 return (NULL);
00063
00064 lx = roi->lx;
00065 ux = roi->ux;
00066 ly = roi->ly;
00067 uy = roi->uy;
00068
00069 n1 = prof->n1;
00070 n2 = prof->n2;
00071 lxn = MAX(lx, lx - n2 + 1);
00072 uxn = MIN(ux, ux - n1);
00073
00074 im2 = im_alloc(im1->height, im1->width, roi, float_v);
00075
00076 row1 = fvector_alloc(lx - n2 + 1, ux - n1);
00077 row2 = fvector_alloc(lx, ux);
00078
00079 for (i = ly; i < uy; ++i)
00080 {
00081 im_get_rowf(row1, im1, i, lxn, uxn);
00082 conv_line(row1, prof, lx, ux, row2);
00083 im_put_rowf(row2, im2, i, lx, ux);
00084 }
00085
00086 fvector_free((void *) row1, lx - n2 + 1);
00087 fvector_free((void *) row2, lx);
00088 return (im2);
00089 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 135 of file im_conv_1d.c. References im_conv_h(), im_conv_v(), im_free(), Imrect, and Prof1.
00136 {
00137 Imrect *im2;
00138 Imrect *im3;
00139
00140 if (im1 == NULL)
00141 return (NULL);
00142 if (prof_h == NULL)
00143 return (NULL);
00144 if (prof_v == NULL)
00145 return (NULL);
00146
00147 im2 = im_conv_h(im1, prof_h);
00148 im3 = im_conv_v(im2, prof_v);
00149
00150 im_free(im2);
00151 return (im3);
00152 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 91 of file im_conv_1d.c. References conv_line(), fvector_alloc, fvector_free, imrect::height, im_alloc(), im_get_colf(), im_put_colf(), Imrect, Imregion, imregion::lx, imregion::ly, MAX, MIN, prof1::n1, prof1::n2, Prof1, imrect::region, imregion::ux, imregion::uy, and imrect::width. Referenced by im_conv_separable().
00092 {
00093 Imrect *im2;
00094 Imregion *roi;
00095 float *col1, *col2;
00096 int lx, ux, ly, uy;
00097 int lyn, uyn;
00098 int n1, n2;
00099 int i;
00100
00101 if (im1 == NULL)
00102 return (NULL);
00103 if (prof == NULL)
00104 return (NULL);
00105
00106 if ((roi = im1->region) == NULL)
00107 return (NULL);
00108
00109 lx = roi->lx;
00110 ux = roi->ux;
00111 ly = roi->ly;
00112 uy = roi->uy;
00113
00114 n1 = prof->n1;
00115 n2 = prof->n2;
00116 lyn = MAX(ly, ly - n2 + 1);
00117 uyn = MIN(uy, uy - n1);
00118
00119 im2 = im_alloc(im1->height, im1->width, roi, float_v);
00120
00121 col1 = fvector_alloc(ly - n2 + 1, uy - n1);
00122 col2 = fvector_alloc(ly, uy);
00123 for (i = lx; i < ux; ++i)
00124 {
00125 im_get_colf(col1, im1, i, lyn, uyn);
00126 conv_line(col1, prof, ly, uy, col2);
00127 im_put_colf(col2, im2, i, ly, uy);
00128 }
00129
00130 fvector_free((void *) col1, ly - n2 + 1);
00131 fvector_free((void *) col2, ly);
00132 return (im2);
00133 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 21 of file convolve.c. References FOR_IM, IM_FLOAT, Imrect, Imregion, imregion::lx, imregion::ly, imrect::region, roi_alloc(), imregion::ux, and imregion::uy. Referenced by grimson_proc().
00022 {
00023 Imregion *roi; /* temporary roi */
00024 int row, col, krow, kcol; /* loop variables */
00025 int width, height, lower_x, lower_y, upper_x, upper_y, off_x, off_y;
00026
00027 width = (int)abs(kern->region->ux - kern->region->lx);
00028 height = (int)abs(kern->region->uy - kern->region->ly);
00029
00030 if ((width % 2)==0)
00031 {
00032 lower_x = -(int)(abs(width/2));
00033 upper_x = (int)(abs(width/2));
00034 }
00035 else
00036 {
00037 lower_x = -(int)(abs(width/2));
00038 upper_x = (int)(abs(width/2))+1;
00039 }
00040 if ((height % 2)==0)
00041 {
00042 lower_y = -(int)(abs(height/2));
00043 upper_y = (int)(abs(height/2));
00044 }
00045 else
00046 {
00047 lower_y = -(int)(abs(height/2));
00048 upper_y = (int)(abs(height/2))+1;
00049 }
00050
00051 roi = roi_alloc(lower_x, lower_y, upper_x, upper_y);
00052
00053 off_x = kern->region->lx - lower_x;
00054 off_y = kern->region->ly - lower_y;
00055
00056 FOR_IM(new_im->region, row, col)
00057 {
00058 IM_FLOAT(new_im, row, col) = 0.0;
00059
00060 FOR_IM(roi, krow, kcol)
00061 IM_FLOAT(new_im, row, col) +=
00062 (IM_FLOAT(im, row+krow, col+kcol) * IM_FLOAT(kern, off_y+krow, off_x+kcol));
00063 }
00064 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Definition at line 373 of file im_create.c. References imrect::height, im_free(), im_sum(), imf_unif_noise(), Imrect, and imrect::width. Referenced by stereo_noise_proc().
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 433 of file im_combine.c. References im_sup_vtype(), imf_diff(), imi_diff(), Imrect, imz_diff(), and imrect::vtype. Referenced by edge_remove(), im_corscale2(), imcalc_diff(), imcalc_xy_norm(), smooth_slopes(), and thresh_slice().
00434 {
00435 if (im1 == NULL || im2 == NULL)
00436 return (NULL);
00437 switch (im_sup_vtype(im1->vtype, im2->vtype))
00438 {
00439 case uchar_v:
00440 case char_v:
00441 case short_v:
00442 case ushort_v:
00443 case int_v:
00444 return(imi_diff(im1, im2));
00445 case float_v:
00446 return(imf_diff(im1, im2));
00447 case complex_v:
00448 return(imz_diff(im1, im2));
00449 default:
00450 return (NULL);
00451 }
00452 return (NULL);
00453 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 969 of file im_combine.c. References cmplx(), im_sup_vtype(), imf_div(), Imrect, imz_div(), and imrect::vtype. Referenced by imcalc_div(), imcalc_optf(), and nmr_hfit_normed().
00970 {
00971 if (im1 == NULL || im2 == NULL)
00972 return (NULL);
00973 switch (im_sup_vtype(im1->vtype, im2->vtype))
00974 {
00975 case uchar_v:
00976 case char_v:
00977 case short_v:
00978 case ushort_v:
00979 case int_v:
00980 case float_v:
00981 return(imf_div(im1, im2, thresh, val));
00982 case complex_v:
00983 return(imz_div(im1, im2, thresh, cmplx(val, 0.0)));
00984 default:
00985 return (NULL);
00986 }
00987 return (NULL);
00988 }
|
Here is the call graph for this function:

|
|
Definition at line 172 of file im_log.c. References imf_exp(), Imrect, imz_exp(), and imrect::vtype. Referenced by imcalc_exp().
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Definition at line 217 of file im_ptr.c. References imrect::height, im_alloc(), im_get_rowf(), im_put_row(), Imrect, Imregion, imregion::lx, imregion::ly, MIN, imrect::region, rfree(), roi_inter(), tvector_alloc, tvector_free, imregion::ux, imregion::uy, and imrect::width. Referenced by im_vec3().
00218 {
00219 Imrect *im4;
00220 Imregion *roi;
00221 float *row1, *row2, *row3;
00222 int *row4;
00223 int lx, ux, ly, uy;
00224 int width, height;
00225 int i, j;
00226
00227 if (im1 == NULL || im2 == NULL)
00228 return (NULL);
00229
00230 roi = roi_inter(im1->region, im2->region);
00231 if (roi == NULL)
00232 return (NULL);
00233 lx = roi->lx;
00234 ux = roi->ux;
00235 ly = roi->ly;
00236 uy = roi->uy;
00237
00238 width = MIN(im1->width, im2->width);
00239 height = MIN(im1->height, im2->height);
00240
00241 im3 = im_alloc(height, width, roi, ptr_v);
00242 row1 = tvector_alloc(lx, ux, float);
00243 row2 = tvector_alloc(lx, ux, float);
00244 row3 = tvector_alloc(lx, ux, float);
00245 row4 = tvector_alloc(lx, ux, int);
00246
00247 for (i = ly; i < uy; ++i)
00248 {
00249 im_get_rowf(row1, im1, i, lx, ux);
00250 im_get_rowf(row2, im2, i, lx, ux);
00251 im_get_rowf(row3, im3, i, lx, ux);
00252 for (j = lx; j < ux; ++j)
00253 row4[j] = (int) (*func) (row1[j], row2[j], row3[j], data);
00254 im_put_row(row4, im4, i, lx, ux);
00255 }
00256
00257 tvector_free(row1, lx, float);
00258 tvector_free(row2, lx, float);
00259 tvector_free(row3, lx, float);
00260 tvector_free(row4, lx, int);
00261 rfree((void *) roi);
00262 return (im4);
00263 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
combining two images float float -> ptr Definition at line 172 of file im_ptr.c. References imrect::height, im_alloc(), im_get_rowf(), im_put_row(), Imrect, Imregion, imregion::lx, imregion::ly, MIN, imrect::region, rfree(), roi_inter(), tvector_alloc, tvector_free, imregion::ux, imregion::uy, and imrect::width. Referenced by im_vec2().
00173 {
00174 Imrect *im3;
00175 Imregion *roi;
00176 float *row1, *row2;
00177 int *row3;
00178 int lx, ux, ly, uy;
00179 int width, height;
00180 int i, j;
00181
00182 if (im1 == NULL || im2 == NULL)
00183 return (NULL);
00184
00185 roi = roi_inter(im1->region, im2->region);
00186 if (roi == NULL)
00187 return (NULL);
00188 lx = roi->lx;
00189 ux = roi->ux;
00190 ly = roi->ly;
00191 uy = roi->uy;
00192
00193 width = MIN(im1->width, im2->width);
00194 height = MIN(im1->height, im2->height);
00195
00196 im3 = im_alloc(height, width, roi, ptr_v);
00197 row1 = tvector_alloc(lx, ux, float);
00198 row2 = tvector_alloc(lx, ux, float);
00199 row3 = tvector_alloc(lx, ux, int);
00200
00201 for (i = ly; i < uy; ++i)
00202 {
00203 im_get_rowf(row1, im1, i, lx, ux);
00204 im_get_rowf(row2, im2, i, lx, ux);
00205 for (j = lx; j < ux; ++j)
00206 row3[j] = (int) (*func) (row1[j], row2[j], data);
00207 im_put_row(row3, im3, i, lx, ux);
00208 }
00209
00210 tvector_free(row1, lx, float);
00211 tvector_free(row2, lx, float);
00212 tvector_free(row3, lx, int);
00213 rfree((void *) roi);
00214 return (im3);
00215 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 7 of file im_fourier.c. References Complex, fft_cmplx_inplace(), im_alloc(), im_get_colz(), im_get_rowz(), im_put_colz(), im_put_rowz(), Imrect, Imregion, imregion::lx, imregion::ly, imrect::region, imregion::ux, imregion::uy, zvector_alloc, and zvector_free. Referenced by im_gabor_fft(), and imcalc_fft().
00008 {
00009 Imrect *im2;
00010 Imregion roi;
00011 Complex *line;
00012 int nx, ny;
00013 int lx, ux, ly, uy;
00014 int i;
00015
00016 if (im1 == NULL)
00017 return (NULL);
00018
00019 if (region==NULL) region = im1->region;
00020 if (region == NULL) return (NULL);
00021
00022 lx = roi.lx = region->lx;
00023 ux = roi.ux = region->ux;
00024 ly = roi.ly = region->ly;
00025 uy = roi.uy = region->uy;
00026
00027 for(nx = 1; nx <= ux-lx; nx *= 2);
00028 for(ny = 1; ny <= uy-ly; ny *= 2);
00029 nx/=2;
00030 ny/=2;
00031
00032 ux = roi.ux = lx + nx;
00033 uy = roi.uy = ly + ny;
00034
00035 im2 = im_alloc(ny, nx, &roi, complex_v);
00036 line = zvector_alloc(lx, ux);
00037
00038 for (i = ly; i < uy; ++i)
00039 {
00040 im_get_rowz(line, im1, i, lx, ux);
00041 line += lx;
00042 fft_cmplx_inplace(line, nx);
00043 line -= lx;
00044 im_put_rowz(line, im2, i, lx, ux);
00045 }
00046
00047 zvector_free(line, lx);
00048 line = zvector_alloc(ly, uy);
00049 for (i = lx; i < ux; ++i)
00050 {
00051 im_get_colz(line, im2, i, ly, uy);
00052 line += ly;
00053 fft_cmplx_inplace(line, ny);
00054 line -= ly;
00055 im_put_colz(line, im2, i, ly, uy);
00056 }
00057
00058 zvector_free(line, ly);
00059 return (im2);
00060 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 62 of file im_fourier.c. References Complex, fft_inverse_cmplx_inplace(), im_alloc(), im_get_colz(), im_get_rowz(), im_put_colz(), im_put_rowz(), Imrect, Imregion, imregion::lx, imregion::ly, imrect::region, imregion::ux, imregion::uy, zvector_alloc, and zvector_free. Referenced by im_gabor_fft(), and imcalc_fft_inverse().
00063 {
00064 Imrect *im2;
00065 Imregion roi;
00066 Complex *line;
00067 int nx, ny;
00068 int lx, ux, ly, uy;
00069 int i;
00070
00071 if (im1 == NULL)
00072 return (NULL);
00073
00074 if (region==NULL) region = im1->region;
00075 if (region == NULL) return (NULL);
00076
00077 lx = roi.lx = region->lx;
00078 ux = roi.ux = region->ux;
00079 ly = roi.ly = region->ly;
00080 uy = roi.uy = region->uy;
00081
00082 for(nx = 1; nx <= ux-lx; nx *= 2);
00083 for(ny = 1; ny <= uy-ly; ny *= 2);
00084 nx/=2;
00085 ny/=2;
00086
00087 ux = roi.ux = lx + nx;
00088 uy = roi.uy = ly + ny;
00089
00090 im2 = im_alloc(ny, nx, &roi, complex_v);
00091 line = zvector_alloc(lx, ux);
00092
00093 for (i = ly; i < uy; ++i)
00094 {
00095 im_get_rowz(line, im1, i, lx, ux);
00096 line += lx;
00097 fft_inverse_cmplx_inplace(line, nx);
00098 line -= lx;
00099 im_put_rowz(line, im2, i, lx, ux);
00100 }
00101
00102 zvector_free(line, lx);
00103 line = zvector_alloc(ly, uy);
00104 for (i = lx; i < ux; ++i)
00105 {
00106 im_get_colz(line, im2, i, ly, uy);
00107 line += ly;
00108 fft_inverse_cmplx_inplace(line, ny);
00109 line -= ly;
00110 im_put_colz(line, im2, i, ly, uy);
00111 }
00112
00113 zvector_free(line, ly);
00114 return (im2);
00115 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 121 of file im_gabor.c. References cmplx_times(), cmplx_unit(), Complex, Complex_id, im_alloc(), IM_PIX_SETZ, Imrect, Imregion, imregion::lx, imregion::ly, MIN, sqrt(), tvector_alloc, tvector_free, TWOPI, imregion::ux, and imregion::uy. Referenced by gabor_proc().
00122 {
00123 Imrect *im1;
00124 double s, kx, ky, c1, c2;
00125 double *px, *py;
00126 int x, y, wx, wy;
00127 Complex z = {Complex_id};
00128
00129 /* work in frequency space */
00130 wx = roi->ux - roi->lx;
00131 wy = roi->uy - roi->ly;
00132 im1 = im_alloc(wy,wx,NULL,complex_v);
00133
00134 b = pow(2.0, b);
00135 s = k * (b - 1.0) / (b + 1.0);
00136 kx = k * cos(theta);
00137 ky = k * sin(theta);
00138 c1 = 1.0 / (s * sqrt(TWOPI));
00139 c2 = -0.5 / (s * s);
00140
00142 px = tvector_alloc(0, wx, double);
00143 for (x = 0; x < wx; x++)
00144 {
00145 int x1, x2;
00146
00147 x1 = (int)fabs((double)x - kx);
00148 x2 = wx - x1;
00149 x1 = MIN(x1, x2);
00150 px[x] = c1 * exp(c2 * x1 * x1);
00151 }
00152 py = tvector_alloc(0, wy, double);
00153 for (y = 0; y < wy; y++)
00154 {
00155 int y1, y2;
00156
00157 y1 = (int)fabs((double)y - ky);
00158 y2 = wy - y1;
00159 y1 = MIN(y1, y2);
00160 py[y] = c1 * exp(c2 * y1 * y1);
00161 }
00162
00163 /* apply convolutuion as product in frequency space */
00164 for (x = 0; x < wx; x++)
00165 for (y = 0; y < wy; y++)
00166 {
00167 z = cmplx_unit();
00168 z = cmplx_times(px[x] * py[y], z);
00169 IM_PIX_SETZ(im1, y, x, z);
00170 }
00171 tvector_free(px, 0, double);
00172 tvector_free(py, 0, double);
00173 return (im1);
00174 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 49 of file im_filter.c. References func, fvector_alloc, fvector_free, imrect::height, im_alloc(), im_get_colf(), im_put_colf(), Imrect, imregion::lx, imregion::ly, imrect::region, imregion::ux, imregion::uy, and imrect::width. Referenced by imf_gauss().
00053 {
00054 Imrect *filtered_im;
00055 float *line;
00056 int lx, ux, ly, uy;
00057 int i;
00058
00059 if (image == NULL)
00060 return (NULL);
00061
00062 lx = image->region->lx;
00063 ux = image->region->ux;
00064 ly = image->region->ly;
00065 uy = image->region->uy;
00066
00067 filtered_im = im_alloc(image->height, image->width, image->region, float_v);
00068 line = fvector_alloc(ly, uy);
00069
00070 for (i = lx; i < ux; ++i)
00071 {
00072 im_get_colf(line, image, i, ly, uy);
00073 func(line, ly, uy, data);
00074 im_put_colf(line, filtered_im, i, ly, uy);
00075 }
00076
00077 fvector_free((void *) line, ly);
00078 return (filtered_im);
00079 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
@(#) Definition at line 17 of file im_filter.c. References func, fvector_alloc, fvector_free, imrect::height, im_alloc(), im_get_rowf(), im_put_rowf(), Imrect, imregion::lx, imregion::ly, imrect::region, imregion::ux, imregion::uy, and imrect::width. Referenced by imf_gauss().
00021 {
00022 Imrect *filtered_im;
00023 float *line;
00024 int lx, ux, ly, uy;
00025 int i;
00026
00027 if (image == NULL)
00028 return (NULL);
00029
00030 lx = image->region->lx;
00031 ux = image->region->ux;
00032 ly = image->region->ly;
00033 uy = image->region->uy;
00034
00035 filtered_im = im_alloc(image->height, image->width, image->region, float_v);
00036 line = fvector_alloc(lx, ux);
00037
00038 for (i = ly; i < uy; ++i)
00039 {
00040 im_get_rowf(line, image, i, lx, ux);
00041 func(line, lx, ux, data);
00042 im_put_rowf(line, filtered_im, i, lx, ux);
00043 }
00044
00045 fvector_free((void *) line, lx);
00046 return (filtered_im);
00047 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 20 of file fireburn.c. References FOR_IM, imrect::height, im_alloc(), im_cast(), im_copy(), IM_FLOAT, im_free(), IM_SHORT, Imrect, imregion::lx, imregion::ly, imrect::region, imregion::ux, imregion::uy, Vartype, imrect::vtype, and imrect::width. Referenced by grimson_proc().
00021 {
00022 Imrect *smask = NULL; /* source mask store */
00023 Imrect *dmask = NULL; /* destination mask store */
00024 Imrect *mask; /* temporary store when pointers are swapped */
00025 int row, col; /* loop variables */
00026 int burnt; /* fully burnt control variable */
00027 Vartype vtype;
00028 Imrect *im2;
00029 int row_max, row_min, col_max, col_min;
00030
00031 vtype = im->vtype;
00032 im2 = im_cast(im, float_v);
00033 im_free(im);
00034 im = im2;
00035
00036 row_max = im->region->uy;
00037 row_min = im->region->ly;
00038 col_max = im->region->ux;
00039 col_min = im->region->lx;
00040
00041 /* generate the source mask, 1 for a known value, 0 otherwise */
00042
00043 smask = im_alloc(im->height, im->width, im->region, short_v);
00044
00045 FOR_IM(im->region, row, col) IM_SHORT(smask, row, col) =
00046 (((IM_FLOAT(im, row, col)>=(float)low_thresh) &&
00047 (IM_FLOAT(im, row, col)<=(float)high_thresh)) ? 0 : 1);
00048
00049 /* generate the destination mask, 1 for a known value, 0 otherwise */
00050
00051 dmask = im_copy(smask);
00052
00053 /* check to see if image is not already fully burnt */
00054
00055 burnt = 1;
00056
00057 FOR_IM(im->region, row, col) burnt = burnt && IM_SHORT(smask, row, col);
00058
00059 /* fireburn the image */
00060
00061 while (burnt==0)
00062 {
00063 FOR_IM(im->region, row, col)
00064 {
00065 if (IM_SHORT(smask, row, col)!=0)
00066 {
00067 IM_SHORT(dmask, row, col) = IM_SHORT(smask, row, col);
00068 if ((row+1<row_max)&&(col+1<col_max))
00069 if (IM_SHORT(smask, row+1, col+1)==0)
00070 {
00071 IM_SHORT(dmask, row+1, col+1)=1;
00072 IM_FLOAT(im, row+1, col+1)=IM_FLOAT(im, row, col);
00073 }
00074 if (row+1<row_max)
00075 if (IM_SHORT(smask, row+1, col)==0)
00076 {
00077 IM_SHORT(dmask, row+1, col)=1;
00078 IM_FLOAT(im, row+1, col)=IM_FLOAT(im, row, col);
00079 }
00080 if ((row+1<row_max)&&(col-1>=col_min))
00081 if (IM_SHORT(smask, row+1, col-1)==0)
00082 {
00083 IM_SHORT(dmask, row+1, col-1)=1;
00084 IM_FLOAT(im, row+1, col-1)=IM_FLOAT(im, row, col);
00085 }
00086 if (col+1<col_max)
00087 if (IM_SHORT(smask, row, col+1)==0)
00088 {
00089 IM_SHORT(dmask, row, col+1)=1;
00090 IM_FLOAT(im, row, col+1)=IM_FLOAT(im, row, col);
00091 }
00092 if (col-1>=col_min)
00093 if (IM_SHORT(smask, row, col-1)==0)
00094 {
00095 IM_SHORT(dmask, row, col-1)=1;
00096 IM_FLOAT(im, row, col-1)=IM_FLOAT(im, row, col);
00097 }
00098 if ((row-1>=row_min)&&(col+1<col_max))
00099 if (IM_SHORT(smask, row-1, col+1)==0)
00100 {
00101 IM_SHORT(dmask, row-1, col+1)=1;
00102 IM_FLOAT(im, row-1, col+1)=IM_FLOAT(im, row, col);
00103 }
00104 if (row-1>=row_min)
00105 if (IM_SHORT(smask, row-1, col)==0)
00106 {
00107 IM_SHORT(dmask, row-1, col)=1;
00108 IM_FLOAT(im, row-1, col)=IM_FLOAT(im, row, col);
00109 }
00110 if ((row-1>=row_min)&&(col-1>=col_min))
00111 if (IM_SHORT(smask, row-1, col-1)==0)
00112 {
00113 IM_SHORT(dmask, row-1, col-1)=1;
00114 IM_FLOAT(im, row-1, col-1)=IM_FLOAT(im, row, col);
00115 }
00116 }
00117 }
00118
00119 /* check to see if image is now fully burnt */
00120
00121 burnt = 1;
00122
00123 FOR_IM(im->region, row, col) burnt = burnt && IM_SHORT(dmask, row, col);
00124
00125 /* swap over the source and destination masks */
00126
00127 mask = dmask;
00128 dmask = smask;
00129 smask = mask;
00130 }
00131
00132 im = im_cast(im2, vtype);
00133 im_free(im2);
00134
00135 im_free(smask);
00136 im_free(dmask);
00137
00138 return(im);
00139 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
combining two images float ptr -> ptr Definition at line 271 of file im_ptr.c. References imrect::height, im_alloc(), im_get_row(), im_get_rowf(), im_put_row(), Imrect, Imregion, imregion::lx, imregion::ly, MIN, imrect::region, rfree(), roi_inter(), tvector_alloc, tvector_free, imregion::ux, imregion::uy, and imrect::width.
00272 {
00273 Imrect *im3;
00274 Imregion *roi;
00275 float *row1;
00276 int *row2, *row3;
00277 int lx, ux, ly, uy;
00278 int width, height;
00279 int i, j;
00280
00281 if (im1 == NULL || im2 == NULL)
00282 return (NULL);
00283
00284 roi = roi_inter(im1->region, im2->region);
00285 if (roi == NULL)
00286 return (NULL);
00287 lx = roi->lx;
00288 ux = roi->ux;
00289 ly = roi->ly;
00290 uy = roi->uy;
00291
00292 width = MIN(im1->width, im2->width);
00293 height = MIN(im1->height, im2->height);
00294
00295 im3 = im_alloc(height, width, roi, ptr_v);
00296 row1 = tvector_alloc(lx, ux, float);
00297 row2 = tvector_alloc(lx, ux, int);
00298 row3 = tvector_alloc(lx, ux, int);
00299
00300 for (i = ly; i < uy; ++i)
00301 {
00302 im_get_rowf(row1, im1, i, lx, ux);
00303 im_get_row(row2, im2, i, lx, ux);
00304 for (j = lx; j < ux; ++j)
00305 row3[j] = (int) (*func) (row1[j], (void *) row2[j], data);
00306 im_put_row(row3, im3, i, lx, ux);
00307 }
00308
00309 tvector_free(row1, lx, float);
00310 tvector_free(row2, lx, int);
00311 tvector_free(row3, lx, int);
00312 rfree((void *) roi);
00313 return (im3);
00314 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||||||||||||||||||
|
Definition at line 48 of file im_gabor.c. References gabor_profile(), im_conv_separable(), Imrect, Prof1, and prof1_free().
00049 {
00050 Prof1 *profx = gabor_profile((float)phasex, (float)sigmax, (float)omegax, (float)nsigmax);
00051 Prof1 *profy = gabor_profile((float)phasey, (float)sigmay, (float)omegay, (float)nsigmay);
00052 Imrect *im2;
00053
00054 im2 = im_conv_separable(im1, profx, profy);
00055 prof1_free(profx);
00056 prof1_free(profy);
00057 return (im2);
00058 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 63 of file im_gabor.c. References cmplx_times(), Complex, Complex_id, imrect::height, im_fft(), im_fft_inverse(), im_free(), IM_PIX_GETZ, IM_PIX_SETZ, Imrect, MIN, imrect::region, sqrt(), tvector_alloc, tvector_free, TWOPI, and imrect::width. Referenced by imcalc_gabor().
00064 {
00065 Imrect *im1;
00066 Imrect *im2;
00067 double s, kx, ky, c1, c2;
00068 double *px, *py;
00069 int x, y, wx, wy;
00070
00071 /* work in frequency space */
00072 im1 = im_fft(im,im->region);
00073 wx = im->width;
00074 wy = im->height;
00075 b = pow(2.0, b);
00076 s = k * (b - 1.0) / (b + 1.0);
00077 kx = k * cos(theta);
00078 ky = k * sin(theta);
00079 c1 = 1.0 / (s * sqrt(TWOPI));
00080 c2 = -0.5 / (s * s);
00081
00083 px = tvector_alloc(0, wx, double);
00084 for (x = 0; x < wx; x++)
00085 {
00086 int x1, x2;
00087
00088 x1 = (int)fabs((double)x - kx);
00089 x2 = wx - x1;
00090 x1 = MIN(x1, x2);
00091 px[x] = c1 * exp(c2 * x1 * x1);
00092 }
00093 py = tvector_alloc(0, wy, double);
00094 for (y = 0; y < wy; y++)
00095 {
00096 int y1, y2;
00097
00098 y1 = (int)fabs((double)y - ky);
00099 y2 = wy - y1;
00100 y1 = MIN(y1, y2);
00101 py[y] = c1 * exp(c2 * y1 * y1);
00102 }
00103
00104 /* apply convolutuion as product in frequency space */
00105 for (x = 0; x < wx; x++)
00106 for (y = 0; y < wy; y++)
00107 {
00108 Complex z = {Complex_id};
00109
00110 IM_PIX_GETZ(im1, y, x, z);
00111 z = cmplx_times(px[x] * py[y], z);
00112 IM_PIX_SETZ(im1, y, x, z);
00113 }
00114 tvector_free(px, 0, double);
00115 tvector_free(py, 0, double);
00116 im2 = im_fft_inverse(im1,im1->region);
00117 im_free(im1);
00118 return (im2);
00119 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||||||||||||||
|
Definition at line 280 of file im_scale.c. References fvector_alloc, fvector_free, im_get_rowf(), im_put_rowf(), Imrect, Imregion, imregion::lx, imregion::ly, MAX, MIN, imrect::region, imregion::ux, and imregion::uy. Referenced by ims_rescale_images().
00285 {
00286 Imregion *roi;
00287 float *row1, *row2;
00288 int lx, ux, ly, uy;
00289 double scale, base, range;
00290 int i, j;
00291
00292 if (im == NULL)
00293 return;
00294
00295 roi = im->region;
00296 if (roi == NULL)
00297 return;
00298 lx = roi->lx;
00299 ux = roi->ux;
00300 ly = roi->ly;
00301 uy = roi->uy;
00302
00303 if (oldlow == oldhigh)
00304 scale = 1.0;
00305 else
00306 scale = 1.0 / (oldhigh - oldlow);
00307 base = newlow;
00308 range = newhigh - oldlow;
00309
00310 row1 = fvector_alloc(lx, ux);
00311 row2 = fvector_alloc(lx, ux);
00312 for (i = ly; i < uy; ++i)
00313 {
00314 im_get_rowf(row1, im, i, lx, ux);
00315 for (j = lx; j < ux; ++j)
00316 {
00317 double val;
00318
00319 val = base + range * pow(scale * (row1[j] - oldlow), gamma);
00320 val = MAX(val, threslow);
00321 row2[j] = (float)MIN(val, threshigh);
00322 }
00323 im_put_rowf(row2, im, i, lx, ux);
00324 }
00325
00326 fvector_free((void *) row1, lx);
00327 fvector_free((void *) row2, lx);
00328 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 100 of file im_deriv.c. References imf_diffx(), imf_diffy(), and Imrect.
|
Here is the call graph for this function:

|
||||||||||||||||||||||||||||
|
Definition at line 109 of file im_deriv.c. References im_free(), imf_diffx(), imf_diffy(), and Imrect. Referenced by imf_ddn(), and imf_ddt().
00110 {
00111 Imrect *imx1;
00112 Imrect *imy1;
00113
00114 imx1 = imf_diffx(im);
00115 imy1 = imf_diffy(im);
00116 *imxx = imf_diffx(imx1);
00117
00118 if (imx == NULL)
00119 im_free(imx1);
00120 else
00121 *imx = imx1;
00122
00123 *imxy = imf_diffx(imy1);
00124 *imyy = imf_diffy(imy1);
00125
00126 if (imy == NULL)
00127 im_free(imy1);
00128 else
00129 *imy = imy1;
00130 }
|
Here is the call graph for this function:

|
|
Definition at line 19 of file im_apply.c. References imrect::height, im_alloc(), Imrect, imz_im(), imrect::region, imrect::vtype, and imrect::width. Referenced by conn_add_regions(), conn_seg_regions(), fulldraw(), imcalc_imag(), and imz_dscat().
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 581 of file im_scale.c. References fvector_alloc, fvector_free, im_get_rowf(), Imrect, Imregion, imregion::lx, imregion::ly, imrect::region, SWAP, imregion::ux, and imregion::uy.
00582 {
00583 Imregion *roi;
00584 float *row1, *row2;
00585 double max;
00586 int lx, ux, ly, uy, minx, miny = 0;
00587 int i, j;
00588
00589 if (im == NULL)
00590 {
00591 *y = *x = 0;
00592 return;
00593 }
00594 roi = im->region;
00595 if (roi == NULL)
00596 {
00597 *y = *x = 0;
00598 return;
00599 }
00600 lx = roi->lx;
00601 ux = roi->ux;
00602 ly = roi->ly;
00603 uy = roi->uy;
00604
00605 max = 0.0;
00606 row1 = fvector_alloc(lx, ux);
00607 row2 = fvector_alloc(lx, ux);
00608 im_get_rowf(row2, im, ly, lx, ux);
00609 for (i = ly + 1; i < uy - 1; ++i)
00610 {
00611 SWAP(float *, row1, row2);
00612
00613 im_get_rowf(row2, im, i + 1, lx, ux);
00614 for (j = lx + 1; j < ux - 1; ++j)
00615 {
00616 double dxy;
00617
00618 dxy = fabs(row1[j - 1] - row2[j + 1]) + fabs(row1[j + 1] - row2[j - 1]);
00619 if (max < dxy)
00620 {
00621 max = dxy;
00622 minx = j;
00623 miny = i;
00624 }
00625 }
00626 }
00627
00628 *x = minx;
00629 *y = miny;
00630 fvector_free((void *) row1, lx);
00631 fvector_free((void *) row2, lx);
00632 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 535 of file im_scale.c. References fvector_alloc, fvector_free, im_get_pixf(), im_get_rowf(), Imrect, Imregion, imregion::lx, imregion::ly, imrect::region, imregion::ux, and imregion::uy.
00536 {
00537 Imregion *roi;
00538 float *row, max;
00539 int lx, ux, ly, uy, xmax, ymax;
00540 int i, j;
00541
00542 if (im == NULL)
00543 {
00544 *y = *x = 0;
00545 return(0);
00546 }
00547 roi = im->region;
00548 if (roi == NULL)
00549 {
00550 *y = *x = 0;
00551 return(0);
00552 }
00553 lx = roi->lx;
00554 ux = roi->ux;
00555 ly = roi->ly;
00556 uy = roi->uy;
00557
00558 row = fvector_alloc(lx, ux);
00559 max = (float)im_get_pixf(im, ly, lx);
00560 xmax = lx;
00561 ymax = ly;
00562 for (i = ly; i < uy; ++i)
00563 {
00564 im_get_rowf(row, im, i, lx, ux);
00565 for (j = lx; j < ux; ++j)
00566 if (max < row[j])
00567 {
00568 max = row[j];
00569 xmax = j;
00570 ymax = i;
00571 }
00572 }
00573
00574 *x = xmax;
00575 *y = ymax;
00576 fvector_free((void *) row, lx);
00577 return(max);
00578 }
|
Here is the call graph for this function:

|
|
Definition at line 88 of file im_log.c. References imf_log(), Imrect, imz_log(), and imrect::vtype. Referenced by imcalc_log().
|
Here is the call graph for this function:

|
|
Definition at line 558 of file im_ptr.c. References im_pf_apply(), Imrect, and pmat2_det().
00559 {
00560 return (im_pf_apply(m, pmat2_det, NULL));
00561 }
|
Here is the call graph for this function:

|
|
Definition at line 380 of file im_ptr.c. References im_free(), im_ptr_apply(), Imrect, and rfree().
00381 {
00382 im_ptr_apply(im, rfree, NULL);
00383 im_free(im);
00384 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 522 of file im_ptr.c. References im_free(), im_mat2_of_cols(), im_vec2(), im_vec2_free(), im_vec2_grad(), imf_diffx(), imf_diffy(), and Imrect. Referenced by im_mat2_hessian().
00523 {
00524 Imrect *imx = imf_diffx(im);
00525 Imrect *imy = imf_diffy(im);
00526 Imrect *gx;
00527 Imrect *gy;
00528
00529 gx = im_vec2_grad(imx);
00530 gy = im_vec2_grad(imy);
00531 *g = im_vec2(imx, imy);
00532 im_free(imx);
00533 im_free(imy);
00534 *h = im_mat2_of_cols(gx, gy);
00535 im_vec2_free(gx);
00536 im_vec2_free(gy);
00537 }
|
Here is the call graph for this function:

|
|
Definition at line 541 of file im_ptr.c. References im_mat2_grad_hessian(), im_vec2_free(), and Imrect.
00542 {
00543 Imrect *g;
00544 Imrect *h;
00545
00546 im_mat2_grad_hessian(im, &g, &h);
00547 im_vec2_free(g);
00548 return (h);
00549 }
|
Here is the call graph for this function:

|
|
Definition at line 477 of file im_ptr.c. References im_pp_apply(), Imrect, and pmat2_inverse().
00478 {
00479 return (im_pp_apply(m, pmat2_inverse, NULL));
00480 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 489 of file im_ptr.c. References im_ppp_combine(), Imrect, and pmat2_of_cols(). Referenced by im_mat2_grad_hessian().
00490 {
00491 return (im_ppp_combine(cx, cy, pmat2_of_cols, NULL));
00492 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 501 of file im_ptr.c. References im_ppp_combine(), Imrect, and pmat2_of_rows().
00502 {
00503 return (im_ppp_combine(rx, ry, pmat2_of_rows, NULL));
00504 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 460 of file im_ptr.c. References im_mat2_vprod(), im_ptr_apply(), im_vec2_dot(), Imrect, and rfree().
00461 {
00462 Imrect *mv = im_mat2_vprod(m, v);
00463 Imrect *umv;
00464
00465 umv = im_vec2_dot(u, mv);
00466 im_ptr_apply(mv, rfree, NULL);
00467 return (umv);
00468 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 453 of file im_ptr.c. References im_ppp_combine(), Imrect, and pmat2_vprod(). Referenced by im_mat2_sprod().
00454 {
00455 return (im_ppp_combine(m, v, pmat2_vprod, NULL));
00456 }
|
Here is the call graph for this function:

|
|
Definition at line 590 of file im_ptr.c. References im_pf_apply(), Imrect, and pmat2_xx().
00591 {
00592 return (im_pf_apply(m, pmat2_xx, NULL));
00593 }
|
Here is the call graph for this function:

|
|
Definition at line 600 of file im_ptr.c. References im_pf_apply(), Imrect, and pmat2_xy().
00601 {
00602 return (im_pf_apply(m, pmat2_xy, NULL));
00603 }
|
Here is the call graph for this function:

|
|
Definition at line 610 of file im_ptr.c. References im_pf_apply(), Imrect, and pmat2_yx().
00611 {
00612 return (im_pf_apply(m, pmat2_yx, NULL));
00613 }
|
Here is the call graph for this function:

|
|
Definition at line 620 of file im_ptr.c. References im_pf_apply(), Imrect, and pmat2_yy().
00621 {
00622 return (im_pf_apply(m, pmat2_yy, NULL));
00623 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 682 of file im_combine.c. References im_sup_vtype(), imf_maxsel(), imi_maxsel(), Imrect, imz_maxsel(), and imrect::vtype. Referenced by imcalc_maxsel().
00683 {
00684 if (im1 == NULL || im2 == NULL)
00685 return (NULL);
00686 switch (im_sup_vtype(im1->vtype, im2->vtype))
00687 {
00688 case uchar_v:
00689 case char_v:
00690 case short_v:
00691 case ushort_v:
00692 case int_v:
00693 return(imi_maxsel(im1, im2));
00694 case float_v:
00695 return(imf_maxsel(im1, im2));
00696 case complex_v:
00697 return(imz_maxsel(im1, im2));
00698 default:
00699 return (NULL);
00700 }
00701 return (NULL);
00702 }
|
Here is the call graph for this function:

|
|
Definition at line 238 of file im_median.c. References imc_median(), imf_median(), imi_median(), Imrect, imz_median(), and imrect::vtype. Referenced by imcalc_median(), and smooth_slopes().
00239 {
00240 if(im == NULL)
00241 return(NULL);
00242 switch(im->vtype)
00243 {
00244 case uchar_v:
00245 return(imc_median(im));
00246 case short_v:
00247 case ushort_v:
00248 case int_v:
00249 return(imi_median(im));
00250 case float_v:
00251 return(imf_median(im));
00252 case complex_v:
00253 return(imz_median(im));
00254 default:
00255 return(NULL);
00256 }
00257 }
|
Here is the call graph for this function:

|
|
Definition at line 29 of file im_apply.c. References imf_minus(), imi_minus(), Imrect, imz_minus(), and imrect::vtype. Referenced by imcalc_minus(), and zero_mask().
|
Here is the call graph for this function:

|
|
Definition at line 43 of file im_apply.c. References imf_mod(), imi_mod(), Imrect, imz_mod(), and imrect::vtype. Referenced by imcalc_mod(), and zero_cut().
|
Here is the call graph for this function:

|
||||||||||||||||
|
applying function to image ptr -> float Definition at line 85 of file im_ptr.c. References imrect::height, im_alloc(), im_get_row(), im_put_rowf(), Imrect, imregion::lx, imregion::ly, imrect::region, tvector_alloc, tvector_free, imregion::ux, imregion::uy, and imrect::width. Referenced by im_mat2_det(), im_mat2_xx(), im_mat2_xy(), im_mat2_yx(), im_mat2_yy(), im_vec2_x(), and im_vec2_y().
00086 {
00087 Imrect *im2;
00088 int *row1;
00089 float *row2;
00090 int lx, ux, ly, uy;
00091 int i, j;
00092
00093 if (im1 == NULL)
00094 return (NULL);
00095
00096 lx = im1->region->lx;
00097 ux = im1->region->ux;
00098 ly = im1->region->ly;
00099 uy = im1->region->uy;
00100 im2 = im_alloc(im1->height, im1->width, im1->region, float_v);
00101 row1 = tvector_alloc(lx, ux, int);
00102 row2 = tvector_alloc(lx, ux, float);
00103
00104 for (i = ly; i < uy; ++i)
00105 {
00106 im_get_row(row1, im1, i, lx, ux);
00107 for (j = lx; j < ux; ++j)
00108 row2[j] = (float)((*func) ((void *) row1[j], data));
00109 im_put_rowf(row2, im2, i, lx, ux);
00110 }
00111
00112 tvector_free(row1, lx, int);
00113 tvector_free(row2, lx, float);
00114
00115 return (im2);
00116 }
|
Here is the call graph for this function:

|
|
Definition at line 507 of file im_apply.c. References Imrect, and imz_arg().
00508 {
00509 return (imz_arg(im));
00510 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 164 of file im_poly_crop.c. References imf_poly_crop(), Imrect, List, poly, and imrect::vtype. Referenced by imcalc_roi(), mask_size_show(), region_size_show(), and stim_roi_acqu().
|
Here is the call graph for this function:

|
|
Definition at line 125 of file im_fourier.c. References Complex, fvector_alloc, fvector_free, imrect::height, im_alloc(), im_get_rowz(), im_put_rowf(), Imrect, line_power_spectrum(), imrect::width, zvector_alloc, and zvector_free. Referenced by imcalc_power_spectrum().
00126 {
00127 Imrect *im2;
00128 Complex *l1;
00129 float *l2;
00130 int i;
00131 int ux, uy, hx, hy;
00132
00133 if (im1 == NULL)
00134 return (NULL);
00135
00136 ux = im1->width; hx = ux/2;
00137 uy = im1->height; hy = uy/2;
00138
00139 im2 = im_alloc(uy, ux, NULL, float_v);
00140 l1 = zvector_alloc(0, ux);
00141 l2 = fvector_alloc(0, ux);
00142
00143 for (i = 0; i < hy; ++i)
00144 {
00145 im_get_rowz(l1, im1, i, 0, hx);
00146 line_power_spectrum(l1, l2, 0, hx);
00147 im_put_rowf(l2-hx, im2, i+hy, hx, ux);
00148
00149 im_get_rowz(l1, im1, i, hx, ux);
00150 line_power_spectrum(l1, l2, hx, ux);
00151 im_put_rowf(l2+hx, im2, i+hy, 0, hx);
00152 }
00153
00154 for (i = hy; i < uy; ++i)
00155 {
00156 im_get_rowz(l1, im1, i, 0, hx);
00157 line_power_spectrum(l1, l2, 0, hx);
00158 im_put_rowf(l2-hx, im2, i-hy, hx, ux);
00159
00160 im_get_rowz(l1, im1, i, hx, ux);
00161 line_power_spectrum(l1, l2, hx, ux);
00162 im_put_rowf(l2+hx, im2, i-hy, 0, hx);
00163 }
00164
00165 zvector_free(l1, 0);
00166 fvector_free(l2, 0);
00167
00168 return(im2);
00169 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
applying function to image ptr -> ptr Definition at line 48 of file im_ptr.c. References imrect::height, im_alloc(), im_get_row(), im_put_row(), Imrect, imregion::lx, imregion::ly, imrect::region, tvector_alloc, tvector_free, imregion::ux, imregion::uy, and imrect::width. Referenced by im_mat2_inverse().
00049 {
00050 Imrect *im2;
00051 int *row1, *row2;
00052 int lx, ux, ly, uy;
00053 int i, j;
00054
00055 if (im1 == NULL)
00056 return (NULL);
00057
00058 lx = im1->region->lx;
00059 ux = im1->region->ux;
00060 ly = im1->region->ly;
00061 uy = im1->region->uy;
00062 im2 = im_alloc(im1->height, im1->width, im1->region, ptr_v);
00063 row1 = tvector_alloc(lx, ux, int);
00064 row2 = tvector_alloc(lx, ux, int);
00065
00066 for (i = ly; i < uy; ++i)
00067 {
00068 im_get_row(row1, im1, i, lx, ux);
00069 for (j = lx; j < ux; ++j)
00070 row2[j] = (int) (*func) ((void *) row1[j], data);
00071 im_put_row(row2, im2, i, lx, ux);
00072 }
00073
00074 tvector_free(row1, lx, int);
00075 tvector_free(row2, lx, int);
00076
00077 return (im2);
00078 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
combining two images ptr ptr -> float Definition at line 321 of file im_ptr.c. References imrect::height, im_alloc(), im_get_row(), im_put_rowf(), Imrect, Imregion, imregion::lx, imregion::ly, MIN, imrect::region, rfree(), roi_inter(), tvector_alloc, tvector_free, imregion::ux, imregion::uy, and imrect::width. Referenced by im_vec2_cross(), and im_vec2_dot().
00322 {
00323 Imrect *im3;
00324 Imregion *roi;
00325 int *row1, *row2;
00326 float *row3;
00327 int lx, ux, ly, uy;
00328 int width, height;
00329 int i, j;
00330
00331 if (im1 == NULL || im2 == NULL)
00332 return (NULL);
00333
00334 roi = roi_inter(im1->region, im2->region);
00335 if (roi == NULL)
00336 return (NULL);
00337 lx = roi->lx;
00338 ux = roi->ux;
00339 ly = roi->ly;
00340 uy = roi->uy;
00341
00342 width = MIN(im1->width, im2->width);
00343 height = MIN(im1->height, im2->height);
00344
00345 im3 = im_alloc(height, width, roi, ptr_v);
00346 row1 = tvector_alloc(lx, ux, int);
00347 row2 = tvector_alloc(lx, ux, int);
00348 row3 = tvector_alloc(lx, ux, float);
00349
00350 for (i = ly; i < uy; ++i)
00351 {
00352 im_get_row(row1, im1, i, lx, ux);
00353 im_get_row(row2, im2, i, lx, ux);
00354 for (j = lx; j < ux; ++j)
00355 row3[j] = (float)((*func) ((void *) row1[j], (void *) row2[j], data));
00356 im_put_rowf(row3, im3, i, lx, ux);
00357 }
00358
00359 tvector_free(row1, lx, int);
00360 tvector_free(row2, lx, int);
00361 tvector_free(row3, lx, float);
00362 rfree((void *) roi);
00363 return (im3);
00364 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
combining two images ptr ptr -> ptr Definition at line 123 of file im_ptr.c. References imrect::height, im_alloc(), im_get_row(), im_put_row(), Imrect, Imregion, imregion::lx, imregion::ly, MIN, imrect::region, rfree(), roi_inter(), tvector_alloc, tvector_free, imregion::ux, imregion::uy, and imrect::width. Referenced by im_mat2_of_cols(), im_mat2_of_rows(), im_mat2_vprod(), im_vec2_diff(), and im_vec2_sum().
00124 {
00125 Imrect *im3;
00126 Imregion *roi;
00127 int *row1, *row2, *row3;
00128 int lx, ux, ly, uy;
00129 int width, height;
00130 int i, j;
00131
00132 if (im1 == NULL || im2 == NULL)
00133 return (NULL);
00134
00135 roi = roi_inter(im1->region, im2->region);
00136 if (roi == NULL)
00137 return (NULL);
00138 lx = roi->lx;
00139 ux = roi->ux;
00140 ly = roi->ly;
00141 uy = roi->uy;
00142
00143 width = MIN(im1->width, im2->width);
00144 height = MIN(im1->height, im2->height);
00145
00146 im3 = im_alloc(height, width, roi, ptr_v);
00147 row1 = tvector_alloc(lx, ux, int);
00148 row2 = tvector_alloc(lx, ux, int);
00149 row3 = tvector_alloc(lx, ux, int);
00150
00151 for (i = ly; i < uy; ++i)
00152 {
00153 im_get_row(row1, im1, i, lx, ux);
00154 im_get_row(row2, im2, i, lx, ux);
00155 for (j = lx; j < ux; ++j)
00156 row3[j] = (int) (*func) ((void *) row1[j], (void *) row2[j], data);
00157 im_put_row(row3, im3, i, lx, ux);
00158 }
00159
00160 tvector_free(row1, lx, int);
00161 tvector_free(row2, lx, int);
00162 tvector_free(row3, lx, int);
00163 rfree((void *) roi);
00164 return (im3);
00165 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 838 of file im_combine.c. References im_sup_vtype(), imf_prod(), imi_prod(), Imrect, imz_prod(), and imrect::vtype. Referenced by edge_remove(), gamma_fit_region(), imcalc_optf(), imcalc_prod(), imcalc_xy_norm(), and mask_size_show().
00839 {
00840 if (im1 == NULL || im2 == NULL)
00841 return (NULL);
00842 switch (im_sup_vtype(im1->vtype, im2->vtype))
00843 {
00844 case uchar_v:
00845 case char_v:
00846 case short_v:
00847 case ushort_v:
00848 case int_v:
00849 return(imi_prod(im1, im2));
00850 case float_v:
00851 return(imf_prod(im1, im2));
00852 case complex_v:
00853 return(imz_prod(im1, im2));
00854 default:
00855 return (NULL);
00856 }
00857 return (NULL);
00858 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
applying function to image ptr -> void Definition at line 18 of file im_ptr.c. References im_get_row(), Imrect, imregion::lx, imregion::ly, imrect::region, tvector_alloc, tvector_free, imregion::ux, and imregion::uy. Referenced by im_mat2_free(), im_mat2_sprod(), im_vec2_free(), and im_vec3_free().
00019 {
00020 int *row;
00021 int lx, ux, ly, uy;
00022 int i, j;
00023
00024 if (im == NULL)
00025 return;
00026
00027 lx = im->region->lx;
00028 ux = im->region->ux;
00029 ly = im->region->ly;
00030 uy = im->region->uy;
00031 row = tvector_alloc(lx, ux, int);
00032
00033 for (i = ly; i < uy; ++i)
00034 {
00035 im_get_row(row, im, i, lx, ux);
00036 for (j = lx; j < ux; ++j)
00037 (*func) ((void *) row[j], data);
00038 }
00039
00040 tvector_free(row, lx, int);
00041 }
|
Here is the call graph for this function:

|
|
Definition at line 19 of file im_quad.c. References imrect::height, im_alloc(), IM_PIX_GET, IM_PIX_SET, Imrect, Imregion, imregion::lx, imregion::ly, pixval, imrect::region, imregion::ux, imregion::uy, imrect::vtype, and imrect::width. Referenced by grimson_proc().
00020 {
00021 Imrect *im2;
00022 Imregion roi;
00023 double pixval;
00024 int lx,ux,ly,uy;
00025 int i,j;
00026
00027 if (im->vtype == complex_v) return (NULL);
00028 roi = *(Imregion *)im->region;
00029
00030 lx = roi.lx;
00031 ux = roi.ux;
00032 ly = roi.ly;
00033 uy = roi.uy;
00034
00035 roi.ux+=ux-lx;
00036 roi.uy+=uy-ly;
00037
00038 im2 = im_alloc(2*im->height,2*im->width,&roi,im->vtype);
00039
00040 for(i = ly; i < uy; i++)
00041 {
00042 for (j = lx; j < ux; j++)
00043 {
00044 IM_PIX_GET(im,i,j,pixval);
00045 IM_PIX_SET(im2,i,j,pixval);
00046 IM_PIX_SET(im2,i,roi.ux+roi.lx-j-1,pixval);
00047 IM_PIX_SET(im2,roi.uy+roi.ly-i-1,j,pixval);
00048 IM_PIX_SET(im2,roi.uy+roi.ly-i-1,roi.ux+roi.lx-j-1,pixval);
00049 }
00050 }
00051 return(im2);
00052 }
|
Here is the call graph for this function:

|
|
Definition at line 105 of file im_quad.c. References imrect::height, im_alloc(), IM_PIX_GET, IM_PIX_SET, Imrect, Imregion, imregion::lx, imregion::ly, pixval, imrect::region, imregion::ux, imregion::uy, imrect::vtype, and imrect::width. Referenced by imcalc_quad().
00106 {
00107 Imrect *im2;
00108 Imregion roi;
00109 double pixval;
00110 int lx,ux,ly,uy,nx,ny;
00111 int i,j;
00112
00113 if (im->vtype == complex_v) return (NULL);
00114 roi = *(Imregion *)im->region;
00115 lx = roi.lx;
00116 ux = roi.ux;
00117 ly = roi.ly;
00118 uy = roi.uy;
00119 for(nx = 1; nx <= ux-lx; nx *= 2);
00120 for(ny = 1; ny <= uy-ly; ny *= 2);
00121 nx/=2;
00122 ny/=2;
00123
00124 ux = roi.ux = lx + nx;
00125 uy = roi.uy = ly + ny;
00126
00127 roi.ux+=ux-lx;
00128 roi.uy+=uy-ly;
00129
00130 im2 = im_alloc(2*im->height,2*im->width,&roi,im->vtype);
00131
00132 for(i = ly; i < uy; i++)
00133 {
00134 for (j = lx; j < ux;j++)
00135 {
00136 IM_PIX_GET(im,i,j,pixval);
00137 IM_PIX_SET(im2,i,j,pixval);
00138 IM_PIX_SET(im2,i,roi.ux+roi.lx-j-1,pixval);
00139 IM_PIX_SET(im2,roi.uy+roi.ly-i-1,j,pixval);
00140 IM_PIX_SET(im2,roi.uy+roi.ly-i-1,roi.ux+roi.lx-j-1,pixval);
00141 }
00142 }
00143 return(im2);
00144 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 234 of file im_rank.c. References im_cast(), im_free(), imf_rank(), imi_rank(), Imrect, MAXRANGE, and imrect::vtype. Referenced by imcalc_rank().
00234 {
00235 Imrect *rim;
00236 if(im == NULL || range > MAXRANGE)
00237 return(NULL);
00238 switch(im->vtype)
00239 {
00240 case uchar_v:
00241 case char_v:
00242 case short_v:
00243 case ushort_v:
00244 im = im_cast(im, int_v);
00245 rim = imi_rank(im, range, noise);
00246 im_free(im);
00247 return(rim);
00248 case int_v:
00249 return(imi_rank(im, range, noise));
00250 case double_v:
00251 im = im_cast(im, float_v);
00252 rim = imf_rank(im, range, noise);
00253 im_free(im);
00254 return(rim);
00255 case float_v:
00256 return(imf_rank(im, range, noise));
00257 case complex_v:
00258 return(NULL);
00259 default:
00260 return(NULL);
00261 }
00262 }
00263 }
|
Here is the call graph for this function:

|
|
Definition at line 57 of file im_apply.c. References im_copy(), Imrect, imz_re(), and imrect::vtype. Referenced by conn_seg_regions(), fulldraw(), im_shading(), imcalc_real(), and imz_dscat().
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 94 of file im_warp.c. References Complex, Complex_id, imrect::height, im_alloc(), im_put_pixf(), im_put_pixz(), im_sub_pixf(), im_sub_pixz(), Imrect, Imregion, imregion::lx, imregion::ly, Mat3, Mat3_id, mat3_inverse(), imrect::region, rfree(), roi_rectify(), imregion::ux, imregion::uy, vec2(), Vec2, Vec2_id, vec2_rectify(), vec2_x, vec2_y, imrect::vtype, and imrect::width.
00095 {
00096 Mat3 irect = {Mat3_id};
00097 Imrect *im2;
00098 Imregion *roi;
00099 int x, y, lx, ly, ux, uy;
00100
00101 if (im1 == NULL)
00102 return (NULL);
00103
00104 roi = roi_rectify(im1->region, rect);
00105
00106 im2 = im_alloc(im1->height, im1->width, roi, im1->vtype);
00107 lx = roi->lx;
00108 ux = roi->ux;
00109 ly = roi->ly;
00110 uy = roi->uy;
00111 rfree((void *) roi);
00112
00113 irect = mat3_inverse(rect);
00114
00115 for (x = lx; x < ux; x++)
00116 for (y = ly; y < uy; y++)
00117 {
00118 Vec2 v = {Vec2_id};
00119
00120 v = vec2_rectify(irect, vec2(x + 0.5, y + 0.5));
00121 if (im2->vtype != complex_v)
00122 {
00123 double g;
00124
00125 g = im_sub_pixf(im1, vec2_y(v), vec2_x(v));
00126 im_put_pixf(g, im2, y, x);
00127 } else
00128 {
00129 Complex g = {Complex_id};
00130
00131 g = im_sub_pixz(im1, vec2_y(v), vec2_x(v));
00132 im_put_pixz(g, im2, y, x);
00133 }
00134 }
00135
00136 return (im2);
00137 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||||||||||
|
Definition at line 332 of file im_scale.c. References fvector_alloc, fvector_free, im_get_rowf(), im_put_rowf(), Imrect, Imregion, imregion::lx, imregion::ly, MAX, MIN, imrect::region, imregion::ux, and imregion::uy.
00336 {
00337 Imregion *roi;
00338 float *row1, *row2;
00339 int lx, ux, ly, uy;
00340 float scale, base;
00341 int i, j;
00342
00343 if (im == NULL)
00344 return;
00345
00346 roi = im->region;
00347 if (roi == NULL)
00348 return;
00349 lx = roi->lx;
00350 ux = roi->ux;
00351 ly = roi->ly;
00352 uy = roi->uy;
00353
00354 if (oldlow == oldhigh)
00355 scale = (float)1.0;
00356 else
00357 scale = (float)((newhigh - newlow) / (oldhigh - oldlow));
00358 base = (float)(newlow - scale * oldlow);
00359
00360 row1 = fvector_alloc(lx, ux);
00361 row2 = fvector_alloc(lx, ux);
00362 for (i = ly; i < uy; ++i)
00363 {
00364 im_get_rowf(row1, im, i, lx, ux);
00365 for (j = lx; j < ux; ++j)
00366 {
00367 double val;
00368
00369 val = base + scale * row1[j];
00370 val = MAX(val, threslow);
00371 row2[j] = (float)MIN(val, threshigh);
00372 }
00373 im_put_rowf(row2, im, i, lx, ux);
00374 }
00375
00376 fvector_free((void *) row1, lx);
00377 fvector_free((void *) row2, lx);
00378 }
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 7 of file im_shade.c. References fvector_alloc, fvector_free, im_free(), im_get_rowf(), im_put_rowf(), im_re(), imf_grad_h(), imf_grad_v(), Imrect, Imregion, imregion::lx, imregion::ly, imrect::region, sqrt(), imregion::ux, and imregion::uy. Referenced by imcalc_shade(), and shade_proc().
00009 {
00010 Imrect *fim,*hgim,*vgim,*im_re();
00011 Imrect *imf_grad_h(),*imf_grad_v();
00012 Imregion *roi;
00013 float *row1,*row2,*row3;
00014 int i,j;
00015 int lx,ux,ly,uy;
00016 double ctss,stss,cs;
00017
00018 fim = im_re(im);
00019 if (fim == NULL)
00020 return (NULL);
00021
00022 roi = fim->region;
00023 if (roi == NULL)
00024 return (NULL);
00025 lx = roi->lx;
00026 ux = roi->ux;
00027 ly = roi->ly;
00028 uy = roi->uy;
00029
00030 hgim = imf_grad_h(fim);
00031 vgim = imf_grad_v(fim);
00032 ctss = cos(tilt)*sin(slant);
00033 stss = sin(tilt)*sin(slant);
00034 cs = cos(slant);
00035
00036 row1 = fvector_alloc(lx, ux);
00037 row2 = fvector_alloc(lx, ux);
00038 row3 = fvector_alloc(lx, ux);
00039
00040 for (i = ly; i < uy; ++i)
00041 {
00042 im_get_rowf(row1, hgim, i, lx, ux);
00043 im_get_rowf(row2, vgim, i, lx, ux);
00044 for (j = lx; j < ux; ++j)
00045 {
00046 row3[j] = (float) (scale*(row1[j]*ctss + row2[j]*stss + cs)
00047 / sqrt(row1[j]*row1[j] + row2[j]*row2[j] + 1.0));
00048
00049 }
00050 im_put_rowf(row3, fim, i, lx, ux);
00051 }
00052
00053 fvector_free(row1, lx);
00054 fvector_free(row2, lx);
00055 fvector_free(row3, lx);
00056 im_free(hgim);
00057 im_free(vgim);
00058 return (fim);
00059 }
|
Here is the call graph for this function:

|
|
Definition at line 82 of file im_sin.c. References imf_sin(), Imrect, imz_sin(), and imrect::vtype. Referenced by imcalc_sin().
|
Here is the call graph for this function:

|
|
Definition at line 622 of file im_apply.c. References imf_sqr(), imi_sqr(), Imrect, imz_sqr(), and imrect::vtype. Referenced by edge_slice(), and imcalc_sqr().
|