Aircraft Detection 1.0
Loading...
Searching...
No Matches
eigenplanes.cpp File Reference
#include "eigenplanes.h"
#include "utils.h"

Functions

cv::Mat createDataMatrix (const std::vector< cv::Mat > &images)
 Creates a data matrix from a vector of images.
 
cv::Mat eigenPlanes (const std::vector< cv::Mat > &vec, cv::Size img_dims)
 Computes the average plane from a vector of images using PCA.
 

Function Documentation

◆ createDataMatrix()

cv::Mat createDataMatrix ( const std::vector< cv::Mat > & images)

Creates a data matrix from a vector of images.

This function takes a vector of images (each represented as a cv::Mat) and flattens each image to a single row. These rows are then stacked to create a data matrix where each row represents a flattened image.

Parameters
[in]imagesA vector of images to be converted into a data matrix. Each image is a cv::Mat.
Returns
A cv::Mat where each row is a flattened version of the corresponding image from the input vector.
See also
cv::Mat

◆ eigenPlanes()

cv::Mat eigenPlanes ( const std::vector< cv::Mat > & vec,
cv::Size img_dims )

Computes the average plane from a vector of images using PCA.

This function takes a vector of images, converts them to CV_64F, and creates a data matrix. It then performs Principal Component Analysis (PCA) on the centered data matrix, projects each image onto the PCA space, and computes the average projection. Finally, it reshapes the average projection back into the original image dimensions and normalizes the result.

Parameters
[in]vecA vector of images (each represented as a cv::Mat) to be processed.
[in]img_dimsThe dimensions of the input images.
Returns
A cv::Mat representing the average plane computed from the input images.
See also
cv::Mat
cv::PCA