00001 /*!@file Envision/env_image_ops.h Fixed-point integer math versions of some of our floating-point image functions */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005 // 00005 // by the University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: Rob Peters <rjpeters at usc dot edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Envision/env_image_ops.h $ 00035 // $Id: env_image_ops.h 11338 2009-06-24 06:58:51Z itti $ 00036 // 00037 00038 #ifndef ENVISION_ENV_IMAGE_OPS_H_DEFINED 00039 #define ENVISION_ENV_IMAGE_OPS_H_DEFINED 00040 00041 #include "Envision/env_config.h" 00042 #include "Envision/env_image.h" 00043 #include "Envision/env_math.h" 00044 #include "Envision/env_pyr.h" 00045 00046 struct env_rgb_pixel; 00047 00048 #define INTMAXNORMMIN ((intg32) 0) 00049 #define INTMAXNORMMAX ((intg32) 32768) 00050 00051 #ifdef __cplusplus 00052 extern "C" 00053 { 00054 #endif 00055 00056 //! Decimate in X and Y (take one every 'factor' pixels). 00057 void env_dec_xy(const struct env_image* src, struct env_image* result); 00058 00059 //! Decimate in X (take one every 'factor' pixels). 00060 void env_dec_x(const struct env_image* src, struct env_image* result); 00061 00062 //! Decimate in Y (take one every 'factor' pixels). 00063 void env_dec_y(const struct env_image* src, struct env_image* result); 00064 00065 void env_lowpass_5_x_dec_x(const struct env_image* src, 00066 const struct env_math* imath, 00067 struct env_image* result); 00068 00069 void env_lowpass_5_y_dec_y(const struct env_image* src, 00070 const struct env_math* imath, 00071 struct env_image* result); 00072 00073 void env_lowpass_9_x(const struct env_image* src, 00074 const struct env_math* imath, 00075 struct env_image* result); 00076 void env_lowpass_9_y(const struct env_image* src, 00077 const struct env_math* imath, 00078 struct env_image* result); 00079 void env_lowpass_9(const struct env_image* src, 00080 const struct env_math* imath, 00081 struct env_image* result); 00082 void env_quad_energy(const struct env_image* img1, 00083 const struct env_image* img2, 00084 struct env_image* result); 00085 void env_steerable_filter(const struct env_image* src, 00086 const intg32 kxnumer, const intg32 kynumer, 00087 const env_size_t kdenombits, 00088 const struct env_math* imath, 00089 struct env_image* result); 00090 void env_attenuate_borders_inplace(struct env_image* a, env_size_t size); 00091 00092 void env_pyr_build_hipass_9(const struct env_image* image, 00093 env_size_t firstlevel, 00094 const struct env_math* imath, 00095 struct env_pyr* result); 00096 00097 void env_pyr_build_steerable_from_hipass_9(const struct env_pyr* hipass, 00098 const intg32 kxnumer, 00099 const intg32 kynumer, 00100 const env_size_t kdenombits, 00101 const struct env_math* imath, 00102 struct env_pyr* result); 00103 //! Wrapper for _cpu or _cuda version 00104 void env_pyr_build_lowpass_5(const struct env_image* image, 00105 env_size_t firstlevel, 00106 const struct env_math* imath, 00107 struct env_pyr* result); 00108 00109 //! _cpu version implemented here, see CUDA/env_cuda.h for GPU version 00110 void env_pyr_build_lowpass_5_cpu(const struct env_image* image, 00111 env_size_t firstlevel, 00112 const struct env_math* imath, 00113 struct env_pyr* result); 00114 00115 void env_downsize_9_inplace(struct env_image* src, const env_size_t depth, 00116 const struct env_math* imath); 00117 void env_rescale(const struct env_image* src, struct env_image* result); 00118 void env_max_normalize_inplace(struct env_image* src, 00119 intg32 min, intg32 max, 00120 enum env_maxnorm_type typ, 00121 const intg32 rangeThresh); 00122 void env_max_normalize_none_inplace(struct env_image* src, 00123 intg32 min, intg32 max, 00124 const intg32 rangeThresh); 00125 void env_max_normalize_std_inplace(struct env_image* src, 00126 intg32 min, intg32 max, 00127 const intg32 rangeThresh); 00128 00129 void env_center_surround(const struct env_image* center, 00130 const struct env_image* surround, 00131 const int absol, 00132 struct env_image* result); 00133 00134 /// Compute R-G and B-Y opponent color maps 00135 /** If src2 is non-null, then average values from src and src2 00136 together before any further processing (this may be useful 00137 in averaging noise out of noisy color input sources). */ 00138 void env_get_rgby(const struct env_rgb_pixel* const src, 00139 const struct env_rgb_pixel* const src2 /* or null is fine here */, 00140 const env_size_t sz, 00141 struct env_image* rg, 00142 struct env_image* by, const intg32 thresh, 00143 const env_size_t inputbits); 00144 00145 /// Update the range [mi,ma] to include the range of values in src 00146 void env_merge_range(const struct env_image* src, 00147 intg32* mi, intg32* ma); 00148 00149 /// rescale the src image to a [0..255] result 00150 void env_rescale_range_inplace(struct env_image* src, 00151 const intg32 mi, const intg32 ma); 00152 00153 #ifdef ENV_WITH_DYNAMIC_CHANNELS 00154 00155 //! Shift an image by (dx, dy), without wraparound 00156 void env_shift_clean(const struct env_image* srcImg, 00157 const env_ssize_t dx, const env_ssize_t dy, 00158 struct env_image* result); 00159 00160 void env_shift_image(const struct env_image* srcImg, 00161 const env_ssize_t dxnumer, const env_ssize_t dynumer, 00162 const env_size_t denombits, 00163 struct env_image* result); 00164 00165 #endif // ENV_WITH_DYNAMIC_CHANNELS 00166 00167 #ifdef __cplusplus 00168 } 00169 #endif 00170 00171 // ###################################################################### 00172 /* So things look consistent in everyone's emacs... */ 00173 /* Local Variables: */ 00174 /* indent-tabs-mode: nil */ 00175 /* c-file-style: "linux" */ 00176 /* End: */ 00177 00178 #endif // ENVISION_ENV_IMAGE_OPS_H_DEFINED