cv.jit Blob Tracking - only biggest Blob Coordinates

Andreas Förster's icon

Hello,
I am working on a juggle tracker and for this I am using open cv and colour Tracking. Right now it is working unstable, so what I want to do now is to only track the "biggest blob". In the help file of cv.jit.label it says, that I am supposed to use mode 1 and then I can get the biggest blob using: jit.op @op == @val 1.
When I use the objects this way, I can get the drawing of the biggest blob, but I don't to how to extract the x/y coordinates of it. I also get a lot of -1 numbers.

Can anybody help me with extracting x/y of the biggest blob?

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

Andreas Förster's icon

any suggestions?

mattyo's icon

just send the results of the jit.op to cv.jit.blobs.centroids

Andreas Förster's icon

thanks for the reply! I tried that, but what I get is a Matrix with one row and a lot of cells that have -1, -1, 0 inside and only the last cell seems to contain the coordinates of the blob. (See the picture)

mattyo's icon

Hm. I can reproduce, and I'm not sure what that's about. If I were you, I would just skip the [jit.==], and just take the first cell of cv.jit.blobs.centroids, which will by default be the biggest blob. So spill out the matrix coming out of there, and just take the first cell values....

Andreas Förster's icon

okay thank you, would you do this with a getcell message?

mattyo's icon

A couple of options

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

hope this helps,

\M

Andreas Förster's icon

Perfect! thank you