Aircraft Detection 1.0
|
Functions | |
std::vector< cv::Mat > | loadAvgPlanes () |
Loads average airplane images from the specified directory. | |
std::vector< int > | angle_range (int start, int end, int step) |
Generates a range of angles from start to end with a specified step. | |
cv::Mat | rotateImage (const cv::Mat &src_img, int degree_angle) |
Rotates an image by a specified angle. | |
cv::Point | transformPoint (const cv::Point &match_center, const cv::Mat &rotation_mat) |
Transforms a point using the inverse of a given affine transformation matrix. | |
std::vector< cv::Point > | performTemplateMatching (const cv::Mat &src_img, const cv::Mat &avg_plane, int degree_angle) |
Performs template matching on a source image with a rotated template. | |
std::vector< cv::Point > | matchTemplateMultiThreaded (const cv::Mat &src_img, const std::vector< cv::Mat > &avg_planes) |
Performs multi-threaded template matching on a source image using multiple average planes. | |
std::vector< cv::Point > | templateMatching (const cv::Mat &src_img) |
Performs template matching on a source image using pre-loaded average planes. | |
std::vector< int > angle_range | ( | int | start, |
int | end, | ||
int | step ) |
Generates a range of angles from start to end with a specified step.
This function creates a vector of integers representing angles starting from start
, incremented by step
, and ending before end
.
[in] | start | The starting angle. |
[in] | end | The ending angle (exclusive). |
[in] | step | The step size between consecutive angles. |
std::vector< cv::Mat > loadAvgPlanes | ( | ) |
Loads average airplane images from the specified directory.
This function reads all PNG images from the "avg_airplanes" directory within the source directory and loads them into a vector of cv::Mat
objects.
cv::Mat
objects containing the loaded average airplane images.SRC_DIR_PATH
. std::vector< cv::Point > matchTemplateMultiThreaded | ( | const cv::Mat & | src_img, |
const std::vector< cv::Mat > & | avg_planes ) |
Performs multi-threaded template matching on a source image using multiple average planes.
This function performs template matching on a source image using a set of average planes, rotating each plane by various angles. It uses multi-threading to parallelize the matching process, combining the results into a single list of matched points.
[in] | src_img | The source image in which to perform template matching. |
[in] | avg_planes | A vector of cv::Mat objects representing the average planes used for matching. |
cv::Point
objects representing the coordinates of all matched points.std::async
with std::launch::async
to perform template matching in parallel. std::vector< cv::Point > performTemplateMatching | ( | const cv::Mat & | src_img, |
const cv::Mat & | avg_plane, | ||
int | degree_angle ) |
Performs template matching on a source image with a rotated template.
This function rotates the source image by a specified angle, performs template matching using the normalized cross-correlation method, and returns the coordinates of the matched points transformed back to the original image coordinates.
[in] | src_img | The source image in which to perform template matching. |
[in] | avg_plane | The template image used for matching. |
[in] | degree_angle | The angle in degrees by which to rotate the source image for matching. |
cv::Point
objects representing the coordinates of the matched points in the original image.cv::getRotationMatrix2D
to compute the rotation matrix and rotateImage
to rotate the source image. cv::matchTemplate
with the cv::TM_CCOEFF_NORMED
method to perform template matching. transformPoint
to transform the coordinates of the matched points back to the original image coordinates.cv::Mat rotateImage | ( | const cv::Mat & | src_img, |
int | degree_angle ) |
Rotates an image by a specified angle.
This function rotates the given image by a specified angle around its center. It adjusts the bounding box to ensure the entire rotated image fits within the resulting image.
[in] | src_img | The source image to be rotated. |
[in] | degree_angle | The angle in degrees by which the image should be rotated. |
cv::Mat
object containing the rotated image.std::vector< cv::Point > templateMatching | ( | const cv::Mat & | src_img | ) |
Performs template matching on a source image using pre-loaded average planes.
This function loads a set of average planes and performs multi-threaded template matching on the source image. It returns the coordinates of all matched points found in the image.
[in] | src_img | The source image in which to perform template matching. |
cv::Point
objects representing the coordinates of all matched points.loadAvgPlanes
to load the average planes from the predefined directory. matchTemplateMultiThreaded
to perform multi-threaded template matching.cv::Point transformPoint | ( | const cv::Point & | match_center, |
const cv::Mat & | rotation_mat ) |
Transforms a point using the inverse of a given affine transformation matrix.
This function takes a point and an affine transformation matrix, computes the inverse of the matrix, and applies it to the point to obtain its transformed coordinates.
[in] | match_center | The point to be transformed. |
[in] | rotation_mat | The affine transformation matrix to be inverted and applied to the point. |
cv::Point
representing the transformed coordinates of the input point.cv::invertAffineTransform
to compute the inverse of the affine transformation matrix. cv::transform
to apply the inverted matrix to the point.