-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathragion_growing.h
56 lines (46 loc) · 1.1 KB
/
ragion_growing.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
51
52
53
54
55
56
#pragma once
#include<opencv2/features2d/features2d.hpp>
#include<opencv2/opencv.hpp>
#include<iostream>
#include<stack>
#define RGB_CENTER(i) src.at<Vec3b>(center)[i]
#define RGB_ESTIMATE(i) src.at<Vec3b>(est_point)[i]
using namespace std;
using namespace cv;
class Region_Growing
{
private:
Point PointShift2D[8] =
{
cv::Point(1, 0),
cv::Point(1, -1),
cv::Point(0, -1),
cv::Point(-1, -1),
cv::Point(-1, 0),
cv::Point(-1, 1),
cv::Point(0, 1),
cv::Point(1, 1)
};
cv::Mat src;//picture input
cv::Mat dest;//picture output
cv::Mat mask;//picture output
int threshold;
int max_region_num;
double min_region_num_factor;
int min_region_area;
Point center;
Point est_point;
int circle=0;
stack<cv::Point> seed_stack;
int delta;
int event, x, y, flags;
Point recent_point;
uchar marker;
public:
Region_Growing();
Region_Growing(Mat& input);
~Region_Growing();
void grow(Mat& src, Mat& dest, Mat& mask, Point seed, int threshold);
void click(int event,int x,int y,int flags,void*);
int deal_region();
};