- Home /
Getting pixel data from image byte array
I'm using the Vuforia sdk and getting a byte array of image data with with the mCameraDevice.GetCameraImage(mPixelFormat); Meathod. The pixel format I see used most is RGB888
I'm having a difficult time deciphering how to use the byte array. My goal is to sample pixel color at specific (x,y) positions so Ideally I'd like to write a meathod that accepts and (x,y) and can return the Color of that pixel using the byte array. Can anyone point me to an example of how this can be done or some documentation on converting byte array to useable pixel information?
Also, I have asked this same question on the vuforia forums here
Answer by liamcary · Feb 22, 2013 at 07:22 AM
The Texture2D has a function called LoadImage(byte[] byteArray) Once loaded, Texture2D also has GetPixel(int x, int y) that returns the color of the pixel at that coordinate.
LoadImage(): http://docs.unity3d.com/Documentation/ScriptReference/Texture2D.LoadImage.html
GetPixel(): http://docs.unity3d.com/Documentation/ScriptReference/Texture2D.GetPixel.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613093136im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Getting Vuforia to work with zxing 3 Answers
Cloud recognition in Vuforia 0 Answers
Converting Vector3 to Byte[]? 4 Answers
Binding "Central Anchor Point" in Unity Beta 2017.2 1 Answer
Vuforia option absent in Linux editor 0 Answers