/*Copyright (C) 2007 Matteo Lucarelli - matteolucarelli@altervista.org * *This program is free software; you can redistribute it and/or *modify it under the terms of the GNU General Public License *as published by the Free Software Foundation; either version 2 *of the License, or (at your option) any later version. * *This program is distributed in the hope that it will be useful, *but WITHOUT ANY WARRANTY; without even the implied warranty of *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *GNU General Public License for more details. * *You should have received a copy of the GNU General Public License *along with this program; if not, write to the Free Software *Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA ******************************************************************************/ // macros to access pixel value on IplImage (openCV format) // Author: M.Lucarelli - last version on matteolucarelli.altervista.org #if !defined(CV_PIXEL_MACRO_INCLUDED) #define CV_PIXEL_MACRO_INCLUDED // for 8bit 1ch image (grayscale) #define CVPIXEL(img,x,y) ((unsigned char*)(img->imageData + img->widthStep*(y)))[x] // for 8bit 3ch image (BGR) #define CVPIXELB(img,x,y) ((unsigned char*)(img->imageData + img->widthStep*(y)))[(x)*3] #define CVPIXELG(img,x,y) ((unsigned char*)(img->imageData + img->widthStep*(y)))[(x)*3+1] #define CVPIXELR(img,x,y) ((unsigned char*)(img->imageData + img->widthStep*(y)))[(x)*3+2] #endif // CV_PIXEL_MACRO_INCLUDED