Ocean
CV.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_CV_CV_H
9 #define META_OCEAN_CV_CV_H
10 
11 #include "ocean/base/Base.h"
12 
13 namespace Ocean
14 {
15 
16 namespace CV
17 {
18 
19 /**
20  * @defgroup cv Ocean Computer Vision (CV) Library
21  * @{
22  * The Ocean CV Library provides basic Computer Vision functionalities.
23  * There exist several further specialized Computer Vision libraries, like e.g,. the Advanced Computer Vision library or the Computer Vision libraries addressing feature detection tasks.<br>
24  * The library is platform independent.
25  *
26  * The FrameConverterABGR32, FrameConverterARGB32, ... classes implement functions to convert frame data with specific pixel format to different pixel formats (and e.g., different pixel origins).
27  * The FrameConverter::Comfort::change() and FrameConverter::Comfort::convert() functions provide a simple interface for frame conversion task.
28  *
29  * The Bresenham and Canvas class provide drawing and painting functionalities (also with sub-pixel accuracies).
30  *
31  * Several individual common frame filter are implemented in e.g., FrameFilterGaussian, FrameFilterSeparable, FrameFilterDilation, ..., FrameFilterScharr, ...
32  *
33  * The FrameShrinker allows to reduce the size of a frame while the FrameEnlarger allows to increase the size of a frame.
34  * The FrameShrinkerAlpha additionally provides specific support for frames with alpha channel.
35  *
36  * The SSE class provides SIMD functions for x86, x64 platforms while the NEON class provides SIMD functions for Android ARM platforms.
37  *
38  * The PixelPosition class stores a 2D pixel-accurate position, the PixelBoundingBox class implements a bounding box with pixel-accuracy.
39  *
40  * The NonMaximumSuppression class provides a multi-core-capable solution to determine peaks in filter responses e.g., for feature point detection.
41  *
42  * The SubRegion class can be used to determine a sub-region within a frame either by defining a mask or by defining the 2D coordinates of the contour.
43  *
44  * The SumAbsoluteDifferences, the SumSquareDifferences and the ZeroMeanSumSquareDifferences classes provide functions measuring distances between image regions (patches).
45  * @}
46  */
47 
48 /**
49  * @namespace Ocean::CV Namespace of the CV library.<p>
50  * The Namespace Ocean::CV is used in the entire Ocean CV Library.
51  */
52 
53 // Defines OCEAN_CV_EXPORT for dll export and import.
54 #if defined(_WINDOWS) && defined(OCEAN_RUNTIME_SHARED)
55  #ifdef USE_OCEAN_CV_EXPORT
56  #define OCEAN_CV_EXPORT __declspec(dllexport)
57  #else
58  #define OCEAN_CV_EXPORT __declspec(dllimport)
59  #endif
60 #else
61  #define OCEAN_CV_EXPORT
62 #endif
63 
64 /**
65  * Definition of individual directions with pixel accuracy.
66  * The values of the individual directions are defined by the angle (in counter clockwise order) in degree.<br>
67  * The default direction is the north direction (pointing upwards in an image with pixel origin in the top left corner).<br>
68  * Here is a visualization of the individual pixel directions:
69  * <pre>
70  * Image with origin in top left corner (denoted by X) and the pixel position P:
71  * X--------------------- X---------------------
72  * | | | |
73  * | NW N NE | | 45 0 315 |
74  * | | | |
75  * | W P E | | 90 P 270 |
76  * | | | |
77  * | SW S SE | | 135 180 225 |
78  * | | | |
79  * --------------------- ---------------------
80  * </pre>
81  * Beware: An invalid pixel direction (PD_INVALID) has the value -1 and not 0 as often for other enums.
82  * @ingroup cv
83  */
84 enum PixelDirection : int32_t
85 {
86  // Invalid direction.
87  PD_INVALID = -1,
88  // North direction.
89  PD_NORTH = 0,
90  // North west direction.
92  // West direction.
93  PD_WEST = 90,
94  // South west direction.
96  // South direction.
97  PD_SOUTH = 180,
98  // South east direction.
100  // East direction.
101  PD_EAST = 270,
102  // North east direction.
103  PD_NORTH_EAST = 315
104 };
105 
106 /**
107  * Definition of a vector holding pixel directions.
108  * @ingroup cv
109  */
110 typedef std::vector<PixelDirection> PixelDirections;
111 
112 /**
113  * Definition of individual centers of pixels.
114  * @ingroup cv
115  */
116 enum PixelCenter : uint32_t
117 {
118  /**
119  * The center of a pixel is in the upper-left corner of each pixel's square.
120  * Below an image with 2x2 pixels, the pixel center is denoted by 'X':
121  * <pre>
122  * X-------X-------
123  * | | |
124  * | | | <- first pixel row of image
125  * | | |
126  * X-------X-------
127  * | | |
128  * | | | <- second pixel row of image
129  * | | |
130  * ------- -------
131  * </pre>
132  */
134 
135  /**
136  * The center of a pixel is located in the center of each pixel's square (with an offset of 0.5, 0.5).
137  * Below an image with 2x2 pixels, the pixel center is denoted by 'X':
138  * <pre>
139  * ------- -------
140  * | | |
141  * | X | X | <- first pixel row of image
142  * | | |
143  * ------- -------
144  * | | |
145  * | X | X | <- second pixel row of image
146  * | | |
147  * ------- -------
148  * </pre>
149  */
150  PC_CENTER
151 };
152 
153 }
154 
155 }
156 
157 #endif // META_OCEAN_CV_CV_H
PixelCenter
Definition of individual centers of pixels.
Definition: CV.h:117
std::vector< PixelDirection > PixelDirections
Definition of a vector holding pixel directions.
Definition: CV.h:110
PixelDirection
Definition of individual directions with pixel accuracy.
Definition: CV.h:85
@ PC_TOP_LEFT
The center of a pixel is in the upper-left corner of each pixel's square.
Definition: CV.h:133
@ PC_CENTER
The center of a pixel is located in the center of each pixel's square (with an offset of 0....
Definition: CV.h:150
@ PD_WEST
Definition: CV.h:93
@ PD_NORTH_EAST
Definition: CV.h:103
@ PD_NORTH_WEST
Definition: CV.h:91
@ PD_EAST
Definition: CV.h:101
@ PD_SOUTH_WEST
Definition: CV.h:95
@ PD_SOUTH
Definition: CV.h:97
@ PD_SOUTH_EAST
Definition: CV.h:99
@ PD_INVALID
Definition: CV.h:87
@ PD_NORTH
Definition: CV.h:89
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15