carla icon indicating copy to clipboard operation
carla copied to clipboard

Tearing image from camera sensor

Open silencial opened this issue 11 months ago • 3 comments

I am running Carla in synchronous mode with fixed_delta_seconds=0.05. I attached a camera sensor on the vehicle to collect RGB images. The image size is 640*480. The image is saved as a nump array and visualized as below:

img = np.frombuffer(img.raw_data, dtype=np.dtype('uint8'))
img = img.reshape(640, 480, 4)
img = img[:, :, 2::-1]  # BGRA to RGB
plt.imshow(img)

However some images have this tearing problem as shown below: image What could be wrong here and how should I fix this?

CARLA version: 0.9.15 Platform/OS: Ubuntu 20.04 Problem you have experienced: Tearing RGB image What you expected to happen: RGB image rendered correctly Steps to reproduce: Other information (documentation you consulted, workarounds you tried):

silencial avatar Mar 07 '24 21:03 silencial

You can try saving the numpy array and see if it has the same problem.

# pillow
from PIL import Image as PILImage

cam_image = PILImage.fromarray(np_array)
cam_image.save(file_name) # change file_name

You can do the same with the image class from calra

img.save_to_disk(file_name)

https://carla.readthedocs.io/en/latest/python_api/#carlaimage

PatrickPromitzer avatar Mar 26 '24 08:03 PatrickPromitzer

Hi @silencial, have you been able to verify that the saved images or saved data have the same tearing problem?

JoseM98 avatar Apr 26 '24 12:04 JoseM98

Actually I was saving the data with the PIL.Image.fromarray() method and plotted it afterwards. And the tearing problem was there. I have not tried saving the image directly with the CARLA method. Will test later.

silencial avatar Apr 27 '24 16:04 silencial

I am closing this issue as there has been no more feedback. If you try the CARLA method and it still doesn't work, feel free to reopen the issue.

JoseM98 avatar May 24 '24 10:05 JoseM98