forked from merlzbert/SkinScan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Camera.py
101 lines (79 loc) · 2.08 KB
/
Camera.py
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
85
86
87
88
89
90
91
92
93
94
95
96
from abc import abstractmethod
class Camera:
def __init__(self, exposure, white_balance, auto_focus, fps, resolution, grayscale):
# Exposure passed as float in seconds
self.exposure = exposure
# White balanced passed as a float
self.white_balance = white_balance
# Auto_focus passed as boolean
self.auto_focus = auto_focus
# FPS in float
self.fps = fps
# Resolution as tuple (Width, Height)
self.resolution = resolution
# Grayscale in boolean
self.grayscale = grayscale
# Capture object may be in cv2.capture, pypylon, PySpin etc.
self.capture = None
# Calibration object
self.calibration = None
@abstractmethod
def getImage(self):
# To override: Capture image, return frame and save in corresponding folder in specified file format
pass
@abstractmethod
def setExposure(self, exposure):
# To override
pass
@abstractmethod
def getExposure(self):
# To override
pass
@abstractmethod
def getFPS(self):
# To override
pass
@abstractmethod
def setFPS(self):
# To override
pass
@abstractmethod
def setAutoGain(self):
# To override
pass
@abstractmethod
def getGain(self):
# To override
pass
@abstractmethod
def setGain(self):
# To override
pass
@abstractmethod
def getResolution(self):
# To override
pass
@abstractmethod
def setResolution(self):
# To override
pass
@abstractmethod
def viewCameraStream(self):
# To override
pass
@abstractmethod
def quit_and_close(self):
# To override
pass
@abstractmethod
def quit_and_open(self):
# To override
pass
@abstractmethod
def getStatus(self):
# To override
pass
@abstractmethod
def setCalibration(self, calibration):
# Set the calibration object
self.calibration = calibration