Populating jit.gl.multiple with centroid coords?
Hey,
I'm trying to draw circles corresponding not only to the center of blob masses, but with the size of the circle reflecting the blob area. So, bigger person -> bigger blob -> bigger circle (at the same coordinates).
Here is what I have so far:
As you can see, it doesn't work. I'm not sure where my problem is; should the position matrix be receiving different information, or is the scale matrix?
if you want the objects drawn by gl.multiple to reflect the size and position of the blobs, then of course you need to update both the scale and position matrix each frame.
the blobs matrix contains information about blobs in screen coordinates (2D pixel values), but the gl.multiple requires world coordinates (3D world-space values), so you must iterate the blobs matrix, call screentoworld for each cell and pack into a new matrix for the gl.multiple position input.
the area value of the blobs can be scaled into an appropriate value for the 3d shapes using simple math objects, or the scale object.
you also need to send a binary matrix to the centroids object (black and white, not greyscale) so you send it through a jit.op @op > for thresholding, to get a binary matrix output.
take a look at the patch below:
ahh, forgot about jit.map.
seems a much easier solution.
here's previous patch with a jit.map solution.
notice you have to invert the y plane:
Can I ask you though, why jit.pack 3 that info for x and y? Is that the only acceptable form for the input matrix?
Here's another solution that does the coordinate scaling based on video input size:
As always, thanks for your help!
I just found these, great patches also exactly what I was trying to do. Essentially have been re working the eye tracking idea to track coloured markers on the end of laparoscopic instruments, red for left and blue or green for right. as long as nothing else in the image was similar colour the values RGB and alpha I could easily modify to produce monochrome image that just highlighted the marker. but for some reason centroids was not drawing the blobs correctly? I matched all the values to those in your patch and it works fine - so I'm confused as to why mine didn't work. with your patch where / how do I output the values - I reasoned if I could track the co ordinates of the blob that would identify movement and the area would correspond to depth - ie. the closer the instrument came to the camera the marker would appear larger - in that respect I can essentially guage an idea of the 3d movement of the marker and hence instrument through my camera view.
here is My patch as stands.
Also I have duplicated the patch so that one tracks the red filter and another tracks the green filter - I changed the name for the second from test to testb. But I can't get the pwindow for my second frame to output any visual feedback. am I missing something there?