OpenCVUtil.H

Go to the documentation of this file.
00001 /*!@file Image/OpenCVUtil.H OpenCV IPL image conversions
00002  */
00003 
00004 // //////////////////////////////////////////////////////////////////// //
00005 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the //
00006 // University of Southern California (USC) and the iLab at USC.         //
00007 // See http://iLab.usc.edu for information about this project.          //
00008 // //////////////////////////////////////////////////////////////////// //
00009 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00010 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00011 // in Visual Environments, and Applications'' by Christof Koch and      //
00012 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00013 // pending; application number 09/912,225 filed July 23, 2001; see      //
00014 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00015 // //////////////////////////////////////////////////////////////////// //
00016 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00017 //                                                                      //
00018 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00019 // redistribute it and/or modify it under the terms of the GNU General  //
00020 // Public License as published by the Free Software Foundation; either  //
00021 // version 2 of the License, or (at your option) any later version.     //
00022 //                                                                      //
00023 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00024 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00025 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00026 // PURPOSE.  See the GNU General Public License for more details.       //
00027 //                                                                      //
00028 // You should have received a copy of the GNU General Public License    //
00029 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00030 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00031 // Boston, MA 02111-1307 USA.                                           //
00032 // //////////////////////////////////////////////////////////////////// //
00033 //
00034 // Primary maintainer for this file: Lior Elazary <elazary@usc.edu>
00035 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Image/OpenCVUtil.H $
00036 // $Id: OpenCVUtil.H 14700 2011-04-08 22:38:43Z dparks $
00037 //
00038 
00039 #ifndef IMAGE_OPENCVUTIL_H_DEFINED
00040 #define IMAGE_OPENCVUTIL_H_DEFINED
00041 
00042 
00043 
00044 
00045 // opencv 2.0 (but not earlier versions) defines int64 and uint64 so
00046 // let's not redefine them in Util/Types.H:
00047 #ifdef HAVE_OPENCV2
00048 #   include <opencv2/core/version.hpp>
00049 #   include <opencv2/core/core.hpp>
00050 #   include <opencv2/core/core_c.h>
00051 #   include <opencv2/core/types_c.h>
00052 #   include <opencv2/features2d/features2d.hpp>
00053 #   include <opencv2/objdetect/objdetect.hpp>
00054 #   include <opencv2/imgproc/imgproc.hpp>
00055 #   include <opencv2/imgproc/imgproc_c.h>
00056 #   include <opencv2/video/background_segm.hpp>
00057 #   include <opencv2/highgui/highgui_c.h>
00058 #   include <opencv2/video/tracking.hpp>
00059 
00060 #else
00061 #ifdef HAVE_OPENCV1
00062 
00063 #ifdef HAVE_OPENCV_CV_H
00064 #   include <cstddef>
00065 #endif //HAVE_OPENCV_CV_H
00066 
00067 #   include <opencv/cvver.h>
00068 #   include <opencv/cv.h>
00069 #ifdef HAVE_OPENCVAUX
00070 #   include <opencv/cxtypes.h>
00071 #   include <opencv/highgui.h>
00072 #endif //HAVE_OPENCVAUX
00073 #endif //HAVE_OPENCV
00074 #endif //HAVE_OPENCV2
00075 
00076 #if CV_MAJOR_VERSION >= 2
00077 #define INVT_TYPEDEF_INT64
00078 #define INVT_TYPEDEF_UINT64
00079 #endif
00080 #include "Util/Types.H"
00081 
00082 #ifdef HAVE_OPENCV
00083 
00084 template <class T> class Image;
00085 template <class T> class PixRGB;
00086 
00087 //! Convert from Image<PixRGB<byte>> to IplImage
00088 IplImage* img2ipl(const Image< PixRGB<byte> > &img);
00089 
00090 //! Convert from Image<byte> to IplImage
00091 IplImage* img2ipl(const Image<byte> &img);
00092 
00093 //! Convert from Image<float> to IplImage
00094 IplImage* img2ipl(const Image<float> &img);
00095 
00096 //! Convert to Image<byte> from IplImage, which must have depth==8 and nChannels==1
00097 Image<byte> ipl2gray(const IplImage* img);
00098 
00099 //! Convert to Image<PixRGB<byte>> from IplImage, which must have depth==8, nChannels==3, and dataOrder==0 (interleaved)
00100 Image<PixRGB<byte> > ipl2rgb(const IplImage* img);
00101 
00102 //! Convert to Image<byte> from IplImage, which must have depth==32 and nChannels==1
00103 Image<float> ipl2float(const IplImage* img);
00104 
00105 #endif
00106 
00107 // ######################################################################
00108 // ######################################################################
00109 /* So things look consistent in everyone's emacs... */
00110 /* Local Variables: */
00111 /* indent-tabs-mode: nil */
00112 /* End: */
00113 
00114 #endif
Generated on Sun May 8 08:05:14 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3