-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconnected_components.h
More file actions
executable file
·40 lines (26 loc) · 1.27 KB
/
connected_components.h
File metadata and controls
executable file
·40 lines (26 loc) · 1.27 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
#ifndef connected_components_H_
#define connected_components_H_
#include <iostream>
#include <vector>
#include <tuple>
using namespace std;
#include "Image.h"
#include "Pixel.h"
class Connected_Components
{
private:
int* parent; //parent array stores the equivalences of labels using union find disjoint structure
int label_count; //keeps track of count of labels
int _height; // height of image for which connected componenet labelling should be done
int _width; // width of image for which connected componenet labelling should be done
public:
Connected_Components(); //default constructor
Connected_Components(int width,int height); //constructor
~Connected_Components(); // destructor
Connected_Components(Connected_Components const &obj); // copy constructor
Connected_Components& operator=(Connected_Components const &connect_components); //assignment operator overloading
int find(int x,int *parent); //finds root parent of x
void Union(int x,int y,int *parent,int *rank); // union two disjoint subsets x and y
void identify_labels(Image &image, const char *fileName); //identifies and colors the connected components labels of given image
};
#endif