35 #pragma warning(push, 0) // no warnings from includes 37 #include <opencv2/core.hpp> 38 #include <opencv2/imgproc.hpp> 42 #ifdef DLL_CORE_EXPORT 43 #define DllCoreExport Q_DECL_EXPORT 45 #define DllCoreExport Q_DECL_IMPORT 66 static cv::Mat createStructuringElement(
int seSize,
int shape);
67 static cv::Mat dilateImage(
const cv::Mat& bwImg,
int seSize,
MorphShape shape = IP::morph_square,
int borderValue = 0);
68 static cv::Mat erodeImage(
const cv::Mat& bwImg,
int seSize,
MorphShape shape = IP::morph_square,
int borderValue = 255);
71 static cv::Mat convolveIntegralImage(
const cv::Mat& src,
const int kernelSizeX,
const int kernelSizeY = 0,
MorphBorder norm = IP::border_zero);
72 static cv::Mat get1DGauss(
double sigma,
int kernelsize = -1);
74 static cv::Mat threshOtsu(
const cv::Mat& srcImg,
int thType = CV_THRESH_BINARY_INV);
75 static double getThreshOtsu(
const cv::Mat& hist,
const double otsuThresh = 0);
77 static void setBorderConst(cv::Mat &src,
float val = 0.0f);
78 static void invertImg(cv::Mat& srcImg, cv::Mat mask = cv::Mat());
79 static cv::Mat preFilterArea(
const cv::Mat& img,
int minArea,
int maxArea = -1);
80 static cv::Mat computeHist(
const cv::Mat img,
const cv::Mat mask = cv::Mat());
82 static cv::Mat estimateMask(
const cv::Mat& src,
bool preFilter =
true);
83 static void mulMask(cv::Mat& src, cv::Mat mask = cv::Mat());
84 static QPointF calcRotationSize(
double angleRad,
const QPointF& srcSize);
85 static cv::Mat rotateImage(
const cv::Mat& src,
double angleRad,
int interpolation = cv::INTER_CUBIC, cv::Scalar borderValue = cv::Scalar(0));
87 static cv::Mat invert(
const cv::Mat& src);
88 static cv::Mat grayscale(
const cv::Mat& src);
90 static cv::Mat computeHist(
const cv::Mat& data,
int width,
int numElements = -1,
double* maxBin = 0);
91 static void draw(
const std::vector<cv::Point>& pts, cv::Mat& img,
unsigned char val = 255);
93 static double statMomentMat(
const cv::Mat& src,
const cv::Mat& mask = cv::Mat(),
double momentValue = 0.5,
int maxSamples = 10000,
int area = -1);
94 static QColor statMomentColor(
const cv::Mat& src,
const cv::Mat& mask = cv::Mat(),
double momentValue = 0.5);
96 static void normalize(cv::Mat& src);
99 template<
typename sFmt,
typename mFmt>
100 static void mulMaskIntern(cv::Mat src,
const cv::Mat mask) {
102 sFmt* srcPtr = (sFmt*)src.data;
103 const mFmt* mPtr = (mFmt*)mask.data;
105 int srcStep = (int)src.step /
sizeof(sFmt);
106 int mStep = (int)mask.step /
sizeof(mFmt);
108 for (
int rIdx = 0; rIdx < src.rows; rIdx++, srcPtr += srcStep, mPtr += mStep) {
110 for (
int cIdx = 0; cIdx < src.cols; cIdx++) {
112 if (mPtr[cIdx] == 0) srcPtr[cIdx] = 0;
117 template<
typename sFmt>
118 static void setBorderConstIntern(cv::Mat src, sFmt val) {
120 sFmt* srcPtr = (sFmt*)src.data;
121 sFmt* srcPtr2 = (sFmt*)src.ptr<sFmt*>(src.rows - 1);
122 int srcStep = (int)src.step /
sizeof(sFmt);
124 for (
int cIdx = 0; cIdx < src.cols; cIdx++) {
129 srcPtr = (sFmt*)src.data;
130 for (
int rIdx = 0; rIdx < src.rows; rIdx++, srcPtr += srcStep) {
132 srcPtr[src.cols - 1] = val;
#define DllCoreExport
Definition: ImageProcessor.h:45
bool operator==(const cv::KeyPoint &kpl, const cv::KeyPoint &kpr)
Definition: ImageProcessor.cpp:45
MorphShape
Definition: ImageProcessor.h:62
Definition: ImageProcessor.h:59
Definition: Algorithms.cpp:45
MorphBorder
Definition: ImageProcessor.h:63