setting RGB colors to detect change when white objects are placed in front of the camera, Android

StackOverflow https://stackoverflow.com/questions/14669528

Вопрос

I have an android phone that has the camera facing a brown wooden desk. I want it to fire an intent when someone places a white piece of paper on the desk.

on the wooden desk the RGB values returned by the camera are 85 to 120 for all three RGB values, as expected the android phone is not white balanced.

I had one phone that i could set the Red RGB value to if(RedValue > 120){ //fire intent }. This worked reliably for that particular phone. however for the different android phone i want to use is not working the same way. want to get it to work reliably.

I understand that white is RGB(255, 255, 255), should I put an if statement where all are RGB values must be closer to 255 like for example 230?

How best to do this. Any suggestions?

Это было полезно?

Решение

Look into using JavaCV or OpenCV. They support object and pattern recognition.

Here is my recent post about setting openCV up on android: Setting Up Android with OpenCV

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top