-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrapid-af.h
50 lines (39 loc) · 2.24 KB
/
rapid-af.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef RAPID_AF_H
#define RAPID_AF_H
#include <opencv2/opencv.hpp>
namespace rapid_af {
struct AlignOptions {
bool multithreading_enable = true; //!< Compute image preprocessing using multiple threads
uint padding = 100; //!< Padding used for cross correlation
double agreement_threshold = 5; //!< Maximum allowed discrepancy between displacements
bool prefilter_enable = true; //!< Apply Gaussian prefiltering
double prefilter_ksize = 20; //!< Kernel size for Gaussian filter
double prefilter_sigma = 5; //!< Sigma for Gaussian filter
bool bin_enable = true; //!< Enable binarize
double bin_threshold = 0.6; //!< Threshold of maximum for binarization. Value in [0, 1].
bool dog_enable = true; //!< Enable Difference-of-Gaussians (DoG)
int dog_ksize = 100; //!< Kernel size for DoG
double dog_sigma1 = 5; //!< Sigma of first Gaussian
double dog_sigma2 = 10; //!< Sigma of second Gaussian
bool canny_enable = true; //!< Enable Canny filter
int canny_ksize = 29; //!< Kernel size for Canny filter
double canny_sigma = 20; //!< Smoothing sigma for Canny filter
double canny_alpha = 0; //!< Lower threshold for hysteresis thresholding
double canny_beta = 1; //!< Higher threshold for hysteresis thresholding
};
struct ImageQualityOptions {
double sigma_threshold = 0.1; //!< minimum standard deviation
double sratio_threshold = 1e-4; //!< minimum spectral ratio (within annular ring)
int sratio_radius = 30; //!< radius for spectral ratio
int sratio_thickness = 5; //!< thickness for spectral ratio
};
cv::Mat binarize(const cv::Mat &image, double percentage);
cv::Mat dog(const cv::Mat &image, int ksize, double sigma1, double sigma2);
cv::Mat canny(const cv::Mat &image, int ksize, double sigma, double alpha, double beta);
cv::Mat crossCorr(const cv::Mat &image1, const cv::Mat &image2, const uint padding);
bool checkImageQuality(cv::Mat &image, ImageQualityOptions options);
cv::Point2f align(const cv::Mat &image1, const cv::Mat &image2, const struct AlignOptions opt,
bool * const ok = nullptr);
cv::Mat merge(cv::Mat image1, cv::Mat image2, cv::Point2f shift);
}
#endif // RAPID_AF_H