Image acquisition package: Difference between revisions

Jump to navigation Jump to search
replaced $ with octave>, added start & stop streaming, getsnapshot
No edit summary
(replaced $ with octave>, added start & stop streaming, getsnapshot)
Line 8: Line 8:
   $ tar czf image-acquisition.tar.gz octave-image-acquisition
   $ tar czf image-acquisition.tar.gz octave-image-acquisition
   octave:>> pkg install image-acquisition.tar.gz
   octave:>> pkg install image-acquisition.tar.gz
If you want to report a bug see [[Image_acquisition_package#Reporting_bugs]]


== Example session ==
== Example session ==


Lines starting with $ are commands executed on the octave prompt.
Lines starting with octave> are executed on the octave prompt.


=== Load the package and list available hardware ===
=== Load the package and list available hardware ===


  $ pkg load image-acquisition
  octave> pkg load image-acquisition
  $ imaqhwinfo
  octave> imaqhwinfo
  ans =
  ans =
   
   
Line 29: Line 31:


=== Open the v4l2 device and output the result ===
=== Open the v4l2 device and output the result ===
  $ obj = videoinput("v4l2", "/dev/video0")
  octave> obj = videoinput("v4l2", "/dev/video0")
  obj = videoinput for v4l2
  obj = videoinput for v4l2
       device            = /dev/video0
       device            = /dev/video0
Line 39: Line 41:


=== Query which properties are available for the used device ===
=== 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.
The first 6 ones, starting with an upper letter are fixed, the other specific to the used v4l2 device.
  $ get(obj)
  octave> get(obj)
  ans =  
  ans =  
  {
  {
Line 64: Line 66:


=== Get device capabilities ===
=== Get device capabilities ===
  $ get(obj, "DeviceCapabilities")
  octave> get(obj, "DeviceCapabilities")
  ans =
  ans =
   
   
Line 76: Line 78:


=== List available video resolutions ===
=== List available video resolutions ===
  $ set(obj, "VideoResolution")
  octave> set(obj, "VideoResolution")
  ans =
  ans =
   
   
Line 101: Line 103:
=== Set the video resolution to 320x240px ===
=== Set the video resolution to 320x240px ===


  $ set(obj, "VideoResolution", [320 240])
  octave> set(obj, "VideoResolution", [320 240])


=== Get the current brightness value ===
=== Get the current brightness value ===
  $ get(obj, "brightness")
  octave> get(obj, "brightness")
  ans =  100
  ans =  100


=== Query possible range for brightness ===
=== Query possible range for brightness ===
  $ set(obj, "brightness")
  octave> set(obj, "brightness")
  ans =
  ans =
   
   
Line 119: Line 121:


=== Set a new value for brightness ===
=== Set a new value for brightness ===
  $ set(obj, "brightness", 100)
  octave> set(obj, "brightness", 100)
$


=== Start preview ===
=== Start preview ===
octave> preview(obj)
Close it with CTRL+C or with [X] on the preview window
Close it with CTRL+C or with [X] on the preview window
  $ preview(obj)
 
=== Use higher resolution and start streaming with 2 buffers ===
  octave> set(obj, "VideoResolution", [640 480]);
octave> start(obj, 2)
 
=== Get an image from the buffers, view and save it ===
octave> img = getsnapshot(obj);
octave> image(img)
octave> imwrite(img, "ex1_a.png")
octave> [img, seq, t] = getsnapshot(obj);
octave> seq
  seq =  1
octave> t
  t =
  scalar structure containing the fields:
    tv_sec =  19618
    tv_usec =  346553
 
=== Stop streaming ===
octave> stop(obj)


== Using v4l2loopback for tests ==
== Using v4l2loopback for tests ==
Line 154: Line 177:
Consider running the included tests:
Consider running the included tests:


  test @videoinput/videoinput
  octave> test @videoinput/videoinput
  test @videoinput/get
  octave> test @videoinput/get
  test @videoinput/set
  octave> test @videoinput/set
  test @videoinput/getsnapshot
  octave> test @videoinput/getsnapshot
219

edits

Navigation menu