carla
carla copied to clipboard
Tearing image from camera sensor
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:
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):
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
Hi @silencial, have you been able to verify that the saved images or saved data have the same tearing problem?
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.
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.