Aircraft Detection 1.0
Loading...
Searching...
No Matches
hog_features_extraction.h File Reference
#include <opencv2/opencv.hpp>
#include <string>
#include <vector>

Go to the source code of this file.

Functions

std::vector< std::vector< float > > hog_features_extraction (const std::vector< cv::Rect > &rois, const cv::Mat &image)
 Extracts HOG features from specified regions of interest (ROIs) in an image.
 
void writeHogFeaturesToCsv (const std::vector< std::vector< float > > &hog_features, const std::string &filename)
 Writes HOG features to a CSV file.
 

Function Documentation

◆ hog_features_extraction()

std::vector< std::vector< float > > hog_features_extraction ( const std::vector< cv::Rect > & rois,
const cv::Mat & image )

Extracts HOG features from specified regions of interest (ROIs) in an image.

This function takes a vector of regions of interest (ROIs) and an image, extracts each ROI from the image, resizes it to 64x64, and computes the HOG (Histogram of Oriented Gradients) descriptors for each resized ROI. The HOG features are then returned in a vector of vectors, where each inner vector corresponds to the HOG descriptors of a single ROI.

Parameters
[in]roisA vector of cv::Rect defining the regions of interest in the image.
[in]imageThe input image from which the ROIs are extracted.
Returns
A vector of vectors, where each inner vector contains the HOG descriptors for a corresponding ROI.
See also
cv::HOGDescriptor

◆ writeHogFeaturesToCsv()

void writeHogFeaturesToCsv ( const std::vector< std::vector< float > > & hog_features,
const std::string & filename )

Writes HOG features to a CSV file.

This function takes a vector of HOG feature vectors and writes them to a specified CSV file. Each row in the CSV file corresponds to one HOG feature vector, and each value in the vector is written with a fixed precision of 6 decimal places.

Parameters
[in]hog_featuresA vector of HOG feature vectors to be written to the CSV file.
[in]filenameThe name of the CSV file to write the HOG features to.
Note
The file is opened using the openFile function, which is assumed to return a file stream. The features are written in a consistent format with a fixed precision to ensure proper formatting regardless of locale settings.