IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.52k stars 4.81k forks source link

How to get a suitable rgb image and depth image to generate a point cloud image? #11662

Closed zechengli96 closed 1 year ago

zechengli96 commented 1 year ago

Hi, first thanks so much for all developers that might helped with this. I am trying to convert a RGB image and a Depth image in python using open3d's function. I got this code online and this is the code: These are the original files:

rgb

depth

And here are the code:

import open3d as o3d

if name == 'main':

read the color and the depth image:

rgb_image = o3d.io.read_image("./1.jpg")
depth_image = o3d.io.read_image("./depth.png")

# create an rgbd image object:
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(
    rgb_image, depth_image, convert_rgb_to_intensity=False)
# use the rgbd image to create point cloud:
pcd = o3d.geometry.PointCloud.create_from_rgbd_image(
    rgbd_image,
    o3d.camera.PinholeCameraIntrinsic(
        o3d.camera.PinholeCameraIntrinsicParameters.PrimeSenseDefault))
# visualize:
o3d.visualization.draw_geometries([pcd])

Now I am trying to use this code based on Intel realsense, I think I will be able to get the rgb image just from snapshot the camera, but how can I get the depth image? It seems this so called depth image is different from the Stereo Mode's RGBD image. It is just called depth image, how can I get the image? Would be much appreciated. Delete if this isn't allowed.
MartyG-RealSense commented 1 year ago

Hi @zechengli96 Is the Python Open3D pointcloud script at https://github.com/IntelRealSense/librealsense/issues/10894#issuecomment-1245803237 helpful to you, please?

zechengli96 commented 1 year ago

Thanks @MartyG-RealSense checking it still, will close and post any progress. Thanks!

zechengli96 commented 1 year ago

@MartyG-RealSense Hi Sir or Madam, I have some basic question I think you can answer better than chatgpt. If you don't mind. I have read through the tutorial but I couldn't find what exact I want.

1) What method the Intel depth camera used, to identify an arbitrary image's boundary of an object? I know this might be a very vague question. My understanding is we are using depth detection, just like human's eye have a stable distance with each other, two camera have a constant distance between them so using similar triangle theory, we can get the distance of an object, of its boundary, but just look at this boundary thing, it has a significant depth difference compared to outside of the boundary, say if I put my face here, in the range of my face, in depth image, there will be all blue, but on the boundary, it is actually black, and then outside the black there is another layer. Do you know what was used, to actually decide this boundary that has to be black? Is just based on a certain depth differences? Or is there any machine learning algorithm?

More clear version of the question is, let's say if I have a rgb image, and a depth image, what algorithm or code it used to generate the boundary/gap between each section? Do you know if there is a tutorial/paper that explain this?

2) A photo in 2D stereo mode, can we call it the image there as in "RGBD value"? Is there a script that we can use, to see on a boundary, what pattern this RGBD value look like? Or, the RGBD value inside and outside the boundary's comparison? I did some research and found there was a code that can just get 1 coordinates, from this one #2231, do I just have to modify the script, and get a line of boundary, to see what's really going on underneath?

3) One more thing, if I have a normal rgb image, and a depth image generated by stereo mode, is there anyway to align/combine these two and make a point cloud model? In another word, in the realsense tool, in 2D, we can get a rbg image and a depth image, on 3D, we can just directly get a point cloud image, is there a way we running a code from a vscode terminal to actually just have this 2 image and make a point cloud image out of it?

Best Regards, thank you so much.

MartyG-RealSense commented 1 year ago
  1. If you are referring to a black boundary around an object on an image where depth and RGB are aligned, this is a phenomenon called occlusion. It occurs due to the different positions of the RGB and depth sensors on the front of the camera, meaning that the RGB sensor may not see all of the detail in the scene that the depth sensor is seeing. The effect can be reduced by using occlusion invalidation, as described in the section of Intel's Projection,Texture-Mapping and Occlusion guide linked to below.

https://dev.intelrealsense.com/docs/projection-texture-mapping-and-occlusion-with-intel-realsense-depth-cameras#4-occlusion-invalidation

  1. If you use a camera configuration Visual Preset (json) file called Edge Map then you can render the depth image as only edges. The preset file can be obtained by visiting the link below and scrolling down to the Additional Presets not in the Viewer section.

https://dev.intelrealsense.com/docs/d400-series-visual-presets#preset-table

image

  1. If you are using C++ code in VSCode then the RealSense SDK's rs-pointcloud example program may meet your requirements for an aligned pointcloud. It uses the instruction pc.map_to(color); to map RGB color onto depth to generate a combined textured pointcloud.

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

If your librealsense installation is on Linux and includes the tools and example programs then you should be able to find an executable version of rs-pointcloud in the folder location /usr/local/bin

zechengli96 commented 1 year ago

@MartyG-RealSense Hi Marty, thank you so much for the reply, I have never seen anyone that down to earth like you.

