How to detect what is there, in an image?

Hello…

I will try to explain.

Let,s say I take a picture with the camera – [media.capturePhoto]

the image is a white rectangle 200X200 pixels

in the center of the image I have a black square 20X20 pixels

That’s it a white page with a black square in the center.

QUESTION


is there a way that I can program some code to tell the app

function isSquare( )

    “see” the image and if you see a black square then

               audio.play(aSound)

      if it is a black circle

               image.rotation = 45

      end

end

Something like that.

The idea is to be able to “see” with a program what is inside that image

I hope this make sense and you can help me out.

Thanks

Victor

As far as I know, you can’t read or manipulate image pixels directly with Corona – think that requires using Corona Enterprise and doing it as native code for the OS you’re targeting (or simply build your whole app native).

So the only way to do it is with Xcode? my app is for the iPad

Actually we do.  See:  https://docs.coronalabs.com/api/library/display/colorSample.html

This is a costly call.  Do not run it in a tight loop. You have to setup a call back function, it does not return the value immediately. 

Rob

As far as I know, you can’t read or manipulate image pixels directly with Corona – think that requires using Corona Enterprise and doing it as native code for the OS you’re targeting (or simply build your whole app native).

So the only way to do it is with Xcode? my app is for the iPad

Actually we do.  See:  https://docs.coronalabs.com/api/library/display/colorSample.html

This is a costly call.  Do not run it in a tight loop. You have to setup a call back function, it does not return the value immediately. 

Rob