hornetseye-v4l2 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/ext/v4l2input.cc +0 -1
- data/lib/hornetseye-v4l2/docs.rb +538 -0
- data/lib/hornetseye-v4l2/v4l2input.rb +17 -0
- metadata +3 -2
data/README.md
CHANGED
@@ -39,7 +39,7 @@ You can open a V4L2-compatible camera as shown below. This example will open the
|
|
39
39
|
require 'hornetseye_v4l2'
|
40
40
|
require 'hornetseye_xorg'
|
41
41
|
include Hornetseye
|
42
|
-
camera = V4L2Input.new '/dev/
|
42
|
+
camera = V4L2Input.new '/dev/video0' do |modes|
|
43
43
|
modes.each_with_index { |mode,i| puts "#{i + 1}: #{mode}" }
|
44
44
|
modes[ STDIN.readline.to_i - 1 ]
|
45
45
|
end
|
data/Rakefile
CHANGED
data/ext/v4l2input.cc
CHANGED
@@ -0,0 +1,538 @@
|
|
1
|
+
# hornetseye-xorg - Graphical output under X.Org
|
2
|
+
# Copyright (C) 2010 Jan Wedekind
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
# Namespace of Hornetseye computer vision library
|
18
|
+
module Hornetseye
|
19
|
+
|
20
|
+
# Class for handling a V4L2-compatible camera
|
21
|
+
#
|
22
|
+
# @see http://v4l2spec.bytesex.org/spec-single/v4l2.html
|
23
|
+
class V4L2Input
|
24
|
+
|
25
|
+
class << self
|
26
|
+
|
27
|
+
# Video mode
|
28
|
+
#
|
29
|
+
# @private
|
30
|
+
MODE_RGB332 = nil
|
31
|
+
|
32
|
+
# Video mode
|
33
|
+
#
|
34
|
+
# @private
|
35
|
+
MODE_RGB444 = nil
|
36
|
+
|
37
|
+
# Video mode
|
38
|
+
#
|
39
|
+
# @private
|
40
|
+
MODE_RGB555 = nil
|
41
|
+
|
42
|
+
# Video mode
|
43
|
+
#
|
44
|
+
# @private
|
45
|
+
MODE_RGB565 = nil
|
46
|
+
|
47
|
+
# Video mode
|
48
|
+
#
|
49
|
+
# @private
|
50
|
+
MODE_RGB555X = nil
|
51
|
+
|
52
|
+
# Video mode
|
53
|
+
#
|
54
|
+
# @private
|
55
|
+
MODE_RGB565X = nil
|
56
|
+
|
57
|
+
# Video mode
|
58
|
+
#
|
59
|
+
# @private
|
60
|
+
MODE_BGR24 = nil
|
61
|
+
|
62
|
+
# Video mode
|
63
|
+
#
|
64
|
+
# @private
|
65
|
+
MODE_RGB24 = nil
|
66
|
+
|
67
|
+
# Video mode
|
68
|
+
#
|
69
|
+
# @private
|
70
|
+
MODE_BGR32 = nil
|
71
|
+
|
72
|
+
# Video mode
|
73
|
+
#
|
74
|
+
# @private
|
75
|
+
MODE_RGB32 = nil
|
76
|
+
|
77
|
+
# Video mode
|
78
|
+
#
|
79
|
+
# @private
|
80
|
+
MODE_GREY = nil
|
81
|
+
|
82
|
+
# Video mode
|
83
|
+
#
|
84
|
+
# @private
|
85
|
+
MODE_Y16 = nil
|
86
|
+
|
87
|
+
# Video mode
|
88
|
+
#
|
89
|
+
# @private
|
90
|
+
MODE_PAL8 = nil
|
91
|
+
|
92
|
+
# Video mode
|
93
|
+
#
|
94
|
+
# @private
|
95
|
+
MODE_YVU410 = nil
|
96
|
+
|
97
|
+
# Video mode
|
98
|
+
#
|
99
|
+
# @private
|
100
|
+
MODE_YVU420 = nil
|
101
|
+
|
102
|
+
# Video mode
|
103
|
+
#
|
104
|
+
# @private
|
105
|
+
MODE_YUYV = nil
|
106
|
+
|
107
|
+
# Video mode
|
108
|
+
#
|
109
|
+
# @private
|
110
|
+
MODE_YYUV = nil
|
111
|
+
|
112
|
+
# Video mode
|
113
|
+
#
|
114
|
+
# @private
|
115
|
+
MODE_YVYU = nil
|
116
|
+
|
117
|
+
# Video mode
|
118
|
+
#
|
119
|
+
# @private
|
120
|
+
MODE_UYVY = nil
|
121
|
+
|
122
|
+
# Video mode
|
123
|
+
#
|
124
|
+
# @private
|
125
|
+
MODE_VYUY = nil
|
126
|
+
|
127
|
+
# Video mode
|
128
|
+
#
|
129
|
+
# @private
|
130
|
+
MODE_YUV422P = nil
|
131
|
+
|
132
|
+
# Video mode
|
133
|
+
#
|
134
|
+
# @private
|
135
|
+
MODE_YUV411P = nil
|
136
|
+
|
137
|
+
# Video mode
|
138
|
+
#
|
139
|
+
# @private
|
140
|
+
MODE_Y41P = nil
|
141
|
+
|
142
|
+
# Video mode
|
143
|
+
#
|
144
|
+
# @private
|
145
|
+
MODE_YUV444 = nil
|
146
|
+
|
147
|
+
# Video mode
|
148
|
+
#
|
149
|
+
# @private
|
150
|
+
MODE_YUV555 = nil
|
151
|
+
|
152
|
+
# Video mode
|
153
|
+
#
|
154
|
+
# @private
|
155
|
+
MODE_YUV565 = nil
|
156
|
+
|
157
|
+
# Video mode
|
158
|
+
#
|
159
|
+
# @private
|
160
|
+
MODE_YUV32 = nil
|
161
|
+
|
162
|
+
# Video mode
|
163
|
+
#
|
164
|
+
# @private
|
165
|
+
MODE_YUV410 = nil
|
166
|
+
|
167
|
+
# Video mode
|
168
|
+
#
|
169
|
+
# @private
|
170
|
+
MODE_YUV420 = nil
|
171
|
+
|
172
|
+
# Video mode
|
173
|
+
#
|
174
|
+
# @private
|
175
|
+
MODE_HI240 = nil
|
176
|
+
|
177
|
+
# Video mode
|
178
|
+
#
|
179
|
+
# @private
|
180
|
+
MODE_HM12 = nil
|
181
|
+
|
182
|
+
# Video mode
|
183
|
+
#
|
184
|
+
# @private
|
185
|
+
MODE_NV12 = nil
|
186
|
+
|
187
|
+
# Video mode
|
188
|
+
#
|
189
|
+
# @private
|
190
|
+
MODE_NV21 = nil
|
191
|
+
|
192
|
+
# Video mode
|
193
|
+
#
|
194
|
+
# @private
|
195
|
+
MODE_NV16 = nil
|
196
|
+
|
197
|
+
# Video mode
|
198
|
+
#
|
199
|
+
# @private
|
200
|
+
MODE_NV61 = nil
|
201
|
+
|
202
|
+
# Video mode
|
203
|
+
#
|
204
|
+
# @private
|
205
|
+
MODE_SBGGR8 = nil
|
206
|
+
|
207
|
+
# Video mode
|
208
|
+
#
|
209
|
+
# @private
|
210
|
+
MODE_SGBRG8 = nil
|
211
|
+
|
212
|
+
# Video mode
|
213
|
+
#
|
214
|
+
# @private
|
215
|
+
MODE_SGRBG8 = nil
|
216
|
+
|
217
|
+
# Video mode
|
218
|
+
#
|
219
|
+
# @private
|
220
|
+
MODE_SGRBG10 = nil
|
221
|
+
|
222
|
+
# Video mode
|
223
|
+
#
|
224
|
+
# @private
|
225
|
+
MODE_SGRBG10DPCM8 = nil
|
226
|
+
|
227
|
+
# Video mode
|
228
|
+
#
|
229
|
+
# @private
|
230
|
+
MODE_SBGGR16 = nil
|
231
|
+
|
232
|
+
# Video mode
|
233
|
+
#
|
234
|
+
# @private
|
235
|
+
MODE_MJPEG = nil
|
236
|
+
|
237
|
+
# Video mode
|
238
|
+
#
|
239
|
+
# @private
|
240
|
+
MODE_JPEG = nil
|
241
|
+
|
242
|
+
# Video mode
|
243
|
+
#
|
244
|
+
# @private
|
245
|
+
MODE_DV = nil
|
246
|
+
|
247
|
+
# Video mode
|
248
|
+
#
|
249
|
+
# @private
|
250
|
+
MODE_MPEG = nil
|
251
|
+
|
252
|
+
# Video mode
|
253
|
+
#
|
254
|
+
# @private
|
255
|
+
MODE_WNVA = nil
|
256
|
+
|
257
|
+
# Video mode
|
258
|
+
#
|
259
|
+
# @private
|
260
|
+
MODE_SN9C10X = nil
|
261
|
+
|
262
|
+
# Video mode
|
263
|
+
#
|
264
|
+
# @private
|
265
|
+
MODE_SN9C20X_I420 = nil
|
266
|
+
|
267
|
+
# Video mode
|
268
|
+
#
|
269
|
+
# @private
|
270
|
+
MODE_PWC1 = nil
|
271
|
+
|
272
|
+
# Video mode
|
273
|
+
#
|
274
|
+
# @private
|
275
|
+
MODE_PWC2 = nil
|
276
|
+
|
277
|
+
# Video mode
|
278
|
+
#
|
279
|
+
# @private
|
280
|
+
MODE_ET61X251 = nil
|
281
|
+
|
282
|
+
# Video mode
|
283
|
+
#
|
284
|
+
# @private
|
285
|
+
MODE_SPCA501 = nil
|
286
|
+
|
287
|
+
# Video mode
|
288
|
+
#
|
289
|
+
# @private
|
290
|
+
MODE_SPCA505 = nil
|
291
|
+
|
292
|
+
# Video mode
|
293
|
+
#
|
294
|
+
# @private
|
295
|
+
MODE_SPCA508 = nil
|
296
|
+
|
297
|
+
# Video mode
|
298
|
+
#
|
299
|
+
# @private
|
300
|
+
MODE_SPCA561 = nil
|
301
|
+
|
302
|
+
# Video mode
|
303
|
+
#
|
304
|
+
# @private
|
305
|
+
MODE_PAC207 = nil
|
306
|
+
|
307
|
+
# Video mode
|
308
|
+
#
|
309
|
+
# @private
|
310
|
+
MODE_MR97310A = nil
|
311
|
+
|
312
|
+
# Video mode
|
313
|
+
#
|
314
|
+
# @private
|
315
|
+
MODE_SQ905C = nil
|
316
|
+
|
317
|
+
# Video mode
|
318
|
+
#
|
319
|
+
# @private
|
320
|
+
MODE_PJPG = nil
|
321
|
+
|
322
|
+
# Video mode
|
323
|
+
#
|
324
|
+
# @private
|
325
|
+
MODE_OV511 = nil
|
326
|
+
|
327
|
+
# Video mode
|
328
|
+
#
|
329
|
+
# @private
|
330
|
+
MODE_OV518 = nil
|
331
|
+
|
332
|
+
# Feature type
|
333
|
+
TYPE_INTEGER = nil
|
334
|
+
|
335
|
+
# Feature type
|
336
|
+
TYPE_BOOLEAN = nil
|
337
|
+
|
338
|
+
# Feature type
|
339
|
+
TYPE_MENU = nil
|
340
|
+
|
341
|
+
# Feature type
|
342
|
+
TYPE_BUTTON = nil
|
343
|
+
|
344
|
+
# Feature type
|
345
|
+
TYPE_CTRL_CLASS = nil
|
346
|
+
|
347
|
+
# First feature
|
348
|
+
FEATURE_BASE = nil
|
349
|
+
|
350
|
+
# First custom feature
|
351
|
+
FEATURE_USER_BASE = nil
|
352
|
+
|
353
|
+
# First standard feature
|
354
|
+
FEATURE_PRIVATE_BASE = nil
|
355
|
+
|
356
|
+
# A feature
|
357
|
+
FEATURE_BRIGHTNESS = nil
|
358
|
+
|
359
|
+
# A feature
|
360
|
+
FEATURE_CONTRAST = nil
|
361
|
+
|
362
|
+
# A feature
|
363
|
+
FEATURE_SATURATION = nil
|
364
|
+
|
365
|
+
# A feature
|
366
|
+
FEATURE_HUE = nil
|
367
|
+
|
368
|
+
# A feature
|
369
|
+
FEATURE_AUDIO_VOLUME = nil
|
370
|
+
|
371
|
+
# A feature
|
372
|
+
FEATURE_AUDIO_BALANCE = nil
|
373
|
+
|
374
|
+
# A feature
|
375
|
+
FEATURE_AUDIO_BASS = nil
|
376
|
+
|
377
|
+
# A feature
|
378
|
+
FEATURE_AUDIO_TREBLE = nil
|
379
|
+
|
380
|
+
# A feature
|
381
|
+
FEATURE_AUDIO_MUTE = nil
|
382
|
+
|
383
|
+
# A feature
|
384
|
+
FEATURE_AUDIO_LOUDNESS = nil
|
385
|
+
|
386
|
+
# A feature
|
387
|
+
FEATURE_BLACK_LEVEL = nil
|
388
|
+
|
389
|
+
# A feature
|
390
|
+
FEATURE_AUTO_WHITE_BALANCE = nil
|
391
|
+
|
392
|
+
# A feature
|
393
|
+
FEATURE_DO_WHITE_BALANCE = nil
|
394
|
+
|
395
|
+
# A feature
|
396
|
+
FEATURE_RED_BALANCE = nil
|
397
|
+
|
398
|
+
# A feature
|
399
|
+
FEATURE_BLUE_BALANCE = nil
|
400
|
+
|
401
|
+
# A feature
|
402
|
+
FEATURE_GAMMA = nil
|
403
|
+
|
404
|
+
# A feature
|
405
|
+
FEATURE_WHITENESS = nil
|
406
|
+
|
407
|
+
# A feature
|
408
|
+
FEATURE_EXPOSURE = nil
|
409
|
+
|
410
|
+
# A feature
|
411
|
+
FEATURE_AUTOGAIN = nil
|
412
|
+
|
413
|
+
# A feature
|
414
|
+
FEATURE_GAIN = nil
|
415
|
+
|
416
|
+
# A feature
|
417
|
+
FEATURE_HFLIP = nil
|
418
|
+
|
419
|
+
# A feature
|
420
|
+
FEATURE_VFLIP = nil
|
421
|
+
|
422
|
+
# A feature
|
423
|
+
FEATURE_HCENTER = nil
|
424
|
+
|
425
|
+
# A feature
|
426
|
+
FEATURE_VCENTER = nil
|
427
|
+
|
428
|
+
# A feature
|
429
|
+
FEATURE_LASTP1 = nil
|
430
|
+
|
431
|
+
# Close the video device
|
432
|
+
#
|
433
|
+
# @return [V4L2Input] Returns +self+.
|
434
|
+
def close
|
435
|
+
end
|
436
|
+
|
437
|
+
# Read a video frame
|
438
|
+
#
|
439
|
+
# @return [MultiArray,Frame_] The video frame.
|
440
|
+
def read
|
441
|
+
end
|
442
|
+
|
443
|
+
# Check whether device is not closed
|
444
|
+
#
|
445
|
+
# @return [Boolean] Returns +true+ as long as device is open.
|
446
|
+
def status?
|
447
|
+
end
|
448
|
+
|
449
|
+
# Width of video input
|
450
|
+
#
|
451
|
+
# @return [Integer] Width of video frames.
|
452
|
+
def width
|
453
|
+
end
|
454
|
+
|
455
|
+
# Height of video input
|
456
|
+
#
|
457
|
+
# @return [Integer] Width of video frames.
|
458
|
+
def height
|
459
|
+
end
|
460
|
+
|
461
|
+
# Check for existence of feature
|
462
|
+
#
|
463
|
+
# @param [Integer] id Feature identifier.
|
464
|
+
#
|
465
|
+
# @return [Boolean] Returns +true+ if this feature is supported.
|
466
|
+
def feature_exist?( id )
|
467
|
+
end
|
468
|
+
|
469
|
+
# Get value of feature
|
470
|
+
#
|
471
|
+
# @param [Integer] id Feature identifier.
|
472
|
+
#
|
473
|
+
# @return [Integer] Current value of feature.
|
474
|
+
def feature_read( id )
|
475
|
+
end
|
476
|
+
|
477
|
+
# Set value of feature
|
478
|
+
#
|
479
|
+
# @param [Integer] id Feature identifier.
|
480
|
+
#
|
481
|
+
# @return [Integer] Returns +value+.
|
482
|
+
def feature_write( id, value )
|
483
|
+
end
|
484
|
+
|
485
|
+
# Get type of feature
|
486
|
+
#
|
487
|
+
# @param [Integer] id Feature identifier.
|
488
|
+
#
|
489
|
+
# @return [Integer] Type of feature.
|
490
|
+
def feature_type( id )
|
491
|
+
end
|
492
|
+
|
493
|
+
# Get name of feature
|
494
|
+
#
|
495
|
+
# @param [Integer] id Feature identifier.
|
496
|
+
#
|
497
|
+
# @return [String] Name of feature.
|
498
|
+
def feature_name( id )
|
499
|
+
end
|
500
|
+
|
501
|
+
# Get minimum value of feature
|
502
|
+
#
|
503
|
+
# @param [Integer] id Feature identifier.
|
504
|
+
#
|
505
|
+
# @return [Integer] Minimum value.
|
506
|
+
def feature_min( id )
|
507
|
+
end
|
508
|
+
|
509
|
+
# Get maximum value of feature
|
510
|
+
#
|
511
|
+
# @param [Integer] id Feature identifier.
|
512
|
+
#
|
513
|
+
# @return [Integer] Maximum value.
|
514
|
+
def feature_max( id )
|
515
|
+
end
|
516
|
+
|
517
|
+
# Get step size of feature
|
518
|
+
#
|
519
|
+
# @param [Integer] id Feature identifier.
|
520
|
+
#
|
521
|
+
# @return [Integer] Step size.
|
522
|
+
def feature_step( id )
|
523
|
+
end
|
524
|
+
|
525
|
+
# Get default value of feature
|
526
|
+
#
|
527
|
+
# @param [Integer] id Feature identifier.
|
528
|
+
#
|
529
|
+
# @return [Integer] Default value.
|
530
|
+
def feature_default_value( id )
|
531
|
+
end
|
532
|
+
|
533
|
+
end
|
534
|
+
|
535
|
+
end
|
536
|
+
|
537
|
+
end
|
538
|
+
|
@@ -17,12 +17,29 @@
|
|
17
17
|
# Namespace of Hornetseye computer vision library
|
18
18
|
module Hornetseye
|
19
19
|
|
20
|
+
# Class for handling a V4L2-compatible camera
|
21
|
+
#
|
22
|
+
# @see http://v4l2spec.bytesex.org/spec-single/v4l2.html
|
20
23
|
class V4L2Input
|
21
24
|
|
22
25
|
class << self
|
23
26
|
|
24
27
|
alias_method :orig_new, :new
|
25
28
|
|
29
|
+
# Open a camera device for input
|
30
|
+
#
|
31
|
+
# The device is opened and a list of supported resolutions is handed back as
|
32
|
+
# parameter to the code block. The code block must return the selected mode
|
33
|
+
# so that initialisation can be completed.
|
34
|
+
#
|
35
|
+
# @example Open a camera device
|
36
|
+
# require 'hornetseye_v4l2'
|
37
|
+
# include Hornetseye
|
38
|
+
# camera = V4L2Input.new { |modes| modes.last }
|
39
|
+
#
|
40
|
+
# @param [String] device The device file name.
|
41
|
+
# @param [Proc] action A block for selecting the desired video mode.
|
42
|
+
# @return [V4L2Input] An object for accessing the camera.
|
26
43
|
def new( device = '/dev/video0', &action )
|
27
44
|
orig_new device do |modes|
|
28
45
|
map = { MODE_UYVY => UYVY,
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jan Wedekind
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- COPYING
|
87
87
|
- .document
|
88
88
|
- lib/hornetseye-v4l2/v4l2input.rb
|
89
|
+
- lib/hornetseye-v4l2/docs.rb
|
89
90
|
- lib/hornetseye_v4l2_ext.rb
|
90
91
|
- ext/v4l2input.cc
|
91
92
|
- ext/v4l2select.cc
|