[VPI] How can I do alpha blending of images in C++?

Please understand that my English is poor.

Purpose

  • Create a single image by stitching multiple camera images.
  • At that time, I would like to weight the parts where the images overlap each other with a ratio of 0.0 to 1.0 and paste them together.

Question

  1. Is alpha blending of images possible with VPI?

    • If VPI doesn’t have alpha blending function, does VPI have simple add and divide function between image objects (VPIImage)? Alpha blending is also possible by using them.
  2. If the above is difficult, is it possible to use VPI and CUDA together?

    • Implement only alpha blending with CUDA, and the rest with VPI.
    • In this case, what point should I pay attention to?
      • I need to be careful when using GPU (CUDA backend?) in VPI and CUDA at the same time, right?
  3. Or if there is a better way, please let me know.

Thanks

Environment

• Hardware Platform (Jetson / GPU): Jetson Orin AGX 32GB Developer kit
• VPI Version: 2.1.6
• JetPack Version (valid for Jetson only): 5.02 (L4T: 35.1)
• TensorRT Version: 8.4.1
• NVIDIA GPU Driver Version (valid for GPU only) : N/A
• Issue Type( questions, new requirements, bugs) Questions

Hello,

Your topic will be best served in the Jetson category.

I will move this post over for visibility.

Cheers,
Tom

Hello, Tom.
Thanks for moving the category !

Best regards,
Yuki

1 Like

Hi,

1.
Unfortunately, VPI doesn’t have the add or divide function.

2.
Yes, you can implement a custom CUDA to do so.
Please wrap buffer and stream from CUDA to ensure consistency.

3
OpenCV has CUDA-based blending function that you can give it a check.
https://docs.opencv.org/4.5.1/d0/d05/group__cudaimgproc.html#ga4793607e5729bcc15b27ea33d9fe335e

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.