Jemmy Gunawan
Jemmy Gunawan

Reputation: 21

How to detect color live using camera on android in unity

i want to make a live color detection using camera on android in unity. apps that i want is like "color grab" on playstore. anyone can help me how it works? or how to make it on unity?

Upvotes: 0

Views: 1276

Answers (1)

Kardux
Kardux

Reputation: 2157

Well SO isn't a script providing service: always try to provide what you have tried already before asking a question. If you don't have any script, at least expose you way you want to do it, the steps you think are needed, ...

Anyway, I'd advise you to take a look at Unity Texture2D.ReadPixels() method:

  • display what you need on screen
  • when the user touch a place, call for ReadPixels()
  • then retrieve the color of the desire location on the texture using Texture2D.GetPixel()

If you want to search for a larger area (not a single pixel), you can look for all the pixels around the wanted location and then get the average color found.

Hope this helps,

Upvotes: 1

Related Questions