I think what I am referring to the black edge, is not the edge on the left, is the edge around an object, like my face, it has an edge, I want to know how the depth camera decide to form that edge...

MartyG-RealSense commented 1 year ago

Yes, I initially thought it was the edge on the left (Invalid Depth Band) and then edited my 1. answer above at https://github.com/IntelRealSense/librealsense/issues/11662#issuecomment-1502906230 to say that it was likely to be occlusion (a black silhouette often seen around body parts such as head and arms). As mentioned above, it occurs in images that use both depth and RGB because of the sensors being in different physical positions on the front of the camera.

zechengli96 commented 1 year ago

Hi, @MartyG-RealSense, Thanks for your explanation. I want to post some of my understanding to help other people.

1) Honest, your answer to "occlusion" still not answers my question, my question is in short, how can the depth camera measure/recognize the boundary of an object? And by boundary/edge, I mean for instance, when we see using our eye to see our hand, there will be an edge of hand where there is, imagine there is a line out of our hand, in daily life we consider it to be very typical, but on the depth image, or point cloud image, does those lines mean anything special? Because they all have a depth value, so do they occlusion to form a gap between objects? I know this question description might sound very vague, but I hope you can understand where I was coming from. ( In the example below, I am not talking about the big shadowing on my head area, I am talking about in general, on the edge of an object, there will be a line, my question is how that line formed?)

For occlusion, I want to explain it in an easier-to-understand way: 1) When we generate a depth image, we always tend to get an overlap, or, a shadow area, let's see this image: image See I am sitting in front of the camera, and there is a shadow area on the back of my head. On the normal RGB image, we people will not see that shadowing area, the reason depth image see that is because:

  1. The position of RGB camera and Depth camera is different, so Depth camera will be able to see something where blocked in RGB camera, we call this phenomenon as occlusion.
  2. This will happen when there are 3 objects, object in the back, object in the middle, and camera itself.
  3. Because depth camera sees it, so, in order to combine/align depth and color camera together to form a point cloud image, when forming the point cloud image, the depth camera will populate that part with a shadow. The area of the shadow will depend on the distance between depth camera and color camera, and also the depth. The shape of shadow will sometime depend on the order of the depth camera and color camera, if they horizontal or vertical. And sometime, both will be affected.

( I will post my finding after trying the codes.)

zechengli96 commented 1 year ago

The only edge solution works really well. Here are the step: 1) Go to https://github.com/IntelRealSense/librealsense/tree/master/examples/pointcloud Then go to Additional Presets not in the viewer: download and save the EdgeMapD435.json by right click the browser, save it local 2) Open the realsense viewer, close your stream, there is a little upload button on the left panel, upload, select all file option then pick this json file. 3) Then load it, you will get a very nice just edge picture.

Here are the example: sample_Color sample1_Depth

Thanks @MartyG-RealSense

zechengli96 commented 1 year ago

Hi @MartyG-RealSense when trying the final step, I encountered some challenge, hope you can help me. So, this is the step I took: 1) Download the librealsense-master code base 2) Open it in VScode, navigate to the examples/pointcloud/rs-pointcloud.cpp file 3) Fixed all of the errors:

  1. cannot locate the example.hpp, I fixed this by changing the relative path to actual path
  2. cannot find the GLFW folder, and cannot find the glut lib, I fixed by installed them
  3. Right now I am backing to this file rs-pointcloud.cpp, when I try to build it, it finished with errors and there is no other clear debug information, I had my camera hooked in, and I had my app stream shut, still does not work. Below is the error build info, any insight?

Executing task: C/C++: g++ build active file

