![]() |
Companion
1.0.0
Companion is an object recognition framework written with OpenCV.
|
#include <Util.h>
Static Public Member Functions | |
static cv::Mat | CutImage (cv::Mat img, cv::Rect cutArea) |
static bool | IsImageLoaded (const cv::Mat &img) |
static void | ResizeImage (cv::Mat &img, SCALING scaling) |
static void | ResizeImage (cv::Mat &img, cv::Size size) |
static void | ResizeImage (cv::Mat &img, int width) |
static void | RatioPosition (cv::Point &point, int cWidth, int cHeight, int nWidth, int nHeight) |
static bool | ValidateShape (cv::Point2f topRight, cv::Point2f bottomLeft, cv::Point2f topLeft, cv::Point2f bottomRight, int minSidelLength=10, float maxSideDeviation=0.5f, float maxDiagonalDeviation=0.1f) |
static void | ConvertColor (cv::Mat &src, cv::Mat &dst, ColorFormat colorFormat) |
Utility class for Companion.
|
static |
Convert an image to the given color format. BGR is expected as source format.
src | Source image. |
dst | Destination image. |
colorFormat | Color format for the converted image. |
|
static |
Cut the given area out of the given image.
img | Source image. |
cutArea | Area to cut out. |
|
static |
Check if given image is loaded.
img | Image to check if it is not null. |
True
if image is loaded, false
otherwise.
|
static |
Recalculate the coordinates of the given point from current image dimensions to new given dimensions.
point | Point the coordinates of which should be recalculated. |
cWidth | Current width. |
cHeight | Current height. |
nWidth | New width. |
nHeight | New height. |
|
static |
Resize given image.
img | Image to resize. |
scaling | Scaling factor to resize. |
|
static |
Resize given image.
img | Image to resize. |
size | Width and height in pixels to resize image. |
|
static |
Resize given image to given width (keeps aspect ratio).
img | Image to resize. |
width | Image width in pixels. |
|
static |
Validate the rectangular shape of a recognized area.
topRight | Top right corner of the recognized area. |
bottomLeft | Bottom left corner of the recognized area. |
topLeft | Top left corner of the recognized area. |
bottomRight | Bottom right corner of the recognized area. |
minSidelLength | Minimum length of the recognized area's sides (in pixels). |
maxSideDeviation | Maximum deviation of the sides' lengths. |
maxDiagonalDeviation | Maximum deviation of the diagonals' lengths. |
True
if the diagonals are long enough and both have a similar length, otherwise false
.