Class: Hornetseye::DC1394Input
- Includes:
- ReaderConversion
- Defined in:
- docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb,
docs/hornetseye-dc1394/lib/hornetseye-dc1394/dc1394input.rb
Overview
Class for handling a DC1394-compatible firewire camera
This Ruby-extension is based on libdc1394.
Constant Summary collapse
- SPEED_100 =
Firewire bus speed
nil
- SPEED_200 =
Firewire bus speed
nil
- SPEED_400 =
Firewire bus speed
nil
- SPEED_800 =
Firewire bus speed
nil
- SPEED_1600 =
Firewire bus speed
nil
- SPEED_3200 =
Firewire bus speed
nil
- FRAMERATE_1_875 =
Frame rate
nil
- FRAMERATE_3_75 =
Frame rate
nil
- FRAMERATE_7_5 =
Frame rate
nil
- FRAMERATE_15 =
Frame rate
nil
- FRAMERATE_30 =
Frame rate
nil
- FRAMERATE_60 =
Frame rate
nil
- FRAMERATE_120 =
Frame rate
nil
- FRAMERATE_240 =
Frame rate
nil
- FEATURE_MIN =
First feature
nil
- FEATURE_BRIGHTNESS =
A feature
nil
- FEATURE_EXPOSURE =
A feature
nil
- FEATURE_SHARPNESS =
A feature
nil
- FEATURE_WHITE_BALANCE =
A feature
nil
- FEATURE_HUE =
A feature
nil
- FEATURE_SATURATION =
A feature
nil
- FEATURE_GAMMA =
A feature
nil
- FEATURE_SHUTTER =
A feature
nil
- FEATURE_GAIN =
A feature
nil
- FEATURE_IRIS =
A feature
nil
- FEATURE_FOCUS =
A feature
nil
- FEATURE_TEMPERATURE =
A feature
nil
- FEATURE_TRIGGER =
A feature
nil
- FEATURE_TRIGGER_DELAY =
A feature
nil
- FEATURE_WHITE_SHADING =
A feature
nil
- FEATURE_FRAME_RATE =
A feature
nil
- FEATURE_ZOOM =
A feature
nil
- FEATURE_PAN =
A feature
nil
- FEATURE_TILT =
A feature
nil
- FEATURE_OPTICAL_FILTER =
A feature
nil
- FEATURE_CAPTURE_SIZE =
A feature
nil
- FEATURE_CAPTURE_QUALITY =
A feature
nil
- FEATURE_MAX =
Last feature
nil
- FEATURE_MODE_MANUAL =
Feature mode
nil
- FEATURE_MODE_AUTO =
Feature mode
nil
- FEATURE_MODE_ONE_PUSH_AUTO =
Feature mode
nil
Class Method Summary collapse
-
.new(node = 0, speed = SPEED_400, frame_rate = nil, &action) ⇒ Object
Open the firewire camera.
Instance Method Summary collapse
-
#close ⇒ DC1394Input
Close the video device.
-
#feature_exist?(id) ⇒ Boolean
Check for existence of feature.
-
#feature_max(id) ⇒ Integer
Get maximum value of feature.
-
#feature_min(id) ⇒ Integer
Get minimum value of feature.
-
#feature_mode_read(id) ⇒ Integer
Get current mode of feature.
-
#feature_mode_write(id, mode) ⇒ Integer
Set mode of feature.
-
#feature_modes(id) ⇒ Array<Integer>
Get supported modes of feature.
-
#feature_on(id, value) ⇒ Boolean
Switch feature on or off.
-
#feature_on?(id) ⇒ Boolean
Check whether feature is switched on.
-
#feature_read(id) ⇒ Integer
Get value of feature.
-
#feature_readable?(id) ⇒ Boolean
Check whether feature can be read.
-
#feature_switchable?(id) ⇒ Boolean
Check whether feature can be switched on and off.
-
#feature_write(id, value) ⇒ Integer
Set value of feature.
-
#height ⇒ Integer
Height of video input.
-
#read ⇒ MultiArray, Frame_
Read a video frame.
-
#status? ⇒ Boolean
Check whether device is not closed.
-
#width ⇒ Integer
Width of video input.
Class Method Details
.new(node = 0, speed = SPEED_400, frame_rate = nil, &action) ⇒ Object
Open the firewire camera
return [DC1394Input] An object for accessing the firewire camera.
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 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/dc1394input.rb', line 47 def new( node = 0, speed = SPEED_400, frame_rate = nil, &action ) dc1394 = @@dc1394 || DC1394.new begin retval = orig_new dc1394, node, speed, frame_rate != nil, frame_rate || FRAMERATE_240 do |modes| map = { MODE_MONO8 => UBYTE, MODE_YUV422 => UYVY, MODE_RGB8 => UBYTERGB, MODE_MONO16 => USINT } frame_types, index = [], [] modes.each do |mode| unless map[mode.first] warn "Unsupported video mode #{"0x%08x" % mode.first} #{mode[1]}x#{mode[2]}" end end modes.collect { |mode| [map[mode.first], *mode[1 .. 2]] }. each_with_index do |mode,i| if mode.first frame_types.push mode index.push i end end if action desired = action.call frame_types else preference = [ UBYTERGB, UYVY, USINT, UBYTE ] desired = frame_types.sort_by do |mode| [-preference.index(mode.first), mode[1] * mode[2]] end.last raise "Device does not support a known video mode" unless desired end unless frame_types.member? desired raise "Frame type #{desired.inspect} not supported by camera" end index[frame_types.index(desired)] end @@dc1394 = dc1394 retval ensure dc1394.close unless @@dc1394 end end |
Instance Method Details
#close ⇒ DC1394Input
Close the video device
212 213 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 212 def close end |
#feature_exist?(id) ⇒ Boolean
Check for existence of feature
260 261 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 260 def feature_exist?( id ) end |
#feature_max(id) ⇒ Integer
Get maximum value of feature
334 335 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 334 def feature_max( id ) end |
#feature_min(id) ⇒ Integer
Get minimum value of feature
326 327 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 326 def feature_min( id ) end |
#feature_mode_read(id) ⇒ Integer
Get current mode of feature
309 310 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 309 def feature_mode_read( id ) end |
#feature_mode_write(id, mode) ⇒ Integer
Set mode of feature
318 319 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 318 def feature_mode_write( id, mode ) end |
#feature_modes(id) ⇒ Array<Integer>
Get supported modes of feature
301 302 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 301 def feature_modes( id ) end |
#feature_on(id, value) ⇒ Boolean
Switch feature on or off
293 294 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 293 def feature_on( id, value ) end |
#feature_on?(id) ⇒ Boolean
Check whether feature is switched on
284 285 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 284 def feature_on?( id ) end |
#feature_read(id) ⇒ Integer
Get value of feature
244 245 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 244 def feature_read( id ) end |
#feature_readable?(id) ⇒ Boolean
Check whether feature can be read
268 269 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 268 def feature_readable?( id ) end |
#feature_switchable?(id) ⇒ Boolean
Check whether feature can be switched on and off
276 277 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 276 def feature_switchable?( id ) end |
#feature_write(id, value) ⇒ Integer
Set value of feature
252 253 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 252 def feature_write( id, value ) end |
#height ⇒ Integer
Height of video input
236 237 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 236 def height end |
#read ⇒ MultiArray, Frame_
Read a video frame
218 219 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 218 def read end |
#status? ⇒ Boolean
Check whether device is not closed
224 225 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 224 def status? end |
#width ⇒ Integer
Width of video input
230 231 |
# File 'docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb', line 230 def width end |