<trclass="memdesc:a4810e60f3af95b73a61879aa97201695"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Constructor using full camera parameters. <br/></td></tr>
<trclass="memdesc:aadb6b19ea8a94f3f6719ea0233196c34"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Minimal constructor using intrinsic parameters. This assumes the images are already rectified. <br/></td></tr>
<trclass="memdesc:a745c2d60ef6b460ca380aebd55b5d61c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Minimal constructor with name for saving. <br/></td></tr>
<trclass="memdesc:a5690a86d11b0d84e80961ae5d38b1d25"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Initializes the rectification maps used to undistort and rectify images. <br/></td></tr>
<trclass="memdesc:a80cacb16d347e89980369cb2e02f3d48"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Checks if the rectification map has been initialized. <br/></td></tr>
<trclass="memdesc:a7b6db41415e085d52bf363d09d5e6d67"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Checks if the model is valid for 2D->3D projection. <br/></td></tr>
<trclass="memdesc:abd4db4f23eb05d531a34ee44f7cdb687"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Checks if the model is valid for 3D->2D reprojection. <br/></td></tr>
<trclass="memdesc:a46864eb8de680d45d79777e828dcbb6a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Checks if the model has sufficient data for image rectification. <br/></td></tr>
<trclass="memdesc:a402a407fa2bca721087a6deda24cc10d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the camera name, used to set a camera name when saving to a file. <br/></td></tr>
<trclass="memdesc:a6f6dc18af13a777e89a75725ef3e8ab4"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the x translation (usually fx * baseline in case of stereo, otherwise would be 0). <br/></td></tr>
<trclass="memdesc:ada626650b01d35b494016a5490efb31a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the raw intrinsic matrix (before rectification). <br/></td></tr>
<trclass="memdesc:a88ec7053f4d442c4b1b79803c2840f28"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the raw distortion coefficients (before rectification). <br/></td></tr>
<trclass="memdesc:a5df2e6c3f361b7084e4d26d7f1846e3d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the rectified camera intrinsic matrix if the projection matrix P exists, otherwise returns the raw intrinsic matrix. <br/></td></tr>
<trclass="memdesc:a4aa121905a9b2aabb6a3592a6eb7459a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the rectified distortion coefficients (1x5 filled with zeros) if the projection matrix P exists, otherwise returns the raw distortion coefficients. <br/></td></tr>
<trclass="memdesc:ad763246258ddf02c27873c2536901781"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the rectification matrix. <br/></td></tr>
<trclass="memdesc:acda5d9c4eeeaaad69e950f5ea630430a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the projection matrix. <br/></td></tr>
<trclass="memdesc:aa1325c971f17d371553c3f75be7aeece"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the local transform of the camera (base frame to optical frame). <br/></td></tr>
<trclass="memdesc:a8a1712ca95bf08c71b2bf2da1d635bc8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the local transform (base frame to optical frame). <br/></td></tr>
<trclass="memdesc:a43fd48b917ca145876024859f8565931"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the image size of the camera model and updates the principal point if undefined. <br/></td></tr>
<trclass="memdesc:ac3aa6835f8ae019de4dbf85eed849b75"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the horizontal field of view (FoV) in radians. <br/></td></tr>
<trclass="memdesc:af4df41cc8a613f3e03b1ed14fc0a887e"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the vertical field of view (FoV) in radians. <br/></td></tr>
<trclass="memdesc:a12abd4cac897f48bf862a96f0eba1d65"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the horizontal field of view in degrees. <br/></td></tr>
<trclass="memdesc:af6226e43afcb69259b137bbe50099537"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the vertical field of view in degrees. <br/></td></tr>
<trclass="memdesc:a3ceb0d36d8786f03b778d1969cb6e839"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Checks if the distortion model is fisheye (6 coefficients: k1,k2,0,0,k3,k4). <br/></td></tr>
<trclass="memdesc:a2c2ff6db9029c3ee219642d7e48b04fa"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Loads the camera model parameters from a YAML calibration file. <br/></td></tr>
<trclass="memdesc:abe9b3c87c086fd33286c01361e454056"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Loads the camera model by constructing a file path from a directory and camera name. <br/></td></tr>
<trclass="memdesc:ab5ec6010459c4e642e162dc8914bccb9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Saves the camera model parameters to a YAML calibration file in ROS format. <br/></td></tr>
<trclass="memdesc:a5724619c7ac8c796fd8c63660e398082"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Serializes the camera model to a binary format. <br/></td></tr>
<trclass="memdesc:a490dc97ca8aa55d96324eb6612ccfd30"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Deserializes a camera model from a byte vector. <br/></td></tr>
<trclass="memitem:a181c2e53da1151c281d85fde986a29c5"id="r_a181c2e53da1151c281d85fde986a29c5"><tdclass="memItemLeft"align="right"valign="top">unsigned int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classrtabmap_1_1CameraModel.html#a181c2e53da1151c281d85fde986a29c5">deserialize</a> (const unsigned char *data, unsigned int dataSize)</td></tr>
<trclass="memdesc:a181c2e53da1151c281d85fde986a29c5"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Deserializes a camera model from a raw byte buffer. <br/></td></tr>
<trclass="memdesc:aecf2e87f260558dbf631e4803e1ed986"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns a new camera model with all intrinsic parameters scaled by a given factor. <br/></td></tr>
<trclass="memdesc:a2ff3290299c36b64ee880db2386f898f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns a new camera model adjusted for a given region of interest (ROI). <br/></td></tr>
<trclass="memitem:a17219cf5cf82d224f2a7ed5af01fa236"id="r_a17219cf5cf82d224f2a7ed5af01fa236"><tdclass="memItemLeft"align="right"valign="top">cv::Mat </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classrtabmap_1_1CameraModel.html#a17219cf5cf82d224f2a7ed5af01fa236">rectifyImage</a> (const cv::Mat &raw, int interpolation=cv::INTER_LINEAR) const</td></tr>
<trclass="memdesc:a17219cf5cf82d224f2a7ed5af01fa236"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Rectifies a raw image using the precomputed rectification maps. <br/></td></tr>
<trclass="memdesc:a22cf7f5b49ef0cd8be08755010f6acb5"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Rectifies a raw depth image using the precomputed rectification maps. <br/></td></tr>
<trclass="memdesc:a01de9a3cdc993275b2fbcf21d6e29833"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Projects a 2D pixel and depth value into a 3D point in the camera coordinate frame (/camera_link). <br/></td></tr>
<trclass="memdesc:a637a730717e42939449cd9f09e20db26"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Reprojects a 3D point in the camera frame (/camera_link) into 2D image coordinates (floating-point). <br/></td></tr>
<trclass="memitem:a99204ef1a884478cf45b1503432b235b"id="r_a99204ef1a884478cf45b1503432b235b"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classrtabmap_1_1CameraModel.html#a99204ef1a884478cf45b1503432b235b">reproject</a> (float x, float y, float z, int &u, int &v) const</td></tr>
<trclass="memdesc:a99204ef1a884478cf45b1503432b235b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Reprojects a 3D point in the camera frame (/camera_link) into 2D image coordinates (rounded to int). <br/></td></tr>
<trclass="memitem:aa07cbe07c7893e726c408392cf54d9ca"id="r_aa07cbe07c7893e726c408392cf54d9ca"><tdclass="memItemLeft"align="right"valign="top">bool </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classrtabmap_1_1CameraModel.html#aa07cbe07c7893e726c408392cf54d9ca">inFrame</a> (int u, int v) const</td></tr>
<trclass="memdesc:aa07cbe07c7893e726c408392cf54d9ca"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Checks if a given pixel coordinate lies within the image bounds. <br/></td></tr>
<trclass="memdesc:a0853af9d0117565311da4ffc3965f8d2"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the default optical rotation to convert image coordinates to robot coordinates. <br/></td></tr>
<divclass="textblock"><p>Represents a pinhole camera model containing intrinsic and extrinsic parameters, used for projection, rectification, and transformation. </p>
<p>This class encapsulates camera calibration data, including intrinsic parameters (fx, fy, cx, cy), distortion coefficients, rectification and projection matrices. It provides utility functions for image rectification, projection from 2D to 3D, and vice versa.</p>
<p>This class supports the 4 to 14 parameters Radial Tangential distortion model (also called Plumb Bob or Brown-Conrady model) and 4 parameters Fish Eye model (also known as Equidistant model).</p>
<dlclass="section see"><dt>See also</dt><dd>OpenCV's calib3d module for all supported camera models. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00052">52</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
</div><h2class="groupheader">Constructor & Destructor Documentation</h2>
<tr><tdclass="paramname">D</td><td>Distortion coefficients, 1xN matrix where N is between 4 and 14 parameters: k1,k2,p1,p2[,k3[,k4,k5,k6[,s1,s2,s3,s4[,tx,ty]]]]). To set Fish Eye / Equidistant model, it is implicitly used if we provide 6 values like this: [k1,k2,0,0,k3,k4], where you only need to fill "k" parameters. </td></tr>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00128">128</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
</div>
</div>
<h2class="groupheader">Member Function Documentation</h2>
<p>Returns the default optical rotation to convert image coordinates to robot coordinates. </p>
<p>Image frame: x -> right, y -> down, z -> forward <br/>
Robot frame: x -> forward, y -> left, z -> up</p>
<dlclass="section return"><dt>Returns</dt><dd><aclass="el"href="classrtabmap_1_1Transform.html"title="Represents a 3D rigid body transformation (rotation + translation).">Transform</a> rotation matrix. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00063">63</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Initializes the rectification maps used to undistort and rectify images. </p>
<p>This function prepares the <code>mapX_</code> and <code>mapY_</code> lookup tables used for image rectification. It supports both standard radial-tangential distortion and fisheye/equidistant distortion models.</p>
<ul>
<li>If the distortion model is <b>fisheye</b> (indicated by <code>D_.cols == 6</code>), it uses <code>cv::fisheye::initUndistortRectifyMap()</code> to create the rectification maps. This requires OpenCV ≥ 2.4.10.</li>
<li>Otherwise, it uses the standard <code>cv::initUndistortRectifyMap()</code> for plumb bob or rational polynomial models.</li>
</ul>
<dlclass="section pre"><dt>Precondition</dt><dd>The camera model must be valid for rectification:<ul>
<li><code>imageSize_</code> must be non-zero.</li>
<li><code>D_</code> must be a 1-row matrix with an accepted number of columns (4, 5, 6, 8, 12, or 14).</li>
<li><code>R_</code> must be a 3x3 rectification matrix.</li>
<li><code>P_</code> must be a 3x4 projection matrix.</li>
</ul>
</dd></dl>
<dlclass="section return"><dt>Returns</dt><dd><code>true</code> if the rectification maps were successfully initialized (<code>mapX_</code> and <code>mapY_</code> are not empty), <code>false</code> otherwise.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1CameraModel.html#a80cacb16d347e89980369cb2e02f3d48"title="Checks if the rectification map has been initialized.">isRectificationMapInitialized()</a>, <aclass="el"href="classrtabmap_1_1CameraModel.html#a17219cf5cf82d224f2a7ed5af01fa236"title="Rectifies a raw image using the precomputed rectification maps.">rectifyImage()</a>, <aclass="el"href="classrtabmap_1_1CameraModel.html#a22cf7f5b49ef0cd8be08755010f6acb5"title="Rectifies a raw depth image using the precomputed rectification maps.">rectifyDepth()</a></dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>Requires OpenCV 2.4.10 or newer for fisheye support. If the version is older, fisheye rectification will not work. </dd></dl>
<p>Checks if the rectification map has been initialized. </p>
<dlclass="section return"><dt>Returns</dt><dd>True if both mapX_ and mapY_ are initialized. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00159">159</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Checks if the model is valid for 2D->3D projection. </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00164">164</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Checks if the model is valid for 3D->2D reprojection. </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00168">168</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Checks if the model has sufficient data for image rectification. </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00172">172</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Sets the camera name, used to set a camera name when saving to a file. </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00183">183</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00185">185</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00188">188</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00190">190</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00192">192</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00194">194</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Returns the x translation (usually fx * baseline in case of stereo, otherwise would be 0). </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00196">196</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Returns the raw intrinsic matrix (before rectification). </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00199">199</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Returns the raw distortion coefficients (before rectification). </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00201">201</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Returns the rectified camera intrinsic matrix if the projection matrix P exists, otherwise returns the raw intrinsic matrix. </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00203">203</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Returns the rectified distortion coefficients (1x5 filled with zeros) if the projection matrix P exists, otherwise returns the raw distortion coefficients. </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00205">205</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00207">207</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00209">209</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Sets the local transform of the camera (base frame to optical frame). </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00212">212</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Returns the local transform (base frame to optical frame). </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00214">214</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Sets the image size of the camera model and updates the principal point if undefined. </p>
<p>This function updates the internal image size (<code>imageSize_</code>) with the provided size. If the intrinsic matrices (<code>K_</code> or <code>P_</code>) are present and the principal point coordinates (<code>cx</code>, <code>cy</code>) are zero, they are set to the image center (<code>width/2 - 0.5</code>, <code>height/2 - 0.5</code>).</p>
<p>This ensures the camera model remains valid and useful even when the calibration file has no principal point set or the image size is updated manually.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">size</td><td>The new image size. It must be either both dimensions zero (clearing) or both positive.</td></tr>
<dlclass="section post"><dt>Postcondition</dt><dd>Updates the <code>imageSize_</code>, and adjusts <code>cx</code> and <code>cy</code> in <code>K_</code> and <code>P_</code> if they were initially zero.</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>If <code>K_</code> or <code>P_</code> are not initialized (<code>empty()</code>), no updates will be applied to them.</dd></dl>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00236">236</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00237">237</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00238">238</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Returns the horizontal field of view in degrees. </p>
<p>Converts the result of <code><aclass="el"href="classrtabmap_1_1CameraModel.html#ac3aa6835f8ae019de4dbf85eed849b75"title="Returns the horizontal field of view (FoV) in radians.">fovX()</a></code> from radians to degrees.</p>
<dlclass="section return"><dt>Returns</dt><dd>Horizontal field of view in degrees. Returns 0.0 if the result is invalid. </dd></dl>
<p>Returns the vertical field of view in degrees. </p>
<p>Converts the result of <code><aclass="el"href="classrtabmap_1_1CameraModel.html#af4df41cc8a613f3e03b1ed14fc0a887e"title="Returns the vertical field of view (FoV) in radians.">fovY()</a></code> from radians to degrees.</p>
<dlclass="section return"><dt>Returns</dt><dd>Vertical field of view in degrees. Returns 0.0 if the result is invalid. </dd></dl>
<p>Checks if the distortion model is fisheye (6 coefficients: k1,k2,0,0,k3,k4). </p>
<pclass="definition">Definition at line <aclass="el"href="CameraModel_8h_source.html#l00283">283</a> of file <aclass="el"href="CameraModel_8h_source.html">CameraModel.h</a>.</p>
<p>Loads the camera model parameters from a YAML calibration file. </p>
<p>This method attempts to read camera intrinsic/extrinsic parameters and image size from a YAML file, typically in the ROS calibration format. If the distortion model is "fisheye" or "equidistant", we expect 4 coefficients, which are converted to a 6-coefficient format for internal representation.</p>
<p>On success, the internal matrices and settings of the camera model are updated. If the model is valid for rectification, the rectification map is initialized.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">filePath</td><td>Absolute or relative path to the YAML file. </td></tr>
<tr><tdclass="paramname">initRectificationMaps</td><td>Set to false to skip building the (potentially large) rectification maps when rectification won't be used (saves time and memory). </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>True if the file was successfully loaded and parsed, false otherwise.</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>Logs warnings if any fields are missing. If file does not exist or parsing fails, returns false.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1CameraModel.html#a5690a86d11b0d84e80961ae5d38b1d25"title="Initializes the rectification maps used to undistort and rectify images.">initRectificationMap()</a></dd></dl>
<p>Loads the camera model by constructing a file path from a directory and camera name. </p>
<p>This is a convenience wrapper around <code>load(filePath)</code> that constructs the file path as: <code>directory + "/" + cameraName + ".yaml"</code>.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">directory</td><td>Path to the folder containing the camera YAML file. </td></tr>
<tr><tdclass="paramname">cameraName</td><td>Base name of the camera file (without extension). </td></tr>
<tr><tdclass="paramname">initRectificationMaps</td><td>Set to false to skip building the (potentially large) rectification maps when rectification won't be used (saves time and memory). </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>True if loading from the constructed path succeeds, false otherwise. </dd></dl>
<p>Serializes the camera model to a binary format. </p>
<p>The serialization includes the camera intrinsics (<code>K_</code>, <code>D_</code>), rectification matrix (<code>R_</code>), projection matrix (<code>P_</code>), image size, and the local transform. The format is compact and suitable for file storage or transmission over a network.</p>
<p>Data layout:</p><ul>
<li>Header (11 integers):<ul>
<li>[0-2] RTAB-Map version (major, minor, patch)</li>
<li>[3] <aclass="el"href="classrtabmap_1_1Camera.html">Camera</a> type (0 = mono, 1=stereo)</li>
<li>[4-5] Image width, height</li>
<li>[6-9] Element counts for K, D, R, P matrices</li>
<li>[10] Size of localTransform (0 if null)</li>
</ul>
</li>
<li>Data section (in order): raw memory blocks for K, D, R, P (<code>double</code> values), followed by <code>float</code> values for localTransform</li>
</ul>
<dlclass="section return"><dt>Returns</dt><dd>A byte vector containing the serialized data. The format is compatible with <code><aclass="el"href="classrtabmap_1_1CameraModel.html#a490dc97ca8aa55d96324eb6612ccfd30"title="Deserializes a camera model from a byte vector.">deserialize()</a></code>.</dd></dl>
<dlclass="section note"><dt>Note</dt><dd>This is a custom binary format, not meant to be human-readable. </dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1CameraModel.html#a490dc97ca8aa55d96324eb6612ccfd30"title="Deserializes a camera model from a byte vector.">deserialize()</a>, <aclass="el"href="classrtabmap_1_1StereoCameraModel.html"title="A class representing a calibrated stereo camera system.">StereoCameraModel</a></dd></dl>
<p>Deserializes a camera model from a byte vector. </p>
<p>This is a convenience wrapper around <code><aclass="el"href="classrtabmap_1_1CameraModel.html#a181c2e53da1151c281d85fde986a29c5"title="Deserializes a camera model from a raw byte buffer.">deserialize(const unsigned char*, unsigned int)</a></code> that takes a <code>std::vector<unsigned char></code> instead of a raw buffer.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">data</td><td>Byte vector containing data serialized by <code><aclass="el"href="classrtabmap_1_1CameraModel.html#a5724619c7ac8c796fd8c63660e398082"title="Serializes the camera model to a binary format.">serialize()</a></code>. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The number of bytes successfully read and parsed. Returns 0 on failure.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1CameraModel.html#a5724619c7ac8c796fd8c63660e398082"title="Serializes the camera model to a binary format.">serialize()</a>, <aclass="el"href="classrtabmap_1_1CameraModel.html#a181c2e53da1151c281d85fde986a29c5"title="Deserializes a camera model from a raw byte buffer.">deserialize(const unsigned char*, unsigned int)</a></dd></dl>
<p>Deserializes a camera model from a raw byte buffer. </p>
<p>Reads the camera intrinsics, distortion, rectification, projection matrices, image size, and local transform from a serialized binary format previously created with <code><aclass="el"href="classrtabmap_1_1CameraModel.html#a5724619c7ac8c796fd8c63660e398082"title="Serializes the camera model to a binary format.">serialize()</a></code>.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">data</td><td>Pointer to the binary data buffer. </td></tr>
<tr><tdclass="paramname">dataSize</td><td>Size of the data buffer in bytes. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The number of bytes successfully read. Returns 0 on error or if the format is invalid.</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>If the buffer format does not match the expected layout or version, an error is logged and the camera model remains in a default-initialized state.</dd></dl>
<dlclass="section note"><dt>Note</dt><dd>Assumes little-endian architecture and strict size/type matching. The serialized format must be created by <code><aclass="el"href="classrtabmap_1_1CameraModel.html#a5724619c7ac8c796fd8c63660e398082"title="Serializes the camera model to a binary format.">CameraModel::serialize()</a></code>. Non-mono camera types are not supported. See <code><aclass="el"href="classrtabmap_1_1StereoCameraModel.html"title="A class representing a calibrated stereo camera system.">StereoCameraModel</a></code> to serialize/deserialize stereo models.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1CameraModel.html#a5724619c7ac8c796fd8c63660e398082"title="Serializes the camera model to a binary format.">serialize()</a></dd></dl>
<p>Returns a new camera model with all intrinsic parameters scaled by a given factor. </p>
<p>This method scales the camera's intrinsic matrix (<code>K_</code>) and projection matrix (<code>P_</code>), as well as the image size, by the given <code>scale</code> factor. The distortion and rectification matrices are left unchanged.</p>
<p>Only valid camera models (i.e., those for which <code><aclass="el"href="classrtabmap_1_1CameraModel.html#a7b6db41415e085d52bf363d09d5e6d67"title="Checks if the model is valid for 2D->3D projection.">isValidForProjection()</a></code> returns true) are scaled. If the model is invalid, a warning is issued and the original model is returned unchanged.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">scale</td><td>Scaling factor (> 0). For example, use 0.5 to downscale or 2.0 to upscale. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>A scaled copy of the camera model with updated intrinsics and image size.</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>If the camera model is not valid for projection, the scale operation is ignored. </dd></dl>
<p>Returns a new camera model adjusted for a given region of interest (ROI). </p>
<p>This method shifts the principal point (<code>cx</code>, <code>cy</code>) in the intrinsic matrix (<code>K_</code>) and projection matrix (<code>P_</code>) by subtracting the ROI’s top-left <code>(x, y)</code> offset. The image size is also set to the ROI size.</p>
<p>Only valid camera models (i.e., those for which <code><aclass="el"href="classrtabmap_1_1CameraModel.html#a7b6db41415e085d52bf363d09d5e6d67"title="Checks if the model is valid for 2D->3D projection.">isValidForProjection()</a></code> returns true) can be adjusted. If the model is invalid, a warning is issued and the original model is returned unchanged.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">roi</td><td>Region of interest defined as a rectangle (typically a subwindow of the full image). </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>A new camera model adapted to the ROI with adjusted intrinsics and image size.</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>If the camera model is not valid for projection, the ROI operation is ignored. </dd></dl>
<p>Rectifies a raw image using the precomputed rectification maps. </p>
<p>This function applies geometric correction (rectification) to an image using the camera model's <code>mapX_</code> and <code>mapY_</code> rectification maps. It is typically used to correct lens distortion in images based on the calibration parameters.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">raw</td><td>Input raw image (e.g., from camera). Must be a valid <code>cv::Mat</code>. </td></tr>
<tr><tdclass="paramname">interpolation</td><td>Interpolation method to use. Typically <code>cv::INTER_LINEAR</code> or <code>cv::INTER_NEAREST</code>.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Rectified image. If the rectification maps are not initialized, the function logs an error and returns a clone of the original image.</dd></dl>
<dlclass="section pre"><dt>Precondition</dt><dd><code>mapX_</code> and <code>mapY_</code> must be initialized using <code><aclass="el"href="classrtabmap_1_1CameraModel.html#a5690a86d11b0d84e80961ae5d38b1d25"title="Initializes the rectification maps used to undistort and rectify images.">initRectificationMap()</a></code>.</dd></dl>
<dlclass="section note"><dt>Note</dt><dd>Works for color and grayscale images of any valid type.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1CameraModel.html#a5690a86d11b0d84e80961ae5d38b1d25"title="Initializes the rectification maps used to undistort and rectify images.">initRectificationMap()</a>, <aclass="el"href="classrtabmap_1_1CameraModel.html#a22cf7f5b49ef0cd8be08755010f6acb5"title="Rectifies a raw depth image using the precomputed rectification maps.">rectifyDepth()</a></dd></dl>
<p>Rectifies a raw depth image using the precomputed rectification maps. </p>
<p>This function applies geometric correction (rectification) to a 16-bit unsigned depth image. It performs a pixel-by-pixel bilinear interpolation, only if all neighboring pixels have valid (non-zero) depth values, and the variation among them is within 1% of their average.</p>
<p>The method is optimized to avoid introducing noise in regions of high depth variance.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">raw</td><td>Input raw depth image (<code>CV_16UC1</code>). Must contain 16-bit unsigned depth values.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Rectified depth image. If the rectification maps are not initialized or the input image is not of type <code>CV_16UC1</code>, the function logs an error and returns a clone of the input.</dd></dl>
<dlclass="section pre"><dt>Precondition</dt><dd>Input image must be of type <code>CV_16UC1</code>. <code>mapX_</code> and <code>mapY_</code> must be initialized.</dd></dl>
<dlclass="section note"><dt>Note</dt><dd>Inspired by the Kinect2 CPU depth registration implementation from: <ahref="https://github.com/code-iai/iai_kinect2">https://github.com/code-iai/iai_kinect2</a></dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>Invalid or noisy regions are skipped in interpolation to maintain depth consistency.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1CameraModel.html#a5690a86d11b0d84e80961ae5d38b1d25"title="Initializes the rectification maps used to undistort and rectify images.">initRectificationMap()</a>, <aclass="el"href="classrtabmap_1_1CameraModel.html#a17219cf5cf82d224f2a7ed5af01fa236"title="Rectifies a raw image using the precomputed rectification maps.">rectifyImage()</a></dd></dl>
<p>Projects a 2D pixel and depth value into a 3D point in the camera coordinate frame (/camera_link). </p>
<p>This function uses the camera's intrinsic parameters to compute the 3D point corresponding to the given 2D image coordinates and depth value.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir"></td><tdclass="paramname">u</td><td>Horizontal image coordinate (in pixels). </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">v</td><td>Vertical image coordinate (in pixels). </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">depth</td><td>Depth value at (u, v) in meters. </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">x</td><td>Output X coordinate in 3D space. </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">y</td><td>Output Y coordinate in 3D space. </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">z</td><td>Output Z coordinate in 3D space (equals <code>depth</code>).</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>If <code>depth <= 0</code>, the output (x, y, z) will be set to <code>NaN</code>.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1CameraModel.html#a637a730717e42939449cd9f09e20db26"title="Reprojects a 3D point in the camera frame (/camera_link) into 2D image coordinates (floating-point).">reproject()</a></dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1CameraModel.html#a01de9a3cdc993275b2fbcf21d6e29833"title="Projects a 2D pixel and depth value into a 3D point in the camera coordinate frame (/camera_link).">project()</a>, reproject(int&, int&) </dd></dl>
<p>Reprojects a 3D point in the camera frame (/camera_link) into 2D image coordinates (rounded to int). </p>
<p>This version of <code><aclass="el"href="classrtabmap_1_1CameraModel.html#a637a730717e42939449cd9f09e20db26"title="Reprojects a 3D point in the camera frame (/camera_link) into 2D image coordinates (floating-point).">reproject()</a></code> returns integer pixel indices, computed from the 3D position.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir"></td><tdclass="paramname">x</td><td>X coordinate in camera space. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">y</td><td>Y coordinate in camera space. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">z</td><td>Z coordinate in camera space (must be non-zero). </td></tr>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1CameraModel.html#a01de9a3cdc993275b2fbcf21d6e29833"title="Projects a 2D pixel and depth value into a 3D point in the camera coordinate frame (/camera_link).">project()</a>, reproject(float&, float&) </dd></dl>
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.9.8 </li>