Items with no label
3335 Discussions

Area calculation of an irregular shape

SEnsa
Beginner
2,078 Views

I am using RealSense D415 camera and want to calculate the (physical) area of an irregular shape.

For this, I have the mask image and have the depth of each pixel inside the mask.

If I can get the pixel size according to the distance of it to the camera, I will be able to measure the area.

How should I calculate the pixel size?

0 Kudos
4 Replies
MartyG
Honored Contributor III
851 Views

RealSense expert Samontab once gave some advice about calculating pixel size.

Please ignore the references to the instructions QueryColorFocalLengthMM and QueryColorFocalLength, as these refer to the old 2016 RealSense SDK that does not work with 400 Series cameras.

0 Kudos
SEnsa
Beginner
851 Views

Thank you for your reply.

I had seen that post before raising this question.

It is mentioned that "The distance of the objects is totally irrelevant to the size of the pixels.", in this case, how can I measure the area of my arbitrary shape!?

I thought that I can get the pixel size by the following formulation:

https://stackoverflow.com/a/45481222/6037506 Kinect V2 Depth Frame Pixel Size - Stack Overflow

0 Kudos
MartyG
Honored Contributor III
851 Views

I wonder if a shortcut to solving your problem may be to use the Librealsense Python sample program 'Box Dimensioner', where you have the camera scan a 'calibration object' that is bigger than the object you are going to measure in order to define a "bounding box", and then place the object you want to measure (that should be smaller than the size of the calibration object).

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python/examples/box_dimensioner_multicam librealsense/wrappers/python/examples/box_dimensioner_multicam at master · IntelRealSense/librealsense · GitHub

If you prefer to do it with trigonometry like in your example, trigonometry is a universal math. You would therefore just need to find out how to express the trigonometry instructions in Librealsense's format. The RealSense GitHub is the best place to ask about this. You can do so by visiting the link below and clicking on the 'New Issue' button to post a question.

https://github.com/IntelRealSense/librealsense/issues Issues · IntelRealSense/librealsense · GitHub

0 Kudos
SEnsa
Beginner
851 Views

Thank you for your time.

I will check the python code to see if I can use it.

Additionally, I will ask my question in the RealSense GitHub to get more insights on this matter.

0 Kudos
Reply