graspnet / anygrasp_sdk

222 stars 22 forks source link

RuntimeError: Unable to cast Python instance to C++ type (compile in debug mode for details) #23

Closed StarsTesla closed 4 months ago

StarsTesla commented 9 months ago

Hi, I tried the demo example, it works fine, but when I put my own image and depth map into it(just change the example data, didnt change the demo code), and it give the error. Besides, I get my image and depth from simulator, is there anythink I can do extra to fix this error?

StarsTesla commented 9 months ago

depth是通过模拟器里面的深度相机获取的深度图,难道说是需要点云还是什么

StarsTesla commented 9 months ago

I tried to calculate the camera intrinsics from

focal_length = 24.0
horizontal_aperture = 20.954999923706055

f_x = resolution_width * (focal_length / horizontal_aperture)
f_y = resolution_height * (focal_length / (horizontal_aperture * (resolution_height / resolution_width)))
cx = 720/2
cy=720/2

and I enlarge the range of (xmin, xmax, .....) then without debug mode, I can get print:

The depth map:
[[4 4 4 ... 4 4 4]
 [4 4 4 ... 4 4 4]
 [4 4 4 ... 4 4 4]
 ...
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]]
[-0.34925005 -0.34925005  0.2       ] [0.3482799 0.0055783 0.8      ]
[0.41166928 0.41083568 0.37239367 0.35485765 0.34048703 0.33973414
 0.33700421 0.33512661 0.33366004 0.31646827 0.30400574 0.28369677
 0.26644608 0.26290739 0.24731785 0.24569029 0.23752831 0.23578714
 0.22961262 0.21941546]
grasp score: 0.4116692841053009

But I want to see the result, with debug it still gives me RuntimeError: Unable to cast Python instance to C++ type (compile in debug mode for details)

Fang-Haoshu commented 9 months ago

Hi, please check the file type of your RGBD data and see if there is any difference.

StarsTesla commented 9 months ago

@Fang-Haoshu Here is my code for saving the depth image

chenxi-wang commented 9 months ago

@Fang-Haoshu Here is my code for saving the depth image

Depth image should be converted to uint16.

StarsTesla commented 9 months ago

@chenxi-wang I change to np.uint16, still same error

chenxi-wang commented 8 months ago

Could you locate the line reporting the bug?

Fang-Haoshu commented 4 months ago

close due to no response