10 Replies Latest reply on Feb 28, 2018 5:31 AM by TrayJ

    Settings for best Z accuracy




      I hope you are all doing well


      I have just received a D415 to evaluate. I have the following questions that I hope you can help with it?


      I am trying to measure the height of PCB components across a PCB.


      For the sake or argument assume the following but I am flexible on the setup. I just need the most accurate Z settings to be able to tell if all the component are present and what height they are each at.



      • The object is a PCB with a number of components at different height levels.
      • The filed of view can be as small as you like
      • There might be small resistors to large capacitors on the board, so the heights could be as low as 0.5mm and up to 30mm.
      • Width and height of components could be as small as 5mm x 5mm up to 20mm x 20mm
      • I can control the lighting if required
      • I don't need to continuously stream. I just want to 'snap' and save the best point cloud I can get from the D415 to process later on
      • Assume the PCB is perpendicular to the D415



      • What settings are required to get sub 100 um accuracy for the setup above (or as close as possible to 100um)? The only one I know is changing the Depth units to 100 from 1000.
      • Do I need to calibrate the setup first? If so how?
      • What is the best way to evaluate such a test? Any setting look like they stream. Can I just snap?


      Any help would be greatly appreciated?





        • 1. Re: Settings for best Z accuracy

          RealSense cameras are usually well calibrated when they are new out of the box.  However, the 400 Series cameras have strong support for custom calibration if you decide that it is required.


          Calibration software:


          Download Intel® RealSense™ D400 Series Dynamic Calibration Software Tools


          Calibration documentation:


          Intel® RealSense™ D400 Product Family Dynamic Calibration Quick Start...

          Intel® RealSense™ D400 Series Dynamic Calibration Programmer Guide

          Intel® RealSense™ D400 Series Dynamic Calibration User Guide


          The RealSense SDK 2.0 SDK used with the 400 Series cameras has a sample program called Measure that can be used to measure the dimensions of objects.


          librealsense/examples/measure at master · IntelRealSense/librealsense · GitHub


          Intel's documentation says about accuracy that "The depth accuracy of the D400 series cameras is less than one Percent of the distance from the object.  So if the camera is 1m from the object, the expected accuracy is between 2.5mm to 5mm."


          The 400 Series has a Visual Preset system where you can change which aspects of the scan receive higher or lower quality.  There is a pre-made "High Accuracy" preset that gives higher accuracy at the cost of a lower fill rate.  In the camera's Advanced Mode, you can define your own Visual Preset if the pre-made ones do not meet your exact needs.


          D400 Series Visual Presets · IntelRealSense/librealsense Wiki · GitHub

          • 2. Re: Settings for best Z accuracy

            Hi MartyG,


            Thanks for your reply. Much appreciated.


            If you think the D415 is pretty well calibrated I'll concentrate on achieving the best settings through the settings in Realsense Viewer in the short term. I can return to calibration afterwards.


            Ideally I was hoping to use the Realsense viewer to obtain the best settings before I started to get stuck into the code. Is that the correct approach? Can I do everything I need to prove that the D415 will give me the results I require. Can I snap a single frame in here for example?


            I took a look at the measure example and while it will be helpful, I believe what I need help with at the moment is what settings I should be changing in order to get the best Z accuracy.


            I have seen it mentioned on this forum that it's possible to get sub um accuracy. What I am not sure is what are the optimum settings. Should I use the highest resolution framerate?  What other setting effect the accuracy? I tried the higher accuracy profile you mentioned, but it doesn't seem to really help with the Z accuracy. (It improves but not that much)


            So really what I am looking for is what is the optimal setup to get the best accuracy. Distance to the object  (near  / far) + frame rate and resolution + other setting available though the viewer


            Any other help would be greatly appreciated?





            • 3. Re: Settings for best Z accuracy

              I think your approach of seeing what the pre-made software settings can provide you with first and then using code if necessary is an efficient approach, and  I use it myself.


              You can snap a single frame using the SDK's record and playback functions.  The RealSense Viewer has built-in save and record.  To capture a frame instead of recording a sequence of frames with the Record button, click on the Pause icon to pause the stream, and then click on the Snapshot button next to it to capture that paused frame as a PNG image.



              If you want more complex frame capture, you can do that through scripting, as  described in the link below.


              librealsense/readme.md at master · IntelRealSense/librealsense · GitHub


              Intel's data sheet document for the 400 Series recommends using the Depth Quality Tool that comes with the SDK.  "This application can be used to test depth quality, including: distance to plane accuracy, Z accuracy, standard deviation of the Z accuracy and fill rate."


              Intel also recommend a White Paper document on depth testing methodology, which contains detailed information about Z-accuracy on page 7 and 8.



              • 4. Re: Settings for best Z accuracy

                Many thanks. Some really valuable information there. Let me take a look at these links and see what I can figure out.


                I'm sure I'll be back with more questions!!


                Thanks again

                • 5. Re: Settings for best Z accuracy

                  Glad I could help.  Please feel free to come back any time with further questions.  Have a great day! 

                  • 6. Re: Settings for best Z accuracy

                    Hi MartyG,


                    I made some progress yesterday with understanding what parameters did what with regards in using the intel viewer 2.1.0.


                    A couple of more questions that you or anyone else might be able to shed some light on



                    1. I'm having real problems picking up resistors, SOICs & caps that are less than 5mm in height of the board. Some of these are fairly large in the X & Y axis (up to 20mm x 20mm). I had some success in changing the Disparity Shift parameter for pulling out the larger components in height but I can't seem to land on any setting that will give me a depth resolution of less than 5mm. Everything is just coming back as the one height. Is this a limit of the D415 do you think or have I just not found the right combination of settings yet?
                    2. From your understanding of what the D415 sensor can do what size features should I be able to pick up on?
                    3. I have a lot of 'noise' in the image that surrounds the PCB I am looking at. What's the best way to remove this in your opinion


                    Thanks again in advance

                    • 7. Re: Settings for best Z accuracy

                      1.   If you are having trouble picking up the very thin components, it may be because the camera is having trouble seeing their edges. I would recommend trying rotating the camera 90 degrees and see if it can pick up the components' detail better when viewing it from a different direction.


                      Also, a couple of years ago, a technique called the Canny Edge Detector emerged.  You could use SDK 2.0's OpenCV compatibility to create a Canny Edge Detector via OpenCV.  Google 'opencv canny edge detector' for details of how to do this.


                      Canny Edge Detector


                      Canny Edge Detection - YouTube


                      2.  The D415 model's traits are reminiscent of the older SR300 camera model, in that it excels at scanning smaller static objects. Having said that, it may have greater trouble with objects that are less than 1 cm in size, at least when doing 3D model scanning.  You may get best results if you ensure that the object (the PCB in this case) fills as much of the camera's view as possible.


                      3.  Is the surface around the PCB that has the noise made of reflective / glossy material?  If so, the noise may be caused by the reflection.  Better results can be got from reflective surfaces if you apply a fine spray-on powder such as foot powder or baby powder to dampen the reflection.  This technique is used to scan shiny surfaces such as jewelry.


                      I wonder if spraying the whole PCB with foot / baby powder would help the camera to see the components that are less than 5mm by giving it an easily detectable surface to lock on to

                      • 8. Re: Settings for best Z accuracy

                        Yeah I'm familiar with Canny Edge detector. I used it a lot when using OpenCV in 2D images so maybe I can help you out down the line if you need help in the 2D world! I'm hoping there are ways of using what I know in 2D and bring them into the 3D world but they are very different


                        I think my understanding on how the 3D algorithm is lacking. Is there a good resource  / link you can point me too so that I can better understand on what it is trying to do? For example I didn't realise it was looking for edges in order to 'create' a region of interest of a particular height. What makes a good edge in 3D?


                        Just looking through other posts that you have helped out on I see it sometime mentioned to load different presets that are not part of the standard options. Would something like that help here? Do these presets contain what is basically just a combination of settings available in the standard intel viewer or can it also add ones that are currently not exposed though the intel viewer interface?


                        I'll try the baby powder technique and see what it yields. One way or another it might tell me where the problem lies.


                        Again thanks for the help

                        • 9. Re: Settings for best Z accuracy

                          A camera may find it easier to scan a complex object with lots of different shapes and edges than a simple object that lacks sharp edges or height features, such as a sphere.  The more shapes and edges there are, the more detail there is to identify and lock on to. 


                          At the bottom of the Visual Presets documentation, Intel suggest a link to a discussion on getting best results at close range.


                          [D435] Recommended configuration for near-range (< 1m) accuracy · Issue #1021 · IntelRealSense/librealsense · GitHub


                          Regarding introductory information about depth, the image below about how the 400 Series cameras handle depth may be helpful.


                          • 10. Re: Settings for best Z accuracy

                            Thanks for the information. I'll let you know how I get on