ImageBuffer.cpp
Go to the documentation of this file.
1
#include "
ImageBuffer.h
"
2
3
#include <
ArmarXCore/core/exceptions/local/ExpressionException.h
>
4
5
#include <
VisionX/core/ImageProcessor.h
>
6
#include <
VisionX/tools/ImageUtil.h
>
7
8
9
namespace
visionx
10
{
11
12
ImageBuffer::~ImageBuffer
()
13
{
14
if
(
images
)
15
{
16
for
(
size_t
i = 0 ; i < numImages; i++)
17
{
18
delete
images
[i];
19
}
20
delete
[]
images
;
21
}
22
}
23
24
void
ImageBuffer::allocate
(
const
visionx::ImageProviderInfo
& providerInfo)
25
{
26
ARMARX_CHECK_NULL
(
images
) <<
"Images have already been allocated."
;
27
28
numImages = providerInfo.
numberImages
;
29
30
images
=
new
CByteImage*[numImages];
31
for
(
size_t
i = 0 ; i < numImages; i++)
32
{
33
images
[i] =
visionx::tools::createByteImage
(providerInfo);
34
}
35
}
36
37
void
ImageBuffer::update
(std::function<
void
(CByteImage**)> setImagesFn)
38
{
39
std::scoped_lock lock(
mutex
);
40
ARMARX_CHECK_NOT_NULL
(
images
) <<
"Images must be allocated before calling update()."
;
41
setImagesFn(
images
);
42
imagesSeq
++;
43
}
44
}
visionx::ImageBuffer::images
CByteImage ** images
Definition:
ImageBuffer.h:52
visionx::ImageProviderInfo::numberImages
int numberImages
Number of images.
Definition:
ImageProcessor.h:506
visionx::ImageBuffer::update
void update(std::function< void(CByteImage **)> setImagesFn)
Definition:
ImageBuffer.cpp:37
visionx
ArmarX headers.
Definition:
OpenPoseStressTest.h:38
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition:
ExpressionException.h:206
visionx::ImageBuffer::~ImageBuffer
~ImageBuffer()
Definition:
ImageBuffer.cpp:12
visionx::ImageBuffer::mutex
std::mutex mutex
Definition:
ImageBuffer.h:50
visionx::tools::createByteImage
CByteImage * createByteImage(const ImageFormatInfo &imageFormat, const ImageType imageType)
Creates a ByteImage for the destination type specified in the given imageProviderInfo.
visionx::ImageProviderInfo
Definition:
ImageProcessor.h:466
ImageProcessor.h
ImageBuffer.h
ExpressionException.h
visionx::ImageBuffer::imagesSeq
long imagesSeq
Update this each time you update images.
Definition:
ImageBuffer.h:54
ImageUtil.h
ARMARX_CHECK_NULL
#define ARMARX_CHECK_NULL(ptr)
Definition:
ExpressionException.h:212
visionx::ImageBuffer::allocate
void allocate(const visionx::ImageProviderInfo &providerInfo)
Definition:
ImageBuffer.cpp:24
VisionX
core
ImageBuffer.cpp
Generated on Sat Oct 12 2024 09:14:17 for armarx_documentation by
1.8.17