- Home /
Using of Texture2D.LoadImage
Hello, I want to load in a Unity texture an image that I get from a dll, open with OpenCV. I actually just get the bytes array of an IplImage.imageData. This part works fine, and I can construct a new Texture2D using setPixels by reading the bytes array.
However, i would like to use Texture2D.LoadImage for studying its performance, but I can't fine how to use it well. In every case, I get a red question mark on my texture. I try to just send my byte array to load image, and for tests, I also try to use TextAsset, load a jpeg file with extension ".txt", like in many examples I've seen, but I still get my question mark.
What I would really like to know is what kind of data is expecting LoadImage. Thank you for your help.
I'm at the same point... I used SetPixels32 and then Apply() to load the IplImage, but is too much slow. With LoadImage I always got the red question mark. I tried to assign byte per byte a ready to use Color32 array into a byte array, but as always the Color32 array with SetPixels32 is working, not the clone byte array with LoadImage. Any suggestion on how to use it?
Your answer
![](https://koobas.hobune.stream/wayback/20220613064345im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
import video from camera 3 Answers
Image Stitching without external libraries 0 Answers
fast way for converting from opencv mat to texture2d 1 Answer
How to cut an image at an angle from the center? 0 Answers
Fetching files from disk at runtime 0 Answers