Starting build... /usr/bin/g++ -fdiagnostics-color=always -g /home/zli/Documents/librealsense-master/examples/pointcloud/rs-pointcloud.cpp -o /home/zli/Documents/librealsense-master/examples/pointcloud/rs-pointcloud /usr/bin/ld: /tmp/cca6zvzr.o: in function set_viewport(rect const&)': /home/zli/Documents/librealsense-master/examples/example.hpp:135: undefined reference toglViewport' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:136: undefined reference to glLoadIdentity' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:137: undefined reference toglMatrixMode' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:138: undefined reference to glOrtho' /usr/bin/ld: /tmp/cca6zvzr.o: in functiondraw_pointcloud(float, float, glfw_state&, rs2::points&)': /home/zli/Documents/librealsense-master/examples/example.hpp:948: undefined reference to glLoadIdentity' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:949: undefined reference toglPushAttrib' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:951: undefined reference to glClearColor' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:952: undefined reference toglClear' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:954: undefined reference to glMatrixMode' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:955: undefined reference toglPushMatrix' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:956: undefined reference to gluPerspective' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:958: undefined reference toglMatrixMode' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:959: undefined reference to glPushMatrix' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:960: undefined reference togluLookAt' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:962: undefined reference to glTranslatef' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:963: undefined reference toglRotated' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:964: undefined reference to glRotated' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:965: undefined reference toglTranslatef' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:967: undefined reference to glPointSize' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:968: undefined reference toglEnable' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:969: undefined reference to glEnable' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:970: undefined reference toglBindTexture' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:972: undefined reference to glTexParameterfv' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:973: undefined reference toglTexParameteri' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:974: undefined reference to glTexParameteri' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:975: undefined reference toglBegin' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:986: undefined reference to glVertex3fv' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:987: undefined reference toglTexCoord2fv' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:992: undefined reference to glEnd' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:993: undefined reference toglPopMatrix' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:994: undefined reference to glMatrixMode' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:995: undefined reference toglPopMatrix' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:996: undefined reference to glPopAttrib' /usr/bin/ld: /tmp/cca6zvzr.o: in functiondraw_pointcloud_wrt_world(float, float, glfw_state&, rs2::points&, rs2_pose&, float, std::vector<rs2_vector, std::allocator >&)': /home/zli/Documents/librealsense-master/examples/example.hpp:1014: undefined reference to glLoadIdentity' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1015: undefined reference toglPushAttrib' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1017: undefined reference to glClearColor' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1018: undefined reference toglClear' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1020: undefined reference to glMatrixMode' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1021: undefined reference toglPushMatrix' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1022: undefined reference to gluPerspective' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1026: undefined reference toglMatrixMode' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1027: undefined reference to glPushMatrix' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1030: undefined reference toglTranslatef' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1031: undefined reference to glRotated' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1032: undefined reference toglRotated' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1033: undefined reference to glTranslatef' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1036: undefined reference toglEnable' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1037: undefined reference to glLineWidth' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1038: undefined reference toglBegin' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1041: undefined reference to glColor3f' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1042: undefined reference toglVertex3f' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1044: undefined reference to glEnd' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1045: undefined reference toglLineWidth' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1046: undefined reference to glColor3f' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1055: undefined reference toglMultMatrixf' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1058: undefined reference to glMultMatrixf' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1061: undefined reference toglPointSize' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1062: undefined reference to glEnable' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1063: undefined reference toglEnable' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1064: undefined reference to glBindTexture' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1066: undefined reference toglTexParameterfv' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1067: undefined reference to glTexParameteri' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1068: undefined reference toglTexParameteri' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1069: undefined reference to glBegin' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1079: undefined reference toglVertex3fv' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1080: undefined reference to glTexCoord2fv' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1085: undefined reference toglEnd' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1086: undefined reference to glPopMatrix' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1087: undefined reference toglMatrixMode' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1088: undefined reference to glPopMatrix' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1089: undefined reference toglPopAttrib' /usr/bin/ld: /tmp/cca6zvzr.o: in function get_screen_resolution(unsigned int&, unsigned int&)': /home/zli/Documents/librealsense-master/examples/example.hpp:1131: undefined reference toglfwInit' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1132: undefined reference to glfwGetPrimaryMonitor' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:1132: undefined reference toglfwGetVideoMode' /usr/bin/ld: /tmp/cca6zvzr.o: in function `rs2::error::error(rs2_error)': /usr/include/librealsense2/hpp/rs_types.hpp:97: undefined reference to rs2_get_error_message' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_types.hpp:99: undefined reference tors2_get_failed_function' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_types.hpp:99: undefined reference to rs2_get_failed_function' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_types.hpp:100: undefined reference tors2_get_failed_args' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_types.hpp:100: undefined reference to rs2_get_failed_args' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_types.hpp:101: undefined reference tors2_get_librealsense_exception_type' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_types.hpp:102: undefined reference to rs2_free_error' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::error::handle(rs2_error)': /usr/include/librealsense2/hpp/rs_types.hpp:148: undefined reference to rs2_get_librealsense_exception_type' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::stream_profile::stream_profile(rs2_stream_profile const)': /usr/include/librealsense2/hpp/rs_frame.hpp:173: undefined reference to rs2_get_stream_profile_data' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_frame.hpp:176: undefined reference tors2_is_stream_profile_default' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::frame::~frame()': /usr/include/librealsense2/hpp/rs_frame.hpp:432: undefined reference tors2_release_frame' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::frame::keep()': /usr/include/librealsense2/hpp/rs_frame.hpp:439: undefined reference tors2_keep_frame' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::frame::get_data() const': /usr/include/librealsense2/hpp/rs_frame.hpp:550: undefined reference tors2_get_frame_data' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::frame::get_profile() const': /usr/include/librealsense2/hpp/rs_frame.hpp:562: undefined reference tors2_get_frame_stream_profile' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::frame::add_ref() const': /usr/include/librealsense2/hpp/rs_frame.hpp:609: undefined reference tors2_frame_add_ref' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::frame::reset()': /usr/include/librealsense2/hpp/rs_frame.hpp:617: undefined reference tors2_release_frame' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::video_frame::video_frame(rs2::frame const&)': /usr/include/librealsense2/hpp/rs_frame.hpp:649: undefined reference tors2_is_frame_extendable_to' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::video_frame::get_width() const': /usr/include/librealsense2/hpp/rs_frame.hpp:664: undefined reference tors2_get_frame_width' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::video_frame::get_height() const': /usr/include/librealsense2/hpp/rs_frame.hpp:676: undefined reference tors2_get_frame_height' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::points::points(rs2::frame const&)': /usr/include/librealsense2/hpp/rs_frame.hpp:755: undefined reference tors2_is_frame_extendable_to' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_frame.hpp:763: undefined reference to rs2_get_frame_points_count' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::points::get_vertices() const': /usr/include/librealsense2/hpp/rs_frame.hpp:774: undefined reference to rs2_get_frame_vertices' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::points::get_texture_coordinates() const': /usr/include/librealsense2/hpp/rs_frame.hpp:799: undefined reference to rs2_get_frame_texture_coordinates' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::depth_frame::depth_frame(rs2::frame const&)': /usr/include/librealsense2/hpp/rs_frame.hpp:824: undefined reference to rs2_is_frame_extendable_to' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::frameset::frameset(rs2::frame const&)': /usr/include/librealsense2/hpp/rs_frame.hpp:962: undefined reference to rs2_is_frame_extendable_to' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_frame.hpp:971: undefined reference tors2_embedded_frames_count' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::frameset::operator[](unsigned long) const': /usr/include/librealsense2/hpp/rs_frame.hpp:1133: undefined reference tors2_extract_frame' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::options::set_option(rs2_option, float) const': /usr/include/librealsense2/hpp/rs_options.hpp:102: undefined reference tors2_set_option' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::frame_queue::frame_queue(unsigned int, bool)': /usr/include/librealsense2/hpp/rs_processing.hpp:146: undefined reference tors2_create_frame_queue' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_processing.hpp:146: undefined reference to rs2_delete_frame_queue' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::frame_queue::enqueue(rs2::frame) const': /usr/include/librealsense2/hpp/rs_processing.hpp:161: undefined reference to rs2_enqueue_frame' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::processing_block::invoke(rs2::frame) const': /usr/include/librealsense2/hpp/rs_processing.hpp:291: undefined reference to rs2_process_frame' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::pointcloud::init()': /usr/include/librealsense2/hpp/rs_processing.hpp:490: undefined reference to rs2_create_pointcloud' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_processing.hpp:490: undefined reference tors2_delete_processing_block' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::colorizer::init()': /usr/include/librealsense2/hpp/rs_processing.hpp:798: undefined reference tors2_create_colorizer' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_processing.hpp:798: undefined reference to rs2_delete_processing_block' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::sensor::get_stream_profiles() const': /usr/include/librealsense2/hpp/rs_sensor.hpp:226: undefined reference to rs2_get_stream_profiles' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_sensor.hpp:226: undefined reference tors2_delete_stream_profiles_list' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_sensor.hpp:229: undefined reference to rs2_get_stream_profiles_count' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_sensor.hpp:234: undefined reference tors2_get_stream_profile' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::device::query_sensors() const': /usr/include/librealsense2/hpp/rs_device.hpp:30: undefined reference tors2_query_sensors' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_device.hpp:30: undefined reference to rs2_delete_sensor_list' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_device.hpp:33: undefined reference tors2_get_sensors_count' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_device.hpp:41: undefined reference to rs2_create_sensor' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_device.hpp:41: undefined reference tors2_delete_sensor' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::device::supports(rs2_camera_info) const': /usr/include/librealsense2/hpp/rs_device.hpp:69: undefined reference tors2_supports_device_info' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::device::get_info(rs2_camera_info) const': /usr/include/librealsense2/hpp/rs_device.hpp:82: undefined reference tors2_get_device_info' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::device_list::operator[](unsigned int) const': /usr/include/librealsense2/hpp/rs_device.hpp:989: undefined reference tors2_create_device' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_device.hpp:989: undefined reference to rs2_delete_device' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::device_list::size() const': /usr/include/librealsense2/hpp/rs_device.hpp:998: undefined reference to rs2_get_device_count' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::context::context()': /usr/include/librealsense2/hpp/rs_context.hpp:102: undefined reference to rs2_create_context' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_context.hpp:102: undefined reference tors2_delete_context' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::context::query_devices() const': /usr/include/librealsense2/hpp/rs_context.hpp:117: undefined reference tors2_query_devices' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_context.hpp:117: undefined reference to rs2_delete_device_list' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::pipeline::pipeline(rs2::context)': /usr/include/librealsense2/hpp/rs_pipeline.hpp:375: undefined reference to rs2_create_pipeline' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_pipeline.hpp:375: undefined reference tors2_delete_pipeline' /usr/bin/ld: /tmp/cca6zvzr.o: in function rs2::pipeline::start()': /usr/include/librealsense2/hpp/rs_pipeline.hpp:397: undefined reference tors2_pipeline_start' /usr/bin/ld: /usr/include/librealsense2/hpp/rs_pipeline.hpp:397: undefined reference to rs2_delete_pipeline_profile' /usr/bin/ld: /tmp/cca6zvzr.o: in functionrs2::pipeline::wait_for_frames(unsigned int) const': /usr/include/librealsense2/hpp/rs_pipeline.hpp:513: undefined reference to rs2_pipeline_wait_for_frames' /usr/bin/ld: /tmp/cca6zvzr.o: in functiontexture::upload(rs2::video_frame const&)': /home/zli/Documents/librealsense-master/examples/example.hpp:426: undefined reference to glGenTextures' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:427: undefined reference toglGetError' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:435: undefined reference to glBindTexture' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:440: undefined reference toglTexImage2D' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:443: undefined reference to glTexImage2D' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:446: undefined reference toglTexImage2D' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:449: undefined reference to glTexImage2D' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:455: undefined reference toglTexParameteri' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:456: undefined reference to glTexParameteri' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:457: undefined reference toglTexParameteri' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:458: undefined reference to glTexParameteri' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:459: undefined reference toglPixelStorei' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:460: undefined reference to glBindTexture' /usr/bin/ld: /tmp/cca6zvzr.o: in functionwindow::window(int, int, char const)::{lambda(GLFWwindow, int, int, int)#1}::operator()(GLFWwindow, int, int, int) const': /home/zli/Documents/librealsense-master/examples/example.hpp:533: undefined reference to glfwGetWindowUserPointer' /usr/bin/ld: /tmp/cca6zvzr.o: in functionwindow::window(int, int, char const)::{lambda(GLFWwindow, double, double)#2}::operator()(GLFWwindow, double, double) const': /home/zli/Documents/librealsense-master/examples/example.hpp:539: undefined reference to glfwGetWindowUserPointer' /usr/bin/ld: /tmp/cca6zvzr.o: in functionwindow::window(int, int, char const)::{lambda(GLFWwindow, double, double)#3}::operator()(GLFWwindow, double, double) const': /home/zli/Documents/librealsense-master/examples/example.hpp:545: undefined reference to glfwGetWindowUserPointer' /usr/bin/ld: /tmp/cca6zvzr.o: in functionwindow::window(int, int, char const)::{lambda(GLFWwindow, int, int, int, int)#4}::operator()(GLFWwindow, int, int, int, int) const': /home/zli/Documents/librealsense-master/examples/example.hpp:551: undefined reference to glfwGetWindowUserPointer' /usr/bin/ld: /tmp/cca6zvzr.o: in functionwindow::window(int, int, char const)': /home/zli/Documents/librealsense-master/examples/example.hpp:524: undefined reference to glfwInit' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:525: undefined reference toglfwCreateWindow' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:528: undefined reference to glfwMakeContextCurrent' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:530: undefined reference toglfwSetWindowUserPointer' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:531: undefined reference to glfwSetMouseButtonCallback' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:537: undefined reference toglfwSetScrollCallback' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:543: undefined reference to glfwSetCursorPosCallback' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:549: undefined reference toglfwSetKeyCallback' /usr/bin/ld: /tmp/cca6zvzr.o: in function window::~window()': /home/zli/Documents/librealsense-master/examples/example.hpp:633: undefined reference toglfwDestroyWindow' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:634: undefined reference to glfwTerminate' /usr/bin/ld: /tmp/cca6zvzr.o: in functionwindow::operator bool()': /home/zli/Documents/librealsense-master/examples/example.hpp:647: undefined reference to glPopMatrix' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:648: undefined reference toglfwSwapBuffers' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:650: undefined reference to glfwWindowShouldClose' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:652: undefined reference toglfwPollEvents' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:653: undefined reference to glfwGetFramebufferSize' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:656: undefined reference toglClear' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:657: undefined reference to glViewport' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:660: undefined reference toglPushMatrix' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:661: undefined reference to glfwGetWindowSize' /usr/bin/ld: /home/zli/Documents/librealsense-master/examples/example.hpp:662: undefined reference toglOrtho' /usr/bin/ld: /tmp/cca6zvzr.o: in function void rs2::frameset::foreach_rs<rs2::frameset::first_or_default(rs2_stream, rs2_format) const::{lambda(rs2::frame)#1}>(rs2::frameset::first_or_default(rs2_stream, rs2_format) const::{lambda(rs2::frame)#1}) const': /usr/include/librealsense2/hpp/rs_frame.hpp:1117: undefined reference tors2_extract_frame' /usr/bin/ld: /tmp/cca6zvzr.o: in function void rs2::frameset::foreach_rs<rs2::frameset::get_infrared_frame(unsigned long) const::{lambda(rs2::frame const&)#1}>(rs2::frameset::get_infrared_frame(unsigned long) const::{lambda(rs2::frame const&)#1}) const': /usr/include/librealsense2/hpp/rs_frame.hpp:1117: undefined reference tors2_extract_frame' /usr/bin/ld: /tmp/cca6zvzr.o: in function `std::enable_if<std::is_base_of<rs2::frame, rs2::frame>::value, bool>::type rs2::frame_queue::poll_for_frame(rs2::frame) const': /usr/include/librealsense2/hpp/rs_processing.hpp:187: undefined reference to rs2_poll_for_frame' /usr/bin/ld: /tmp/cca6zvzr.o: in functionvoid rs2::processing_block::start(rs2::frame_queue)': /usr/include/librealsense2/hpp/rs_processing.hpp:265: undefined reference to `rs2_start_processing' collect2: error: ld returned 1 exit status

