Skip to content

Retrieving Camera Images from IndyEye

In this section, you'll learn how to retrieve camera images from IndyEye. This functionality is useful when you need to apply custom recognition algorithms beyond those built into IndyEye.

Using IndyDCP3

The IndyEye class within the neuromeka package provides an image() function that retrieves the current camera image. This image is returned as a PIL.Image object, making it compatible with the Python Imaging Library (PIL) for easy manipulation and processing.

Example Usage

In this example, the current_image variable stores the latest image retrieved from the IndyEye camera.

from neuromeka import IndyEye
from neuromeka.eye import *

# Initialize the IndyEye client
eye_ip = "192.168.0.114"
eye = IndyEye(eye_ip)

# Get the current image
current_image = eye.image()

Using the REST API

Alternatively, you can use IndyEye’s REST API to retrieve the current camera image in PNG format. This approach is helpful if you're integrating IndyEye into applications without a direct Python interface.

REST API Endpoint Details

  • Method: GET
  • Endpoint: http://<IndyEyeIP>:8088/main/robot/image
    Replace <IndyEyeIP> with the IP address of your IndyEye server.
  • Response: A PNG-format image (image/PNG) of the current camera view.

Example Request

To request the current camera image using curl, run the following command, replacing <IndyEyeIP> with your server’s IP address:

curl -X GET http://<IndyEyeIP>:8088/main/robot/image --output current_image.png

This command will save the retrieved camera image as current_image.png in your working directory.