Image acquisition package: Difference between revisions

formated example session
No edit summary
(formated example session)
Line 7: Line 7:
Lines starting with $ are commands executed on the octave prompt.
Lines starting with $ are commands executed on the octave prompt.


Let's load the package and list available hardware
=== Load the package and list available hardware ===


<code>
  $ pkg load image-acquisition
  $ pkg load image-acquisition
  $ imaqhwinfo
  $ imaqhwinfo
  ans =
  ans =
 
   scalar structure containing the fields:
   scalar structure containing the fields:
 
     driver = uvcvideo
     driver = uvcvideo
     card = UVC Camera (046d:0825)
     card = UVC Camera (046d:0825)
Line 22: Line 21:
     capabilities =  83886081
     capabilities =  83886081
     device = /dev/video0
     device = /dev/video0
</code>
 
$
=== Open the v4l2 device and output the result ===
$ obj = videoinput("v4l2", "/dev/video0")
$ obj = videoinput("v4l2", "/dev/video0")
obj = videoinput for v4l2
obj = videoinput for v4l2
       device            = /dev/video0
       device            = /dev/video0
       driver            = uvcvideo
       driver            = uvcvideo
Line 32: Line 31:
       VideoResolution    = 320 x 240 px
       VideoResolution    = 320 x 240 px
       VideoFrameInterval = 1/30 s (30.0 fps)
       VideoFrameInterval = 1/30 s (30.0 fps)
$ get(obj)
 
ans =  
=== Query which properties are available for the used device ===
{
The first 6 ones starting with an upper letter are fixed, the other specific to the used v4l2 device.
$ get(obj)
ans =  
{
   [1,1] = SelectedSourceName
   [1,1] = SelectedSourceName
   [2,1] = DeviceCapabilities
   [2,1] = DeviceCapabilities
Line 53: Line 55:
   [17,1] = exposure_absolute
   [17,1] = exposure_absolute
   [18,1] = exposure_auto_priority
   [18,1] = exposure_auto_priority
}
}
$
$ get(obj, "DeviceCapabilities")
ans =


=== Get device capabilities ===
$ get(obj, "DeviceCapabilities")
ans =
   scalar structure containing the fields:
   scalar structure containing the fields:
 
     driver = uvcvideo
     driver = uvcvideo
     card = UVC Camera (046d:0825)
     card = UVC Camera (046d:0825)
Line 66: Line 69:
     capabilities =  83886081
     capabilities =  83886081


$
=== List available video resolutions ===
$ set(obj, "VideoResolution")
$ set(obj, "VideoResolution")
ans =
ans =
 
     640    480
     640    480
     160    120
     160    120
Line 90: Line 93:
   1280    960
   1280    960


$ set(obj, "VideoResolution", [320 240])
=== Set the video resolution to 320x240px ===
$
 
$ get(obj, "brightness")
$ set(obj, "VideoResolution", [320 240])
ans =  100
 
$ set(obj, "brightness")
=== Get the current brightness value ===
ans =
$ get(obj, "brightness")
ans =  100


=== Query possible range for brightness ===
$ set(obj, "brightness")
ans =
   scalar structure containing the fields:
   scalar structure containing the fields:
 
     min = 0
     min = 0
     max =  255
     max =  255
Line 104: Line 112:
     default =  128
     default =  128


$ set(obj, "brightness", 100)
=== Set a new value for brightness ===
$  
$ set(obj, "brightness", 100)
$ preview(obj)
$  
 
=== Start preview ===
Close it with CTRL+C or with [X] on the preview window
$ preview(obj)


== Using v4l2loopback for tests ==
== Using v4l2loopback for tests ==
219

edits