Open milan-r-shah opened 4 years ago
Hi @milan-r-shah I hope that the link below will be helpful to you.
CMake files provided with the examples are for building them inside the SDK. We also provide cmake
example showing how you can develop an application on top of the SDK and link to librealsense using CMake. Or if you are on Windows, the link above may be useful
CMake files provided with the examples are for building them inside the SDK. We also provide
cmake
example showing how you can develop an application on top of the SDK and link to librealsense using CMake. Or if you are on Windows, the link above may be useful
Thanks a lot @MartyG-RealSense & @dorodnic . As I'm working on Linux, the quoted response worked.
I'm not sure whether you guys have already planned to update code-samples page or not but it would be really helpful, if you can include this cmake
example over there as well. Or may be on C/C++ wrapper page when it becomes available.
Thanks again!
Hi @milan-r-shah I think that the best way to progress with your request above is to mark this case with a Documentation label and leave it open so that your request about the examples can be looked at by Intel at a later date. Thanks!
This is a duplicate of https://github.com/IntelRealSense/librealsense/issues/10436.
Has the IntelRealSense project provided an example of how to create an independent project?
Request:
An independent cmake project that creates a binary executable in C++
cd example-project && mkdir build && cd build
cmake -S ../ -B .
./example-project
Problem:
It is very hard to understand how to create an independent project. The reason it is hard is because the examples repo builds 20+ examples in one script (I'd like to do it just for one project). thanks in advance
Hi @SuperElectron There is a C++ example of creating a new project with CMake at the link below.
https://github.com/IntelRealSense/librealsense/tree/master/examples/cmake
There is also a Getting Started tutorial project in the link below, which does not have dependencies and so is a good learning experience before doing projects with dependencies.
https://github.com/zivsha/librealsense/tree/getting_started_example/examples/getting-started
Also, a RealSense user created a guide to setting up a Visual Studio project on Windows with the three props files provided by the RealSense SDK.
https://github.com/EduardoWang/visual-studio-real-sense-record-and-playback-project
The prop files are located in the root directory of the RealSense SDK folder at this Windows location after the full SDK has been installed:
C: > Program Files (x86) > Intel RealSense SDK 2.0
Hi @SuperElectron Was the information in the comment above helpful to you, please? Thanks!
Hey, thank you for the detailed reply.
I am familiar with Nvidia products and a bit new to intel and its SDK. Another way of saying this is it takes a while to get used to the realsense SDK (and that costs my employer lots of money). The cmake example is good; however, it doesn't show how to build a project using the SDK, it tells you how you should do it. I think I need to do a bit of explaining to justify myself, and I am not saying the documentation and examples are not good, it is more just that the structure is someone difficult to deconstruct. So, I'll elaborate on the structure for project building.
I hope this explains what I was trying to say with my previous comment above: "It is very hard to understand how to create an independent project. The reason it is hard is because the examples repo builds 20+ examples in one script (I'd like to do it just for one project)."
Here is my attempt at creating a standalone project: https://github.com/SuperElectron/openvino-rs-face-demo/tree/master
This example below is not a stand alone example.
So, my challenge is this:
Any thoughts, pointers, or hints is greatly appreciated. And thank you very much for the links @MartyG-RealSense , I will be reading them and trying to get this repo working.
Hi @SuperElectron I will respond to your questions tomorrow in order to provide time to research them. Thanks in advance for your patience!
Thanks again for your patience. A RealSense support team member provides advice at the link below for setting up an independent OpenVINO project in Visual Studio instead of CMake.
Are you able to use Visual Studio on Windows? I was unable to find any CMake references for creating an independent OpenVINO project unfortunately.
Hi all, Here's how I got my project working starting from scratch.
Steps:-
Create a new Source file"FileName.cpp" Paste the source code from any example project and save.
In Project Properties
VC++ Directories
Update the Library Directories with the following path
C:\Program Files %28x86%29\Intel RealSense SDK 2.0\lib\x64;$(LibraryPath)
C/C++
General-> Update the Additional Include Directories with the following path
C:\Program Files %28x86%29\Intel RealSense SDK 2.0\third-party\glfw-imgui\include\GLFW;C:\Program Files %28x86%29\Intel RealSense SDK 2.0\include;%(AdditionalIncludeDirectories)
Linker
General-> Update the Additional Library Directories with the following path
$(librealsenseSDK)\lib\$(PlatformShortName);%(AdditionalLibraryDirectories)
Input-> Update the Additional Dependencies with the following path
C:\Program Files (x86)\Intel RealSense SDK 2.0\lib\x64\realsense2.lib;%(AdditionalDependencies)
System->
SubSystem Type = Console (/SUBSYSTEM:CONSOLE)
Build Events
Post-Build Event->
Update the Command Line with the following command
xcopy /y "C:\Program Files (x86)\Intel RealSense SDK 2.0\bin\x64\realsense2.dll" "$(OutDir)"
That's it! you have now successfully created your custom project with Intel RealSense SDK.
Thanks so much @Shreyas-NR for sharing your detailed Windows and Visual Studio project setup guide with the RealSense community!
Issue Description
How exactly the build procedure for librealsense for C++ work?
Initially, I was facing the problems with building example code snippets. So, I created #6784 Then to build them without any errors, I had to follow installation.md file for the proper installation of the library.
So, after running required scripts, for running an example code e.g. rs-hello-realsense.cpp (in Ubuntu 18.04 LTS), I did this:
and it worked!!
Afterwords, I also followed #2946 to understand what to do if I modify any example code. So, e.g. if I modify rs-hello-realsense.cpp then I have to do simply:
But, this procedure is only for example codes, right? The main confusion is how can I build my own independent code which is not residing in librealsense directory (but somewhere else)? How to use this library just like OpenCV or PCL (i.e. once installed globally, can be used from anywhere)?
Thanks in advance :)