Images and sounds

Functions are also provided to work with images and sounds.

urbiGetImage returns an image taken by the robot using the camera.val variable by default. The function outputs a matrix containing the image. This image can be displayed through the imshow function:

>> imshow(urbiGetImage(myrobot));

urbiGetSound records sound from the Urbi server, and returns a struct with the data and some associated parameters, using the micro.val variable by default. The sound duration should be specified in milliseconds:

>> snd = urbiGetSound(myrobot,5000)
snd = 
     samples: [1x319488 char]
          Fs: 16000
       nbits: 16
      length: 319488
     channel: 2
    duration: 4992

The sound struct can be save to a wav file through the urbiSound2Wav function:

>> urbiSound2Wav(snd,'recordedSound.wav'); 

Sounds can also be sent to a variable on the Urbi server with the urbiSendSound or urbiSendWav functions. By default, sound are sent to the speaker.val variable for playback.

>> urbiSendSound(myrobot,snd);
>> urbiSendWav(myrobot,'recordedSound.wav');