Forums > Jitter

pick a color from picture, to recover this color coordinates in an other picture

March 27, 2012 | 10:22 am

Hi,
stupid problem I guess:
I have two pictures for instance.
Thx to suckah, I have rgb coordinates of my mouse cursor.
I would like to find this particular picked color in an other picture.
I trie with jit.findbounds, but the color displayed in the second picture is not as expected. (see the patch).
"jit.op @op==" should be a solution too, (xray.cellocoordinates should give me the coords, but doesn’t work…).
don’t really know what I do wrong…
any help would appreciated.
thx.
f

– Pasted Max Patch, click to expand. –

March 27, 2012 | 10:38 am

i just had a quick look at your patch, but it seems to me you’re asuming suckah gives you ARGB. in fact it outputs RGBA, so you’re ignoring red and using alpha, so that it finds unexpected colors…


March 27, 2012 | 10:48 am

thx for response. stupid mistake; change this gives me nobounds at all, worse

I’m not really kind of jit.findbounds anyway…sure there is a better way……
well ok if it could just work;)

– Pasted Max Patch, click to expand. –

f.


March 27, 2012 | 11:49 am

ok, no i have no idea wth is going on :(


March 27, 2012 | 7:36 pm

would some of you know about this ? Would it be a bug ?
f


March 27, 2012 | 10:53 pm

i think you just gave it too small a color range. i tried with the green number box and it goes better:

– Pasted Max Patch, click to expand. –

March 28, 2012 | 3:18 am

I still don’t really get the result, why such a great difference according to the picked color…?
When I am in the "red area", the bound is x boundbox is 320, almost the entire matrix, I need more precision…

Shouldn’t be possible to just retrieve one pixel of the second image ?

What I really need: If I pick white color from the first picture by example, I need to get cellcoords in the second picture of cells wich respond to "yes I’am white and here’s my xy coordinates".

I’m pretty lost about this ! thx anyway oldturtle.

f.


March 28, 2012 | 3:48 am

Need specific description,thanks.


March 28, 2012 | 3:56 am

no time for bycycle right now, if anyone has more wise advice, I’ll take it ;)


March 29, 2012 | 7:28 am

would someone know about this ?
little emergency here !
thx
f


March 29, 2012 | 9:46 am

Noticed your post yesterday and i had a go but i’m also having a hard time trying to solve this. Somehow the colors get compared individually i think. Sure somebody else will chime in.

HTH (a bit)
FRid

– Pasted Max Patch, click to expand. –

March 29, 2012 | 10:48 am

Thx a lot!!
I was little rushed.
really nice little patch comparing to my mess !!
big up
f


March 29, 2012 | 5:13 pm

sorry for the noise, but I still have lot of weird values…though I have to be very precise…
unicolor works just fine, the problem is when the color is composed of several primary colors…
I'm really lost…fiou…
I attached the patch and my thermal picture with its scale, wich I have to analyse to know almost every pixel temperature !

thx.

– Pasted Max Patch, click to expand. –

[attachment=189731,3612]

Attachments:
  1. thermo.jpeg

March 29, 2012 | 6:01 pm

what do you want to do with the results?
i would just use jit.chromakey, which will allow you to adjust things like threshold and feathering.

you can tell it to output the keyed channel (@mode 1 or 2).

if you need it to be binary, send it to a jit.op @op > for thresholding.


March 29, 2012 | 6:15 pm

thx rob.
I have to analyse the argb pixel from a thermal picture, and find the position of the corresponding color in the scale picture to deduce the temperature of the analyse pixel…

I’m gonna try jit.chromakey, but I’m affraid of the needed ressources (about 10 points, so 10 jit.chromakey).
thx
f


April 3, 2012 | 3:47 pm

Hi,
I’ve made my little really simple shader for this problem. hm "==" does the trick…
I would like to know how could I streched the color bar. I trie to put an offset on result.y but I think I must confused .r and .x coordinates in shaders wich I’m not familiar to.
Could you just take a glance to this little patch and shader ? I use the same "scale.png" file than precedently post.
here’s the patch and the shader:

find any common colors in 2 matrixes.

//sampler

uniform sampler2DRect tex0;

uniform sampler2DRect tex1;
uniform vec4 tolerance;

const vec4 one = vec4(1.0);
// texcoord
varying vec2 texcoord0;
varying vec2 texcoord1;

void main()
{

vec4 source = texture2DRect(tex0, texcoord0);
vec4 target = texture2DRect(tex1, texcoord0);
vec4 delta = vec4(source==target);
vec4 result= vec4(delta.x, delta.y + tolerance); //how could I stetch the color bar ?
gl_FragColor = result*source;
}
]]>

– Pasted Max Patch, click to expand. –

[attachment=190098,3640]

Attachments:
  1. scale.png

Viewing 16 posts - 1 through 16 (of 16 total)