IDS peak ICV v1.2.0
Loading...
Searching...
No Matches
peak_icv_metadata_conversion.hpp
Go to the documentation of this file.
1
11#pragma once
12
14#include <peak_icv_c/types/peak_icv_image.h>
15
16namespace peak
17{
18namespace icv
19{
20namespace detail
21{
22inline peak_icv_capture_information CreateCCaptureInformationFromMetadata(const peak::common::Metadata& metadata)
23{
24 peak_icv_capture_information captureInformationC{};
25
27 {
28 captureInformationC.relative_timestamp = metadata.GetValueByKey<peak::common::MetadataKey::DeviceTimestamp>();
29 }
30 else
31 {
32 captureInformationC.relative_timestamp = 0;
33 }
35 {
36 captureInformationC.binning_factor.x = metadata.GetValueByKey<peak::common::MetadataKey::BinningHorizontal>();
37 }
38 else
39 {
40 captureInformationC.binning_factor.x = 1;
41 }
43 {
44 captureInformationC.binning_factor.y = metadata.GetValueByKey<peak::common::MetadataKey::BinningVertical>();
45 }
46 else
47 {
48 captureInformationC.binning_factor.y = 1;
49 }
51 {
52 auto roi = metadata.GetValueByKey<peak::common::MetadataKey::Roi>();
53 captureInformationC.region_of_interest.x = roi.GetX();
54 captureInformationC.region_of_interest.y = roi.GetY();
55 captureInformationC.region_of_interest.width = roi.GetWidth();
56 captureInformationC.region_of_interest.height = roi.GetHeight();
57 }
58 else
59 {
60 captureInformationC.region_of_interest.x = 0;
61 captureInformationC.region_of_interest.y = 0;
62 captureInformationC.region_of_interest.width = 0;
63 captureInformationC.region_of_interest.height = 0;
64 }
66 {
67 captureInformationC.exposure_time = metadata.GetValueByKey<peak::common::MetadataKey::DeviceExposureTime>();
68 }
69 else
70 {
71 captureInformationC.exposure_time = 0;
72 }
73
74 return captureInformationC;
75}
76
77inline peak_icv_capture_information CreateCCaptureInformationFromMetadata(
78 peak::common::Metadata metadata, const peak::common::Size& imageSize)
79{
81 {
83 peak::common::RectangleU{ 0, 0, imageSize.GetWidth(), imageSize.GetHeight() });
84 }
86}
87} // namespace detail
88} // namespace icv
89} // namespace peak
Type-safe container for image acquisition metadata.
void SetValueByKey(T &&value)
Stores a value using a strongly typed metadata key.
bool HasEntryByKey() const
Checks if a known key is stored in the metadata.
detail::MetadataKeyTraits< metadataKey >::type GetValueByKey() const
Retrieves the value of a strongly typed metadata key.
A generic rectangle defined by a point and a size.
Represents a two-dimensional size with non-negative width and height.
constexpr T GetWidth() const
Returns the width.
constexpr T GetHeight() const
Returns the height.
@ Roi
Region of interest applied to the image.
@ DeviceExposureTime
Device exposure time the image was captured with.
@ BinningHorizontal
Horizontal pixel binning factor.
@ DeviceTimestamp
Device-provided image acquisition timestamp in nanoseconds.
@ BinningVertical
Vertical pixel binning factor.
peak_icv_capture_information CreateCCaptureInformationFromMetadata(const peak::common::Metadata &metadata)