env_image.h

Go to the documentation of this file.
00001 /*!@file Envision/env_image.h A basic image class */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00005 // 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.h $
00035 // $Id: env_image.h 7645 2007-01-04 21:07:32Z rjpeters $
00036 //
00037 
00038 #ifndef ENVISION_ENV_IMAGE_H_DEFINED
00039 #define ENVISION_ENV_IMAGE_H_DEFINED
00040 
00041 #include "Envision/env_alloc.h"
00042 #include "Envision/env_types.h"
00043 
00044 //! Basic image class
00045 struct env_image
00046 {
00047         struct env_dims dims;   // width+height of data array
00048         intg32* pixels;         // data array
00049 };
00050 
00051 #define env_img_initializer { {0,0}, 0 }
00052 
00053 #ifdef __cplusplus
00054 extern "C"
00055 {
00056 #endif
00057 
00058         void env_img_init(struct env_image* img,
00059                           const struct env_dims d);
00060 
00061         static inline void env_img_init_empty(struct env_image* img);
00062 
00063         //! Get image size (width * height)
00064         static inline env_size_t env_img_size(const struct env_image* img);
00065 
00066         //! Check whether image is non-empty (i.e., non-zero height and width).
00067         static inline int env_img_initialized(const struct env_image* img);
00068 
00069         void env_img_swap(struct env_image* img1,
00070                           struct env_image* img2);
00071 
00072         void env_img_make_empty(struct env_image* img);
00073 
00074         void env_img_resize_dims(struct env_image* img,
00075                                  const struct env_dims d);
00076 
00077         static inline const intg32* env_img_pixels(const struct env_image* img);
00078 
00079         static inline intg32* env_img_pixelsw(struct env_image* img);
00080 
00081         void env_img_copy_src_dst(const struct env_image* src,
00082                                   struct env_image* dst);
00083 
00084         static inline int env_dims_equal(const struct env_dims d1,
00085                                          const struct env_dims d2);
00086 
00087 #ifdef __cplusplus
00088 }
00089 #endif
00090 
00091 // ######################################################################
00092 static inline void env_img_init_empty(struct env_image* img)
00093 {
00094         img->pixels = 0;
00095         img->dims.w = img->dims.h = 0;
00096 }
00097 
00098 // ######################################################################
00099 static inline env_size_t env_img_size(const struct env_image* img)
00100 {
00101         return img->dims.w * img->dims.h;
00102 }
00103 
00104 // ######################################################################
00105 static inline int env_img_initialized(const struct env_image* img)
00106 {
00107         return (img->dims.w * img->dims.h) > 0;
00108 }
00109 
00110 // ######################################################################
00111 static inline const intg32* env_img_pixels(const struct env_image* img)
00112 {
00113         return img->pixels;
00114 }
00115 
00116 // ######################################################################
00117 static inline intg32* env_img_pixelsw(struct env_image* img)
00118 {
00119         return img->pixels;
00120 }
00121 
00122 // ######################################################################
00123 static inline int env_dims_equal(const struct env_dims d1,
00124                                  const struct env_dims d2)
00125 {
00126         return d1.w == d2.w && d1.h == d2.h;
00127 }
00128 
00129 // ######################################################################
00130 /* So things look consistent in everyone's emacs... */
00131 /* Local Variables: */
00132 /* indent-tabs-mode: nil */
00133 /* c-file-style: "linux" */
00134 /* End: */
00135 
00136 #endif
Generated on Sun May 8 08:40:38 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3