Items with no label
3335 Discussions

Intrinsics always return 0?

VBisc
Beginner
3,093 Views

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 Kudos
12 Replies
MartyG
Honored Contributor III
1,283 Views

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

0 Kudos
VBisc
Beginner
1,283 Views

I am doing

import pyrealsense2 as rs

which I think is correct?

0 Kudos
MartyG
Honored Contributor III
1,283 Views

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

import pyrealsense2 as rs2

0 Kudos
VBisc
Beginner
1,283 Views

Hello, thank you for your answer.

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

0 Kudos
MartyG
Honored Contributor III
1,283 Views

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.

0 Kudos
idata
Employee
1,283 Views

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
0 Kudos
VBisc
Beginner
1,283 Views

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!

0 Kudos
idata
Employee
1,283 Views

^^ 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++?

0 Kudos
VBisc
Beginner
1,283 Views

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

0 Kudos
idata
Employee
1,283 Views

Thanks!

0 Kudos
idata
Employee
1,283 Views

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.

0 Kudos
idata
Employee
1,283 Views

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.

 

0 Kudos
Reply