Object Detection: bgra8 to rgb8 conversion

I have a Zed 2i camera and a Jetson AXG Orin (ROS and C++). I am trying to run Object Detection. I got error when I tried to convert image data into OpenCV format by doing:

image

I got an error because the ZED image is BGRA, so I tried:

image

it works, but I can’t work with OpenCV, so I’m trying to convert bgra to rbg by doing:

then I got errored for the last line to use “rgb8” for processing
can anyone help me to convert this image data?

Thanks,