-1

Is it possible to detect if an image captured with the camera roll has a certain RGB colour in it?

mm24
  • 9,280
  • 12
  • 75
  • 170

1 Answers1

1

I haven't tried it myself but Google has an api you could potentially use for this called Vision API. It looks like it returns a lot of information regarding the image provided (even counting number of occurrences of items, example: 1 boat, 1 tree). I'm not sure about the specific use case and if hitting an api would work for you but that could potentially work.

As for locally Ole Begemann has a class called UIImage+ColorAtPixel that you could use to find colors per pixel but the amount of overhead to scan all pixels in an image would be pretty intense.

https://github.com/ole/OBShapedButton/blob/master/UIImage%2BColorAtPixel/UIImage%2BColorAtPixel.h

Steve
  • 921
  • 1
  • 7
  • 18
  • Thanks Steve, interesting library. I guess I could reduce the image size and then apply the colour at pixel function to a reduced search space. I could possibly also apply some other optimizations to it. Will give it a go. The google API is interesting but I am trying to find something that works offline. Do you all reckon that the ColorAtPixel approach is the optimal one? Is there some other library that I could use? – mm24 Mar 05 '16 at 11:08
  • Why may I ask do you need to know if a specific color exists. I think a few libraries may exist that would return the dominant color. – Steve Mar 06 '16 at 14:10