env_params.c

Go to the documentation of this file.
00001 /*!@file Envision/env_params.c */
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_params.c $
00035 // $Id: env_params.c 9830 2008-06-18 18:50:22Z lior $
00036 //
00037 
00038 #ifndef ENVISION_ENV_PARAMS_C_DEFINED
00039 #define ENVISION_ENV_PARAMS_C_DEFINED
00040 
00041 #include "Envision/env_params.h"
00042 
00043 #include "Envision/env_log.h"
00044 
00045 // ######################################################################
00046 void env_params_set_defaults(struct env_params* envp)
00047 {
00048         envp->maxnorm_type = ENV_VCXNORM_MAXNORM;
00049         envp->range_thresh = 0;
00050         envp->scale_bits = 30;
00051 #ifdef ENV_WITH_DYNAMIC_CHANNELS
00052         envp->num_motion_directions = 4;
00053         envp->motion_thresh = 0;
00054         envp->flicker_thresh = 0;
00055         envp->multiscale_flicker = 0;
00056 #endif
00057         envp->num_orientations = 4;
00058         envp->cs_lev_min = 2;
00059         envp->cs_lev_max = 4;
00060         envp->cs_del_min = 3;
00061         envp->cs_del_max = 4;
00062         envp->output_map_level = 4;
00063         envp->chan_i_weight = 255;
00064         envp->chan_c_weight = 255;
00065         envp->chan_o_weight = 255;
00066 #ifdef ENV_WITH_DYNAMIC_CHANNELS
00067         envp->chan_f_weight = 255;
00068         envp->chan_m_weight = 255;
00069 #endif
00070 
00071 #ifdef ENV_WITH_VISIT_CHANNEL
00072         envp->submapPreProc = 0;
00073         envp->submapPostNormProc = 0;
00074         envp->submapPostProc = 0;
00075 #endif
00076 }
00077 
00078 // ######################################################################
00079 env_size_t env_max_cs_index(const struct env_params* envp)
00080 {
00081         return (envp->cs_del_max - envp->cs_del_min + 1)
00082                 * (envp->cs_lev_max - envp->cs_lev_min + 1);
00083 }
00084 
00085 // ######################################################################
00086 env_size_t env_max_pyr_depth(const struct env_params* envp)
00087 {
00088         return (envp->cs_lev_max + envp->cs_del_max + 1);
00089 }
00090 
00091 // ######################################################################
00092 intg32 env_total_weight(const struct env_params* envp)
00093 {
00094         return
00095                 ((intg32) envp->chan_c_weight)
00096                 + ((intg32) envp->chan_i_weight)
00097                 + ((intg32) envp->chan_o_weight)
00098 #ifdef ENV_WITH_DYNAMIC_CHANNELS
00099                 + ((intg32) envp->chan_f_weight)
00100                 + ((intg32) envp->chan_m_weight)
00101 #endif
00102                 ;
00103 }
00104 
00105 // ######################################################################
00106 void env_params_validate(const struct env_params* envp)
00107 {
00108         ENV_ASSERT(envp->maxnorm_type == ENV_VCXNORM_NONE ||
00109                    envp->maxnorm_type == ENV_VCXNORM_MAXNORM);
00110         ENV_ASSERT((envp->scale_bits+1) < (8*sizeof(intg32)));
00111 #ifdef ENV_WITH_DYNAMIC_CHANNELS
00112         ENV_ASSERT(envp->num_motion_directions <= 99);
00113 #endif
00114         ENV_ASSERT(envp->num_orientations <= 99);
00115 
00116         ENV_ASSERT(envp->cs_lev_max >= envp->cs_lev_min);
00117         ENV_ASSERT(envp->cs_del_max >= envp->cs_del_min);
00118 
00119         ENV_ASSERT(env_total_weight(envp) > 0);
00120 }
00121 
00122 // ######################################################################
00123 /* So things look consistent in everyone's emacs... */
00124 /* Local Variables: */
00125 /* indent-tabs-mode: nil */
00126 /* c-file-style: "linux" */
00127 /* End: */
00128 
00129 #endif // ENVISION_ENV_PARAMS_C_DEFINED
Generated on Sun May 8 08:04:45 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3