forked from simondlevy/UE4_OpenCV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EdgeDetection.h
46 lines (30 loc) · 822 Bytes
/
EdgeDetection.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
#pragma once
/*
* EdgeDetection.h: OpenCV demo algorithm for UnrealEngine4
*
* Copyright (C) 2017 Simon D. Levy
* MIT License
*/
#pragma once
#include "VisionAlgorithm.h"
class EdgeDetection : public VisionAlgorithm {
public:
EdgeDetection(int width, int height);
~EdgeDetection();
void draw(AHUD* hud, int leftx, int topy) override;
private:
// Arbitrary edge-detection params
const int LOW_THRESHOLD = 50;
const int RATIO = 3;
const int KERNEL_SIZE = 3;
// For drawing edges
FColor EDGE_COLOR = FColor::Green;
// Runs on its own thread
virtual void perform(void) override;
// Stores vertices computed on thread
static const int MAX_VERTICES = 1000;
cv::Point _vertices[MAX_VERTICES];
int _vertexCount;
// Helper
static int min(int a, int b) { return a < b ? a : b; }
};