Populating jit.gl.multiple with centroid coords?

    Nov 23 2011 | 8:38 pm
    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?

    • Nov 23 2011 | 10:30 pm
      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:
    • Nov 23 2011 | 10:43 pm
    • Nov 23 2011 | 10:54 pm
      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:
    • Nov 23 2011 | 11:18 pm
    • Nov 23 2011 | 11:20 pm
      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?
    • Nov 27 2011 | 5:30 pm
      Here's another solution that does the coordinate scaling based on video input size:
    • Nov 27 2011 | 5:34 pm
      As always, thanks for your help!