Build finished with error(s).

Seems there are lots of undefined reference, I have tried multiple ways of fixing it, including:

Changing the cmake.txt file Check the usr/ to find the build libreal package (which I cannot find) run the file using command like g++ -o runfile rs-pointcloud.cpp -lrealsense2

Do I just need to instead of using zip file and all manually, but do a way of git clone and compile everything? Is there a standard step I can follow?

@MartyG-RealSense Thank you so much for the help!

MartyG-RealSense commented 1 year ago

There is not information available on how the RealSense depth algorithm identifies edges. Some aspects of RealSense technology are 'closed source' and not publicly available in order for Intel to protect the confidential details of them. As mentioned above though, you can isolate the edges on the depth image using a preset like you have done.


RealSense SDK example programs are compiled differently from how programs are usually built when created by a RealSense user. So if the code is directly copied from an example program's cpp into your own program then it will likely not work because it will be missing vital linkages to the librealsense library. This can be corrected in the CMakeLists.txt file of a project.

The Getting Started project at the link below demonstrates this. It is the same script as the SDK's rs-hello-realsense example program but has a more complex CMakeLists.txt file with the linkages necessary to run the project standalone from the SDK.

https://github.com/zivsha/librealsense/tree/getting_started_example/examples/getting-started

https://github.com/zivsha/librealsense/blob/getting_started_example/examples/getting-started/CMakeLists.txt

