Items with no label
3338 討論

Intrinsics always return 0?

VBisc
初學者
4,492 檢視

I am using the python wrapper for the SDK 2 for the D435 camera.

I need to get the intrinsic values of my camera, but when I run rs.intrinsics() in python I get

width: 0, height: 0, ppx: 0, ppy: 0, fx: 0, fy: 0, model: None, coeffs: [0, 0, 0, 0, 0]

Can I get intrinsic values for my camera easily within python or in some other way?

0 積分
12 回應
MartyG
榮譽貢獻者 III
2,682 檢視

RealSense SDK 2.0 uses the instruction rs2_intrinsics instead of rs_intrinsics Are you using rs2?

https://github.com/IntelRealSense/librealsense/wiki/Projection-in-RealSense-SDK-2.0# intrinsic-camera-parameters Projection in RealSense SDK 2.0 · IntelRealSense/librealsense Wiki · GitHub

VBisc
初學者
2,682 檢視

I am doing

import pyrealsense2 as rs

which I think is correct?

MartyG
榮譽貢獻者 III
2,682 檢視

Someone else who was converting a script for Pyrealsense in SDK 2.0 used:

import pyrealsense2 as rs2

VBisc
初學者
2,682 檢視

Hello, thank you for your answer.

rs is an alias, I could have used rs or rs2 or realSenseRandomName, wouldn't change

MartyG
榮譽貢獻者 III
2,682 檢視

The Python wrapper in SDK 2.0 is supposed to allow extrinsics and intrinsics creation and modification, according to the release notes since version 2.10.0. I have yet to find documentation for this feature though and as Python programming is not a specialist area of mine, an Intel support team member may be able to give better advice on this subject than I can. I apologize for you having to wait for an answer.

idata
員工
2,682 檢視

Hello Valerio1988,

Please try downcasting to "video_stream_profile" like below:

 

cfg = pipeline.start() # Start pipeline and get the configuration it found

 

profile = cfg.get_stream(rs.stream.depth) # Fetch stream profile for depth stream

 

intr = profile.as_video_stream_profile().get_intrinsics() # Downcast to video_stream_profile and fetch intrinsics

 

print intr.ppx

 

 

Please let us know if this solution works for you.

 

 

Regards,

 

Jesus

 

Intel Customer Support
VBisc
初學者
2,682 檢視

I ended up doing something very similar:

self.profile = self.pipeline.start(self.config)

depth_stream=rs.video_stream_profile(self.profile.get_stream(rs.stream.depth))

a= depth_stream.get_intrinsics()

thanks!

idata
員工
2,682 檢視

^^ Can we please clarify here that the intrinsics should not be {0}'s? Per the above thread, it was indicated that the reason for the 0's was that the streams were rectified.

If not 0's, can we also please supply the correct mechanism for accessing them via C++?

VBisc
初學者
2,682 檢視

They are not zero in my case, they are what appear to be the correct value.

check this

https://github.com/IntelRealSense/librealsense/wiki/API-How-To# get-video-stream-intrinsics API How To · IntelRealSense/librealsense Wiki · GitHub

idata
員工
2,682 檢視

Thanks!

idata
員工
2,682 檢視

I am able to get the intrinsic data with CPP but I cannot figure out how to do this Python. Is there some documentation for the Python wrapper that will teach me how to do this? Has anyone had success getting the intrinsic data with Python and can help? I am trying to keep everything to one language.

idata
員工
2,682 檢視

Hello pault587,

 

 

Thank you for your contacting Intel® RealSense™ Technology support.

 

 

Use the following script to get intrinsics with Python:

 

 

/// Intrinsics:

 

pipe = rs.pipeline()

 

cfg = rs.config()

 

cfg.enable_stream(rs.stream.infrared, 1)

 

cfg.enable_stream(rs.stream.infrared, 2)

 

cfg.enable_stream(rs.stream.depth)

 

prof = self.pipe.start(cfg)

 

ds = prof.get_stream(rs.stream.depth)

 

intr = ds.as_video_stream_profile().get_intrinsics()

 

self.fx = intr.fx

 

 

I hope you find this information helpful.

 

 

Best regards.

 

 

Josh B.

 

回覆