Log in or register to post comments

Detecting background color and text color in Text Recognition

November 19, 2013 - 2:19am #1

hi,

 

in a nutshell, i am trying to detect a text background and text color.

 

i am lost in qcar class referance but i can't find any clue about detecting color.

 

  1.  can you point me to the right direction? 
  2.  or is it possible?

 

in the meantime i will keep diging class referance. 

 

regards.

emre

Detecting background color and text color in Text Recognition

November 29, 2013 - 1:34am #7

The point of the BTA sample is to provide access to the underlying camera feed as a texture.

The thinking was that however remote the possibility is of detecting the background of the text and its colour, learning about this would be a step along the way.

So, really the BTA sample is less about the shader and more about the creation of the underlying mesh/texture from the camera feed, as shown in this method:

- (void)CreateVideoBackgroundMesh

However, as I stated earlier, your scope for detecting the text colour and background may well be limited.

 

N

 

Detecting background color and text color in Text Recognition

November 28, 2013 - 7:04am #6

hi again N!

as you said before looked backgroundTextureAccess and did not help much. 

 

as i understand, this backgroundTextureAccess sample uses a shader program like this;

in Shader.fsh file

 

const char* fragmentShader = MAKESTRING(
precision mediump float;
varying vec2 texCoord;
 
uniform sampler2D texSampler2D;
 
void main()
{
    gl_FragColor = texture2D(texSampler2D, texCoord);
}
);

 

and with this shader program demo create new mesh.

 

but i just need a point's colour values with given wordx & wordy.

 

float wordx = - obb.getCenter().data[1];
float wordy = obb.getCenter().data[0];

 

Do i have to use shader program even i dont render custom videobackground? or are there another way?

 

Detecting background color and text color in Text Recognition

November 19, 2013 - 6:15am #5

Great, thanks.

Detecting background color and text color in Text Recognition

November 19, 2013 - 6:10am #4

Look at the BackgroundTextureAccess sample.

N

Detecting background color and text color in Text Recognition

November 19, 2013 - 6:08am #3

ok,

i am now tring to reach background data. What is the eastint way to do it? Using Renderer Class?

Where can i access this texture data using Renderer class somehow.

https://developer.vuforia.com/sites/default/files/doxygen/07-31-2013-05-37-24_doxygen/publicAPI/nav_f.png); background-color: rgb(221, 236, 238); line-height: 18px; background-repeat: repeat no-repeat;">
virtual bool QCAR::Renderer::setVideoBackgroundTextureID ( int  textureID ) [pure virtual]

Tells QCAR where the texture id to use for updating video background data

 

or is this a dead and?

i must admit. I'm a little confused right now.

 

for the sake of question, what i am trying to ask is;

Where can i access "VideoBackgroundTexture" data? 

Regards.

Detecting background color and text color in Text Recognition

November 19, 2013 - 5:18am #2

Hi emre,

Unfortunately, there is no API to do this, because if you think about it the colour could be very different across the background and across the character.

Try to think if there is any other way to achieve what you want.

If you want to keep trying then one thing you can do is to get the background texture and try to get the quad surrounding the text to see what colours it might contain.  However the results may be inconsistent.

HTH

N

Log in or register to post comments