CPPxDIC
C++ Digital Image Correlation library for fingertip 3D reconstruction
Loading...
Searching...
No Matches
image_processor.h
Go to the documentation of this file.
1
7#ifndef IMAGE_PROCESSOR_H
8#define IMAGE_PROCESSOR_H
9
10#include <opencv2/opencv.hpp>
11#include <vector>
12#include <string>
13
14namespace cppxdic {
15
21public:
30 static std::vector<cv::Mat> saturate(const std::vector<cv::Mat>& input, int level);
31
40 static cv::Mat saturate(const cv::Mat& input, int level, const std::string& method = "high");
41
52 static std::pair<std::vector<cv::Mat>, std::pair<double, double>>
53 filterLikeBen(const std::vector<cv::Mat>& input,
54 const cv::Mat& mask,
55 const std::vector<int>& param_filt,
56 const std::pair<double, double>* gs_boundaries = nullptr);
57
65 static cv::Mat applyBandpassFilter(const cv::Mat& input,
66 const std::vector<int>& param_filt);
67
75 static std::pair<double, double> computeGrayscaleBoundaries(const cv::Mat& image,
76 const cv::Mat& mask);
77
87 static std::pair<double, double> computePercentileBoundaries(const cv::Mat& image,
88 const cv::Mat& mask,
89 double lower_percentile,
90 double upper_percentile);
91
99 static cv::Mat normalizeAndClamp(const cv::Mat& image,
100 const std::pair<double, double>& boundaries);
101
109 static std::vector<cv::Mat> loadImages(const std::vector<std::string>& paths,
110 bool grayscale = true);
111
120 static bool saveImages(const std::vector<cv::Mat>& images,
121 const std::string& base_path,
122 const std::string& prefix);
123
133 static cv::Mat blurOutsideMask(const cv::Mat& img, const cv::Mat& mask, int kwidth = 25, int kheight = 25);
134
135private:
143 static cv::Mat applyHistogramEqualization(const cv::Mat& image, double clip_limit = 2.0);
144
153 static cv::Mat normalizeImage(const cv::Mat& image, double min_val, double max_val);
154};
155
156} // namespace cppxdic
157
158#endif // IMAGE_PROCESSOR_H
ImageProcessor class Provides image preprocessing operations for DIC analysis.
static bool saveImages(const std::vector< cv::Mat > &images, const std::string &base_path, const std::string &prefix)
Save images to disk.
static std::pair< double, double > computePercentileBoundaries(const cv::Mat &image, const cv::Mat &mask, double lower_percentile, double upper_percentile)
Compute grayscale boundaries using percentiles.
static std::vector< cv::Mat > saturate(const std::vector< cv::Mat > &input, int level)
Saturate image intensities Equivalent to satur.m in Matlab.
static std::pair< std::vector< cv::Mat >, std::pair< double, double > > filterLikeBen(const std::vector< cv::Mat > &input, const cv::Mat &mask, const std::vector< int > &param_filt, const std::pair< double, double > *gs_boundaries=nullptr)
Filter images like Ben's method Equivalent to filter_like_ben.m in Matlab.
static std::pair< double, double > computeGrayscaleBoundaries(const cv::Mat &image, const cv::Mat &mask)
Compute grayscale boundaries from masked region using min/max.
static cv::Mat applyBandpassFilter(const cv::Mat &input, const std::vector< int > &param_filt)
Apply bandpass filter to image using FFT.
static cv::Mat normalizeAndClamp(const cv::Mat &image, const std::pair< double, double > &boundaries)
Normalize and clamp image to [0, 255] using boundaries.
static cv::Mat blurOutsideMask(const cv::Mat &img, const cv::Mat &mask, int kwidth=25, int kheight=25)
Blur the outside of a mask.
static std::vector< cv::Mat > loadImages(const std::vector< std::string > &paths, bool grayscale=true)
Load images from file paths.
DataSerializer - Abstract base class for format-agnostic DIC data I/O.