Software Archive
Read-only legacy content

How to use Blob data on Unity?

Lucas_M_2
Principiante
2.556 Visualizações

Hey guys, I managed to write a script that retrieves IContour Blob Data from the camera.
I don't have much experience by writing RealSense's custom scripts on Unity so I was wondering...
How do I pass the information to the engine so the Blob Contour can be made into a collider?
Here's the script for reference:

switch(RealSenseCameraStatus)
        {
            case pxcmStatus.PXCM_STATUS_NO_ERROR:
                HandDataOutput.Update();
                blobData.Update();
                Int32 iBlobsNum = blobData.QueryNumberOfBlobs();
                for (int i = 0; i < iBlobsNum; i++)
                {
                    PXCMBlobData.IBlob pBlob;
                    PXCMBlobData.IContour pContour;
                    blobData.QueryBlobByAccessOrder(i, PXCMBlobData.AccessOrderType.ACCESS_ORDER_RIGHT_TO_LEFT, out pBlob);
                    pBlob.QueryContour(i, out pContour);
                }
                SenseManager.ReleaseFrame();
                break;

            case pxcmStatus.PXCM_STATUS_EXEC_TIMEOUT:
                break;
        }

Thank you!

0 Kudos
3 Respostas
Bryan_B_Intel1
Funcionário
2.556 Visualizações

Hi Lucas - Are you controlling a gameobject using blob tracking, and want to apply a collider to the game object? Just trying to understand your application a little better.

 

Lucas_M_2
Principiante
2.556 Visualizações

Hi Bryan, I'm actually trying to do something similar as done by the game Warrior Wave by using user segmentation and blob tracking. In this game the user's hands are made into colliders, so he can manipulate the scene.

Warrior Wave demo
https://www.youtube.com/watch?v=DYzOSCX6gp0

Thanks,
Lucas

Felipe_P_Intel
Funcionário
2.556 Visualizações

Hi Lucas,

Please take a look at this documentation link: https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?doc_blob_understanding_the_blob_data.html

Basically, the blob data will provide you the points of the contour, where you are going to use the to create the sprite to represent the blob and also its collider. Here are some links about how to do this (assuming that you are looking to 2D generation):

http://docs.unity3d.com/ScriptReference/Sprite.Create.html

http://answers.unity3d.com/questions/595208/can-i-create-a-sprite-at-runtime.html

http://answers.unity3d.com/questions/601640/correct-way-to-draw-on-screen-for-2d-game.html

http://answers.unity3d.com/questions/575363/how-can-i-change-my-polygon-collider-to-correctly.html

http://docs.unity3d.com/Manual/class-PolygonCollider2D.html

I hope that it helps.

Regards,

Felipe

 

Responder