convert BGRA8 image format to RGB format

15 ビュー (過去 30 日間)
L 2021 年 10 月 12 日
コメント済み: L 2021 年 10 月 16 日
Is there a built-in function for conversion of BGRA8 image to RGB image? If there is no available function for the conversion, is there a way to make this conversion?


Jan 2021 年 10 月 12 日
Do you have the pixels values as UINT8 array already? Then:
RGB = BGRA8(:, :, [3, 2, 1])
  7 件のコメント
L 2021 年 10 月 13 日
編集済み: L 2021 年 10 月 13 日
The issue with the structure is solved. The solution is to call the receive() function.
But, still there is a problem with the conversion from BGRA8 to RGB.
What can be the problem here?
Here is the screenshot, and the code. The BGRA8 image is 1010688x1 uint8 array.
msg = receive(sub);
outImg = reshape(img, 672, 376, []);
outImg1=permute(outImg, [2 1 3 4]);
rgb=outImg1(:,:,[2 1 3]);
figure, imshow(rgb);


その他の回答 (1 件)

Cam Salzberger
Cam Salzberger 2021 年 10 月 13 日
Since the image data is coming out of a ROS message, you can use the ROS functions to extract the image from it:
Message object - readImage method
Message struct - rosReadImage function
  1 件のコメント
L 2021 年 10 月 16 日
Thank you, the problem is solved now


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by