Using blob tracking to draw shapes

kodamapixel's icon

I should probably preface this by saying I'm stuck in the world of 'trial and error' at the moment - I'm not totally sure if I'm on the right track, so any suggestions at all are gratefully appreciated...

I'm trying to find a way to use cv.jit.blobs to create shapes - probably with OpenGL, which I've had some success with. The catch is that I don't want to use a perfectly round or square (like cv.jit.bounds) shape - I'd prefer that it fitted the area considered a blob a little closer.

I've been playing with vade's v001.posterize filter, to try and 'crush' the number of colour values into something similar, but because I need to make this a binary image for cv.jit anyway, it isn't making a great deal of difference. The closest I've got is using cv.jit.blobs.color, but I'm hoping to create a more abstract shape with OpenGL than the coloured areas in a jitter matrix.

Max Patch
Copy patch and select New From Clipboard in Max.

Hopefully this all makes some sense, but if not, here is the patch I've been testing some different cv.jit.blobs styles on...

kodamapixel's icon

Just giving this a bit of a nudge by way of another patch - my last post was probably too general anyway.

Basically, what I'm trying to work out is how to take a video feed, crush the colours so I'm left with only a few distinct shades of grey (so that identifying different brightnesses is easier) and loosely tracing those shapes with OpenGL.

Attached is a photoshopped image of the 'crushed colour' effect I'm expecting would make shape tracking easier. The left and right side show before and after, respectively.

What I'm really stuck on now is how to separate each shade, so that I can work with them individually.

Max Patch
Copy patch and select New From Clipboard in Max.

The attached image should work with this patch...

997.20100822_cvTracking.jpg
jpg
Rob Ramirez's icon

i believe jit.charmap is your friend in producing the "crushed colors" effect.

kodamapixel's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Thanks very (very, very) much for the nudge in the right direction, robtherich. jit.charmap did indeed do the trick...

...now I just need to get those cv.jit.features values to draw some shapes for me!

Rob Ramirez's icon

your question is still quite broad, if you get no further response i suggest you simplify/specify your question, perhaps breaking it into parts and reposting to forum.

kodamapixel's icon

You're right robtherich - sorry about that. So jit.charmap took care of finding the edges I was after, which I then used with cv.jit.features to find coordinates. What I'm trying to figure out is how to use these coordinates to draw a shape with OpenGL.

I realise that the points I'm getting from cv.jit.features aren't ordered to give me a sequential perimeter of the shape, but I don't seem to be getting any output at all in jit.gl.sketch.

Max Patch
Copy patch and select New From Clipboard in Max.

I've checked over my OpenGL syntax many times, but I'm still not sure where the output is falling down...

kodamapixel's icon

I've actually just gotten to the bottom of this: jit.gl.sketch wasn't happy with the format of the message being passed to it - sending it through a message first sort it out.

Zachrkn's icon

Kodamapixel, or anyone else that understands what his last post meant, would you mind explaining? In what way did you reformat the message such that jit.gl.sketch could handle it?