OSVR-Core
|
Header. More...
#include <BlobExtractor.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <cstdint>
#include <random>
#include <utility>
#include <vector>
Go to the source code of this file.
Namespaces | |
osvr | |
The main namespace for all C++ elements of the framework, internal and external. | |
Functions | |
cv::Point2f | osvr::vbtracker::castPointToFloat (cv::Point2d const &p) |
void | osvr::vbtracker::drawSubpixelPoint (cv::Mat image, cv::Point2d point, cv::Scalar color=cv::Scalar(0, 0, 0), double radius=1., std::uint8_t fractionalBits=3) |
template<typename F > | |
cv::Mat | osvr::vbtracker::drawFunctorColoredContours (cv::Mat const &baseImage, std::vector< ContourType > const &contours, F &&colorFunc, bool fillContours=false, double centerDotRadius=1.2, bool colorCenterDot=true) |
Draw contours on a copy of the base image (converted to BGR, if required), with each contour a potentially a unique color thanks to functors! If you choose not to fill the contours, the center of each will have a subpixel-accurate circle plotted at it. More... | |
cv::Mat | osvr::vbtracker::drawColoredContours (cv::Mat const &baseImage, std::vector< ContourType > const &contours, bool deterministic=true, bool fillContours=false, double centerDotRadius=1.2, bool colorCenterDot=true) |
Draw contours on a copy of the base image (converted to BGR, if required), with each contour a unique color thanks to a Mersenne Twister! If you choose not to fill the contours, the center of each will have a subpixel-accurate circle plotted at it. More... | |
cv::Mat | osvr::vbtracker::drawSingleColoredContours (cv::Mat const &baseImage, std::vector< ContourType > const &contours, cv::Scalar color, bool fillContours=false, double centerDotRadius=1.2, bool colorCenterDot=true) |
Draw contours on a copy of the base image (converted to BGR, if required), with all contours the same color. More... | |
template<typename F > | |
std::vector< ContourType > | osvr::vbtracker::getOutsidesOfConnectedComponents (cv::Mat input, F &&additionalPredicate) |
template<typename F > | |
void | osvr::vbtracker::consumeHolesOfConnectedComponents (cv::InputOutputArray input, std::vector< ContourType > &contoursTempStorage, std::vector< cv::Vec4i > &hierarchyTempStorage, F &&continuation) |
Calls a continuation on every hole of a connected component. More... | |
template<typename F > | |
void | osvr::vbtracker::consumeHolesOfConnectedComponents (cv::InputOutputArray input, F &&continuation) |
Calls a continuation on every hole of a connected component. | |
Header.
|
inline |
Calls a continuation on every hole of a connected component.
This version lets you pass your own temporary vectors to reduce/re-use allocations during operation
Loop through the outside connected components.
We want all first-level children of connected components.
|
inline |
Draw contours on a copy of the base image (converted to BGR, if required), with each contour a unique color thanks to a Mersenne Twister! If you choose not to fill the contours, the center of each will have a subpixel-accurate circle plotted at it.
baseImage | Image to have the contours drawn on top of - will not be modified - just cloned. |
contours | The contours you'd like drawn. |
deterministic | Should we use a deterministic seed? |
fillContours | Whether contours should be drawn filled, or just as outlines with a center point plotted (default) |
centerDotRadius | Radius, in pixels, of the center dot to plot if fillContours is false. |
colorCenterDot | Whether the center dots drawn if fillContours is false should match the corresponding contour color (default), or if they should all be black. |
Our desired range is a power of two, so we can just mask.
|
inline |
Draw contours on a copy of the base image (converted to BGR, if required), with each contour a potentially a unique color thanks to functors! If you choose not to fill the contours, the center of each will have a subpixel-accurate circle plotted at it.
baseImage | Image to have the contours drawn on top of - will not be modified - just cloned. |
contours | The contours you'd like drawn. |
colorFunc | a callable taking ContourType const &, std::size_t (index) and returning a cv::Scalar color. |
fillContours | Whether contours should be drawn filled, or just as outlines with a center point plotted (default) |
centerDotRadius | Radius, in pixels, of the center dot to plot if fillContours is false. |
colorCenterDot | Whether the center dots drawn if fillContours is false should match the corresponding contour color (default), or if they should all be black. |
Draw a subpixel-accurate dot in the middle.
|
inline |
Draw contours on a copy of the base image (converted to BGR, if required), with all contours the same color.
If you choose not to fill the contours, the center of each will have a subpixel-accurate circle plotted at it.
baseImage | Image to have the contours drawn on top of - will not be modified - just cloned. |
contours | The contours you'd like drawn. |
color | The color you want the contour drawn. |
fillContours | Whether contours should be drawn filled, or just as outlines with a center point plotted (default) |
centerDotRadius | Radius, in pixels, of the center dot to plot if fillContours is false. |
colorCenterDot | Whether the center dots drawn if fillContours is false should match the corresponding contour color (default), or if they should all be black. |