Items with no label
3335 Discussions

How to get the 3D Bounding Box

ysaku3
Novice
2,080 Views

Hi,

 

I would like to get the "3D bounding box" of target object by using the 3DScan module.

 

My goal is to develop the application which shows the size of the smallest box that can entirely contain the target object.

It seems that the QueryArea() or the QueryBoundingBox() of the PXC[M]3DScan Interface makes it possible.

 

However, I'm not sure that the returned value of these functions actually indicates the size I require.

 

Can I have the detail spec of these functions?

Additionally, if there are other solutions, please let me know.

Thank you.

12 Replies
idata
Employee
774 Views

Hello Sakurai,

 

 

Thanks for reaching out!

 

 

You can find the SDK documentation of both functions in the following links:

 

 

QueryArea:

 

 

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v2016r3/documentation/html/index.html?queryarea_pxc3dscan.html

 

 

BoundingBox:

 

 

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v2016r3/documentation/html/index.html?queryboundingbox_pxc3dscan.html

 

 

I'm not aware of other approaches for this in specific, I suggest you to read the documentation and see if they fit your needs.

 

-Peter.
0 Kudos
ysaku3
Novice
774 Views

Hi Peter,

Thank you for your reply.

According to the spec, the QueryArea should return the Area structure which has width, height and depth data of target object.

However the depth value seems always same as the width value.

Can I get the actual depth by this API?

BTW,

Is the SDK 2016 R3 applicable for the R200?

According to the release note , the SDK 2016 R3 (11.0.27.1384) does not support the R200.

So I'm using the SDK 2016 R2.

Thanks,

Sakurai

0 Kudos
idata
Employee
774 Views

Hi Sakurai,

 

 

I see, can you please give me an example of this behavior? Are you able to share a screenshot of these results?

 

 

You are right, the R3 does not apply to the R200, but since I didn't know the camera you were using I simply put the latest version, nevertheless, you can find the documentation of the R2 in the following link:

 

 

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?queryarea_pxc3dscan.html

 

 

-Peter.
0 Kudos
ysaku3
Novice
774 Views

Hi Peter,

I attached the screen shot of 3DScan application.

This is based on the sample source of the SDK "DF_3DScan.cs".

I added the code following AcquirePreviewImage() to show the three values obtained from QueryArea().

(every 30 frames)

/* Get Height,Width,Depth of object */

 

PXCM3DScan.Area scanarea = scan.QueryArea();

counter++;

 

if (counter > 30)

 

{

 

var tempheight = scanarea.shape.height * 100.0f; // cm

var tempwidth = scanarea.shape.width * 100.0f; // cm

 

var tempdepth = scanarea.shape.depth * 100.0f; // cm

form.UpdateValue(tempheight, tempwidth, tempdepth); //Show the values on the main form

counter = 0;

 

}

 

The values are shown at the bottom right of the window (red arrow).

The depth is same as the width almost every time.

(sometimes the least significant digit is different)

In this example, I am capturing the box from the oblique above.

The actual size of the box is H:22cm/ W:8cm/ D:25cm.

How are the values calculated and what size do they indicate?

Thank you,

Sakurai

0 Kudos
idata
Employee
774 Views

Hi Sakurai,

 

 

I currently have R3 installed on my PC, please let me install R2 and I will try to see if I can replicate this behavior.

 

 

-Peter.
0 Kudos
idata
Employee
774 Views

Hi Sakurai,

 

 

I have installed R2 and I am ready to test it, nevertheless, I am not able to find where I must insert this snippet in the entire code. Could you please tell me where you added these lines?

 

 

Peter.
0 Kudos
ysaku3
Novice
774 Views

Hi Peter,

I attached the modified files.

The lines above are added at l.425-l.437 in DF_3DScan.cs.

Thanks,

Sakurai

0 Kudos
idata
Employee
774 Views

Hi Sakurai,

 

 

Thank you for the files provided.

 

 

I tested your code and I got the same values on depth and width. So, I checked the function QueryArea() and I noticed that it gives the scanning area parameters (The green rectangle). Take a look at the SDK documentation: https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?queryarea_pxc3dscan.html

 

 

I know that PXCM3DScan.Area gives the scanning volume but I think it doesn't apply in this case.

 

 

Regarding the values, they are the height and the width of the scanning area, not of the object.

 

 

Have a nice day.

 

 

Regards,

 

-Leonardo
0 Kudos
ysaku3
Novice
774 Views

Hi Leonardo,

Seeing the sample behavior,the height and the width indicate the actual length of the object.

In the attached 3dScan.jpg, the height of the target box is 23cm, and the API returns 23.34721 as "height".

It does not indicate the vertical length of the green rectangle.

My understanding is:

height: actual height of the object

width: actual width of the object (from fixed angle)

depth: no meaning and should be ignored

Is my understanding right?

Thanks,

Sakurai

0 Kudos
idata
Employee
774 Views

Hi Sakurai,

 

 

I think that it gives the green rectangle parameters, just to make sure move your camera to see if the values change, or if they are the same.

 

 

That should confirm if it is the object or the rectangle.

 

 

Have a nice day.

 

 

Regards,

 

Leonardo R.
0 Kudos
ysaku3
Novice
774 Views

Hi Leonardo,

The value of height does not change when moving the camera.

It always indicates the actual height of object.

That is correct behavior conforming to the spec, isn't it?

In conclusion, I can get the height and width (from fixed angle) by the QueryArea(),

but cannot get the depth.

Is there any good method to achieve my aim?

I'm aiming to develop the application which shows the 3 dimensional size of the smallest box

that can entirely contain the target object.

Thank you,

Sakurai

0 Kudos
idata
Employee
774 Views

Hi Sakurai,

 

 

I'm not sure if there is a function that can provide all these three parameters. Since usually the camera can measure the height and width of an object and the depth it measures is the distance between the camera and the object.

 

 

If you would like to measure the object's width, I believe the best way to do it is to slightly change the angle and then measure this parameter.

 

 

I hope this helps.

 

Pedro M.
0 Kudos
Reply