-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathshared-args.ts
More file actions
182 lines (155 loc) · 5.58 KB
/
shared-args.ts
File metadata and controls
182 lines (155 loc) · 5.58 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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
import { StillOptions } from './still-camera';
import { StreamOptions } from './stream-camera';
import { Flip } from '..';
/**
* Get the command line arguments for `raspistill` or `raspivid` that are common among both
*
* @param options Camera options
*/
export function getSharedArgs(options: StillOptions | StreamOptions): string[] {
return [
/**
* Width
*/
...(options.width ? ['--width', options.width.toString()] : []),
/**
* Height
*/
...(options.height ? ['--height', options.height.toString()] : []),
/**
* Rotation
*/
...(options.rotation ? ['--rotation', options.rotation.toString()] : []),
/**
* Horizontal flip
*/
...(options.flip && (options.flip === Flip.Horizontal || options.flip === Flip.Both)
? ['--hflip']
: []),
/**
* Vertical flip
*/
...(options.flip && (options.flip === Flip.Vertical || options.flip === Flip.Both)
? ['--vflip']
: []),
/**
* Shutter Speed
*/
...(options.shutter ? ['--shutter', options.shutter.toString()] : []),
/**
* Sharpness (-100 to 100; default 0)
*/
...(options.sharpness ? ['--sharpness', options.sharpness.toString()] : []),
/**
* Contrast (-100 to 100; default 0)
*/
...(options.contrast ? ['--contrast', options.contrast.toString()] : []),
/**
* Brightness (0 to 100; default 50)
*/
...(options.brightness || options.brightness === 0
? ['--brightness', options.brightness.toString()]
: []),
/**
* Saturation (-100 to 100; default 0)
*/
...(options.saturation ? ['--saturation', options.saturation.toString()] : []),
/**
* ISO (100 to 800)
*/
...(options.iso ? ['--ISO', options.iso.toString()] : []),
/**
* EV Compensation (-10 to 10; default 0)
*/
...(options.exposureCompensation ? ['--ev', options.exposureCompensation.toString()] : []),
/**
* Exposure Mode
*/
...(options.exposureMode ? ['--exposure', options.exposureMode.toString()] : []),
/**
* Auto White Balance Mode
*/
...(options.awbMode ? ['--awb', options.awbMode.toString()] : []),
/**
* Sets the blue and red channel gains if awbMode is Off
*/
...(options.awbGains ? ['--awbgains', options.awbGains.toString()] : []),
/**
* Analog Gain
* Sets the analog gain value directly on the sensor (floating point value from
* 1.0 to 8.0 for the OV5647 sensor on Camera Module V1, and 1.0 to 12.0 for the
* IMX219 sensor on Camera Module V2 and the IMX447 on the HQ Camera).
*/
...(options.analogGain ? ['--analoggain', options.analogGain.toString()] : []),
/**
* Digital Gain
* Sets the digital gain value applied by the ISP
* (floating point value from 1.0 to 64.0,
* but values over about 4.0 willproduce overexposed images)
*/
...(options.digitalGain ? ['--digitalgain', options.digitalGain.toString()] : []),
/**
* Image Effect
*/
...(options.imageEffectMode ? ['--imxfx', options.imageEffectMode.toString()] : []),
/**
* Dynamic Range Control
*/
...(options.dynamicRange ? ['--drc', options.dynamicRange] : []),
/**
* Color Effects
* The supplied U and V parameters (range 0 to 255) are applied to
* the U and Y channels of the image. For example, --colfx 128:128
* should result in a monochrome image.
*/
...(options.colorEffect ? ['--colfx', options.colorEffect.join(':')] : []),
/**
* Metering
* Specify the metering mode used for the preview and capture.
*/
...(options.meteringMode ? ['--metering', options.meteringMode] : []),
/**
* Flicker Avoid Mode
* Set a mode to compensate for lights flickering at the mains frequency,
* which can be seen as a dark horizontal band across an image.
* Flicker avoidance locks the exposure time to a multiple of the mains
* flicker frequency (8.33ms for 60Hz, or 10ms for 50Hz).
* This means that images can be noisier as the control algorithm has to
* increase the gain instead of exposure time should it wish for an
* intermediate exposure value. auto can be confused by external factors,
* therefore it is preferable to leave this setting off unless actually required.
*/
...(options.flickerMode ? ['--flicker', options.flickerMode] : []),
/**
* Video Stabilization
* In video mode only, turn on video stabilization.
*/
...(options.videoStabilization ? ['--vstab'] : []),
/**
* Statistics
* Force recomputation of statistics on stills capture pass. Digital gain and AWB are
* recomputed based on the actual capture frame statistics,
* rather than the preceding preview frame.
*/
...(options.statistics ? ['--stats'] : []),
/**
* Sensor region of interest
* Allows the specification of the area of the sensor to be used as
* the source for the preview and capture. This is defined as x,y for
* the top left corner, and a width and height, all values in
* normalised coordinates (0.0-1.0).
*/
...(options.roi ? ['--roi', options.roi.toString()] : []),
/**
* Annotate
* Adds some text and/or metadata to the picture.
*/
...(options.annotate ? options.annotate.flatMap(e => ['--annotate', e.toString()]) : []),
/**
* Annotate extra
* Specifies annotation size, text colour, and background color.
* Colors are in hex YUV format. Size ranges from 6 - 160; default is 32
*/
...(options.annotateExtra ? ['--annotateex', options.annotateExtra.toString()] : []),
];
}