zechengli96 commented 1 year ago

Hi @MartyG-RealSense , I am still having issue. I am able to run the getting-started program myself and make it work. But when I go to the point cloud example, when I do mkdir build cd build cmake ../

Right now is all working when I do make -j4 the terminal has no reaction

Is it because the cmake file is different? I used the make file on the getting started to this point cloud one and this is what I get:

make -j4 [ 50%] Building CXX object CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o [100%] Linking CXX executable rs-pointcloud /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in function set_viewport(rect const&)': rs-pointcloud.cpp:(.text+0xdbd): undefined reference toglViewport' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xdc2): undefined reference to glLoadIdentity' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xdcc): undefined reference toglMatrixMode' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xe1f): undefined reference to glOrtho' /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in functiondraw_pointcloud(float, float, glfw_state&, rs2::points&)': rs-pointcloud.cpp:(.text+0xe6c): undefined reference to glLoadIdentity' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xe76): undefined reference toglPushAttrib' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xe9d): undefined reference to glClearColor' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xea7): undefined reference toglClear' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xeb1): undefined reference to glMatrixMode' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xeb6): undefined reference toglPushMatrix' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xef1): undefined reference to gluPerspective' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xefb): undefined reference toglMatrixMode' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xf00): undefined reference to glPushMatrix' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xf4f): undefined reference togluLookAt' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xf8a): undefined reference to glTranslatef' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xfb0): undefined reference toglRotated' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xfd5): undefined reference to glRotated' /usr/bin/ld: rs-pointcloud.cpp:(.text+0xff0): undefined reference toglTranslatef' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x100e): undefined reference to glPointSize' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1018): undefined reference toglEnable' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1022): undefined reference to glEnable' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x103e): undefined reference toglBindTexture' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1088): undefined reference to glTexParameterfv' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x109c): undefined reference toglTexParameteri' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x10b0): undefined reference to glTexParameteri' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x10ba): undefined reference toglBegin' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1147): undefined reference to glVertex3fv' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x116b): undefined reference toglTexCoord2fv' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1194): undefined reference to glEnd' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1199): undefined reference toglPopMatrix' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x11a3): undefined reference to glMatrixMode' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x11a8): undefined reference toglPopMatrix' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x11ad): undefined reference to glPopAttrib' /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in functiondraw_pointcloud_wrt_world(float, float, glfw_state&, rs2::points&, rs2_pose&, float, std::vector<rs2_vector, std::allocator >&)': rs-pointcloud.cpp:(.text+0x1596): undefined reference to glLoadIdentity' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x15a0): undefined reference toglPushAttrib' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x15c7): undefined reference to glClearColor' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x15d1): undefined reference toglClear' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x15db): undefined reference to glMatrixMode' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x15e0): undefined reference toglPushMatrix' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1621): undefined reference to gluPerspective' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x162b): undefined reference toglMatrixMode' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1630): undefined reference to glPushMatrix' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x166a): undefined reference toglTranslatef' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1693): undefined reference to glRotated' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x16bb): undefined reference toglRotated' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x16d6): undefined reference to glTranslatef' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x16e0): undefined reference toglEnable' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x16ef): undefined reference to glLineWidth' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x16f9): undefined reference toglBegin' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1763): undefined reference to glColor3f' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x178a): undefined reference toglVertex3f' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x17bf): undefined reference to glEnd' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x17ce): undefined reference toglLineWidth' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x17ed): undefined reference to glColor3f' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1845): undefined reference toglMultMatrixf' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1854): undefined reference to glMultMatrixf' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1875): undefined reference toglPointSize' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x187f): undefined reference to glEnable' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1889): undefined reference toglEnable' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x18a8): undefined reference to glBindTexture' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x18f2): undefined reference toglTexParameterfv' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1906): undefined reference to glTexParameteri' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x191a): undefined reference toglTexParameteri' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1924): undefined reference to glBegin' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x19c9): undefined reference toglVertex3fv' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x19f0): undefined reference to glTexCoord2fv' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1a22): undefined reference toglEnd' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1a27): undefined reference to glPopMatrix' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1a31): undefined reference toglMatrixMode' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1a36): undefined reference to glPopMatrix' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1a3b): undefined reference toglPopAttrib' /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in function get_screen_resolution(unsigned int&, unsigned int&)': rs-pointcloud.cpp:(.text+0x1da0): undefined reference toglfwInit' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1da5): undefined reference to glfwGetPrimaryMonitor' /usr/bin/ld: rs-pointcloud.cpp:(.text+0x1dad): undefined reference toglfwGetVideoMode' /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in function texture::upload(rs2::video_frame const&)': rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x54): undefined reference toglGenTextures' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x59): undefined reference to glGetError' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x11e): undefined reference toglBindTexture' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x197): undefined reference to glTexImage2D' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x1e3): undefined reference toglTexImage2D' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x22f): undefined reference to glTexImage2D' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x27b): undefined reference toglTexImage2D' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x2d0): undefined reference to glTexParameteri' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x2e4): undefined reference toglTexParameteri' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x2f8): undefined reference to glTexParameteri' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x30c): undefined reference toglTexParameteri' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x31b): undefined reference to glPixelStorei' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN7texture6uploadERKN3rs211video_frameE[_ZN7texture6uploadERKN3rs211video_frameE]+0x32a): undefined reference toglBindTexture' /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in function `window::window(int, int, char const)::{lambda(GLFWwindow, int, int, int)#1}::operator()(GLFWwindow, int, int, int) const': rs-pointcloud.cpp:(.text._ZZN6windowC4EiiPKcENKUlP10GLFWwindowiiiE_clES3_iii[_ZZN6windowC4EiiPKcENKUlP10GLFWwindowiiiE_clES3_iii]+0x26): undefined reference to glfwGetWindowUserPointer' /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in functionwindow::window(int, int, char const)::{lambda(GLFWwindow, double, double)#2}::operator()(GLFWwindow, double, double) const': rs-pointcloud.cpp:(.text._ZZN6windowC4EiiPKcENKUlP10GLFWwindowddE0_clES3_dd[_ZZN6windowC4EiiPKcENKUlP10GLFWwindowddE0_clES3_dd]+0x26): undefined reference to glfwGetWindowUserPointer' /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in functionwindow::window(int, int, char const)::{lambda(GLFWwindow, double, double)#3}::operator()(GLFWwindow, double, double) const': rs-pointcloud.cpp:(.text._ZZN6windowC4EiiPKcENKUlP10GLFWwindowddE1_clES3_dd[_ZZN6windowC4EiiPKcENKUlP10GLFWwindowddE1_clES3_dd]+0x26): undefined reference to glfwGetWindowUserPointer' /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in functionwindow::window(int, int, char const)::{lambda(GLFWwindow, int, int, int, int)#4}::operator()(GLFWwindow, int, int, int, int) const': rs-pointcloud.cpp:(.text._ZZN6windowC4EiiPKcENKUlP10GLFWwindowiiiiE2_clES3_iiii[_ZZN6windowC4EiiPKcENKUlP10GLFWwindowiiiiE2_clES3_iiii]+0x2a): undefined reference to glfwGetWindowUserPointer' /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in functionwindow::window(int, int, char const)': rs-pointcloud.cpp:(.text._ZN6windowC2EiiPKc[_ZN6windowC5EiiPKc]+0x121): undefined reference to glfwInit' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowC2EiiPKc[_ZN6windowC5EiiPKc]+0x13d): undefined reference toglfwCreateWindow' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowC2EiiPKc[_ZN6windowC5EiiPKc]+0x1a6): undefined reference to glfwMakeContextCurrent' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowC2EiiPKc[_ZN6windowC5EiiPKc]+0x1c0): undefined reference toglfwSetWindowUserPointer' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowC2EiiPKc[_ZN6windowC5EiiPKc]+0x1e5): undefined reference to glfwSetMouseButtonCallback' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowC2EiiPKc[_ZN6windowC5EiiPKc]+0x20a): undefined reference toglfwSetScrollCallback' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowC2EiiPKc[_ZN6windowC5EiiPKc]+0x22f): undefined reference to glfwSetCursorPosCallback' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowC2EiiPKc[_ZN6windowC5EiiPKc]+0x254): undefined reference toglfwSetKeyCallback' /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in function window::~window()': rs-pointcloud.cpp:(.text._ZN6windowD2Ev[_ZN6windowD5Ev]+0x1f): undefined reference toglfwDestroyWindow' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowD2Ev[_ZN6windowD5Ev]+0x24): undefined reference to glfwTerminate' /usr/bin/ld: CMakeFiles/rs-pointcloud.dir/rs-pointcloud.cpp.o: in functionwindow::operator bool()': rs-pointcloud.cpp:(.text._ZN6windowcvbEv[_ZN6windowcvbEv]+0x11): undefined reference to glPopMatrix' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowcvbEv[_ZN6windowcvbEv]+0x24): undefined reference toglfwSwapBuffers' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowcvbEv[_ZN6windowcvbEv]+0x37): undefined reference to glfwWindowShouldClose' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowcvbEv[_ZN6windowcvbEv]+0x44): undefined reference toglfwPollEvents' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowcvbEv[_ZN6windowcvbEv]+0x70): undefined reference to glfwGetFramebufferSize' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowcvbEv[_ZN6windowcvbEv]+0x7a): undefined reference toglClear' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowcvbEv[_ZN6windowcvbEv]+0xa1): undefined reference to glViewport' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowcvbEv[_ZN6windowcvbEv]+0xa6): undefined reference toglPushMatrix' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowcvbEv[_ZN6windowcvbEv]+0xd2): undefined reference to glfwGetWindowSize' /usr/bin/ld: rs-pointcloud.cpp:(.text._ZN6windowcvbEv[_ZN6windowcvbEv]+0x12b): undefined reference toglOrtho' collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/rs-pointcloud.dir/build.make:98: rs-pointcloud] Error 1 make[1]: [CMakeFiles/Makefile2:83: CMakeFiles/rs-pointcloud.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

make -j4 is working but still having issue, any other insight, thank u so much. @MartyG-RealSense

zechengli96 commented 1 year ago

@MartyG-RealSense Is there anyway to get a runnable cmakefile.txt file?

MartyG-RealSense commented 1 year ago

Advice is provided at https://github.com/IntelRealSense/librealsense/issues/4277#issuecomment-505242118 about linking a project to the librealsense components using CMake.

zechengli96 commented 1 year ago

@MartyG-RealSense I still have not successfully make this work yet. I will keep you on update.

zechengli96 commented 1 year ago

@MartyG-RealSense
One more question, we are able to export the point cloud's file from the 3D version, and open up the code, I see there are x, y, z and RGB coordinates as well. Any idea can I find a depth coordinates anywhere, or can you point me to a previous issue other people who did this? like

x, y, z red, green, blue , depth

1,1,1, 256,256,256, 1(meters)

something like this? Thanks in advance!

MartyG-RealSense commented 1 year ago

If you have exported a .ply pointcloud file from the 3D pointcloud mode of the Viewer then you can import the ply into a 3D modelling tool to do further processing on it. A RealSense-compatible tool to do this is the free open-source MeshLab program.

https://www.meshlab.net/

The link below has a guide for importing a RealSense ply into MeshLab.

https://www.andreasjakl.com/capturing-3d-point-cloud-intel-realsense-converting-mesh-meshlab/

The link below advises how to display the coordinates of a specific point in MeshLab.

https://stackoverflow.com/questions/53178374/meshlab-how-do-i-extract-x-y-z-coordinates-of-points

MartyG-RealSense commented 1 year ago

Hi @zechengli96 Do you require further assistance with this case, please? Thanks!

zechengli96 commented 1 year ago

@MartyG-RealSense Hi, I think we can close this issue. I am currently all set. Thanks.

MartyG-RealSense commented 1 year ago

Thanks very much @zechengli96 for the update!