Software Archive
Read-only legacy content
17061 Discussions

mask_utils in Unity?

Austin_C_
Beginner
508 Views

I want the functionality of mask_utils that will mask out my hand in Unity.

Will this be supported?

0 Kudos
4 Replies
Xusheng_L_Intel
Employee
508 Views

Yes, it also supports in Unity. Please let me know if you have any issue. Thanks!

0 Kudos
Austin_C_
Beginner
508 Views

Thanks for the reply.

Is there a Unity example of mask_utils? All I see is C++ and C#, and the C# version uses Microsoft Forms, so it's not so simple to port to Unity.

This PXCIMBlobExtractor example is not very helpful:

// session is a PXCMSession instance
// Get the the blob extractor instance
PXCMBlobExtractor be;
session.CreateImpl<PXCMBlobExtractor>(out be);
 
// Blob extracting operations
...
 
// Clean up
be.Dispose();

This doesn't explain how to add the blob info to an image, what the blob extractor does, or how it's useful.

Is there another place I can find a good example of using PXCIMBlobExtractor or PXCIMContourExtractor in Unity?

Thanks.

0 Kudos
Amit_M_Intel
Employee
508 Views

In the Unity Toolkit, we provide some scripts that use the Blob Extractor for detecting and tracking blobs. You should take a look at those. BlobDetectedRule.cs for example.

In any case, when querying the blob data, you are getting an image with the blob on it:

BlobExtractor.QueryBlobData(i, new_image, out blobData);

This should work (didn't tested it though):

// session is a PXCMSession instance
// Get the the blob extractor instance
PXCMBlobExtractor be;
session.CreateImpl<PXCMBlobExtractor>(out be);
// Blob extracting operations
PXCMImage.ImageInfo info;
info.format = PXCMImage.PixelFormat.PIXEL_FORMAT_Y8;
PXCMImage new_image = session.CreateImage(info);
...
// Clean up
new_image.Dispose();
be.Dispose();
0 Kudos
Dagan_E_Intel
Employee
508 Views

Austin,

Please note that the BlobExtractor will mask out anything that is seen in front of the camera, not only hands.

If you are specifically interested in hands only (and ignore anything else) you can have a look at the Hand module, where you can also find the mask (called Segmentation Image)

0 Kudos
Reply