- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm curretnly trying to save a pointcloud from a D435 camera using the pyrealsense2 lib on Windows. I'm using basically the code from the exemple :
frames = pipeline.wait_for_frames()
depth_frame = frames.get_depth_frame()
color_frame = frames.get_color_frame()
points = rs.points
pc = rs.pointcloud
pc.map_to(color_frame)
points = pc.calculate(depth_frame)
print("Saving to 1.ply...")
points.export_to_ply("1.ply", color_frame)
print("Done")
But everytime I try to use it it gets me this error :
TypeError('map_to(): incompatible function arguments. The following argument types are supported:\n 1. (self: pyrealsense2.pointcloud, mapped: pyrealsense2.frame) -> None\n\nInvoked with: ')
Does anyone have any idea where this error comes from ?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi FlavG,
Thank you for your interest in the Intel RealSense D435 camera.
Please make sure you followed all the instructions to install pyrealsense2 :
https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python
Then try running this example:
https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/examples/export_ply_example.py
Let me know if it works.
Regards,
Alexandra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Alexandra,
Pyrealsense2 is installed correctly, I followed all the instructions. The example you gave me works fine without me having to change anything to it, I already tried it before to see if there was a problem with my pyrealsense2 install, that was the example I talked about in my question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi FlavG,
Do you still need help with this issue?
Regards,
Alexandra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I still have the error I copied in my first post wich I don't understand why it keeps happenig there and not in the examples you gave me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi FlavG,
Could you be more specific?
Do you get that error when you are running export_ply_example.py ?
What happens when you run other examples? Do you get the same error?
Regards,
Alexandra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Any other example I've tried works fine, it doesn't work only in my code. The main part I don't understand about this error is, if I'm not wrong and understood it correctly, that the frame type I try to map doesn't work with the map_to() function. But using a debugger on both the examples and my code to see which type were the frames, I found out that in both cases the frames are pyrealsense2.video_frame. That is why I don't understand why this error keeps happening only in my code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi FlavG,
Is your code file in the same directory as the librealsense python examples?
You have to make sure that your code is calling the same .lib, .pyd and .dlls that the examples use.
Regards,
Alexandra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Yes, it is in the same folder and uses the same files, the other functions like streaming from the camera and getting the distance from a pixel are working, it's just the export to a .ply file that doesn't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi FlavG,
Can you send us the whole code, not just a section?
Regards,
Alexandra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Here is the whole code :
https://pastebin.com/mv9Ztz25 import pyrealsense2 as rs import numpy as np import cv2 # mouse callback - Pastebin.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi FlavG,
I managed to run your code.
You must add "()" to the function calls:
points = rs.points()
pc = rs.pointcloud()
Regards,
Alexandra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your help, it was such a dumb mistake and I didn't see it. Sorry for taking from your time to answer this question.
Best regards,
FlavG
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page