-
Notifications
You must be signed in to change notification settings - Fork 0
/
VisionLib.h
85 lines (78 loc) · 2.28 KB
/
VisionLib.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
74
75
76
77
78
79
80
81
82
83
84
#ifndef VISIONLIB_H
#define VISIONLIB_H
/**
* @file VisionLib.h
* Main library header.
* @note More exports are found in TargetDetector.
*/
#include "CamFeed.h"
#include "TargetDetector.h"
/**
* Instance of vision system.
*/
class InstanceStore {
public:
/**
* InstanceStore constructor.
* @param cam CamFeed input source.
*/
InstanceStore(CamFeed * cam);
/**
* InstanceStore destructor.
*/
virtual ~InstanceStore();
/**
* CamFeed reference.
*/
CamFeed & feed;
/**
* cv::Mat for storage of the current frame.
*/
Mat imageStore;
/**
* TargetDetector instance.
*/
TargetDetector * detector;
};
#ifdef __cplusplus
extern "C" {
#endif
/**
* Starts the vision system from a feed path.
* @param feedPath URI of feed source.
* @returns InstanceStore for current vision system instance.
* @note See CamFeed::CamFeed(const char * feedPath) for details on URI specification.
*/
InstanceStore * initFeed(const char * feedPath);
/**
* Starts the vision system with a USB camera.
* @param camIndex Index of the camera to use.
* @returns InstanceStore for current vision system instance.
* @note See CamFeed::CamFeed(int camIndex) for details on camera indexes.
*/
InstanceStore * initCamera(int camIndex);
/**
* Sets the thresholding cuttoff value.
* If not run, the value will default to 234.
* @param store Pointer to the store returned by initFeed() or initCamera().
* @param newThreshold The new threshold value - takes values 0-255 (inclusive).
* @returns true if operation was successful, false if newThreshold was invalid or if store is null.
* @note Try to have this as close to 255 as possible while still being able to detect the target reliably.
* @note Can be changed multiple times.
*/
bool setThreshold(InstanceStore * store, int newThreshold);
/**
* Process a new frame for vision.
* @param store Pointer to the store returned by initFeed() or initCamera().
* @returns LineResult Output of vision system.
*/
LineResult processFrame(InstanceStore * store);
/**
* Close/release the camera and deallocate all used memory.
* @param store Pointer to the store returned by initFeed() or initCamera().
*/
void closeCamera(InstanceStore * store);
#ifdef __cplusplus
}
#endif
#endif /* VISIONLIB_H */