The Visual Studio instructions for RealSense beginners with the 400 Series cameras are admittedly not beginner-friendly and users are assumed to have a certain amount of programming knowledge. Even I have to re-read the instructions multiple times to make sure I get it right.
If you are using Windows, once you have installed the complete SDK with the file 'Intel.RealSense.SDK.exe' on the SDK downloads page (be sure to tick that you want a shortcut placed on your desktop during the installation process), it should place a shortcut on your computer's desktop called Intel RealSense Samples. This is a Visual Studio solutions file for setting up RealSense in VS.
Running this should open up Visual Studio automatically and set the solution up in it. If it asks you about missing files during the setup process, click 'Install'.
When the solution has completed its installation, you can press the F5 key in Visual Studio to build and run the sample programs.
You can import the details of files by using an #include statement at the very top of your script. For example, if you look at the main script files of the examples in Visual Studio, most of them have these lines at the top:
#include <librealsense2/rs.hpp> // Include RealSense Cross Platform API
#include "example.hpp" // Include short list of convenience functions for rendering
In programming, anything put after // acts as a reminder note about what that line does, and the program ignores everything after the // when running.
The part that a lot of visual Studio programmers have problems with is that when they run their program, Visual Studio says that it cannot find the include files. You should define the paths to the files so that Visual Studio can locate them.
Most documentation on the internet for creating linkages is horrible, so I've written my own guide for you (I end up writing my own manuals for most programming products). The instructions below were tested by me in Visual Studio 2017, which has a free Community edition.
Make sure you have the Solution Explorer panel open in Visual Studio (go to the View menu and select 'Solution Explorer').
When the Solution Explorer panel is open, highlight the topmost item. Right-click on it and select 'Open folder in File Explorer' to open the folder location on your computer where your project is stored.
Add to this folder location any files and folders you want to include in your project. you can do this by dragging and dropping files and folders into the project folder.
When you have added the files or folders you want to include, return to the Solution Explorer panel, left-click on the panel and select the 'Refresh' option to update the file list.
In the example above, I added to the project folder a folder called 'woooo', put a text file called 'moooo' in it and then clicked Refresh to show it in the list in the Solution Explorer.
Finally, right click on the folder or file in the Solution Explorer that you want to include in the project and select 'Include in project' to link it to the project.
I'm glad you found the guide useful.
If you want to increase accuracy, you could try setting the 'Visual Preset' configuration of the camera to High Accuracy mode. This can be done in script with the line below. I would suggest putting it somewhere near the top of your script, after the pipeline is set up but before the script does processing of camera frames.
const char* new_preset = "High accuracy";
Also, if you are measuring with the camera in close range to the object, you could try altering the camera's depth scale.
If you need high accuracy, the other option would be to increase the resolution that you are using. Accuracy increases as resolution increases and reduces as resolution is lowered. For good accuracy in depth scanning, a minimum resolution of 848x400 is recommended. The downside of increasing resolution is that the minimum distance of the object from the camera must increase, so you cannot position objects as close to the camera.
I do not know another way to change it other than RS2_OPTION_DEPTH_UNITS, unfortunately. I believe that the line below should be used, with the 0.001f value changed to the scale you want to use, such as 0.1f (it's important to put the f on the end, as it stands for float, or decimal-point number).
With your advice,I managed to get the schedule to 0.1mm.
I've read a lot of pots, including one about using OpenCV to work with all the depth that is worth my while.
I did some experiments, and I tried to test the accurary of a point to see if it could detect a change in 1mm.
As I later discovered depth is constantly changing and what can I do to reduce the depth that is worth the ups and downs.
The link below discusses the depth fluctuation issue.
You might also consider using a different Visual Preset setting for the camera, such as 'High Accuracy'.
If you want to use frame metadata, there are additional steps that need to be followed, depending on your operating system. Look at the installation .md (e.g. installation_windows.md) file for your operating system here.