'Unreal: How to access image in MediaTexture with C++?

I'm currently using unreal read from video and cameras. I got a Media Player and Media Texture alongside with it.

I'm aware that It is possible to read pixels from Texture2D. The problem is mediaTexture is derived from Texture. Thus It cannot be casted to Texture2D. And I have no idea how to get pixel data from it.

Thanks for any reply! C++ and blueprint are both welcomed!



Solution 1:[1]

At present, it seems like the only way is to render the media texture to a render target, and then read the result with ReadPixels. This is how Epic does it for their OpenCV Calibration

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 zeeman_effect