- Home /
Is there a way to analyse pictures in Unity?
Lets say I have a algorithm to check the properties of a picture. How do I analyse pictures in Unity? To be exact lets say that I want to be analyse the picture in a detail way. For example maybe the pixels, hues of an area of the picture ( for example there is a photo inputed by a player and i want to take the collective brightness of the photo to set maybe a level's mood) , contrast, and brightness. Lets say that I want to find a way to abstract this information from the picture and auto generate the level based on a formula. Yeah like average brightness, per-channel-brightness.
What do consider "properties of a picture"? This question is very very unspecific and can't be answered.
Edit your question and add what you actually want to analyse / know about the picture. A picture is just a collection of color values. The only direct properties a picture has is the resolution (width and height) and the format it's stored in memory.
Are you interested in analysing the data itself? Like a histogram of the color values, average brightness, per-channel-brightness, ...
If you don't get more specific i'll close the question.
You have to load pixels properties from texture into a matrix and play with the matrix. See https://docs.unity3d.com/Documentation/ScriptReference/Texture2D.html 3D terrains for example may be done using 2D textures in unity, so that I think many algorithms may be applied over the texture pixels matrix.
Answer by socialspiel · Apr 25, 2014 at 01:31 PM
You can access the Pixels of a texture with GetPixel/GetPixels.