Up:Tutorial?     Previous:Use of service provider?     Next:Collision between agents?


Image capture from agent's perspective

(※This tutorial is valid only for later than v2.1.0)

This tutorial explains how to capture an image from the agent's perspective and how to use it in a controller based on service provider function.

Creating a controller

$ emacs captureView.cpp

captureView.cpp

captureView

Receving an image data using captureView in 50th line.

The first argument of the captureView(); is the ID number of the target camera. The camera ID 2 was used in this example. The second and third arguments are corresponded to bit depth and image size. (Only 24bits and 320x240 can be choosen in v2.1.0)

Use the function getBuffer() to extract the image data from the ViewImage.

In this example, the agent will

Image files such as view000.bmp, view001.bmp... in bmp format will be created in a starting directory.

Compilation

$ ./sigmake.sh captureView.cpp

Creating a world file

$ emacs captureView.xml

The following world file is almost the same as the world file used in the Vision sensor.

captureView.xml

The difference between the Vision sensor is number of cameras. The agent has two cameras. the location and orientation of the cameras are modified.

The right camera has ID 1. The left camera has ID 2.

Execution of the image capture

$ sigserver.sh -w ./captureView.xml

You can see a humanoid robot agent in a living room.

You can send "rotation" and "move" to the agent to control the position and orientation of the agent.

Please send a message "capture" when you want to capture an image.

capture_1.PNG

An image file captured by the camera ID 2 will be created in the starting directory


Up:Tutorial?     Previous:Use of service provider?     Next:Collision between agents?


Front page   New List of pages Search Recent changes   Help   RSS of recent changes