0

I am trying to save images from Carla in my disk, but I receive this error on the terminal.

Traceback (most recent call last):
  File "carla_basic_tutorial.py", line 83, in <lambda>
    'out%02d/%06d.png' % (n_output, image.frame)
AttributeError: 'Image' object has no attribute 'frame'

I have already installed the libraries from requirements files and Pillow too, the drivers of GPU were installed.

The part of code is available below

# Spawn the camera and attach it to the vehicle
camera = world.spawn_actor(
    camera_bp,
    camera_transform,
    attach_to=vehicle
)
actor_list.append(camera)
print('created %s' % camera.type_id)



# Check how much "out" folders already exists
n_output = len([d for d in os.listdir() if d.startswith('out')])

# Sets the function that will be called by the camera
# This will save the images to disk at a "out" folder
camera.listen(lambda image: image.save_to_disk(
     'out%02d/%06d.png' % (n_output, image.frame)
 ))

The full code is available here Full code

1 Answers1

0

I solved this using the attribute image.frame_number

camera.listen(lambda image: image.save_to_disk(
    'out%02d/%06d' % (n_output, image.frame_number)
))