-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvials.h
More file actions
52 lines (42 loc) · 1.08 KB
/
vials.h
File metadata and controls
52 lines (42 loc) · 1.08 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
47
48
49
50
51
52
#ifndef VIALS_H
#define VIALS_H
#include <vector>
#include <math.h>
#include "dbscan/constants.h"
#include <opencv2/opencv.hpp>
typedef cv::Vec3b Color;
struct Vial
{
std::vector<cv::Point> pts;
cv::Point center;
int area;
int radius;
int flyCount;
cv::Mat flyPixels;
std::vector<Cluster> labels;
std::map<int, int> clusterSizes;
Vial():
center(cv::Point(0,0)),
flyCount(0)
{}
Vial(const std::vector<cv::Point>& points)
:
pts(points),
center(cv::Point(0,0)),
flyCount(0)
{
// Compute mean and radius
for(cv::Point point : points)
center += point;
center.x /= points.size();
center.y /= points.size();
area = cv::contourArea(pts);
radius = sqrt(area/M_PI);
}
};
typedef std::vector<Vial> Vials;
static const int VIAL_TOLERANCE = 20; //px
bool compareVials(const Vial& first, const Vial& second);
cv::Mat drawVials(const Vials& vials, const cv::Mat& image);
Vials findVials(const cv::Mat& image, int vialSize);
#endif // VIALS_H