-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage_processing.hpp
More file actions
47 lines (34 loc) · 1.07 KB
/
Copy pathimage_processing.hpp
File metadata and controls
47 lines (34 loc) · 1.07 KB
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
#pragma once
#include <opencv2/opencv.hpp>
cv::Mat removeBackground(const cv::Mat &img, const cv::Mat &backgroundImg);
cv::Mat cropSquarePatch(const cv::Mat& src, cv::Point2f center, int cropSize);
cv::Mat normalizeTopPercentile(const cv::Mat& src, float topPercent);
std::vector<cv::Point2f> detectBlobs(
cv::Mat img,
int minPixelWidth,
int maxPixelWidth,
bool findRound,
int colour = 255
);
cv::RotatedRect findBlobEllipse(const cv::Mat& src, int minArea, int maxArea);
struct PreprocessStages {
cv::Mat gray;
cv::Mat blurred;
cv::Mat normalized;
cv::Mat thresholded;
};
PreprocessStages generatePreprocessedStages(
const cv::Mat& src,
int blurSize,
float normalizeTopPercent,
int thresholdBias
);
// ---DEBUG---
void drawPoints(
cv::Mat& image,
const std::vector<cv::Point2f>& points,
cv::Scalar colour = cv::Scalar(0, 0, 255),
bool diffColour = false
);
void drawEllipseDetection(cv::Mat& image, cv::RotatedRect ellipse);
cv::Mat maskImageWithEllipse(const cv::Mat& src, const cv::RotatedRect& ellipse);