{"id":325,"date":"2019-07-23T00:00:15","date_gmt":"2019-07-23T00:00:15","guid":{"rendered":"https:\/\/www.kudan.io\/jp\/?p=325"},"modified":"2020-07-28T22:24:29","modified_gmt":"2020-07-28T22:24:29","slug":"slam%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e3%82%ab%e3%83%a1%e3%83%a9%e3%82%ad%e3%83%a3%e3%83%aa%e3%83%96%e3%83%ac%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%ef%bc%883-3%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.kudan.io\/jp\/archives\/325","title":{"rendered":"SLAM\u306e\u305f\u3081\u306e\u30ab\u30e1\u30e9\u30ad\u30e3\u30ea\u30d6\u30ec\u30fc\u30b7\u30e7\u30f3\uff083\/3\uff09"},"content":{"rendered":"<p>Kudan\u304c\u63d0\u4f9b\u3059\u308bKudanSLAM\u306b\u4ee3\u8868\u3055\u308c\u308bSLAM (Simultaneous Localisation and Mapping)\u6280\u8853\u306e\u305f\u3081\u306e\u30ab\u30e1\u30e9\u30ad\u30e3\u30ea\u30d6\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066\u6982\u8aac\u3057\u307e\u3059\u3002<\/p>\n<hr \/>\n<p>\u524d\u56de\u306e\u8a18\u4e8b\uff1a<br \/>\n<em><a href=\"https:\/\/www.kudan.io\/jp\/archives\/347\">SLAM\u306e\u305f\u3081\u306e\u30ab\u30e1\u30e9\u30ad\u30e3\u30ea\u30d6\u30ec\u30fc\u30b7\u30e7\u30f3\uff081\/3\uff09<\/a><\/em><br \/>\n<em><a href=\"https:\/\/www.kudan.io\/jp\/archives\/344\">SLAM\u306e\u305f\u3081\u306e\u30ab\u30e1\u30e9\u30ad\u30e3\u30ea\u30d6\u30ec\u30fc\u30b7\u30e7\u30f3\uff082\/3\uff09<\/a><\/em><\/p>\n<p><strong>Calibrating stereo extrinsics<\/strong><\/p>\n<p>Once the intrinsics are calibrated, we have to calibrate extrinsics in the stereo case. For this is important to use image pairs captured at exactly the same time in which the internal chessboard corners can be reliably detected.<br \/>\nCoverage and diversity of views is important, like in the extrinsics case, but for extrinsics we usually cannot really cover the left part of the left image together with the right part of the right image due to view disparity.<\/p>\n<p>We recommend trying to keep the chessboard as close as possible with respect to it being visible from both views and cover different vertical offsets in this manner:<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-337\" src=\"https:\/\/www.kudan.io\/jp\/wp-content\/uploads\/sites\/3\/2020\/07\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-07-23-12.02.20-1.png\" alt=\"\" width=\"1082\" height=\"1352\" srcset=\"https:\/\/www.kudan.io\/jp\/wp-content\/uploads\/sites\/3\/2020\/07\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-07-23-12.02.20-1.png 1082w, https:\/\/www.kudan.io\/jp\/wp-content\/uploads\/sites\/3\/2020\/07\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-07-23-12.02.20-1-240x300.png 240w, https:\/\/www.kudan.io\/jp\/wp-content\/uploads\/sites\/3\/2020\/07\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-07-23-12.02.20-1-820x1024.png 820w, https:\/\/www.kudan.io\/jp\/wp-content\/uploads\/sites\/3\/2020\/07\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-07-23-12.02.20-1-768x960.png 768w\" sizes=\"(max-width: 1082px) 100vw, 1082px\" \/><\/p>\n<p>Once this basic views are covered we can try to increase accuracy by introducing some slantness from the sides:<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-338\" src=\"https:\/\/www.kudan.io\/jp\/wp-content\/uploads\/sites\/3\/2020\/07\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-07-23-12.02.53.png\" alt=\"\" width=\"1086\" height=\"902\" srcset=\"https:\/\/www.kudan.io\/jp\/wp-content\/uploads\/sites\/3\/2020\/07\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-07-23-12.02.53.png 1086w, https:\/\/www.kudan.io\/jp\/wp-content\/uploads\/sites\/3\/2020\/07\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-07-23-12.02.53-300x249.png 300w, https:\/\/www.kudan.io\/jp\/wp-content\/uploads\/sites\/3\/2020\/07\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-07-23-12.02.53-1024x851.png 1024w, https:\/\/www.kudan.io\/jp\/wp-content\/uploads\/sites\/3\/2020\/07\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2019-07-23-12.02.53-768x638.png 768w\" sizes=\"(max-width: 1086px) 100vw, 1086px\" \/><\/p>\n<p>Care should be taken in not having an extreme slant angle, because that can negatively impact the internal chessboard corner detection.<\/p>\n<p>Similarly to the intrinsics case, more diverse views increase accuracy at the cost of computation time and possibility of corner mis-detection, also for the same reasons we should take care in the correctness of the corner detection, in not repeating the same view in more than an image pair.<\/p>\n<p>Extrinsic RMS errors are ideally minimised, like in the intrinsics case. For the extrinsic case they denote the average vertical offset of a feature point between left and right camera once the undistortion and rectification are applied. It\u2019s important to notice that real-time stereo algorithm like SLAM do rely quite heavily on this vertical offset to not be more than a fraction of a pixel, because otherwise computation of map depth points is compromised. In practice, if you have an extrinsics RMS error close to one pixel or more, it\u2019s a sign something went wrong in the calibration.<\/p>\n<p><strong>Understanding the parameters<\/strong><\/p>\n<p>Once calibration process is finished we have the following parameters:<\/p>\n<p>Intrinsic parameters:<\/p>\n<p>\u25cfFocal length: fx, fy<br \/>\n\u25cfPrincipal point: cx, cy<br \/>\n\u25cfRadial distortion: k1, k2, k3, k4, k5, k6<br \/>\n\u25cfTangential distortion: p1, p2<\/p>\n<p>In the case of monocular calibration the above is all we have, in the case of stereo we will have a set of intrinsics parameters for each camera plus a set of extrinsics parameters:<\/p>\n<p>\u25cfTranslation vector (3&#215;1) from right camera to left camera<br \/>\n\u25cfRotation matrix (3&#215;3) to rectify cameras.<\/p>\n<p>Focal length is proportional to both the field of view and to the width of the images, vertical and horizontal values should be similar, and values between left and right camera should be similar as well.<\/p>\n<p>Principal point should be approximately the center of the image.<\/p>\n<p>Unfortunately, it&#8217;s basically impossible to judge distortion parameters just by looking at them, because they are factors and ratios in quite complicated formulas (see link for more details). For example it is possible that the absolute numbers in the radial distortion coefficients are different between left and right camera, but it is possible the first and fourth distortion parameters are roughly the same ratio between them, same for the second and fifth parameters, and in that case they should yield similar overall undistortion mappings.<\/p>\n<p>The translation vector should have a norm similar to the baseline between left and right cameras, it depends on the square size given in input to the extrinsics calibration and is in the same units.<\/p>\n<p>The rotation matrix should be close to the identity matrix in the case of properly-assembled stereo rigs.<\/p>\n<p>Other than those general consideration, it\u2019s difficult to judge calibration quality by looking at its numbers, to properly verify that a calibration is correct. there are two distinct kinds of observations to make on the images after the undistortion and rectification are applied:<\/p>\n<p>\u25cfStraight lines in the real world should look straight in the view. If a calibration is imprecise in the distortion parameters,<br \/>\nstraight lines will curve close to the edges.<\/p>\n<p>\u25cfThe same visual features should appear in the same scanline between left and right images. A poor stereo calibration will have<br \/>\na vertical disparity somewhere in the images between the same physical points.<\/p>\n<p>It&#8217;s not very difficult to visually check those conditions on corrected images, but measures should be repeated in different points of the images, possibly looking at different distances from the cameras.<\/p>\n<p><strong>Toolboxes for camera calibration<\/strong><\/p>\n<p>The above guidelines are independent from the specific toolbox used. Possible free options in terms of stereo calibration toolbox are:<\/p>\n<p>\u25cfOpenCV, available from: <a href=\"https:\/\/opencv.org\/\">https:\/\/opencv.org\/<\/a><br \/>\n\u25cfJean-Yves Bouguet\u2019s Camera Calibration Toolbox for Matlab, available from: <a href=\"http:\/\/www.vision.caltech.edu\/bouguetj\/calib_doc\/\">http:\/\/www.vision.caltech.edu\/bouguetj\/calib_doc\/<\/a><br \/>\n\u25cfThe DLR Camera Calibration Toolbox, available from: <a href=\"http:\/\/www.robotic.dlr.de\/callab\/\">http:\/\/www.robotic.dlr.de\/callab\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kudan\u304c\u63d0\u4f9b\u3059\u308bKudanSLAM\u306b\u4ee3\u8868\u3055\u308c\u308bSLAM (Simultaneous Localisation and Mapping)\u6280\u8853\u306e\u305f\u3081\u306e\u30ab\u30e1\u30e9\u30ad\u30e3\u30ea\u30d6\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066\u6982\u8aac\u3057\u307e\u3059\u3002 \u524d\u56de\u306e\u8a18\u4e8b\uff1a SLAM\u306e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":242,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[3],"tags":[],"acf":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/www.kudan.io\/jp\/wp-content\/uploads\/sites\/3\/2020\/06\/blog.jpg","_links":{"self":[{"href":"https:\/\/www.kudan.io\/jp\/wp-json\/wp\/v2\/posts\/325"}],"collection":[{"href":"https:\/\/www.kudan.io\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kudan.io\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kudan.io\/jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kudan.io\/jp\/wp-json\/wp\/v2\/comments?post=325"}],"version-history":[{"count":7,"href":"https:\/\/www.kudan.io\/jp\/wp-json\/wp\/v2\/posts\/325\/revisions"}],"predecessor-version":[{"id":424,"href":"https:\/\/www.kudan.io\/jp\/wp-json\/wp\/v2\/posts\/325\/revisions\/424"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kudan.io\/jp\/wp-json\/wp\/v2\/media\/242"}],"wp:attachment":[{"href":"https:\/\/www.kudan.io\/jp\/wp-json\/wp\/v2\/media?parent=325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kudan.io\/jp\/wp-json\/wp\/v2\/categories?post=325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kudan.io\/jp\/wp-json\/wp\/v2\/tags?post=325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}