gaoxiang12 / slambook2

edition 2 of the slambook
MIT License
5.3k stars 1.99k forks source link

Why divide the camera intrinsics by 2? [ 为什么将相机内参除以 2] #306

Closed denper19 closed 1 month ago

denper19 commented 2 months ago

I have a conceptual doubt. In dataset.cpp on line 38, the author does K = K * 0.5 after reading the camera intrinsics from the parameter files. But I do not understand why this is done. Could you please explain? Thank very much you for your help and this amazing resource.

[ 我有一个概念上的疑问。在 dataset.cpp 的第 38 行中,作者从参数文件中读取相机内部函数后执行了“K = K * 0.5”。但我不明白为什么要这样做。您能解释一下吗?非常感谢您的帮助和这个令人惊叹的资源。]

gaoxiang12 commented 2 months ago

hi @denper19 The images are resized to 0.5 here: https://github.com/gaoxiang12/slambook2/blob/93b65b0a92b50c8f4ebe4805f0376a5b6d2d945f/ch13/src/dataset.cpp#L65C1-L73C49 so the K matrix should also be half of the original matrix.

denper19 commented 1 month ago

hello @gaoxiang12 Thank you for you response. If you resize the image by 0.5 but also scale the K matrix by 0.5, then everything effectively stays the same. In that case, what is the purpose of resizing the image by 0.5? Thanks.

gaoxiang12 commented 1 month ago

@denper19 It's simply to save some computation time by using a smaller input image.

denper19 commented 1 month ago

Thank you so much @gaoxiang12 your guidance and this resource have both been extremely helpful.