Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
iplimage.cpp
1
2
/***************************************************************************
3
* iplimage.cpp - Helper to convert FireVision buffers to IplImages for OpenCV
4
*
5
* Created: Sat Apr 19 17:33:00 2008 (GO2008, day 1)
6
* Copyright 2008 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#include <fvutils/adapters/iplimage.h>
25
26
#include <fvutils/color/conversions.h>
27
#include <cstddef>
28
#include <opencv/cv.h>
29
30
namespace
firevision
{
31
#if 0
/* just to make Emacs auto-indent happy */
32
}
33
#endif
34
35
/** @class IplImageAdapter <fvutils/adapters/iplimage.h>
36
* Adapter for OpenCV IplImages.
37
* Conversion routines from FireVision buffers to OpenCV IplImages.
38
* @author Tim Niemueller
39
*/
40
41
/** Convert image from buffer into IplImage.
42
* @param buffer YUV422_PLANAR buffer of the same size as image
43
* @param image IplImage the result will be written to in BGR notation
44
*/
45
void
46
IplImageAdapter::convert_image_bgr(
unsigned
char
*buffer,
47
IplImage *image)
48
{
49
convert(YUV422_PLANAR, BGR, buffer, (
unsigned
char
*)image->imageData,
50
image->width, image->height);
51
}
52
53
54
/* Creates a new IplImage for a ROI.
55
* This will create a new IplImage with the size of the ROI and convert the data of the
56
* passed YUV422_PLANAR buffer to the IplImage.
57
* @param buffer YUV422_PLANAR buffer
58
* @param roi ROI to take the image from
59
* @return new IplImage instance with the image from the ROI. Use cvReleaseImage after you
60
* are done with it.
61
IplImage *
62
IplImageAdapter::create_image_from_roi(unsigned char *buffer, ROI *roi)
63
{
64
IplImage *image = cvCreateImage(cvSize(roi->extent.width, roi->extent.height), IPL_DEPTH_8U, 3);
65
66
unsigned int to_line = roi->start.y + roi->extend.height;
67
unsigned char *
68
for ( unsigned int h = roi->start.y; h < to_line; ++h) {
69
70
}
71
convert(YUV422_PLANAR, BGR, _src, (unsigned char *)__image->imageData, _width, _height);
72
73
}
74
*/
75
76
}
// end namespace firevision
firevision
Definition:
vision_master.h:32
src
libs
fvutils
adapters
iplimage.cpp
Generated by
1.8.9.1