<trclass="memdesc:a179ffcbc49ff3a281ef33cb4381e061c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Default constructor. Creates an empty stereo model with default suffixes ("left", "right"). <br/></td></tr>
<trclass="memdesc:a1887639053ef5c09c3f650b5a7f280d8"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Constructs a <aclass="el"href="classrtabmap_1_1StereoCameraModel.html"title="A class representing a calibrated stereo camera system.">StereoCameraModel</a> from detailed intrinsic and extrinsic parameters for both cameras. <br/></td></tr>
<trclass="memdesc:ae91c2717319f3cd7b6f40768e5adbb9f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Constructs a <aclass="el"href="classrtabmap_1_1StereoCameraModel.html"title="A class representing a calibrated stereo camera system.">StereoCameraModel</a> from two individual camera models and optional stereo extrinsic parameters. <br/></td></tr>
<trclass="memdesc:a76bab07a51033de989fc522064ede024"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Constructs a <aclass="el"href="classrtabmap_1_1StereoCameraModel.html"title="A class representing a calibrated stereo camera system.">StereoCameraModel</a> from two camera models and an extrinsic <aclass="el"href="classrtabmap_1_1Transform.html"title="Represents a 3D rigid body transformation (rotation + translation).">Transform</a> between them. <br/></td></tr>
<trclass="memdesc:a0bdbbaa6e3ab315b0c5fce03247cea6c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Minimal constructor using focal lengths and baseline only. <br/></td></tr>
<trclass="memdesc:a8e3a5c32e13727545f2d22dda05c96b0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Minimal constructor that also sets a name, required if we want to save it to a file. <br/></td></tr>
<trclass="memdesc:a6c16870b83978d286003b166fd6949cf"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns true if both left and right models are valid for projection and the baseline is positive. <br/></td></tr>
<trclass="memdesc:ac5e22eec7815cb27e436afada2b5769f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns true if both left and right models are valid for rectification. <br/></td></tr>
<trclass="memdesc:a544ee7d540dfe57c94863190d87898aa"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Initializes the rectification maps for both cameras. <br/></td></tr>
<trclass="memdesc:aa35a73db2fc272f0f33b40220b75fa43"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns true if rectification maps are initialized. <br/></td></tr>
<trclass="memdesc:adc404f0be63eedd0e0a9d6d5b5b36a94"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the camera name and optional image suffixes for the left and right cameras. <br/></td></tr>
<trclass="memdesc:a898c2eff7bfc4977703f8edb86ca1187"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the image size for both left and right cameras. <br/></td></tr>
<trclass="memdesc:a9c2d94b9bc335fdec7f5fa4f4c45a07c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Loads stereo camera calibration data from disk. <br/></td></tr>
<trclass="memdesc:abfafd0a24795186f3bf623082663b4cd"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Saves stereo camera calibration data to disk. <br/></td></tr>
<trclass="memdesc:a1d016f499dbcce889ce7b7062c83b660"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Saves stereo extrinsic parameters to a YAML file in ROS format. <br/></td></tr>
<trclass="memdesc:a4eab6254ef808719ca2d0543c89e0722"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Serializes the stereo camera model into a byte vector. <br/></td></tr>
<trclass="memdesc:a7467f3a9a7961e643d0cd152286a13dd"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Deserializes stereo camera model data from a byte vector. <br/></td></tr>
<trclass="memitem:afdec3f5bab7ab9b4c339edaa30e639db"id="r_afdec3f5bab7ab9b4c339edaa30e639db"><tdclass="memItemLeft"align="right"valign="top">unsigned int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#afdec3f5bab7ab9b4c339edaa30e639db">deserialize</a> (const unsigned char *data, unsigned int dataSize)</td></tr>
<trclass="memdesc:afdec3f5bab7ab9b4c339edaa30e639db"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Deserializes stereo camera model data from a raw byte array. <br/></td></tr>
<trclass="memdesc:a8dc48f95fcf68eb81da96941f778535f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the stereo baseline in meters. <br/></td></tr>
<trclass="memdesc:a514f7d1baff8b4be96d760b27279f5d6"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Computes the depth (Z coordinate) from a given disparity value. <br/></td></tr>
<trclass="memdesc:aecf8b2a628ead0bc422dbf791d683f5b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Computes the disparity value from a given depth. <br/></td></tr>
<trclass="memitem:a28230b8236ed778729ed1e1ceb590f31"id="r_a28230b8236ed778729ed1e1ceb590f31"><tdclass="memItemLeft"align="right"valign="top">float </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a28230b8236ed778729ed1e1ceb590f31">computeDisparity</a> (unsigned short depth) const</td></tr>
<trclass="memdesc:a28230b8236ed778729ed1e1ceb590f31"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Computes the disparity value from a depth given in unsigned short format (millimeters). <br/></td></tr>
<trclass="memdesc:a084e3e40c8b0caf66269d508a8fcffbc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Reprojects a 3D point of the left camera frame into both image planes (floating-point). <br/></td></tr>
<trclass="memitem:a626b8f54940ebc77ec504921004dda3a"id="r_a626b8f54940ebc77ec504921004dda3a"><tdclass="memItemLeft"align="right"valign="top">void </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a626b8f54940ebc77ec504921004dda3a">reproject</a> (float x, float y, float z, int &uLeft, int &vLeft, int &uRight, int &vRight) const</td></tr>
<trclass="memdesc:a626b8f54940ebc77ec504921004dda3a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Reprojects a 3D point of the left camera frame into both image planes (rounded to int). <br/></td></tr>
<trclass="memdesc:a264d57ca1e0f6b41d03ffe1d89afc382"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Scales both cameras' calibration by a factor. <br/></td></tr>
<trclass="memdesc:ac2fb1c489ae60bd7e4c104515db3c3a9"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Applies region-of-interest (ROI) cropping to both cameras. <br/></td></tr>
<trclass="memdesc:aee77882ceca428a560f5fd3713a330fb"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets the local transform from left camera to robot base. <br/></td></tr>
<trclass="memdesc:a5257cde3d51bbee7c51c3f36d0c7741f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the local transform from left camera to robot base. <br/></td></tr>
<trclass="memdesc:a506f83654d7f772a3743d24869c05742"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the stereo transform (left camera relative to right camera coordinate system). <br/></td></tr>
<trclass="memdesc:a064d29601c0ba13fc47584849e26b81b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the left camera model. <br/></td></tr>
<trclass="memdesc:ab8061141407d8cc55d7f83211708af85"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Returns the right camera model. <br/></td></tr>
<trclass="memdesc:a799e3f787d015b5cbd0189768f5b673c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the suffix used for the left camera calibration file. <br/></td></tr>
<trclass="memdesc:a3ecae21bbf6bc9914d0bb553c99f9e09"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Gets the suffix used for the right camera calibration file. <br/></td></tr>
<divclass="textblock"><p>A class representing a calibrated stereo camera system. </p>
<p>This class encapsulates the calibration data and operations associated with a stereo camera setup, including intrinsic and extrinsic parameters for both left and right cameras, stereo rectification, and methods for computing depth or disparity from stereo images.</p>
<p>It relies internally on two <code><aclass="el"href="classrtabmap_1_1CameraModel.html"title="Represents a pinhole camera model containing intrinsic and extrinsic parameters, used for projection,...">CameraModel</a></code> instances for the left and right cameras.</p>
<p>Typical uses include:</p><ul>
<li><aclass="el"href="classrtabmap_1_1Stereo.html"title="Sparse stereo matching using block matching.">Stereo</a> rectification</li>
<li><aclass="el"href="classrtabmap_1_1Stereo.html"title="Sparse stereo matching using block matching.">Stereo</a> disparity-to-depth conversion</li>
<li>Saving and loading stereo camera calibration data</li>
<li>Projecting or reprojecting points</li>
</ul>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1CameraModel.html"title="Represents a pinhole camera model containing intrinsic and extrinsic parameters, used for projection,...">CameraModel</a></dd></dl>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00053">53</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
</div><h2class="groupheader">Constructor & Destructor Documentation</h2>
<p>Default constructor. Creates an empty stereo model with default suffixes ("left", "right"). </p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00059">59</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<p>Constructs a <aclass="el"href="classrtabmap_1_1StereoCameraModel.html"title="A class representing a calibrated stereo camera system.">StereoCameraModel</a> from detailed intrinsic and extrinsic parameters for both cameras. </p>
<p>Initializes the stereo camera model by specifying the calibration parameters for the left and right cameras, along with the stereo extrinsic parameters.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">name</td><td>Name identifier for the stereo camera. </td></tr>
<tr><tdclass="paramname">imageSize1</td><td>Image size (width, height) of the left camera. </td></tr>
<tr><tdclass="paramname">K1</td><td>Intrinsic camera matrix (3x3, CV_64FC1) for the left camera. </td></tr>
<tr><tdclass="paramname">D1</td><td>Distortion coefficients for the left camera. </td></tr>
<tr><tdclass="paramname">R1</td><td>Rectification matrix (3x3, CV_64FC1) for the left camera. </td></tr>
<tr><tdclass="paramname">P1</td><td>Projection matrix (3x4, CV_64FC1) for the left camera. </td></tr>
<tr><tdclass="paramname">imageSize2</td><td>Image size (width, height) of the right camera. </td></tr>
<tr><tdclass="paramname">K2</td><td>Intrinsic camera matrix (3x3, CV_64FC1) for the right camera. </td></tr>
<tr><tdclass="paramname">D2</td><td>Distortion coefficients for the right camera. </td></tr>
<tr><tdclass="paramname">R2</td><td>Rectification matrix (3x3, CV_64FC1) for the right camera. </td></tr>
<tr><tdclass="paramname">P2</td><td>Projection matrix (3x4, CV_64FC1) for the right camera. </td></tr>
<tr><tdclass="paramname">R</td><td>Rotation matrix (3x3, CV_64FC1) representing the rotation from left to right camera coordinate system. Can be empty if unknown. </td></tr>
<tr><tdclass="paramname">T</td><td>Translation vector (3x1, CV_64FC1) representing the translation from left to right camera coordinate system. Can be empty if unknown. </td></tr>
<tr><tdclass="paramname">E</td><td>Essential matrix (3x3, CV_64FC1) encoding the stereo camera epipolar geometry. Can be empty if unknown. </td></tr>
<tr><tdclass="paramname">F</td><td>Fundamental matrix (3x3, CV_64FC1) encoding the stereo camera epipolar constraints. Can be empty if unknown. </td></tr>
<tr><tdclass="paramname">localTransform</td><td>The local transform associated with the stereo camera model.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>All matrices must have correct sizes and types as specified. The rectification and projection matrices (R1, P1, R2, P2) are used to define the stereo rectification parameters. The rotation and translation (R, T) define the relative pose between the cameras. </dd></dl>
<p>Constructs a <aclass="el"href="classrtabmap_1_1StereoCameraModel.html"title="A class representing a calibrated stereo camera system.">StereoCameraModel</a> from two individual camera models and optional stereo extrinsic parameters. </p>
<p>This constructor initializes the stereo camera model by assigning the provided left and right camera models. If the stereo extrinsics (<code>R</code>, <code>T</code>) are provided and valid, stereo rectification will be attempted—provided both cameras are valid for rectification and their image dimensions match.</p>
<p>Each camera model will automatically have its name updated using the <code>name</code> parameter and default suffixes ("left", "right").</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">name</td><td>The base name for the stereo camera model. </td></tr>
<tr><tdclass="paramname">leftCameraModel</td><td>The camera model representing the left camera. </td></tr>
<tr><tdclass="paramname">rightCameraModel</td><td>The camera model representing the right camera. </td></tr>
<tr><tdclass="paramname">R</td><td>(Optional) Rotation matrix of the left camera relative to the right camera coordinate system (3x3, CV_64FC1). </td></tr>
<tr><tdclass="paramname">T</td><td>(Optional) Translation vector of the left camera relative to the right camera coordinate system (3x1, CV_64FC1). </td></tr>
<tr><tdclass="paramname">E</td><td>(Optional) Essential matrix between the two cameras (3x3, CV_64FC1). </td></tr>
<tr><tdclass="paramname">F</td><td>(Optional) Fundamental matrix between the two cameras (3x3, CV_64FC1).</td></tr>
</table>
</dd>
</dl>
<dlclass="exception"><dt>Exceptions</dt><dd>
<tableclass="exception">
<tr><tdclass="paramname"><aclass="el"href="classUException.html">UException</a></td><td>if any of the provided matrices (<code>R</code>, <code>T</code>, <code>E</code>, <code>F</code>) are non-empty and not of the expected type/shape. </td></tr>
<tr><tdclass="paramname"><aclass="el"href="classUException.html">UException</a></td><td>if <code>R</code> and <code>T</code> are provided but the camera models are not valid for rectification.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd><aclass="el"href="classrtabmap_1_1Stereo.html"title="Sparse stereo matching using block matching.">Stereo</a> rectification is only attempted if both <code>R</code> and <code>T</code> are non-empty, the cameras are valid, and their image sizes match. </dd></dl>
<p>Constructs a <aclass="el"href="classrtabmap_1_1StereoCameraModel.html"title="A class representing a calibrated stereo camera system.">StereoCameraModel</a> from two camera models and an extrinsic <aclass="el"href="classrtabmap_1_1Transform.html"title="Represents a 3D rigid body transformation (rotation + translation).">Transform</a> between them. </p>
<p>This constructor sets up a stereo camera model using the given left and right camera models along with an optional 3D transform (<code>extrinsics</code>) representing the pose of the left camera relative to the right camera coordinate system.</p>
<p>If a valid (non-null) transform is provided, the corresponding rotation and translation matrices are extracted and stored as the stereo extrinsic parameters. <aclass="el"href="classrtabmap_1_1Stereo.html"title="Sparse stereo matching using block matching.">Stereo</a> rectification will be attempted if both camera models are valid for rectification and their image sizes match.</p>
<p>Each camera model will be renamed using the provided <code>name</code> and default suffixes ("left", "right").</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">name</td><td>Base name for the stereo camera model. </td></tr>
<tr><tdclass="paramname">leftCameraModel</td><td><aclass="el"href="classrtabmap_1_1Camera.html">Camera</a> model for the left camera. </td></tr>
<tr><tdclass="paramname">rightCameraModel</td><td><aclass="el"href="classrtabmap_1_1Camera.html">Camera</a> model for the right camera. </td></tr>
<tr><tdclass="paramname">extrinsics</td><td>(Optional) <aclass="el"href="classrtabmap_1_1Transform.html"title="Represents a 3D rigid body transformation (rotation + translation).">Transform</a> of the left camera relative to the right camera coordinate system. If null, no extrinsics are used.</td></tr>
</table>
</dd>
</dl>
<dlclass="exception"><dt>Exceptions</dt><dd>
<tableclass="exception">
<tr><tdclass="paramname"><aclass="el"href="classUException.html">UException</a></td><td>if <code>extrinsics</code> is not null and either camera model is not valid for rectification.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd><aclass="el"href="classrtabmap_1_1Stereo.html"title="Sparse stereo matching using block matching.">Stereo</a> rectification is performed only when <code>extrinsics</code> is valid and both camera models are rectifiable with matching image dimensions. </dd></dl>
<p>Minimal constructor using focal lengths and baseline only. </p>
<p>Creates a simplified stereo camera model using only the essential intrinsic parameters and baseline. This constructor assumes the images are already rectified and both cameras have the same intrinsic parameters.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">fx</td><td>Focal length in x direction (pixels). </td></tr>
<tr><tdclass="paramname">fy</td><td>Focal length in y direction (pixels). </td></tr>
<tr><tdclass="paramname">cx</td><td>Principal point x coordinate (pixels). </td></tr>
<tr><tdclass="paramname">cy</td><td>Principal point y coordinate (pixels). </td></tr>
<tr><tdclass="paramname">baseline</td><td><aclass="el"href="classrtabmap_1_1Stereo.html"title="Sparse stereo matching using block matching.">Stereo</a> baseline distance in meters. </td></tr>
<tr><tdclass="paramname">localTransform</td><td>Local transform from camera to robot base frame (default: optical rotation). </td></tr>
<tr><tdclass="paramname">imageSize</td><td>Image size (width, height). Optional, can be set later.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>This constructor creates a simplified model suitable for rectified stereo pairs. For full calibration with distortion, use the constructors that accept camera matrices. </dd></dl>
<p>Minimal constructor that also sets a name, required if we want to save it to a file. </p>
<p>Same as the minimal constructor but also sets the camera name, which is required when saving the calibration to disk.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">name</td><td><aclass="el"href="classrtabmap_1_1Camera.html">Camera</a> name identifier (used for saving calibration files). </td></tr>
<tr><tdclass="paramname">fx</td><td>Focal length in x direction (pixels). </td></tr>
<tr><tdclass="paramname">fy</td><td>Focal length in y direction (pixels). </td></tr>
<tr><tdclass="paramname">cx</td><td>Principal point x coordinate (pixels). </td></tr>
<tr><tdclass="paramname">cy</td><td>Principal point y coordinate (pixels). </td></tr>
<tr><tdclass="paramname">baseline</td><td><aclass="el"href="classrtabmap_1_1Stereo.html"title="Sparse stereo matching using block matching.">Stereo</a> baseline distance in meters. </td></tr>
<tr><tdclass="paramname">localTransform</td><td>Local transform from camera to robot base frame (default: optical rotation). </td></tr>
<tr><tdclass="paramname">imageSize</td><td>Image size (width, height). Optional, can be set later.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>Use this constructor when you plan to save the calibration to a file. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00219">219</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
</div>
</div>
<h2class="groupheader">Member Function Documentation</h2>
<p>Returns true if both left and right models are valid for projection and the baseline is positive. </p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00224">224</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<p>Returns true if both left and right models are valid for rectification. </p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00229">229</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<p>Initializes the rectification maps for both cameras. </p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00234">234</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<p>Returns true if rectification maps are initialized. </p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00239">239</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<p>Sets the camera name and optional image suffixes for the left and right cameras. </p>
<p>Updates the stereo camera model name and the suffixes used for identifying left and right camera calibration files. The suffixes are used when loading/saving calibration data from disk.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">name</td><td>Base name for the stereo camera model. </td></tr>
<tr><tdclass="paramname">leftSuffix</td><td>Suffix for the left camera (default: "left"). Used in filenames like "cameraName_left.yaml". </td></tr>
<tr><tdclass="paramname">rightSuffix</td><td>Suffix for the right camera (default: "right"). Used in filenames like "cameraName_right.yaml".</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>The suffixes are used by <aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a9c2d94b9bc335fdec7f5fa4f4c45a07c"title="Loads stereo camera calibration data from disk.">load()</a> and <aclass="el"href="classrtabmap_1_1StereoCameraModel.html#abfafd0a24795186f3bf623082663b4cd"title="Saves stereo camera calibration data to disk.">save()</a> methods to construct filenames for each camera. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00258">258</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<p>Sets the image size for both left and right cameras. </p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00263">263</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<p>Loads stereo camera calibration data from disk. </p>
<p>This method loads the intrinsic parameters for both the left and right cameras from files in the specified directory, using the provided camera name and internal suffixes. If <code>ignoreStereoTransform</code> is false, it also attempts to load the stereo extrinsic parameters (rotation, translation, essential, and fundamental matrices) from a YAML file.</p>
<p>The stereo extrinsics are expected in the file: <code>directory/cameraName_pose.yaml</code>, following the ROS calibration format.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">directory</td><td>The directory where the calibration files are located. </td></tr>
<tr><tdclass="paramname">cameraName</td><td>The base name of the stereo camera (used to derive filenames). </td></tr>
<tr><tdclass="paramname">initRectificationMaps</td><td>Set to false to skip building the (potentially large) left/right 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 is successful, false otherwise.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#abfafd0a24795186f3bf623082663b4cd"title="Saves stereo camera calibration data to disk.">save()</a>, <aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a1d016f499dbcce889ce7b7062c83b660"title="Saves stereo extrinsic parameters to a YAML file in ROS format.">saveStereoTransform()</a>, <aclass="el"href="classrtabmap_1_1CameraModel.html#a5690a86d11b0d84e80961ae5d38b1d25"title="Initializes the rectification maps used to undistort and rectify images.">CameraModel::initRectificationMap()</a></dd></dl>
<p>Saves stereo camera calibration data to disk. </p>
<p>This method saves the intrinsic parameters of both left and right cameras to the specified directory. If <code>ignoreStereoTransform</code> is false, it also saves the stereo extrinsic parameters (rotation, translation, essential, and fundamental matrices) in a ROS-compatible YAML file named <code>cameraName_pose.yaml</code>.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">directory</td><td>The directory where calibration files should be saved. </td></tr>
<dlclass="section return"><dt>Returns</dt><dd>true if saving was successful, false otherwise.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a9c2d94b9bc335fdec7f5fa4f4c45a07c"title="Loads stereo camera calibration data from disk.">load()</a>, <aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a1d016f499dbcce889ce7b7062c83b660"title="Saves stereo extrinsic parameters to a YAML file in ROS format.">saveStereoTransform()</a></dd></dl>
<p>Saves stereo extrinsic parameters to a YAML file in ROS format. </p>
<p>This method exports the stereo transform, including rotation, translation, essential, and fundamental matrices, into a YAML file named <code>cameraName_pose.yaml</code> located in the specified directory. The file format is compatible with ROS camera calibration tools.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">directory</td><td>The target directory for saving the calibration file. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>true if saving was successful, false if required matrices are missing or invalid.</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>If extrinsics (<code>R_</code>, <code>T_</code>, <code>E_</code>, <code>F_</code>) are empty or invalid, nothing will be saved and a warning is printed.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a9c2d94b9bc335fdec7f5fa4f4c45a07c"title="Loads stereo camera calibration data from disk.">load()</a>, <aclass="el"href="classrtabmap_1_1StereoCameraModel.html#abfafd0a24795186f3bf623082663b4cd"title="Saves stereo camera calibration data to disk.">save()</a></dd></dl>
<p>Serializes the stereo camera model into a byte vector. </p>
<p>This method serializes the left and right camera models along with the stereo extrinsic parameters (rotation matrix R_, translation vector T_, essential matrix E_, and fundamental matrix F_) into a contiguous byte array. The serialization format starts with a fixed-size integer header containing version info, stereo type, matrix sizes, and serialized data sizes, followed by the actual matrices and serialized camera data.</p>
<p>The serialized data can later be restored using the corresponding <code><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a7467f3a9a7961e643d0cd152286a13dd"title="Deserializes stereo camera model data from a byte vector.">deserialize()</a></code> method.</p>
<dlclass="section return"><dt>Returns</dt><dd>A vector of unsigned char containing the serialized stereo camera data. </dd></dl>
<p>Deserializes stereo camera model data from a byte vector. </p>
<p>This method wraps the pointer-based <code><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a7467f3a9a7961e643d0cd152286a13dd"title="Deserializes stereo camera model data from a byte vector.">deserialize()</a></code> and attempts to restore the stereo camera model from the given serialized byte vector.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">data</td><td>The vector of bytes containing previously serialized stereo camera model data. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The number of bytes read from the data if successful, 0 otherwise.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#afdec3f5bab7ab9b4c339edaa30e639db"title="Deserializes stereo camera model data from a raw byte array.">deserialize(const unsigned char*, unsigned int)</a></dd></dl>
<p>Deserializes stereo camera model data from a raw byte array. </p>
<p>This method reconstructs the stereo camera model from the provided serialized data buffer. It expects the data format to match the one produced by <code><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a4eab6254ef808719ca2d0543c89e0722"title="Serializes the stereo camera model into a byte vector.">serialize()</a></code>, including a header with version info, matrix sizes, and data sizes, followed by the serialized extrinsic matrices and serialized left and right camera data.</p>
<p>The method performs various sanity checks on data sizes and matrix dimensions and will fail if the data format or sizes are inconsistent.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">data</td><td>Pointer to the raw serialized data buffer. </td></tr>
<tr><tdclass="paramname">dataSize</td><td>Size in bytes of the data buffer. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The number of bytes consumed during deserialization if successful, or 0 on failure.</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The stereo camera model is reset to a default empty state before deserialization. </dd>
<dd>
If the serialized data type is not stereo (type != 1), deserialization will fail.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a4eab6254ef808719ca2d0543c89e0722"title="Serializes the stereo camera model into a byte vector.">serialize()</a></dd></dl>
<p>Computes the baseline distance between the left and right cameras using the projection matrices. The baseline is calculated as the difference in x-translation (Tx) normalized by the focal length.</p>
<dlclass="section return"><dt>Returns</dt><dd>The baseline distance in meters. Returns 0.0 if focal lengths are invalid or zero.</dd></dl>
<dlclass="section note"><dt>Note</dt><dd>The baseline is a physical distance and is essential for depth computation from disparity. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00378">378</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<p> where ( f_x ) is the focal length of the left camera and ( c_x ) are principal points.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">disparity</td><td>The disparity value (difference in pixel coordinates between left and right images). </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The computed depth in the same unit as the baseline (typically meters). Returns 0 if disparity is zero or if the model is not valid for projection.</dd></dl>
<dlclass="section note"><dt>Note</dt><dd>This function requires the stereo camera to be valid for projection (i.e., calibrated and rectified). </dd></dl>
<tr><tdclass="paramname">depth</td><td>Depth value in the same unit as the baseline (typically meters). </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The computed disparity in pixels. Returns 0 if depth is zero or if the model is not valid for projection.</dd></dl>
<dlclass="section note"><dt>Note</dt><dd>This function requires the stereo camera to be valid for projection (i.e., calibrated and rectified). </dd></dl>
<p>Computes the disparity value from a depth given in unsigned short format (millimeters). </p>
<p>Converts depth expressed as an unsigned short (in millimeters) to disparity. The depth is first converted to meters before computing disparity using the formula: </p><pclass="formulaDsp">
<tr><tdclass="paramname">depth</td><td>Depth value in millimeters as an unsigned short. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>The computed disparity in pixels. Returns 0 if depth is zero or if the model is not valid for projection.</dd></dl>
<dlclass="section note"><dt>Note</dt><dd>This function requires the stereo camera to be valid for projection (i.e., calibrated and rectified). </dd></dl>
<p>Reprojects a 3D point of the left camera frame into both image planes (floating-point). </p>
<p>The point is given in the rectified left camera frame (/camera_link), the same frame used by <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).">CameraModel::reproject()</a> of <aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a064d29601c0ba13fc47584849e26b81b"title="Returns the left camera model.">left()</a>. The baseline is taken from the Tx of the rectified projection matrices, so the horizontal shift between uLeft and uRight is the disparity of that point. On a rectified stereo pair the rows are aligned, thus vRight equals vLeft.</p>
<dlclass="section note"><dt>Note</dt><dd>Unlike this function, <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).">CameraModel::reproject()</a> ignores Tx, because a Tx set on a single camera model is also used to tag a left camera having stereo observations (see the stereo edges built by the BA optimizers).</dd></dl>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramdir"></td><tdclass="paramname">x</td><td>X coordinate in the left camera space. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">y</td><td>Y coordinate in the left camera space. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">z</td><td>Z coordinate in the left camera space (must be non-zero). </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">uLeft</td><td>Output horizontal image coordinate in the left image (float). </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">vLeft</td><td>Output vertical image coordinate in the left image (float). </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">uRight</td><td>Output horizontal image coordinate in the right image (float). </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">vRight</td><td>Output vertical image coordinate in the right image (float).</td></tr>
<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).">CameraModel::reproject()</a>, reproject(int&, int&, int&, int&) </dd></dl>
<p>Reprojects a 3D point of the left camera frame into both image planes (rounded to int). </p>
<p>This version of <code><aclass="el"href="classrtabmap_1_1StereoCameraModel.html#a084e3e40c8b0caf66269d508a8fcffbc"title="Reprojects a 3D point of the left camera frame into both image planes (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 the left camera space. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">y</td><td>Y coordinate in the left camera space. </td></tr>
<tr><tdclass="paramdir"></td><tdclass="paramname">z</td><td>Z coordinate in the left camera space (must be non-zero). </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">uLeft</td><td>Output horizontal image coordinate in the left image (integer pixel). </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">vLeft</td><td>Output vertical image coordinate in the left image (integer pixel). </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">uRight</td><td>Output horizontal image coordinate in the right image (integer pixel). </td></tr>
<tr><tdclass="paramdir">[out]</td><tdclass="paramname">vRight</td><td>Output vertical image coordinate in the right image (integer pixel).</td></tr>
<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).">CameraModel::reproject()</a>, reproject(float&, float&, float&, float&) </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00475">475</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00476">476</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00477">477</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00478">478</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<p>Scales both cameras' calibration by a factor. </p>
<p>Scales the intrinsic parameters (focal lengths, principal points) and image sizes of both left and right cameras by the given scale factor. This is useful when working with downscaled or upscaled images.</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 note"><dt>Note</dt><dd>The baseline is not scaled, as it represents a physical distance between cameras. </dd>
<dd>
Only valid camera models are scaled. Invalid models are left unchanged. </dd></dl>
<p>Applies region-of-interest (ROI) cropping to both cameras. </p>
<p>Adjusts both camera models for a region of interest by shifting the principal points and updating the image sizes. This is useful when working with cropped or subwindowed images.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">roi</td><td>Region of interest rectangle. The top-left corner defines the offset for principal points.</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>The principal points (cx, cy) are adjusted by subtracting the ROI's top-left coordinates. </dd>
<dd>
The image size is set to the ROI size. </dd>
<dd>
Only valid camera models are adjusted. Invalid models are left unchanged. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00511">511</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00516">516</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<p>Returns the stereo transform (left camera relative to right camera coordinate system). </p>
<p>The stereo transform brings points given in the first (left) camera's coordinate system to points in the second (right) camera's coordinate system. In more technical terms, it performs a change of basis from the first camera's coordinate system to the second camera's coordinate system. Due to its duality, it is equivalent to the position of the first camera with respect to the second camera coordinate system.</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> from left camera to right camera coordinate system. Returns identity if R_ or T_ are empty.</dd></dl>
<dlclass="section note"><dt>Note</dt><dd>The transform is constructed from the stereo extrinsic parameters R_ and T_.</dd></dl>
<dlclass="section user"><dt>Example:</dt><dd>For a stereo camera with a baseline of 15 cm, where the right camera is positioned to the right of the left camera, the x value of the returned <aclass="el"href="classrtabmap_1_1Transform.html"title="Represents a 3D rigid body transformation (rotation + translation).">Transform</a> would be -0.15 (negative because it represents the position of the left camera in the right camera's coordinate system). <divclass="fragment"><divclass="line"><aclass="code hl_class"href="classrtabmap_1_1StereoCameraModel.html">StereoCameraModel</a> stereo(...);</div>
<divclass="line"><spanclass="comment">// If baseline is 0.15 m, transform.x() would be approximately -0.15</span></div>
<divclass="ttc"id="aclassrtabmap_1_1StereoCameraModel_html"><divclass="ttname"><ahref="classrtabmap_1_1StereoCameraModel.html">rtabmap::StereoCameraModel</a></div><divclass="ttdoc">A class representing a calibrated stereo camera system.</div><divclass="ttdef"><b>Definition</b><ahref="StereoCameraModel_8h_source.html#l00053">StereoCameraModel.h:54</a></div></div>
<divclass="ttc"id="aclassrtabmap_1_1Transform_html"><divclass="ttname"><ahref="classrtabmap_1_1Transform.html">rtabmap::Transform</a></div><divclass="ttdoc">Represents a 3D rigid body transformation (rotation + translation).</div><divclass="ttdef"><b>Definition</b><ahref="Transform_8h_source.html#l00052">Transform.h:53</a></div></div>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00547">547</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00551">551</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00556">556</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="StereoCameraModel_8h_source.html#l00560">560</a> of file <aclass="el"href="StereoCameraModel_8h_source.html">StereoCameraModel.h</a>.</p>
<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>