Fawkes API
Fawkes Development Version
image_drawer.cpp
1
2
/***************************************************************************
3
* image_drawer.cpp - Skeleton Visualization GUI: image drawer
4
*
5
* Created: Sat Mar 19 00:08:37 2011
6
* Copyright 2006-2011 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.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Library General Public License for more details.
19
*
20
* Read the full text in the LICENSE.GPL file in the doc directory.
21
*/
22
23
#include "image_drawer.h"
24
25
#include <fvcams/camera.h>
26
#include <fvutils/color/colorspaces.h>
27
#include <fvutils/color/conversions.h>
28
29
#include <cstdlib>
30
#include <cstdio>
31
#include <algorithm>
32
#include <GL/glut.h>
33
34
using namespace
fawkes
;
35
using namespace
firevision
;
36
37
/** @class SkelGuiImageDrawer "image_drawer.h"
38
* Draw images from camera in texture.
39
* Uses texture mapping to show an image acquired from a camera in the
40
* background.
41
* @author Tim Niemueller
42
*/
43
44
/** Constructor.
45
* @param cam camera to capture image with
46
*/
47
SkelGuiImageDrawer::SkelGuiImageDrawer
(
firevision::Camera
*cam)
48
:
SkelGuiTextureDrawer
(cam->pixel_width(), cam->pixel_height())
49
{
50
__cam = cam;
51
__rgb_buf = malloc_buffer(RGB,
__width
,
__height
);
52
53
}
54
55
/** Destructor. */
56
SkelGuiImageDrawer::~SkelGuiImageDrawer
()
57
{
58
free(__rgb_buf);
59
}
60
61
/** Fill texture. */
62
void
63
SkelGuiImageDrawer::fill_texture
()
64
{
65
__cam->
capture
();
66
convert(__cam->
colorspace
(), RGB, __cam->
buffer
(), __rgb_buf,
__width
,
__height
);
67
copy_rgb_to_texture
(__rgb_buf);
68
__cam->
dispose_buffer
();
69
}
70
SkelGuiImageDrawer::SkelGuiImageDrawer
SkelGuiImageDrawer(firevision::Camera *cam)
Constructor.
Definition:
image_drawer.cpp:47
firevision::Camera
Camera interface for image aquiring devices in FireVision.
Definition:
camera.h:35
fawkes
Fawkes library namespace.
SkelGuiTextureDrawer::__width
const unsigned int __width
Width of visible area from texture.
Definition:
texture_drawer.h:53
firevision
Definition:
vision_master.h:32
firevision::Camera::colorspace
virtual colorspace_t colorspace()=0
Colorspace of returned image.
firevision::Camera::capture
virtual void capture()=0
Capture an image.
SkelGuiTextureDrawer::copy_rgb_to_texture
void copy_rgb_to_texture(const unsigned char *rgb_buf)
Copy an RGB buffer to texture.
Definition:
texture_drawer.cpp:138
firevision::Camera::buffer
virtual unsigned char * buffer()=0
Get access to current image buffer.
SkelGuiTextureDrawer
Draw images from camera in texture.
Definition:
texture_drawer.h:30
SkelGuiImageDrawer::fill_texture
void fill_texture()
Fill texture.
Definition:
image_drawer.cpp:63
SkelGuiTextureDrawer::__height
const unsigned int __height
Height of visible area from texture.
Definition:
texture_drawer.h:54
SkelGuiImageDrawer::~SkelGuiImageDrawer
~SkelGuiImageDrawer()
Destructor.
Definition:
image_drawer.cpp:56
firevision::Camera::dispose_buffer
virtual void dispose_buffer()=0
Dispose current buffer.
src
plugins
openni
skelgui
image_drawer.cpp
Generated by
1.8.13