Antal.Ai - Virtual Makeup
Functions
CvUtils.h File Reference

Core utilities for image and math operations using OpenCV. More...

#include <opencv2/core/mat.hpp>
Include dependency graph for CvUtils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void core::image::resizeRect (cv::Rect &rect, double scaleFactor)
 Resizes a rectangle by a given scale factor. More...
 
void core::image::createQuadraticRect (cv::Rect &r, const cv::Rect &imageRect)
 Creates a quadratic rectangle based on an existing rectangle. More...
 
void core::image::histogramEqualization (cv::Mat &frame)
 Performs histogram equalization on a given frame. More...
 
void core::math::eulerAnglesFromRotationVector (const cv::Mat &rotationVector, cv::Vec3d &eulerAngles)
 Calculates Euler angles from a rotation vector. More...
 
cv::Mat core::math::eulerAnglesToRotationMatrix (const cv::Vec3f &theta)
 Converts Euler angles to a rotation matrix. More...
 
cv::Point3d core::math::rotatePoint (const cv::Point3d &point, const cv::Mat &rotationmatrix)
 Rotates a point using a given rotation matrix. More...
 
cv::Point core::math::perspectiveTransformPoint (const cv::Point2f &pt, cv::Mat &transformation)
 Performs perspective transformation on a point. More...
 
cv::Point2d core::math::findProjectedPoint (const cv::Mat &rotation_matrix, const cv::Mat &translation_vector, const cv::Mat camera_matrix, cv::Point3d model_point)
 Finds the projected point using rotation and translation matrices and a camera matrix. More...
 
int core::math::getBlobIntersectionArea (const cv::Mat &blobImg, const std::vector< cv::Point > &contour1, const std::vector< cv::Point > &contour2)
 Calculates the intersection area of two blobs. More...
 
void core::math::getBlobCorners (const std::vector< cv::Point > &blob, cv::Point &tl, cv::Point &tr, cv::Point &br, cv::Point &bl)
 Retrieves the corners of a blob. More...
 
float core::math::getAngleBetween (cv::Point a_begin, cv::Point a_end, cv::Point b_begin, cv::Point b_end)
 Calculates the angle between two line segments. More...
 
cv::Point core::math::getMean (const std::vector< cv::Point > &vec)
 Calculates the mean point of a vector of points. More...
 

Detailed Description

Core utilities for image and math operations using OpenCV.

Function Documentation

◆ createQuadraticRect()

void core::image::createQuadraticRect ( cv::Rect &  r,
const cv::Rect &  imageRect 
)

Creates a quadratic rectangle based on an existing rectangle.

Parameters
rReference to the new quadratic rectangle.
imageRectThe existing rectangle to base the new rectangle on.

◆ eulerAnglesFromRotationVector()

void core::math::eulerAnglesFromRotationVector ( const cv::Mat &  rotationVector,
cv::Vec3d &  eulerAngles 
)

Calculates Euler angles from a rotation vector.

Usage example: Vec3d eulerAngles; eulerAnglesFromRotationVector(rotationVector, eulerAngles);

Parameters
rotationVectorThe input rotation vector.
eulerAnglesOutput Euler angles (yaw, pitch, roll).

◆ eulerAnglesToRotationMatrix()

cv::Mat core::math::eulerAnglesToRotationMatrix ( const cv::Vec3f &  theta)

Converts Euler angles to a rotation matrix.

Parameters
thetaThe input Euler angles.
Returns
cv::Mat The output rotation matrix.

◆ findProjectedPoint()

cv::Point2d core::math::findProjectedPoint ( const cv::Mat &  rotation_matrix,
const cv::Mat &  translation_vector,
const cv::Mat  camera_matrix,
cv::Point3d  model_point 
)

Finds the projected point using rotation and translation matrices and a camera matrix.

Parameters
rotation_matrixRotation matrix.
translation_vectorTranslation vector.
camera_matrixCamera matrix.
model_pointThe 3D model point.
Returns
cv::Point2d The projected 2D point.

◆ getAngleBetween()

float core::math::getAngleBetween ( cv::Point  a_begin,
cv::Point  a_end,
cv::Point  b_begin,
cv::Point  b_end 
)

Calculates the angle between two line segments.

Parameters
a_beginStart point of the first line segment.
a_endEnd point of the first line segment.
b_beginStart point of the second line segment.
b
b_endEnd point of the second line segment.
Returns
float The angle in radians between the two line segments.

◆ getBlobCorners()

void core::math::getBlobCorners ( const std::vector< cv::Point > &  blob,
cv::Point &  tl,
cv::Point &  tr,
cv::Point &  br,
cv::Point &  bl 
)

Retrieves the corners of a blob.

Parameters
blobThe vector of points defining the blob.
tlTop-left corner of the blob.
trTop-right corner of the blob.
brBottom-right corner of the blob.
blBottom-left corner of the blob.

◆ getBlobIntersectionArea()

int core::math::getBlobIntersectionArea ( const cv::Mat &  blobImg,
const std::vector< cv::Point > &  contour1,
const std::vector< cv::Point > &  contour2 
)

Calculates the intersection area of two blobs.

Parameters
blobImgThe image containing blobs.
contour1The first contour.
contour2The second contour.
Returns
int The area of intersection between the two contours.

◆ getMean()

cv::Point core::math::getMean ( const std::vector< cv::Point > &  vec)

Calculates the mean point of a vector of points.

Parameters
vecThe vector containing the points.
Returns
cv::Point The mean point.

◆ histogramEqualization()

void core::image::histogramEqualization ( cv::Mat &  frame)

Performs histogram equalization on a given frame.

Parameters
frameReference to the frame for histogram equalization.

◆ perspectiveTransformPoint()

cv::Point core::math::perspectiveTransformPoint ( const cv::Point2f &  pt,
cv::Mat &  transformation 
)

Performs perspective transformation on a point.

Parameters
ptThe point for transformation.
transformationThe transformation matrix.
Returns
cv::Point The transformed point.

◆ resizeRect()

void core::image::resizeRect ( cv::Rect &  rect,
double  scaleFactor 
)

Resizes a rectangle by a given scale factor.

Parameters
rectReference to the rectangle to resize.
scaleFactorThe scale factor for resizing.

◆ rotatePoint()

cv::Point3d core::math::rotatePoint ( const cv::Point3d &  point,
const cv::Mat &  rotationmatrix 
)

Rotates a point using a given rotation matrix.

Parameters
pointThe point to rotate.
rotationmatrixThe rotation matrix.
Returns
cv::Point3d The rotated point.