3d object localisation from image

thomas.euvrie's picture

hello everyone,

I am looking for a way to interpret an image as a XYZ map; I have made a terrain-like mesh using height field and an external image. On this image i made a red mark, that is where I want to locate the object (a sphere for example), this object needs to appear on the mesh. How do you image sampling and translate a bunch of pixels into HSL values in Quartz ? I am a MaxMSP user, and I would know how to do it in Jitter, but my goal is to achieve everything in Quartz. You can use the attached project template if you feel like to, Please, help!

PreviewAttachmentSize
test.qtz157.53 KB

thomas.euvrie's picture
Re: 3d object localisation from image

answering partially to my own question, found this openCL script to convert an image to an array of RGB values: __kernel void pixels2array(__rd image2d_t Image, __global float4 *Colors) { int2 pos = (int2)(get_global_id(0), get_global_id(1)); float4 color = read_imagef(Image, CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST, pos); int arraypos = get_image_width(Image) * pos.y + pos.x; Colors[arraypos] = color; }

If that works, then half of the jobs is done. Still hope some experience user could help me :)

thomas.euvrie's picture
Re: 3d object localisation from image

Ok, forget about that, I store now the RGB values in a structure. So how do I query the structure for a specific value, let's say anything with R >0.8 and return their index number ? javascript ? anyone ?

thomas.euvrie's picture
Re: 3d object localisation from image

thank you, this patch is quite interesting to do tracking of a single object, unfortunately, I have more than 1 red location on my image and this patch fps is already quite slow. I think I am asking too much from quartz, I will try to find another route. cheers