Ocean
Loading...
Searching...
No Matches
cv/detector/bullseyes/Utilities.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 OCEAN_CV_DETECTOR_BULLSEYES_UTILITIES_H
9#define OCEAN_CV_DETECTOR_BULLSEYES_UTILITIES_H
10
13
14#include "ocean/base/Frame.h"
15
17
18namespace Ocean
19{
20
21namespace CV
22{
23
24namespace Detector
25{
26
27namespace Bullseyes
28{
29
30/**
31 * This class implements utility functions for the Bullseyes library.
32 * @ingroup cvdetectorbullseyes
33 */
34class OCEAN_CV_DETECTOR_BULLSEYES_EXPORT Utilities
35{
36 public:
37
38 /**
39 * Creates a bullseye image with a given diameter and quiet zone.
40 * @param diameter The diameter of the bullseye in pixels, with range [15, infinity); must be odd; for best results the diameter should also be a multiple of 5
41 * @param emptyBorder The width of an empty border around the bullseye (quiet zone), in pixels, with range [0, infinity)
42 * @param rgbFrame The resulting bullseye image, the frame will be created internally
43 * @param foregroundColor Optional foreground color of the bullseye, nullptr to use the default color (black)
44 * @param backgroundColor Optional background color of the bullseye, nullptr to use the default color (white)
45 * @return True, if succeeded
46 */
47 static bool createBullseyeImage(const unsigned int diameter, const unsigned int emptyBorder, Frame& rgbFrame, const uint8_t* foregroundColor = nullptr, const uint8_t* backgroundColor = nullptr);
48
49 /**
50 * Draws a bullseye pattern into a given frame at a specified offset.
51 * @param rgbFrame The frame in which the bullseye will be drawn, must be valid and have a pixel format RGB24 (or compatible)
52 * @param offset The top-left position where the bullseye will be drawn, must be within frame bounds considering the bullseye size
53 * @param diameter The diameter of the bullseye in pixels, with range [15, infinity); must be odd; for best results the diameter should also be a multiple of 5
54 * @param emptyBorder The width of an empty border around the bullseye (quiet zone), in pixels, with range [0, infinity)
55 * @param foregroundColor Optional foreground color of the bullseye, nullptr to use the default color (black)
56 * @param backgroundColor Optional background color of the bullseye, nullptr to use the default color (white)
57 * @return True, if succeeded
58 */
59 static bool drawBullseyeWithOffset(Frame& rgbFrame, const PixelPosition& offset, const unsigned int diameter, const unsigned int emptyBorder, const uint8_t* foregroundColor = nullptr, const uint8_t* backgroundColor = nullptr);
60
61 /**
62 * Draws the location of a bullseye into a given frame.
63 * @param rgbFrame The frame in which the bullseye will be painted, must be valid and have a pixel format RGB24 (or compatible)
64 * @param bullseye The bullseye to be painted, must be valid
65 * @param color Optional color to be used, one value for each frame channel, nullptr to use the default color (red)
66 */
67 static void drawBullseye(Frame& rgbFrame, const Bullseye& bullseye, const uint8_t* color = nullptr);
68
69 /**
70 * Draws the outline of a bullseye into a given frame.
71 * The function draws a center point and a circle outline at the bullseye's position and radius.
72 * @param rgbFrame The frame in which the bullseye outline will be painted, must be valid and have a pixel format RGB24 (or compatible)
73 * @param bullseye The bullseye whose outline will be painted, must be valid
74 * @param color Optional color to be used, one value for each frame channel, nullptr to use the default color (green)
75 */
76 static void drawBullseyeOutline(Frame& rgbFrame, const Bullseye& bullseye, const uint8_t* color = nullptr);
77
78 /**
79 * Draws the locations of multiple bullseyes into a given frame.
80 * @param rgbFrame The frame in which the bullseyes will be painted, must be valid and have a pixel format RGB24 (or compatible)
81 * @param bullseyes The bullseyes to be painted, must be valid
82 * @param numberBullseyes The number of bullseyes to be painted, with range [0, infinity)
83 * @param color Optional color to be used, one value for each frame channel, nullptr to use the default color (red)
84 */
85 static void drawBullseyes(Frame& rgbFrame, const Bullseye* bullseyes, const size_t numberBullseyes, const uint8_t* color = nullptr);
86};
87
88} // namespace Bullseyes
89
90} // namespace Detector
91
92} // namespace CV
93
94} // namespace Ocean
95
96#endif // OCEAN_CV_DETECTOR_BULLSEYES_UTILITIES_H
Definition of a bullseye composed of a location and a radius.
Definition Bullseye.h:32
This class implements utility functions for the Bullseyes library.
Definition cv/detector/bullseyes/Utilities.h:35
static bool createBullseyeImage(const unsigned int diameter, const unsigned int emptyBorder, Frame &rgbFrame, const uint8_t *foregroundColor=nullptr, const uint8_t *backgroundColor=nullptr)
Creates a bullseye image with a given diameter and quiet zone.
static bool drawBullseyeWithOffset(Frame &rgbFrame, const PixelPosition &offset, const unsigned int diameter, const unsigned int emptyBorder, const uint8_t *foregroundColor=nullptr, const uint8_t *backgroundColor=nullptr)
Draws a bullseye pattern into a given frame at a specified offset.
static void drawBullseyes(Frame &rgbFrame, const Bullseye *bullseyes, const size_t numberBullseyes, const uint8_t *color=nullptr)
Draws the locations of multiple bullseyes into a given frame.
static void drawBullseyeOutline(Frame &rgbFrame, const Bullseye &bullseye, const uint8_t *color=nullptr)
Draws the outline of a bullseye into a given frame.
static void drawBullseye(Frame &rgbFrame, const Bullseye &bullseye, const uint8_t *color=nullptr)
Draws the location of a bullseye into a given frame.
This class implements Ocean's image class.
Definition Frame.h:1879
std::vector< Bullseye > Bullseyes
Definition of a vector holding bullseyes.
Definition Bullseye.h:113
The namespace covering the entire Ocean framework.
Definition Accessor.h:15