51 if (first == last)
return 0;
55 const struct env_dims prevdims = env_pyr_img(pyr, i-1)->dims;
56 const struct env_dims curdims = env_pyr_img(pyr, i)->dims;
62 if (curdims.
w != pw2)
return 0;
63 if (curdims.
h != ph2)
return 0;
78 const intg32*
const bptr = env_img_pixels(b);
79 const intg32*
const cptr = env_img_pixels(c);
80 intg32*
const dptr = env_img_pixelsw(result);
86 dptr[i] = (bptr[i] < cptr[i]) ? cptr[i] - bptr[i] : bptr[i] - cptr[i];
87 if (dptr[i] < thresh) dptr[i] = 0;
92static void abs_diff_thresh_pyr(
const struct env_pyr* b,
const struct env_pyr* c,
95 ENV_ASSERT(env_pyr_depth(b) == env_pyr_depth(c));
96 ENV_ASSERT(env_pyr_depth(c) == env_pyr_depth(result));
100 if (env_pyr_depth(result) != n)
108 const struct env_image* bimg = env_pyr_img(b, i);
110 if (!env_img_initialized(bimg))
continue;
114 const struct env_image* cimg = env_pyr_img(c, i);
115 struct env_image* rimg = env_pyr_imgw(result, i);
119 abs_diff_thresh(bimg, cimg, thresh, rimg);
126 const int normalizeOutput,
struct env_image* result)
132 if (env_pyr_depth(pyr) == 0)
146 intg32*
const rptr = env_img_pixelsw(result);
163 (*envp->
submapPreProc)(tagName, clev, slev, &submap, env_pyr_img(pyr, clev), env_pyr_img(pyr, slev),
167 if (submap.
dims.
w > mapDims.
w || submap.
dims.
h > mapDims.
h)
174 else if (submap.
dims.
w < mapDims.
w || submap.
dims.
h < mapDims.
h)
190 (*envp->
submapPostNormProc)(tagName, clev, slev, &submap, env_pyr_img(pyr, clev), env_pyr_img(pyr, slev),
195 env_img_pixelsw(result));
209 const struct env_dims inputdims,
const struct env_pyr* lowpass5,
const int normalizeOutput,
214 if (status_func) (*status_func)(status_userdata, tagName, result);
226 const intg32 lumthresh = (3*255) / 10;
256 const intg32*
const byptr = env_img_pixels(&byOut);
257 intg32*
const dptr = env_img_pixelsw(result);
260 for (
env_size_t i = 0; i < sz; ++i) dptr[i] = (dptr[i] / 2) + (byptr[i] / 2);
263 if (status_func) (*status_func)(status_userdata, tagName, result);
296 env_chan_intensity(
"blue/yellow", envp, imath, by->
dims, &bypyr, 0, status_func, status_userdata, &byOut);
300 const intg32*
const byptr = env_img_pixels(&byOut);
301 intg32*
const dptr = env_img_pixelsw(result);
304 for (
env_size_t i = 0; i < sz; ++i) dptr[i] = (dptr[i] + byptr[i]) >> 1;
307 if (status_func) (*status_func)(status_userdata, tagName, result);
321 const intg32 sfnumer = 2069;
322 const intg32 sfdenom = 5000;
333 if (status_func) (*status_func)(status_userdata, tagName, result);
341 void* status_userdata,
struct env_image* result)
355 's',
't',
'e',
'e',
'r',
'a',
'b',
'l',
'e',
357 '/',
'_',
'_',
')',
'\0'
372 buf[10] =
'0' + ((i+1) / 10);
373 buf[11] =
'0' + ((i+1) % 10);
375 env_chan_steerable(buf, envp, imath, img->
dims, &hipass9, thetaidx, status_func, status_userdata, &chanOut);
379 if (!env_img_initialized(result))
383 env_img_pixelsw(result));
400 if (status_func) (*status_func)(status_userdata, tagName, result);
406 void* status_userdata,
struct env_image* result)
410 if (!env_img_initialized(prev))
422 abs_diff_thresh(cur, prev, lowthresh, &fli);
434 if (status_func) (*status_func)(status_userdata, tagName, result);
445 void* status_userdata,
struct env_image* result)
449 if (env_pyr_depth(prev_lowpass5) == 0)
461 abs_diff_thresh_pyr(cur_lowpass5, prev_lowpass5, lowthresh, &fli);
465 if (status_func) (*status_func)(status_userdata, tagName, result);
474 const struct env_pyr* unshiftedCur,
const struct env_pyr* shiftedPrev,
476 void* status_userdata,
struct env_image* result)
483 if (env_pyr_depth(unshiftedPrev) == 0)
501 const intg32*
const ucurr = env_img_pixels(env_pyr_img(unshiftedCur, i));
502 const intg32*
const uprev = env_img_pixels(env_pyr_img(unshiftedPrev, i));
503 const intg32*
const scurr = env_img_pixels(env_pyr_img(shiftedCur, i));
504 const intg32*
const sprev = env_img_pixels(env_pyr_img(shiftedPrev, i));
505 intg32*
const dptr = env_img_pixelsw(env_pyr_imgw(&pyr, i));
507 const env_size_t sz = env_img_size(env_pyr_img(&pyr, i));
511 dptr[c] = ((ucurr[c] >> nshift) * (sprev[c] >> nshift)) - ((uprev[c] >> nshift) * (scurr[c] >> nshift));
513 if (dptr[c] < lowthresh) dptr[c] = 0;
519 if (status_func) (*status_func)(status_userdata, tagName, result);
void env_c_image_div_scalar_accum(const intg32 *const a, const env_size_t sz, intg32 val, intg32 *const dst)
result += a / val
void env_c_image_div_scalar(const intg32 *const a, const env_size_t sz, intg32 val, intg32 *const dst)
result = a / val
void env_chan_intensity(const char *tagName, const struct env_params *envp, const struct env_math *imath, const struct env_dims inputdims, const struct env_pyr *lowpass5, const int normalizeOutput, env_chan_status_func *status_func, void *status_userdata, struct env_image *result)
An intensity channel.
void env_chan_color_rgby(const char *tagName, const struct env_params *envp, const struct env_math *imath, const struct env_image *rg, const struct env_image *by, env_chan_status_func *status_func, void *status_userdata, struct env_image *result)
A double opponent color channel that combines r/g, b/y subchannels, with direct RG and BY inputs.
void env_chan_direction(const char *tagName, const struct env_params *envp, const struct env_math *imath, const struct env_dims inputdims, const struct env_pyr *unshiftedPrev, const struct env_pyr *unshiftedCur, const struct env_pyr *shiftedPrev, const struct env_pyr *shiftedCur, env_chan_status_func *status_func, void *status_userdata, struct env_image *result)
A motion sensitive channel with direction selectivity.
void env_chan_flicker(const char *tagName, const struct env_params *envp, const struct env_math *imath, const struct env_image *prev, const struct env_image *cur, env_chan_status_func *status_func, void *status_userdata, struct env_image *result)
A temporal flicker channel.
void env_chan_color(const char *tagName, const struct env_params *envp, const struct env_math *imath, const struct env_rgb_pixel *const colimg, const struct env_dims dims, env_chan_status_func *status_func, void *status_userdata, struct env_image *result)
A double opponent color channel that combines r/g, b/y subchannels.
void env_chan_steerable(const char *tagName, const struct env_params *envp, const struct env_math *imath, const struct env_dims inputdims, const struct env_pyr *hipass9, const env_size_t thetaidx, env_chan_status_func *status_func, void *status_userdata, struct env_image *result)
An orientation filtering channel.
void env_chan_orientation(const char *tagName, const struct env_params *envp, const struct env_math *imath, const struct env_image *img, env_chan_status_func *status_func, void *status_userdata, struct env_image *result)
A composite channel with a set of steerable-filter subchannels.
void env_chan_msflicker(const char *tagName, const struct env_params *envp, const struct env_math *imath, const struct env_dims inputDims, const struct env_pyr *prev_lowpass5, const struct env_pyr *cur_lowpass5, env_chan_status_func *status_func, void *status_userdata, struct env_image *result)
A true multi-scale temporal flicker channel.
void env_chan_process_pyr(const char *tagName, const struct env_dims inputDims, const struct env_pyr *pyr, const struct env_params *envp, const struct env_math *imath, const int takeAbs, const int normalizeOutput, struct env_image *result)
void() env_chan_status_func(void *userdata, const char *tagName, const struct env_image *img)
void env_img_swap(struct env_image *img1, struct env_image *img2)
void env_img_resize_dims(struct env_image *img, const struct env_dims d)
#define env_img_initializer
void env_img_make_empty(struct env_image *img)
void env_img_init(struct env_image *img, const struct env_dims d)
void env_get_rgby(const struct env_rgb_pixel *const src, const env_size_t sz, struct env_image *rg, struct env_image *by, const intg32 thresh, const env_size_t inputbits)
Compute R-G and B-Y opponent color maps.
void env_rescale(const struct env_image *src, struct env_image *result)
void env_pyr_build_steerable_from_hipass_9(const struct env_pyr *hipass, const intg32 kxnumer, const intg32 kynumer, const env_size_t kdenombits, const struct env_math *imath, struct env_pyr *result)
void env_pyr_build_hipass_9(const struct env_image *image, env_size_t firstlevel, const struct env_math *imath, struct env_pyr *result)
void env_center_surround(const struct env_image *center, const struct env_image *surround, const int absol, struct env_image *result)
void env_downsize_9_inplace(struct env_image *src, const env_size_t depth, const struct env_math *imath)
void env_pyr_build_lowpass_5(const struct env_image *image, env_size_t firstlevel, const struct env_math *imath, struct env_pyr *result)
Wrapper for _cpu or _cuda version.
void env_max_normalize_inplace(struct env_image *src, intg32 min, intg32 max, enum env_maxnorm_type typ, const intg32 rangeThresh)
env_size_t env_max_cs_index(const struct env_params *envp)
env_size_t env_max_pyr_depth(const struct env_params *envp)
void env_pyr_init(struct env_pyr *pyr, const env_size_t n)
Construct with a given number of empty images.
#define env_pyr_initializer
void env_pyr_make_empty(struct env_pyr *dst)
ENV_INTG32_TYPE intg32
32-bit signed integer
A simple struct to hold a pair of width/height dimensions.
void * user_data_postnorm
int(* submapPostProc)(const char *tagName, struct env_image *cmap, void *user_data)
int(* submapPreProc)(const char *tagName, env_size_t clev, env_size_t slev, struct env_image *submap, const struct env_image *center, const struct env_image *surround, void *user_data)
env_size_t output_map_level
the pyramid level at which the feature map is taken
void * user_data_postproc
int(* submapPostNormProc)(const char *tagName, env_size_t clev, env_size_t slev, struct env_image *submap, const struct env_image *center, const struct env_image *surround, void *user_data)
enum env_maxnorm_type maxnorm_type
env_size_t num_orientations
number of Gabor subchannels
This class implements a set of images, often used as a dyadic pyramid.