YARP  2.3.70.2
Yet Another Robot Platform
IplImage.h
Go to the documentation of this file.
1 
2 // Summary for YARP:
3 
4 
5 
6 /*
7  * Copyright: (C) 2000, Intel Corporation, all rights reserved.
8  * CopyPolicy: Intel License Agreement For Open Source Computer Vision Library
9  *
10  */
11 
12 // originates from cvtypes.h in intel OpenCV project,
13 // license below.
14 // some local modifications.
15 
16 /*M///////////////////////////////////////////////////////////////////////////////////////
17 //
18 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
19 //
20 // By downloading, copying, installing or using the software you agree to this license.
21 // If you do not agree to this license, do not download, install,
22 // copy or use the software.
23 //
24 //
25 // Intel License Agreement
26 // For Open Source Computer Vision Library
27 //
28 // Copyright (C) 2000, Intel Corporation, all rights reserved.
29 // Third party copyrights are property of their respective owners.
30 //
31 // Redistribution and use in source and binary forms, with or without modification,
32 // are permitted provided that the following conditions are met:
33 //
34 // * Redistribution's of source code must retain the above copyright notice,
35 // this list of conditions and the following disclaimer.
36 //
37 // * Redistribution's in binary form must reproduce the above copyright notice,
38 // this list of conditions and the following disclaimer in the documentation
39 // and/or other materials provided with the distribution.
40 //
41 // * The name of Intel Corporation may not be used to endorse or promote products
42 // derived from this software without specific prior written permission.
43 //
44 // This software is provided by the copyright holders and contributors "as is" and
45 // any express or implied warranties, including, but not limited to, the implied
46 // warranties of merchantability and fitness for a particular purpose are disclaimed.
47 // In no event shall the Intel Corporation or contributors be liable for any direct,
48 // indirect, incidental, special, exemplary, or consequential damages
49 // (including, but not limited to, procurement of substitute goods or services;
50 // loss of use, data, or profits; or business interruption) however caused
51 // and on any theory of liability, whether in contract, strict liability,
52 // or tort (including negligence or otherwise) arising in any way out of
53 // the use of this software, even if advised of the possibility of such damage.
54 //
55 //M*/
56 
57 // check if CV is present
58 #ifndef _CV_H_
59 // check if IPL is present
60 #ifndef HAVE_IPL
61 // or asserted to be present
62 #ifndef HAVE_OPENCV
63 
64 #ifndef YARP_CVTYPES_H_
65 #define YARP_CVTYPES_H_
66 
67 // To simplify interaction with opencv header files, say that we
68 // have ipl headers
69 // We may fail anyway, but we will certainly fail otherwise.
70 #ifndef HAVE_IPL
71 #define HAVE_IPL
72 #endif
73 
74 //#include <yarp/YARPConfig.h>
75 
76 #include <cassert>
77 #include <cstdlib>
78 
79 #if defined _MSC_VER || defined __BORLANDC__
80 typedef __int64 int64;
81 typedef unsigned __int64 uint64;
82 #else
83 typedef long long int64;
84 typedef unsigned long long uint64;
85 #endif
86 
87 #ifndef __IPL_H__
88 typedef unsigned char uchar;
89 #endif
90 
91 
92 
93 
94 /****************************************************************************************\
95  * Image type (IplImage) *
96 \****************************************************************************************/
97 
98 /*
99  * The following definitions (until #endif)
100  * is an extract from IPL headers.
101  * Copyright (c) 1995 Intel Corporation.
102  */
103 
104 #define IPL_DEPTH_SIGN 0x80000000
105 
106 #define IPL_DEPTH_1U 1
107 #define IPL_DEPTH_8U 8
108 #define IPL_DEPTH_16U 16
109 #define IPL_DEPTH_32F 32
110 
111 #define IPL_DEPTH_8S (int)(IPL_DEPTH_SIGN| 8)
112 #define IPL_DEPTH_16S (int)(IPL_DEPTH_SIGN|16)
113 #define IPL_DEPTH_32S (int)(IPL_DEPTH_SIGN|32)
114 
115 #define IPL_DATA_ORDER_PIXEL 0
116 #define IPL_DATA_ORDER_PLANE 1
117 
118 #define IPL_ORIGIN_TL 0
119 #define IPL_ORIGIN_BL 1
120 
121 #define IPL_ALIGN_4BYTES 4
122 #define IPL_ALIGN_8BYTES 8
123 #define IPL_ALIGN_16BYTES 16
124 #define IPL_ALIGN_32BYTES 32
125 
126 #define IPL_ALIGN_DWORD IPL_ALIGN_4BYTES
127 #define IPL_ALIGN_QWORD IPL_ALIGN_8BYTES
128 
129 typedef struct _IplImage {
130  int nSize;
131  int ID;
132  int nChannels;
134  int depth;
136  char colorModel[4];
137  char channelSeq[4];
138  int dataOrder;
140  int origin;
142  int align;
144  int width;
145  int height;
146  struct _IplROI *roi;
147  struct _IplImage *maskROI;
148  void *imageId;
149  struct _IplTileInfo *tileInfo;
150  int imageSize;
153  char *imageData;
154  int widthStep;
155  int BorderMode[4];
156  int BorderConst[4];
160 }
161 IplImage;
162 
163 typedef struct _IplTileInfo IplTileInfo;
164 
165 typedef struct _IplROI {
166  int coi;
167  int xOffset;
168  int yOffset;
169  int width;
170  int height;
171 }
172 IplROI;
173 
174 typedef struct _IplConvKernel
175 {
176  int nCols;
177  int nRows;
178  int anchorX;
179  int anchorY;
180  int *values;
181  int nShiftR;
182 }
184 
185 typedef struct _IplConvKernelFP
186 {
187  int nCols;
188  int nRows;
189  int anchorX;
190  int anchorY;
191  float *values;
192 }
194 
195 #define IPL_IMAGE_HEADER 1
196 #define IPL_IMAGE_DATA 2
197 #define IPL_IMAGE_ROI 4
198 
199 #ifndef IPL_IMAGE_MAGIC_VAL
200 #define IPL_IMAGE_MAGIC_VAL ((int)sizeof(IplImage))
201 #endif
202 
203 /* for file storages make the value independent from arch */
204 #ifndef IPL_IMAGE_FILE_MAGIC_VAL
205 #define IPL_IMAGE_FILE_MAGIC_VAL 112
206 #endif
207 
208 #ifndef IPL_DEPTH_64F
209 #define IPL_DEPTH_64F 64 /* for storing double-precision
210  floating point data in IplImage's */
211 #endif
212 
213 
214 // to fool a few Windows declarations.
215 //typedef int HDC;
216 //typedef char _TCHAR;
217 
224 int _iplCalcPadding (int lineSize, int align);
225 
229 #define IPLAPIIMPL(type,name,arg) extern type name arg
230 
231 
233  iplCreateConvKernel,(int nCols, int nRows,
234  int anchorX, int anchorY,
235  int* values, int nShiftR));
236 
238  iplCreateConvKernelFP,(int nCols, int nRows,
239  int anchorX, int anchorY, float* values));
240 
241 IPLAPIIMPL(void,iplGetConvKernel,
242  (IplConvKernel* kernel, int* nCols, int* nRows,
243  int* anchorX, int* anchorY, int** values, int *nShiftR));
244 
245 
246 IPLAPIIMPL(void,iplGetConvKernelFP,
247  (IplConvKernelFP* kernel,int* nCols, int* nRows,
248  int* anchorX, int* anchorY, float** values));
249 
250 IPLAPIIMPL(void, iplDeleteConvKernel,(IplConvKernel* kernel));
251 
252 IPLAPIIMPL(void, iplDeleteConvKernelFP,(IplConvKernelFP* kernel));
253 
254 IPLAPIIMPL(void, iplConvolve2D,
255  (IplImage* srcImage, IplImage* dstImage,
256  IplConvKernel** kernel, int nKernels, int combineMethod));
257 
258 IPLAPIIMPL(void, iplConvolve2DFP,
259  (IplImage* srcImage, IplImage* dstImage,
260  IplConvKernelFP** kernel, int nKernels, int combineMethod));
261 
262 IPLAPIIMPL(void, iplConvolveSep2DFP,(IplImage* srcImage,
263  IplImage* dstImage,
264  IplConvKernelFP* xKernel,
265  IplConvKernelFP* yKernel));
266 
267 //IPLAPIIMPL(IPLStatus, iplFixedFilter,(IplImage* srcImage, IplImage* dstImage,
268 // IplFilter filter));
269 
270 IPLAPIIMPL(void, iplConvolveSep2D,(IplImage* srcImage, IplImage* dstImage,
271  IplConvKernel* xKernel, IplConvKernel* yKernel));
272 
273 IPLAPIIMPL(void, iplAllocateImage,(IplImage* image, int doFill, int fillValue));
274 
275 IPLAPIIMPL(void, iplAllocateImageFP,(IplImage* image, int doFill, float fillValue));
276 
277 
278 IPLAPIIMPL(void, iplDeallocateImage,(IplImage* image));
279 
280 IPLAPIIMPL(IplImage*, iplCreateImageHeader,
281  (int nChannels, int alphaChannel, int depth,
282  char* colorModel, char* channelSeq, int dataOrder,
283  int origin, int align,
284  int width, int height, IplROI* roi, IplImage* maskROI,
285  void* imageId, IplTileInfo* tileInfo));
286 
287 IPLAPIIMPL(IplImage*, iplCloneImage, ( const IplImage* img ) );
288 
289 IPLAPIIMPL(void, iplCopy, (IplImage* srcImage, IplImage* dstImage));
290 
291 IPLAPIIMPL(void, iplDeallocateHeader,(IplImage* image));
292 
293 IPLAPIIMPL(void, iplDeallocate,(IplImage* image, int flag));
294 
295 IPLAPIIMPL(void,iplSetBorderMode,(IplImage *src,int mode,int border,int constVal));
296 
297 IPLAPIIMPL(void, iplSet, (IplImage* image, int fillValue));
298 
299 IPLAPIIMPL(void, iplSetFP, (IplImage* image, float fillValue));
300 
301 IPLAPIIMPL(void, iplAddS,(IplImage* srcImage, IplImage* dstImage, int value));
302 
303 IPLAPIIMPL(void, iplAdd,(IplImage* srcImageA, IplImage* srcImageB,
304  IplImage* dstImage));
305 
306 IPLAPIIMPL(void, iplSubtract,(IplImage* srcImageA, IplImage* srcImageB,
307  IplImage* dstImage));
308 
309 IPLAPIIMPL(void, iplSubtractS,(IplImage* srcImage, IplImage* dstImage, int value,
310  bool flip));
311 
312 IPLAPIIMPL(void, iplMultiplySFP,(IplImage* srcImage, IplImage* dstImage,
313  float value));
314 
315 IPLAPIIMPL(void, iplAbs,(IplImage* srcImage, IplImage* dstImage));
316 
317 IPLAPIIMPL(void, iplThreshold, (IplImage* srcImage, IplImage* dstImage, int threshold));
318 
319 IPLAPIIMPL(void, iplColorToGray,(IplImage* srcImage, IplImage* dstImage));
320 
321 IPLAPIIMPL(IplROI *,iplCreateROI,(int coi, int xOffset, int yOffset,
322  int width, int height ));
323 
324 
325 IPLAPIIMPL(void, iplRGB2HSV,(IplImage* rgbImage, IplImage* hsvImage));
326 
327 IPLAPIIMPL(void, iplHSV2RGB,(IplImage* hsvImage, IplImage* rgbImage));
328 
329 
330 IPLAPIIMPL(void, iplXorS,(IplImage* srcImage, IplImage* dstImage, unsigned int value));
331 
332 #define IPL_BORDER_CONSTANT 0
333 
334 #define IPL_SIDE_TOP_INDEX 0
335 #define IPL_SIDE_BOTTOM_INDEX 1
336 #define IPL_SIDE_LEFT_INDEX 2
337 #define IPL_SIDE_RIGHT_INDEX 3
338 #define IPL_SIDE_TOP (1<<IPL_SIDE_TOP_INDEX)
339 #define IPL_SIDE_BOTTOM (1<<IPL_SIDE_BOTTOM_INDEX)
340 #define IPL_SIDE_LEFT (1<<IPL_SIDE_LEFT_INDEX)
341 #define IPL_SIDE_RIGHT (1<<IPL_SIDE_RIGHT_INDEX)
342 #define IPL_SIDE_ALL (IPL_SIDE_RIGHT|IPL_SIDE_TOP|IPL_SIDE_LEFT|IPL_SIDE_BOTTOM)
343 
344 #define IPL_DEPTH_MASK 0x7FFFFFFF
345 
346 #define IPL_IMAGE_HEADER 1
347 #define IPL_IMAGE_DATA 2
348 #define IPL_IMAGE_ROI 4
349 #define IPL_IMAGE_TILE 8
350 #define IPL_IMAGE_MASK 16
351 #define IPL_IMAGE_ALL (IPL_IMAGE_HEADER|IPL_IMAGE_DATA|\
352  IPL_IMAGE_TILE|IPL_IMAGE_ROI|IPL_IMAGE_MASK)
353 #define IPL_IMAGE_ALL_WITHOUT_MASK (IPL_IMAGE_HEADER|IPL_IMAGE_DATA|\
354  IPL_IMAGE_TILE|IPL_IMAGE_ROI)
355 
356 #define IPL_INTER_NN 0
357 #define IPL_INTER_LINEAR 1
358 #define IPL_INTER_CUBIC 2
359 #define IPL_INTER_SUPER 3
360 #define IPL_SMOOTH_EDGE 16
361 
362 #define YARP_IMAGE_ALIGN 8
363 
364 #endif /*YARP_CVTYPES_H_*/
365 #endif /*HAVE_OPENCV*/
366 #endif /*HAVE_IPL*/
367 #endif /*_CV_H_*/
368 
369 /* End of file. */
struct _IplConvKernel IplConvKernel
struct _IplTileInfo * tileInfo
must be null
Definition: IplImage.h:149
int ID
version (=0)
Definition: IplImage.h:131
int height
image height in pixels
Definition: IplImage.h:145
char channelSeq[4]
ignored by OpenCV
Definition: IplImage.h:137
#define IPLAPIIMPL(type, name, arg)
Definition for functions implemented within YARP_sig.
Definition: IplImage.h:229
int _iplCalcPadding(int lineSize, int align)
Computes the ipl image padding.
struct _IplImage IplImage
int alphaChannel
ignored by OpenCV
Definition: IplImage.h:133
void * imageId
must be NULL
Definition: IplImage.h:148
unsigned char uchar
Definition: IplImage.h:88
int origin
0 - top-left origin, 1 - bottom-left origin (Windows bitmaps style)
Definition: IplImage.h:140
int align
Alignment of image rows (4 or 8).
Definition: IplImage.h:142
delete image
Definition: IplImage.cpp:897
struct _IplImage * maskROI
must be NULL
Definition: IplImage.h:147
struct _IplTileInfo IplTileInfo
Definition: IplImage.h:163
int BorderConst[4]
ignored by OpenCV
Definition: IplImage.h:156
char * imageDataOrigin
pointer to very origin of image data (not necessarily aligned) - needed for correct deallocation ...
Definition: IplImage.h:157
int height
Definition: IplImage.h:170
char * imageData
pointer to aligned image data
Definition: IplImage.h:153
int * values
Definition: IplImage.h:180
struct _IplROI * roi
image ROI.
Definition: IplImage.h:146
int width
Definition: IplImage.h:169
int xOffset
Definition: IplImage.h:167
delete kernel
Definition: IplImage.cpp:157
struct _IplConvKernelFP IplConvKernelFP
int nChannels
Most of OpenCV functions support 1,2,3 or 4 channels.
Definition: IplImage.h:132
int BorderMode[4]
ignored by OpenCV
Definition: IplImage.h:155
int yOffset
Definition: IplImage.h:168
delete [] kernel values
Definition: IplImage.cpp:152
unsigned long long uint64
Definition: IplImage.h:84
int dataOrder
0 - interleaved color channels, 1 - separate color channels.
Definition: IplImage.h:138
int nSize
sizeof(IplImage)
Definition: IplImage.h:130
int width
image width in pixels
Definition: IplImage.h:144
int coi
0 - no COI (all channels are selected), 1 - 0th channel is selected ...
Definition: IplImage.h:166
struct _IplROI IplROI
int depth
pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S, IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_...
Definition: IplImage.h:134
char colorModel[4]
ignored by OpenCV
Definition: IplImage.h:136
int imageSize
image data size in bytes (==image->height*image->widthStep in case of interleaved data) ...
Definition: IplImage.h:150
int widthStep
size of aligned image row in bytes
Definition: IplImage.h:154
long long int64
Definition: IplImage.h:83
float * values
Definition: IplImage.h:191