Items with no label
3335 Discussions

OpenCV + Intel Realsense Viewer

TBerr1
Novice
2,622 Views

Hi Guys. I can't integrate OpenCV with the Intel Realsense Viewer source code.

Using the OpenCV examples with the openCV I downloaded DOES work, but the problem comes when I try and use openCV in a project that isn't in the OpenCV folder (wrappers/OpenCV).

Also of course the realsense SDK built and runs correctly.

I'm currently on a Windows 10.

I'm using visual studio 2017. msvc 14.12

The opencv version is 3.4.1 (windows pack) that's the version that is pre built for you.

The steps I followed to try and link openCV to the Intel Realsense Viewer:

Some terminology:

1. open the intel realsense sdk solution in visual studio (that's the .sln called librealsense2)

2. go to the realsense-vewier project inside the 'solution explorer' panel inside visual studio

3. right click on the project 'realsense-viewer' and then select properties

4. make sure the 2 drop down boxes above have 'x64' and 'all configurations'

5. Go to the C/C++ -> General option (from the left white box) and then go to 'Additional Include Directories'

6. Add in the directory %OpenCVDownloadRoot%/build/include and %OpenCVDownloadRoot%/build/include/opencv (this is the configuration of the example OpenCV projects

Now at this point, some functions from openCV weren't being linked properly inside the 'realsense-viewer' project (which is weird because the work in the OpenCV projects in the SDK, even though the properties are the same. The errors were as follows:

So then I followed some extra steps to see if I can get this to work.

7. Inside the properties dialog box (the one we were just in) instead of selecting C/C++, select 'Linker'

8. in the 'Additional Libraries Directories' selection, add in %OpenCVDownloadRoot%/build/x64/vc15/lib

9. inside the 'Linker' properties, search for Input (Linker -> Input)

10. add in 'opencv_world341d.lib' inside the 'Additional Dependencies' selection.

Now we get a completely different error:

Now the realsense libraries aren't being recognised. No other properties were modified except for the above. I can confirm that step 10 causes all of these errors. Even if I reverse the actions of step 10 after performing all the steps, the above error still remains -> this must be a visual studio bug.

Any help or hints on how I can get OpenCV 3.4.1 + realsense-viewer (from the SDK) working inside visual studio 2017?

0 Kudos
3 Replies
idata
Employee
1,650 Views

Hello tristanberry,

 

 

Thank you for your interest in the Intel® Real Sense Technology.

 

 

We were able to get to step 6 and build the realsense-viewer without any problems.

 

 

We noticed that you are using x64, is this correct?

 

 

If we infer correctly the only option we get if we setup the environment using these instructions https://github.com/IntelRealSense/librealsense/tree/master/wrappers/opencv, is Win32. This could be an issue.

 

 

Please try this option and let us know the results.

 

 

We will be looking forward for your reply.

 

 

Best regards.

 

 

Josh B.

 

Intel Customer Support

 

0 Kudos
TBerr1
Novice
1,650 Views

Hi Josh B,

Unfortunately I didn't try it in Win32, but I managed to solve the problem by following the answer here: https://stackoverflow.com/questions/49332616/opencv-realsense-visual-studio-link-2019-error/49333031# 49333031 c++ - OpenCV + Realsense : Visual Studio Link 2019 error - Stack Overflow

0 Kudos
idata
Employee
1,650 Views

Hello tristanberry,

 

Thank you for your reply.

 

 

We appreciate that you took the time to share this information with the community.

 

 

Best regards,

 

 

Josh B.

 

Intel Customer Support

 

0 Kudos
Reply