forked from taygunk/multiple-tracking-master
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlobDetectionEngine.h
73 lines (70 loc) · 2.17 KB
/
BlobDetectionEngine.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef BLOB_ENGINE_H
#define BLOB_ENGINE_H
#include "Environment.h"
#include "Hypothesis.h"
#include "BgSubEngine.h"
#include <cxcore.h>
#include <highgui.h>
#include <iostream>
#include <stdio.h>
#define NO_REGION -1
class BlobDetectionEngine{
//Variables
public:
CvFont font;
char text[50];
IplImage *visualImg; // Output Image for drawing
//Blobs
CvPoint cent1;
CvPoint cent2;
CvMemStorage *mem;
static const int maxBlobNum = 200;
CvSeq *contours, *ptr;
int numOfFiltCont;
CvSeq **filtCont;
//Regions
CvRect regRect[30];
short regionList[maxBlobNum];
int numOfRegions;
float r1, r2;
int minAreaFilter;
//Hypothesis and Correspondence
vector<Hypothesis> hyp_t;
vector<Hypothesis> hyp_t_1;
float **corMatrix; // Correspondence Matrix
int curHypNum; // at time t , we have some new hypothesis
int preHypNum; // at time t-1, we have some old hypothesis
CvScalar colors[10];
//Methods
private:
FILE *trackFp;
bool hypClicked;
bool hypUpdated;
int tx,ty;
public:
int frameIdx;
BlobDetectionEngine(IplImage *visualImg);
void setColors();
void fillZero(float **mat, int size);
void userClick(bool *hypClick, bool *hypUpdate, int *tx, int *ty);
double find_eu_distance(const CvPoint& point_one, const CvPoint& point_two);
void setAreaConstraint(int area);
void findBlobs(IplImage *grayImg, bool drawBlobs);
void blobToRegions();
//Experimental Methods {Ongoing Research}
void runMatching(bool **bgMask, int ****bins, int *time); //Update color needs intel from background subtraction histogram bins
void fillColorToRegion(int regionId, float *hist1, float *hist2); //Paint all pixels to Blue(hist1match) or Red(Hist2match)
void alternateMatching(bool **bgMask, int ***bins);
void createHypothesis(bool **bgMask, int ****bins, int *time);
void createHypothesis(bool **bgMask, int ***bins);
void runBasicMatching(bool **bgMask, int ****bins, int *time);
int findIdxOfHyp(int idd);
void eventResolve();
void setLogger(FILE *logger);
//void pixelClassEvaluate(bool **bgMask, int ****bins, int *time);
void pixelClassEvaluate(bool **mask, int ***bins);
void printIterator (int i);
void presentate(IplImage *hypOnly);
void debugPixel(int y, int x, int ***bins);
};
#endif