JeVoisBase  1.20
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
env_image_ops.h
Go to the documentation of this file.
1 /*!@file Envision/env_image_ops.h Fixed-point integer math versions of some of our floating-point image functions */
2 
3 // //////////////////////////////////////////////////////////////////// //
4 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 //
5 // by the University of Southern California (USC) and the iLab at USC. //
6 // See http://iLab.usc.edu for information about this project. //
7 // //////////////////////////////////////////////////////////////////// //
8 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
9 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
10 // in Visual Environments, and Applications'' by Christof Koch and //
11 // Laurent Itti, California Institute of Technology, 2001 (patent //
12 // pending; application number 09/912,225 filed July 23, 2001; see //
13 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). //
14 // //////////////////////////////////////////////////////////////////// //
15 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. //
16 // //
17 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can //
18 // redistribute it and/or modify it under the terms of the GNU General //
19 // Public License as published by the Free Software Foundation; either //
20 // version 2 of the License, or (at your option) any later version. //
21 // //
22 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope //
23 // that it will be useful, but WITHOUT ANY WARRANTY; without even the //
24 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
25 // PURPOSE. See the GNU General Public License for more details. //
26 // //
27 // You should have received a copy of the GNU General Public License //
28 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write //
29 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, //
30 // Boston, MA 02111-1307 USA. //
31 // //////////////////////////////////////////////////////////////////// //
32 //
33 // Primary maintainer for this file: Rob Peters <rjpeters at usc dot edu>
34 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Envision/env_image_ops.h $
35 // $Id: env_image_ops.h 11338 2009-06-24 06:58:51Z itti $
36 //
37 
38 #pragma once
39 
44 
45 struct env_rgb_pixel;
46 
47 #define INTMAXNORMMIN ((intg32) 0)
48 #define INTMAXNORMMAX ((intg32) 32768)
49 
50 #ifdef __cplusplus
51 extern "C"
52 {
53 #endif
54 
55  //! Decimate in X and Y (take one every 'factor' pixels).
56  void env_dec_xy(const struct env_image* src, struct env_image* result);
57 
58  //! Decimate in X (take one every 'factor' pixels).
59  void env_dec_x(const struct env_image* src, struct env_image* result);
60 
61  //! Decimate in Y (take one every 'factor' pixels).
62  void env_dec_y(const struct env_image* src, struct env_image* result);
63 
64  void env_lowpass_5_x_dec_x(const struct env_image* src,
65  const struct env_math* imath,
66  struct env_image* result);
67 
68  void env_lowpass_5_y_dec_y(const struct env_image* src,
69  const struct env_math* imath,
70  struct env_image* result);
71 
72  void env_lowpass_9_x(const struct env_image* src,
73  const struct env_math* imath,
74  struct env_image* result);
75  void env_lowpass_9_y(const struct env_image* src,
76  const struct env_math* imath,
77  struct env_image* result);
78  void env_lowpass_9(const struct env_image* src,
79  const struct env_math* imath,
80  struct env_image* result);
81  void env_quad_energy(const struct env_image* img1,
82  const struct env_image* img2,
83  struct env_image* result);
84  void env_steerable_filter(const struct env_image* src,
85  const intg32 kxnumer, const intg32 kynumer,
86  const env_size_t kdenombits,
87  const struct env_math* imath,
88  struct env_image* result);
90 
91  void env_pyr_build_hipass_9(const struct env_image* image,
92  env_size_t firstlevel,
93  const struct env_math* imath,
94  struct env_pyr* result);
95 
96  void env_pyr_build_steerable_from_hipass_9(const struct env_pyr* hipass,
97  const intg32 kxnumer,
98  const intg32 kynumer,
99  const env_size_t kdenombits,
100  const struct env_math* imath,
101  struct env_pyr* result);
102  //! Wrapper for _cpu or _cuda version
103  void env_pyr_build_lowpass_5(const struct env_image* image,
104  env_size_t firstlevel,
105  const struct env_math* imath,
106  struct env_pyr* result);
107 
108  //! _cpu version implemented here, see CUDA/env_cuda.h for GPU version
109  void env_pyr_build_lowpass_5_cpu(const struct env_image* image,
110  env_size_t firstlevel,
111  const struct env_math* imath,
112  struct env_pyr* result);
113 
114  void env_downsize_9_inplace(struct env_image* src, const env_size_t depth,
115  const struct env_math* imath);
116  void env_rescale(const struct env_image* src, struct env_image* result);
117  void env_max_normalize_inplace(struct env_image* src,
118  intg32 min, intg32 max,
119  enum env_maxnorm_type typ,
120  const intg32 rangeThresh);
121  void env_max_normalize_none_inplace(struct env_image* src,
122  intg32 min, intg32 max,
123  const intg32 rangeThresh);
124  void env_max_normalize_std_inplace(struct env_image* src,
125  intg32 min, intg32 max,
126  const intg32 rangeThresh);
127 
128  void env_center_surround(const struct env_image* center,
129  const struct env_image* surround,
130  const int absol,
131  struct env_image* result);
132 
133  /// Compute R-G and B-Y opponent color maps
134  void env_get_rgby(const struct env_rgb_pixel* const src,
135  const env_size_t sz,
136  struct env_image* rg,
137  struct env_image* by, const intg32 thresh,
138  const env_size_t inputbits);
139 
140  /// Update the range [mi,ma] to include the range of values in src
141  void env_merge_range(const struct env_image* src,
142  intg32* mi, intg32* ma);
143 
144  /// rescale the src image to a [0..255] result
145  void env_rescale_range_inplace(struct env_image* src,
146  const intg32 mi, const intg32 ma);
147 
148  /// Compute average values in each tile of a grid
149  /** dest should have enough memory allocated to contain one byte per grid tile. bitshift is a rightward bit shift that
150  will be applied to the average intg32 value to convert it to byte. If image width or height is not an exact
151  multiple of nx or ny, tile size will be rounded down and some pixels may be skipped between tiles, but tile
152  locations will remain as accurate as possible. Note that here we assume positive values and clamp if negative,
153  this is because the default saliency channels take the absolute value when computing center-surround. */
154  void env_grid_average(const struct env_image * src, unsigned char * dest, unsigned int bitshift,
155  env_size_t nx, env_size_t ny);
156 
157  //! Shift an image by (dx, dy), without wraparound
158  void env_shift_clean(const struct env_image* srcImg,
159  const env_ssize_t dx, const env_ssize_t dy,
160  struct env_image* result);
161 
162  void env_shift_image(const struct env_image* srcImg,
163  const env_ssize_t dxnumer, const env_ssize_t dynumer,
164  const env_size_t denombits,
165  struct env_image* result);
166 
167 #ifdef __cplusplus
168 }
169 #endif
env_dec_xy
void env_dec_xy(const struct env_image *src, struct env_image *result)
Decimate in X and Y (take one every 'factor' pixels).
Definition: env_image_ops.c:45
env_rescale
void env_rescale(const struct env_image *src, struct env_image *result)
Definition: env_image_ops.c:585
env_config.h
env_dec_x
void env_dec_x(const struct env_image *src, struct env_image *result)
Decimate in X (take one every 'factor' pixels).
Definition: env_image_ops.c:86
env_math.h
env_lowpass_5_x_dec_x
void env_lowpass_5_x_dec_x(const struct env_image *src, const struct env_math *imath, struct env_image *result)
Definition: env_image_ops.c:143
env_steerable_filter
void env_steerable_filter(const struct env_image *src, const intg32 kxnumer, const intg32 kynumer, const env_size_t kdenombits, const struct env_math *imath, struct env_image *result)
Definition: env_image_ops.c:347
env_math
Definition: env_math.h:47
demo.img2
img2
Definition: demo.py:63
env_lowpass_9_y
void env_lowpass_9_y(const struct env_image *src, const struct env_math *imath, struct env_image *result)
Definition: env_image_ops.c:253
env_pyr_build_lowpass_5
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.
Definition: env_image_ops.c:534
env_max_normalize_inplace
void env_max_normalize_inplace(struct env_image *src, intg32 min, intg32 max, enum env_maxnorm_type typ, const intg32 rangeThresh)
Definition: env_image_ops.c:659
env_size_t
unsigned long env_size_t
Definition: env_types.h:71
env_ssize_t
long env_ssize_t
Definition: env_types.h:70
demo.result
result
Definition: demo.py:74
env_dec_y
void env_dec_y(const struct env_image *src, struct env_image *result)
Decimate in Y (take one every 'factor' pixels).
Definition: env_image_ops.c:115
env_pyr_build_steerable_from_hipass_9
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)
Definition: env_image_ops.c:505
demo.img1
img1
Definition: demo.py:62
env_rgb_pixel
RGB pixel class.
Definition: env_types.h:74
env_pyr_build_lowpass_5_cpu
void env_pyr_build_lowpass_5_cpu(const struct env_image *image, env_size_t firstlevel, const struct env_math *imath, struct env_pyr *result)
_cpu version implemented here, see CUDA/env_cuda.h for GPU version
env_shift_clean
void env_shift_clean(const struct env_image *srcImg, const env_ssize_t dx, const env_ssize_t dy, struct env_image *result)
Shift an image by (dx, dy), without wraparound.
Definition: env_image_ops.c:969
demo.image
image
Definition: demo.py:84
env_shift_image
void env_shift_image(const struct env_image *srcImg, const env_ssize_t dxnumer, const env_ssize_t dynumer, const env_size_t denombits, struct env_image *result)
Definition: env_image_ops.c:1017
env_get_rgby
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.
Definition: env_image_ops.c:819
env_lowpass_5_y_dec_y
void env_lowpass_5_y_dec_y(const struct env_image *src, const struct env_math *imath, struct env_image *result)
Definition: env_image_ops.c:171
env_maxnorm_type
env_maxnorm_type
Types of normalization.
Definition: env_types.h:87
env_grid_average
void env_grid_average(const struct env_image *src, unsigned char *dest, unsigned int bitshift, env_size_t nx, env_size_t ny)
Compute average values in each tile of a grid.
Definition: env_image_ops.c:931
env_image.h
env_pyr
This class implements a set of images, often used as a dyadic pyramid.
Definition: env_pyr.h:45
env_rescale_range_inplace
void env_rescale_range_inplace(struct env_image *src, const intg32 mi, const intg32 ma)
rescale the src image to a [0..255] result
Definition: env_image_ops.c:903
env_max_normalize_std_inplace
void env_max_normalize_std_inplace(struct env_image *src, intg32 min, intg32 max, const intg32 rangeThresh)
Definition: env_image_ops.c:685
env_attenuate_borders_inplace
void env_attenuate_borders_inplace(struct env_image *a, env_size_t size)
Definition: env_image_ops.c:404
env_pyr.h
env_pyr_build_hipass_9
void env_pyr_build_hipass_9(const struct env_image *image, env_size_t firstlevel, const struct env_math *imath, struct env_pyr *result)
Definition: env_image_ops.c:458
test-model.size
size
Definition: test-model.py:25
env_lowpass_9_x
void env_lowpass_9_x(const struct env_image *src, const struct env_math *imath, struct env_image *result)
Definition: env_image_ops.c:198
env_merge_range
void env_merge_range(const struct env_image *src, intg32 *mi, intg32 *ma)
Update the range [mi,ma] to include the range of values in src.
Definition: env_image_ops.c:883
env_center_surround
void env_center_surround(const struct env_image *center, const struct env_image *surround, const int absol, struct env_image *result)
Definition: env_image_ops.c:763
env_image
Basic image class.
Definition: env_image.h:43
env_lowpass_9
void env_lowpass_9(const struct env_image *src, const struct env_math *imath, struct env_image *result)
Definition: env_image_ops.c:307
env_max_normalize_none_inplace
void env_max_normalize_none_inplace(struct env_image *src, intg32 min, intg32 max, const intg32 rangeThresh)
Definition: env_image_ops.c:672
intg32
ENV_INTG32_TYPE intg32
32-bit signed integer
Definition: env_types.h:52
env_downsize_9_inplace
void env_downsize_9_inplace(struct env_image *src, const env_size_t depth, const struct env_math *imath)
Definition: env_image_ops.c:561
env_quad_energy
void env_quad_energy(const struct env_image *img1, const struct env_image *img2, struct env_image *result)
Definition: env_image_ops.c:320