View my account

How to learn all the functionalities I can program to my own project?

Comments

6 comments

  • MartyG

    An easy way to get started with RealSense C++ application development in Visual Studio is to use the three props property sheet files provided by the RealSense SDK.  Information about doing so can be found at the link below.

    https://support.intelrealsense.com/hc/en-us/community/posts/4412175411859/comments/4412182682387

    0
    Comment actions Permalink
  • U3576598

    Great! That should help me get started, thanks alot! 

    0
    Comment actions Permalink
  • U3576598

    How can I study these three libraries to use their API? 

    1
    Comment actions Permalink
  • MartyG

    If you mean the three property sheet files, they simply contain linkages to the library files of librealsense, OpenCV and glfw / imgui graphics in order to set them up in a RealSense Visual Studio project and do not need to be studied.  The files can be opened in the Windows notepad app if you wish to look at their contents. 

     

    For example, below are the contents of the librealsense prop file.

     

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <ImportGroup Label="PropertySheets" />
      <PropertyGroup Label="UserMacros">
        <librealsenseSDK>$(ProgramFiles)\Intel RealSense SDK 2.0</librealsenseSDK>
      </PropertyGroup>
      <PropertyGroup />
      <ItemDefinitionGroup>
        <ClCompile>
          <AdditionalIncludeDirectories>$(librealsenseSDK)\include;
          $(librealsenseSDK)\third-party\;
          %(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        </ClCompile>
        <Link>
          <AdditionalLibraryDirectories>$(librealsenseSDK)\lib\$(PlatformShortName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
          <AdditionalDependencies>realsense2.lib;%(AdditionalDependencies)</AdditionalDependencies>
        </Link>
        <PostBuildEvent>
          <Command>xcopy /y "$(librealsenseSDK)\bin\$(PlatformShortName)\realsense2.dll" "$(OutDir)"</Command>
        </PostBuildEvent>
        <PostBuildEvent>
          <Message>Copy Intel RealSense SDK 2.0 shared module next to the application</Message>
        </PostBuildEvent>
      </ItemDefinitionGroup>
      <ItemGroup>
        <BuildMacro Include="librealsenseSDK">
          <Value>$(librealsenseSDK)</Value>
        </BuildMacro>
      </ItemGroup>
    </Project>
    0
    Comment actions Permalink
  • U3576598

    So where should I look for the API I need to, like get the depth of a pixel from the camera, crop and scan a certain part only from a 1280x720px? I want to go through all the API i can call from librealsense2, Imgui, opencv and know how each work. Since I'm quite new to being a dev, I don't really know where to look for this documentation. 

    1
    Comment actions Permalink
  • MartyG

    A good place to start is the API How-To page that contains code snippets for different kinds of functions.  Use the code sections headed librealsense2.

    https://dev.intelrealsense.com/docs/api-how-to

     

    The Examples page also contains a wide range of example programs that you can view the cpp source code of.

    https://github.com/IntelRealSense/librealsense/tree/master/examples

     

    Some OpenCV RealSense example programs can be found here:

    https://github.com/IntelRealSense/librealsense/tree/master/wrappers/opencv

     

    The majority of RealSense users will not need to get into Imgui programming, but if you are interested then there is a discussion at the link below about Imgui drawing commands in librealsense.

    https://support.intelrealsense.com/hc/en-us/community/posts/360052500553-How-to-draw-shapes-on-a-window-using-ImGiu-

     

    You can crop the distance using a Threshold Filter to set a minimum and maximum distance for depth rendering.  Depth values outside of that min-max range will be excluded from the depth image.  An example of C++ scripting for doing so is below.

    https://github.com/IntelRealSense/librealsense/issues/7771

     

    If you want to crop XY (horizontal and vertical) instead of forward Z-distance then that is more complicated.  Doing it via the definition of a bounding box is described here:

    https://github.com/IntelRealSense/librealsense/issues/2016

     

    If you wish to get the depth of a specific pixel coordinate instead of the entire image then you can use an API instruction called rs2_project_color_pixel_to_depth_pixel to convert an XY color pixel to an XYZ depth pixel.

     https://github.com/IntelRealSense/librealsense/issues/6239#issuecomment-614261704

    1
    Comment actions Permalink

Please sign in to leave a comment.