Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color_frame intrinsics vs align intrinsics (are same ?) #5658

Closed
scizors opened this issue Jan 16, 2020 · 4 comments
Closed

color_frame intrinsics vs align intrinsics (are same ?) #5658

scizors opened this issue Jan 16, 2020 · 4 comments
Labels

Comments

@scizors
Copy link

scizors commented Jan 16, 2020

D415 camera
code :python

Problem: color intrinsics and align intrinsics are same why?
#code color_intrinsics:
import pyrealsense2 as rs
import numpy as np
import cv2
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 6)
config.enable_stream(rs.stream.color, 1280, 720, rs.format.bgr8, 6)
profile = pipeline.start(config)
frames = pipeline.wait_for_frames()
color_frame = frames.get_color_frame()
intrinsics=color_frame.profile.as_video_stream_profile().intrinsics
output color_intrinsics:
width: 1280, height: 720, ppx: 630.005, ppy: 376.119, fx: 925.769, fy: 925.476, model: 2, coeffs: [0, 0, 0, 0, 0]

#code:align intrinsics
import pyrealsense2 as rs
import numpy as np
import cv2
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 6)
config.enable_stream(rs.stream.color, 1280, 720, rs.format.bgr8, 6)
profile = pipeline.start(config)
frames = pipeline.wait_for_frames()
align_to = rs.stream.color
align = rs.align(align_to)
aligned_frames = align.process(frames)
aligned_depth_frame = aligned_frames.get_depth_frame()
intrinsics = aligned_depth_frame.profile.as_video_stream_profile().intrinsics
output:align intrinsics
width: 1280, height: 720, ppx: 630.005, ppy: 376.119, fx: 925.769, fy: 925.476, model: 2, coeffs: [0, 0, 0, 0, 0]

@ev-mp
Copy link
Collaborator

ev-mp commented Jan 19, 2020

@scizors hello.
The intrinsic (as well as the extrinsic) parameters for the aligned stream are borrowed from the stream the data is aligned to, i.e the color stream:

align_to = rs.stream.color
align = rs.align(align_to)

@ev-mp ev-mp added the question label Jan 19, 2020
@scizors
Copy link
Author

scizors commented Jan 20, 2020

Hello,
Thanks for the reply .
-I have used checker-board to calibrate the RGB camera D415
-Then, I imported the images into Matlab finally I got the intrinsic values from Matlab
width: 1280, height: 720, ppx: 628.505325548172 , ppy: 375.139062149491 , fx: 908.237035106199 , fy: 908.710269684772

From intelrealsense
width: 1280, height: 720, ppx: 630.005, ppy: 376.119, fx: 925.769, fy: 925.476, model: 2, coeffs: [0, 0, 0, 0, 0]
camera is already well calibrated while buying it. why there is major difference in the focal length (fx and fy)? will this deviation affect the accuracy ?

which parameters should I use now ?

@ev-mp
Copy link
Collaborator

ev-mp commented Jan 20, 2020

@scizors,
The focal length affects the object's magnification, so in case fx/fy are skewed the size of the objects would be scaled and it is quite straight-forward to devise a test that will measure ruler's size for verification.
A more methodical approach is to use the DepthQuality white-paper and the accompanying rs-depth-quality tool to characterize depth data and to see whether the metrics are within the specifications.

As for using 3rd part calibration with camera - currently this option is relevant only for OEM customers.
When it come to the usage then with the live camera you can only use the factory calibration (that has been recently extended with on-chip calibration feature)
The way you can try the alternative calibration is wrap the live device with software_device and have it calibration established with Matlab-produced data.

@ev-mp
Copy link
Collaborator

ev-mp commented Feb 3, 2020

Assume resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants