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