25 #ifndef INCLUDED_CVTwoStepProgressBar_h_GUID_259E874E_85B4_4AAD_0FDE_BA90B5D9DCD4 26 #define INCLUDED_CVTwoStepProgressBar_h_GUID_259E874E_85B4_4AAD_0FDE_BA90B5D9DCD4 32 #include <opencv2/core/core.hpp> 33 #include <opencv2/imgproc/imgproc.hpp> 41 cv::Size
size, std::size_t complete,
42 std::size_t partial, std::size_t incomplete) {
43 static const auto RED = cv::Vec3b{0, 0, 255};
44 static const auto YELLOW = cv::Vec3b{0, 255, 255};
45 static const auto GREEN = cv::Vec3b{0, 255, 0};
47 auto totalUnits = complete + partial + incomplete;
48 double totalWidth = size.width;
55 auto drawBar = [&](
int width, cv::Vec3b
const &color) {
56 cv::rectangle(image, location,
57 location + cv::Point(width, size.height),
63 auto drawFraction = [&](std::size_t portionOfTotal,
64 cv::Vec3b
const &color) {
65 auto width = double(portionOfTotal) / totalUnits * totalWidth;
66 drawBar(static_cast<int>(width), color);
72 bool haveBaseBar =
false;
73 auto drawBaseBar = [&](cv::Vec3b
const &color) {
74 drawBar(size.width, color);
78 using std::make_tuple;
82 make_tuple(incomplete, incomplete + partial + complete, RED),
83 make_tuple(partial, partial + complete, YELLOW),
84 make_tuple(complete, complete, GREEN)};
87 for (
auto &layer : layers) {
88 std::size_t portionOfTotal;
89 std::size_t cumulative;
91 std::tie(portionOfTotal, cumulative, color) = layer;
92 if (portionOfTotal == 0) {
100 drawFraction(cumulative, color);
110 #endif // INCLUDED_CVTwoStepProgressBar_h_GUID_259E874E_85B4_4AAD_0FDE_BA90B5D9DCD4 void drawTwoStepProgressBar(cv::Mat &image, cv::Point location, cv::Size size, std::size_t complete, std::size_t partial, std::size_t incomplete)
Definition: CVTwoStepProgressBar.h:40
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
detail::size< coerce_list< Ts... >> size
Get the size of a list (number of elements.)
Definition: Size.h:56
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48