<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Siddhesh Rane on Medium]]></title>
        <description><![CDATA[Stories by Siddhesh Rane on Medium]]></description>
        <link>https://medium.com/@r.siddhesh96?source=rss-497d95153c7a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7O16EkYHxY2flHXFTm-qKw.jpeg</url>
            <title>Stories by Siddhesh Rane on Medium</title>
            <link>https://medium.com/@r.siddhesh96?source=rss-497d95153c7a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:38:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@r.siddhesh96/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What “Real Time” Means in 4D Gaussian Splatting? (HexPlane and Deformation Fields)]]></title>
            <link>https://medium.com/@r.siddhesh96/what-real-time-means-in-4d-gaussian-splatting-hexplane-and-deformation-fields-cc1a89609d8b?source=rss-497d95153c7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc1a89609d8b</guid>
            <category><![CDATA[3d-rendering]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[gaussian-splatting]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Siddhesh Rane]]></dc:creator>
            <pubDate>Sun, 23 Aug 2026 22:17:31 GMT</pubDate>
            <atom:updated>2026-08-23T22:17:31.065Z</atom:updated>
            <content:encoded><![CDATA[<p><em>These are just my handwritten learning notes turned into a short article, not a substitute for the excellent original papers.</em></p><p>When I first saw papers like <a href="https://arxiv.org/pdf/2310.08528v2"><em>4D Gaussian Splatting for Real Time Dynamic Scene Rendering</em></a>, I assumed that “real time” meant the scene itself was being reconstructed continuously as new frames arrived. I imagined something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*54yCSDaxJENegJelD2QzBQ.png" /></figure><p>That is actually a plausible architecture for a live reconstruction system. But it is not what “real time” means in this 4D Gaussian Splatting paper. The sequence is captured first. The model <strong>then learns a representation of the whole dynamic scene during training.</strong> Once that optimization is finished, it can render the learned scene at a random timestamps very quickly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xaXRVCgWwOuT9HBoJOZcKA.png" /></figure><h4>Why Did We Need This?</h4><p>Suppose I captured a dynamic scene at T different timestamps. The simplest possible solution would be to reconstruct a completely independent Gaussian scene for every timestamp. Suppose every scene contains N Gaussians. Each Gaussian contains some fixed number P of parameters.</p><p><strong>Memory:</strong> <strong>T × N × P</strong> ∝ <strong>O(TN)</strong></p><p>Not only it takes a whole lot more space to store, it also discards the shared structure that neighboring splats have! So instead of storing an entire new Gaussian scene at every timestamp, authors ask a different question:</p><blockquote><em>Can I keep one canonical Gaussian scene and learn how it changes over time?</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h0IURk61RIOHjp2iCX8YuQ.png" /></figure><h3>Canonical Gaussians + Deformation</h3><p>First, what exactly needs to change with time?</p><p>A vanilla 3D Gaussian contains <strong>position, scale, rotation, opacity and color</strong>. Instead of learning all of these again at every timestamp, 4D-GS keeps a canonical Gaussian and predicts deformation <strong>ONLY</strong> for its position, scale and rotation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Iumr1SSPhqmO-WHLMZy0dg.png" /></figure><blockquote><strong>Can you spot the major limitation of this method here?</strong></blockquote><blockquote>Standard 4D Gaussian Splatting fails when a scene changes completely. For example, it cannot handle a new object suddenly entering the room or a splash of water splitting into separate drops. :(</blockquote><h3>Why Not Store a 4D Grid?</h3><p>Ok, so we need a some function that takes (x,y,z,t) as input and generates an F dimensional feature output. The most direct way to represent a function of (x,y,z,t) would be a dense 4D feature grid.</p><p>Imagine, if RGB color was some 3-dimensional feature, then a 2D image I(x,y) would be a function that takes a 2D location (x,y) and spits out a 3D number. Similarly we need a function H(..) that takes 4 numbers and <strong>outputs F numbers which are learned as a part of the training!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gVEZuEIWsnl5M_IYutN0Bw.png" /></figure><p>That gets expensive extremely quickly. <a href="https://arxiv.org/pdf/2301.09632">HexPlane</a>’s idea is to <strong>factorize this 4D function into six 2D planes</strong> instead of explicitly storing every (x,y,z,t) combination.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*pELniDw3jIHX2syoLevE6g.png" /><figcaption>Credit: <a href="https://arxiv.org/pdf/2301.09632">https://arxiv.org/pdf/2301.09632</a></figcaption></figure><h3>The small mathematical idea behind HexPlane</h3><p>Before the six planes, there is a simple intuition that made the whole thing easier for me. Take a matrix A. If every entry is independent, we store all MN values. But sometimes the matrix can be built from much simpler pieces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uNuQdr0yKOyuA6K72qTF8w.png" /></figure><p>Rank 1 is very restrictive. So we can add more independent rank 1 components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4fTkyzy50P8qSEe0YQYQcQ.png" /></figure><p>HexPlane takes essentially this factorization intuition into spacetime (XYZ and t). Instead of allowing every (x,y,z,t) combination to be completely independent, HexPlane builds the 4D field from learned <strong>2D factors</strong>.</p><p>With four coordinates (x, y, z, t), there are exactly <strong>six</strong> coordinate planes: <strong>XY, YZ, XZ, XT, YT, ZT</strong></p><p>But the clever idea is how they are paired.</p><blockquote><em>XY + ZT → x,y,z,t</em></blockquote><blockquote><em>XZ + YT → x,y,z,t</em></blockquote><blockquote>YZ + XT <em>→ x,y,z,t</em></blockquote><p>HexPlane picks R as a hyper-parameter and directly learns an R-component approximation. In other words, for <em>H(x,y,z,t)</em> we choose <em>R1, R2, R3</em> where <em>R1+R2+R3=R </em>and assume:</p><p><strong><em>H = sum of R1 components + sum of R2 components + sum of R3 components</em></strong></p><p>And the components themselves are learned by gradient descent through <strong>rendering</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XDw-o4-dZJbE67LzRqU1mQ.png" /></figure><p>Please go through <strong>section 3</strong> of this beautiful <a href="https://arxiv.org/pdf/2301.09632">paper</a> for rigorous mathematical explanation. But overall pipeline can be summarized in simple words as:</p><ol><li>Pick R1, R2, R3 such that R1 + R2 + R3 &lt;&lt; N (Spatial resolution)</li><li>Initialize all Planes (M) and Basis Vectors (V)</li><li>Train end-to-end: images → rendering loss → gradient descent → learn M and V</li></ol><h3>Why Is This Useful for 4D Gaussian Splatting?</h3><p>4D Gaussian Splatting borrows this basic representation idea, but changes what that feature is used for. <strong>Also, note that 4D-GS does not literally implement equation 4 of the original HexPlane paper exactly written above. In fact, the 4D-GS paper’s Equation 7 is more K-Planes-like than the original HexPlane Equation 4.</strong> Its deformation encoder is described as a <strong>multi-resolution</strong> HexPlane and uses a six-plane, K-Planes-style feature construction. So Equation 4 is the mathematical intuition for why these plane factorizations work, while the exact 4D-GS aggregation differs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cptcSWgQsFDYybLkz9SKDg.png" /><figcaption>SOURCE: <a href="https://arxiv.org/pdf/2310.08528">4D Gaussian Splatting for Real-Time Dynamic Scene Rendering</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bWRNgIZ9wPY90ze00EC9dQ.png" /></figure><p>And similar to Hex-Plane optimization, these features are learned through backpropagation of rendering loss.</p><blockquote>Please go through the paper: <a href="https://arxiv.org/pdf/2301.10241">K-Planes: Explicit Radiance Fields in Space, Time, and Appearance</a> for detailed explanation of the underlying maths.</blockquote><h4>Back to my main question ‘What is real time here?’</h4><p>So when the paper says <strong>real-time dynamic scene rendering</strong>, the important word is <em>rendering</em>. The expensive optimization happens beforehand. At inference time, 4D-GS only needs to query the learned spacetime representation for each canonical Gaussian, predict its deformation at the requested timestamp, and rasterize the resulting Gaussians.</p><p>And that is where HexPlane fits into the story. It makes spacetime query compact and fast while still letting the model learn how Guassians are deformed over the time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc1a89609d8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extrinsic Camera Calibration Part 1: COLMAP Rigs]]></title>
            <link>https://medium.com/@r.siddhesh96/extrinsic-camera-calibration-part-1-colmap-rigs-370d39c2b26f?source=rss-497d95153c7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/370d39c2b26f</guid>
            <category><![CDATA[aml]]></category>
            <category><![CDATA[structure-from-motion]]></category>
            <category><![CDATA[gaussian-splatting]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[colmap]]></category>
            <dc:creator><![CDATA[Siddhesh Rane]]></dc:creator>
            <pubDate>Wed, 17 Jun 2026 13:39:43 GMT</pubDate>
            <atom:updated>2026-06-19T11:19:47.855Z</atom:updated>
            <content:encoded><![CDATA[<p>Today I was working with COLMAP’s rig support because I eventually want to integrate my own multi-camera extrinsic calibration into COLMAP. I have written my own <strong>Bundle Adjustment Code</strong> for scale aware extrinsics calibration (More about that in Part 2). But before blindly feeding those poses into COLMAP, I wanted to properly understand how COLMAP represents camera rigs internally.</p><p>So in this first part, I decided to follow the COLMAP rig workflow using the ETH rig dataset, but without using the provided ground-truth calibration.</p><h4>COLMAP Setup and Dataset collection</h4><p>I am using COLMAP 4.1.0.dev0 (Commit c03cb50e on 2026–05–20 with CUDA) built from source. Please make sure you have latest version of COLMAP to use rig support.</p><ul><li>I downloaded ETH rig dataset using wget <a href="https://www.eth3d.net/data/terrains_rig_undistorted.7z">https://www.eth3d.net/data/terrains_rig_undistorted.7z</a> 7zz x terrains_rig_undistorted.7z</li><li>After downloading the ETH terrain rig dataset, my directory looked like this:</li></ul><pre>~/colmap/experiments/terrains$ ls<br>images  rig_calibration_undistorted</pre><p>Inside images/, there are four folders, one for each camera:</p><pre>~/colmap/experiments/terrains$ ls images/<br>images_rig_cam4_undistorted<br>images_rig_cam5_undistorted<br>images_rig_cam6_undistorted<br>images_rig_cam7_undistorted</pre><p>The dataset also provides a calibration/reconstruction folder:</p><pre>~/colmap/experiments/terrains$ ls rig_calibration_undistorted/<br>cameras.txt  images.txt  points3D.txt</pre><p>But for this experiment, I did <strong>not</strong> use rig_calibration_undistorted. COLMAP’s rig model assumes that sensors mounted in a rig have fixed relative poses, one reference sensor defines the rig origin, and a frame corresponds to one exposure instance of the rig where all or some sensors are exposed together.</p><h4>What is a rig in COLMAP?</h4><p>A normal COLMAP reconstruction treats every image pose independently. For example, if I have four cameras and 165 timestamps, then I have: <em>4 × 165 = 660 images</em></p><p>Without rig modeling, COLMAP estimates one independent pose per image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AHTVUfdncWH170DJBXpEMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qg6hbX5GKLAZ67f6KBgPhQ.png" /><figcaption>COLMAP is treating each image as an independent camera instance</figcaption></figure><p>But when you define a multi-camera rig, the relative positions of the cameras are locked. COLMAP factors the absolute pose into a fixed relative component and a moving world component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SiBBB1yzylmujqnU_tEEDw.png" /></figure><p>Component Breakdown:</p><ul><li><strong><em>T_rig-&gt;cami (Sensor Pose Inside Rig):</em></strong><br>The rigid transformation from the rig’s baseline origin to camera i. This is static across all timestamps. <strong><em>COLMAP optimizes this once per camera</em></strong><em>.</em></li><li><strong><em>T_world-&gt;rig^{t} (Rig Pose in World):</em></strong><br>The rigid transformation from the world origin to the rig’s baseline origin at timestamp t. This changes at every frame as the rig moves through space.</li></ul><h3>1. Feature extraction</h3><p>From the dataset root cd ~/colmap/experiments/terrains , I first created a new database for the no-rig experiment:</p><pre>rm -f database_no_rig.db<br>mkdir -p sparse_no_rig</pre><p>Then I extracted features:</p><pre>colmap feature_extractor \<br>    --database_path database_no_rig.db \<br>    --image_path images \<br>    --ImageReader.single_camera_per_folder 1</pre><p>The important option here is --ImageReader.single_camera_per_folder 1 .</p><p>Since my image folders are:</p><pre>images_rig_cam4_undistorted/<br>images_rig_cam5_undistorted/<br>images_rig_cam6_undistorted/<br>images_rig_cam7_undistorted/</pre><p>this tells COLMAP that All images inside one folder belong to the same camera/intrinsic model.</p><p>So COLMAP creates one camera model per folder. At this stage, this is still <strong>not rig modeling</strong>. It only means one camera/intrinsic model per image folder . The relative poses between these cameras are not known yet.</p><h3>2. Sequential matching</h3><p>Next, I ran sequential matching:</p><pre>colmap sequential_matcher \<br>    --database_path database_no_rig.db</pre><p>This dataset is sequence-like, so sequential matching is a reasonable starting point. At this point, COLMAP still does not know that:</p><pre>images_rig_cam4_undistorted/frame_k<br>images_rig_cam5_undistorted/frame_k<br>images_rig_cam6_undistorted/frame_k<br>images_rig_cam7_undistorted/frame_k</pre><p>belong to the same physical rig frame. It is still just doing standard image matching.</p><h3>3. Ordinary no-rig reconstruction</h3><p>Then I ran the normal mapper:</p><pre>colmap mapper \<br>    --database_path database_no_rig.db \<br>    --image_path images \<br>    --output_path sparse_no_rig</pre><p>This produced sparse_no_rig/0 .</p><p>This is the important baseline. At this point, COLMAP has reconstructed the scene, but it has treated all images as independent camera poses.</p><p>Conceptually:</p><pre>sparse_no_rig/<br>    660 images<br>    660 independent image poses<br>    3D points<br>    camera intrinsics</pre><p>This is the model that will later be used to infer the rig layout.</p><h3>4. Creating an unknown-pose rig configuration</h3><p>Now I created a rig configuration file:</p><pre>$ cat &gt; rig_config_unknown.json &lt;&lt; &#39;EOF&#39;<br>[<br>    {<br>        &quot;cameras&quot;: [<br>            {<br>                &quot;image_prefix&quot;: &quot;images_rig_cam4_undistorted/&quot;,<br>                &quot;ref_sensor&quot;: true<br>            },<br>            {<br>                &quot;image_prefix&quot;: &quot;images_rig_cam5_undistorted/&quot;<br>            },<br>            {<br>                &quot;image_prefix&quot;: &quot;images_rig_cam6_undistorted/&quot;<br>            },<br>            {<br>                &quot;image_prefix&quot;: &quot;images_rig_cam7_undistorted/&quot;<br>            }<br>        ]<br>    }<br>]<br>EOF</pre><p>This file says: <em>These four image folders are four cameras belonging to one rig. Use images_rig_cam4_undistorted/ as the reference sensor. But I do not provide relative poses.</em></p><p><strong>But what if you know the relative poses already?</strong></p><p>If you already know the geometric calibration of your camera rig beforehand, you can skip the estimation phase by providing the exact spatial relationships directly. In COLMAP, a known-pose configuration file utilizes the precise mathematical layout shown below:</p><p>Example:</p><pre>[<br>  {<br>    &quot;cameras&quot;: [<br>      {<br>        &quot;image_prefix&quot;: &quot;rig1/camera1/&quot;,<br>        &quot;ref_sensor&quot;: true<br>      },<br>      {<br>        &quot;image_prefix&quot;: &quot;rig1/camera2/&quot;,<br>        &quot;cam_from_rig_rotation&quot;: [<br>            0.7071067811865475,<br>            0.0,<br>            0.7071067811865476,<br>            0.0<br>        ],<br>        &quot;cam_from_rig_translation&quot;: [<br>            0,<br>            0,<br>            0<br>        ]<br>      }<br>    ]<br>  }<br>]</pre><ul><li>cam_from_rig_rotation: Expects a 4-element array defining a unit quaternion formatted strictly as [qw, qx, qy, qz].</li><li>cam_from_rig_translation: Expects a 3-element vector [tx, ty, tz]</li></ul><blockquote><strong>NOTE: </strong>The translation vector t represents the origin (center) of the rig coordinate frame expressed in the camera’s coordinate frame. Because COLMAP uses a passive “world-to-camera” (or in this case, “rig-to-camera”) transformation convention, the vector <em>t</em> points from the camera sensor to the rig origin, measured along the camera’s internal coordinate axes.</blockquote><h3>5. Inferring the rig from the no-rig reconstruction</h3><p>Now I ran:</p><pre>$ mkdir -p sparse_inferred_rig<br>$ colmap rig_configurator \<br>    --database_path database_no_rig.db \<br>    --input_path sparse_no_rig/0 \<br>    --rig_config_path rig_config_unknown.json \<br>    --output_path sparse_inferred_rig</pre><p>From the no-rig reconstruction, COLMAP already has independent poses for many images at timestamp t:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bd-pyGex_eW53rwibI_xIw.png" /></figure><p>For each timestamp <strong><em>t</em></strong>, it can estimate relative transforms between cameras. For example, if camera 4 is chosen as the reference sensor (the rig origin), the relative transform to camera 5 at time <strong><em>t</em></strong> is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iS1r-nG1TgoyGloakDbwCg.png" /></figure><p>Because the cameras are rigidly attached, this relative transform should be approximately the same across frames.</p><p>By calculating this across all available timestamps, COLMAP can <strong>average </strong>and infer the static sensor configurations relative to the rig base. <em>(Note: If camera 4 is the reference, then Tworld-&gt;cam4 is simply the identity matrix I).</em></p><p>This produced: sparse_inferred_rig/ — your very first rig-aware model.</p><h3>6. Convert the inferred rig model to text</h3><p>To inspect what COLMAP produced, I converted the model to text:</p><pre>$ mkdir -p sparse_inferred_rig_txt<br>$ colmap model_converter \<br>    --input_path sparse_inferred_rig \<br>    --output_path sparse_inferred_rig_txt \<br>    --output_type TXT</pre><h3>7. Inspecting rigs.txt</h3><pre>$ cd sparse_inferred_rig_txt &amp;&amp; cat rigs.txt</pre><p>The output was:</p><pre># Rig calib list with one line of data per calib:<br>#   RIG_ID, NUM_SENSORS, REF_SENSOR_TYPE, REF_SENSOR_ID, SENSORS[] as (SENSOR_TYPE, SENSOR_ID, HAS_POSE, [QW, QX, QY, QZ, TX, TY, TZ])<br># Number of rigs: 1<br>5 4 CAMERA 1 CAMERA 2 1 0.99998123663127991 -0.00098065457948955798 0.0057296984204197382 0.0019326815523717854 -0.2850523688677073 0.14458305557808537 0.053821346432722135 CAMERA 3 1 0.99962714521434048 -0.02337040373316826 -0.013289933823573028 -0.0047720476674999795 -0.091748405935830363 0.044933971091494378 0.090088073108902073 CAMERA 4 1 0.99960587788845023 -0.015486746807735626 -0.02340004858121203 -0.00082902989701457645 -0.26318586917758019 -0.0099468495980400105 0.55931028732108579</pre><p>The important beginning is:</p><pre>5 4 CAMERA 1</pre><p>This means:</p><pre>RIG_ID = 5<br>NUM_SENSORS = 4<br>REFERENCE_SENSOR = CAMERA 1</pre><p>So COLMAP has created one rig:</p><pre>Rig 5<br>CAMERA 1: reference sensor<br>CAMERA 2: estimated fixed pose relative to rig<br>CAMERA 3: estimated fixed pose relative to rig<br>CAMERA 4: estimated fixed pose relative to rig</pre><p>Each sensor pose is represented by: QW QX QY QZ TX TY TZ</p><h3>8. Inspecting frames.txt</h3><p>Then I inspected: head -30 frames.txt</p><pre># Frame list with one line of data per frame:<br>#   FRAME_ID, RIG_ID, RIG_FROM_WORLD[QW, QX, QY, QZ, TX, TY, TZ], NUM_DATA_IDS, DATA_IDS[] as (SENSOR_TYPE, SENSOR_ID, DATA_ID)<br># Number of frames: 165<br>661 5 0.99895221673873424 -0.011798653933931053 -0.0050389743014514028 -0.04393027630354393 -5.1748469285411636 -0.19796698159591189 0.11293139847855183 4 CAMERA 1 1 CAMERA 2 166 CAMERA 3 331 CAMERA 4 496<br>662 5 0.9990715053390965 -0.01429855963775855 -0.0042871911794993851 -0.040414086696940944 -5.1146668902207626 -0.22966193657762393 0.13529958268892595 4 CAMERA 1 2 CAMERA 2 167 CAMERA 3 332 CAMERA 4 497<br>663 5 0.99898311893574665 -0.016404244941156807 -0.0057023490831047182 -0.041606634618204644 -5.0623932166083598 -0.21883785144499784 0.13108716427638623 4 CAMERA 1 3 CAMERA 2 168 CAMERA 3 333 CAMERA 4 498</pre><p>The first data line is:</p><pre>661 5 ... 4 CAMERA 1 1 CAMERA 2 166 CAMERA 3 331 CAMERA 4 496</pre><p>This means:</p><pre>FRAME_ID = 661<br>RIG_ID = 5<br>NUM_DATA_IDS = 4<br><br>CAMERA 1 -&gt; IMAGE_ID 1<br>CAMERA 2 -&gt; IMAGE_ID 166<br>CAMERA 3 -&gt; IMAGE_ID 331<br>CAMERA 4 -&gt; IMAGE_ID 496</pre><p>A frame is not just an image. A frame is one physical capture instance of the rig:</p><pre>Frame 661<br>├── one pose of the full rig in the world<br>├── image from CAMERA 1<br>├── image from CAMERA 2<br>├── image from CAMERA 3<br>└── image from CAMERA 4</pre><p>The output also says: # Number of frames: 165</p><p>So the final structure is:</p><pre>165 rig frames<br>4 camera observations per frame<br>660 total images</pre><p>Before rig modeling, COLMAP had 660 image poses. After rig modeling, the reconstruction is organized as:</p><p>165 rig poses + fixed sensor poses inside the rig</p><h3>9. Rig-aware bundle adjustment</h3><p>After COLMAP inferred the rig structure, I ran bundle adjustment on the rig-aware model:</p><pre>$ cd ~/colmap/experiments/terrains<br>$ mkdir -p sparse_inferred_rig_ba<br>$ colmap bundle_adjuster \<br>    --input_path sparse_inferred_rig \<br>    --output_path sparse_inferred_rig_ba</pre><p>The output was:</p><pre>I0525 16:53:50.659735 94592 bundle_adjustment.cc:70] === Global bundle adjustment ===<br>I0525 16:54:16.131942 94592 bundle_adjustment_ceres.cc:1137] Bundle adjustment report<br>    Residuals : 1982170<br>   Parameters : 240097<br>   Iterations : 47<br>         Time : 24.6994 [s]<br> Initial cost : 2.98097 [px]<br>   Final cost : 0.434825 [px]<br>  Termination : CONVERGENCE</pre><pre>I0525 16:54:16.201613 94592 timer.cc:90] Elapsed time: 0.426 [minutes]</pre><p>This was a good result. The reprojection error dropped from: Initial cost: 2.98097 px to Final cost: 0.434825 px</p><p>One thing I noticed in the COLMAP GUI was that the camera positions looked almost the same as the original no-rig reconstruction.</p><blockquote>Hope you found this article useful. In next part, I will discuss how I found extrinsic poses between cameras in my rig.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=370d39c2b26f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Screen tearing while visualizing machine-vision camera feed (Ubuntu + NVIDIA)]]></title>
            <link>https://medium.com/@r.siddhesh96/screen-tearing-while-visualizing-machine-vision-camera-feed-ubuntu-nvidia-6fef6d36bfe0?source=rss-497d95153c7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fef6d36bfe0</guid>
            <category><![CDATA[display]]></category>
            <category><![CDATA[machine-vision]]></category>
            <category><![CDATA[cameras]]></category>
            <category><![CDATA[nvidia]]></category>
            <dc:creator><![CDATA[Siddhesh Rane]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 21:42:36 GMT</pubDate>
            <atom:updated>2026-01-23T21:42:36.018Z</atom:updated>
            <content:encoded><![CDATA[<p>I was testing a high-res machine vision camera (large frames, high bandwidth). Static image looked fine. But the moment I moved the camera or moved anything in front of the camera, I saw a <strong>horizontal line</strong> across the image.</p><p>Top half and bottom half looked like they belonged to two different frames. Line was roughtly always at the same place. I kept wondering “is this sensor row issue? or bad USB bandwidth ? or is it camera sync issue?“</p><p>Turned out it was classic <a href="https://www.peacetech.net/2024/01/27/what-is-screen-tearing-find-out-how-to-fix-it-and-improve-your-display/"><strong>screen tearing</strong></a>. This had <strong>nothing to do with camera FPS or image format</strong>. It was purely <strong>GPU — display synchronization</strong>.</p><p>My setup:</p><ul><li>Ubuntu 22.04</li><li>X11 session (not Wayland)</li><li>NVIDIA 4090X GPU</li><li>Displaying frames via OpenCV</li></ul><h4>Why this happens?</h4><ul><li>GPU renders frames as fast as it can</li><li>Monitor refreshes at fixed rate (usually 60 Hz)</li><li>With X11, <strong>VSync is not always enforced</strong></li><li>GPU updates framebuffer while monitor is mid-draw</li><li>Result = one frame split into two time slices → horizontal tear</li></ul><p>This becomes <em>very obvious</em> with:</p><ul><li>high-resolution images</li><li>fast motion (of camera or in the scene)</li></ul><p>Quick sanity checks I did:</p><pre>echo $XDG_SESSION_TYPE<br>// output x11</pre><p>Tried reducing camera FPS…tearing still there<br>Tried smaller resolution…tearing still there</p><p>So clearly <strong>not camera-side</strong>.</p><h4>The actual fix</h4><p>NVIDIA driver has a hidden switch that basically says: <em>“Finish composing the full frame before sending it to the monitor.”</em></p><p>Steps:</p><ul><li>Open NVIDIA X Server Settings from your app menu.</li><li>Go to X Server Display Configuration.</li><li>Click Advanced… at the bottom right.</li><li>Check the box for Force Full Composition Pipeline.</li><li>Click Apply.</li></ul><h3>Result</h3><p>Went back to the camera stream. Moved camera aggressively.</p><p>No tear line, smooth motion and image looked exactly how it should!</p><h4>Important: make it persistent</h4><p>By default this <strong>resets after reboot</strong>.</p><p>In NVIDIA settings:</p><ul><li>Click <strong>Save to X Configuration File</strong></li><li>Needs root permissions</li></ul><p>If you skip this, tearing will come back and you’ll forget why it was fixed last time.</p><h4>Takeaway</h4><p>When you see a horizontal line during live visualization:</p><ul><li>don’t immediately blame the camera</li><li>don’t start rewriting capture code</li><li>don’t assume bandwidth issues</li></ul><p>If you’re on <strong>Ubuntu + X11 + NVIDIA</strong>,<br> check the <strong>composition pipeline</strong> first.</p><p>This one checkbox saved me a lot of pointless debugging.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fef6d36bfe0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Today I Broke My Bootloader (HTTPs boot to rescue)]]></title>
            <link>https://medium.com/@r.siddhesh96/today-i-broke-my-bootloader-https-boot-to-rescue-3563ac9ce3ce?source=rss-497d95153c7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3563ac9ce3ce</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[operating-systems]]></category>
            <dc:creator><![CDATA[Siddhesh Rane]]></dc:creator>
            <pubDate>Wed, 21 Jan 2026 23:42:08 GMT</pubDate>
            <atom:updated>2026-01-21T23:42:08.197Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rGiB3PpUzBXWT4ry-yoD3Q.png" /></figure><p>Device: Dell G16<br>OS: Windows + previously installed Ubuntu (corrupt)</p><h4>Morning: curiosity</h4><p>Windows was working perfectly. Ubuntu had been flaky for a while, but I hadn’t touched it in months. Suddenly I remembered that I had dual booted Ubuntu on my laptop. Out of habit, I pressed <strong>F12 during restart</strong> and tried booting Ubuntu. Ubuntu didn’t boot. Fine….. But when I went back to reboot into Windows <strong>Windows Boot Manager was gone!</strong></p><p>Not hidden. Not failing. <strong>Gone!!</strong></p><p>At this point I thought I nuked the OS (noob assumption). But after reading online, I came to know that the OS is still there; the firmware has simply lost the pointer to the .efi executable or the priority has been hijacked by a corrupted <strong>GRUB (Grand Unified Bootloader)</strong> instance.</p><h4>The “grub&gt;” Window</h4><p>After few reboot attempts I kept landing on this terminal:</p><pre>Minimal BASH-like line editing is supported.<br>grub&gt;</pre><p>Turns out, when the firmware can’t find a valid Windows entry, it falls back to the next available bootloader. In this case, a broken Ubuntu GRUB. Seeing grub&gt; (the minimal BASH-like interface) is the sign that the bootloader is alive, but its configuration file (grub.cfg) is missing or pointing to the wrong UUID.</p><p>From the grub&gt; prompt, I started probing partitions:</p><pre>ls<br>ls (hd0,gpt1)/<br>ls (hd0,gpt3)/</pre><p>Key observations:</p><ul><li>gpt3 contained Windows/ Program Files/ Recovery/ . Whih means windows filesystem were intact.</li><li>gpt1 contained efi/ and ls(hd0,gpt1)/efi printed Microsoft/ Ubuntu/ Delll/ .The presence of the /Microsoft/ directory confirmed that the <strong>EFI System Partition (ESP)</strong> was intact. This was a <strong>boot routing issue</strong>, not a data loss event.</li></ul><h4>Attempted manual chainload (partially correct, fragile)</h4><p>I tried booting Windows manually from GRUB:</p><pre>set root=(hd0,gpt1)<br>chainloader /efi/Microsoft/Boot/bootmgfw.efi<br>boot</pre><p>The result: <strong>System Hang.</strong> On Dell G-series laptops, a failed handoff between a third-party bootloader and the Windows Boot Manager can trigger an <a href="https://thegeekpage.com/acpi-bios-error/"><strong>ACPI state hang</strong></a>. It appeared bricked — no logo, no backlight.</p><p><strong>The Fix:</strong> A full “flea power” drain (holding the power button for 30 seconds) reset the <strong>Embedded Controller (EC)</strong>, allowing the firmware to initialize again.</p><h3>The Rescue: UEFI HTTPs Boot</h3><p>Modern Dell firmware includes a powerful (and underutilized) feature: <a href="https://www.dell.com/support/manuals/en-uk/bios-connect/https_ug/introduction-to-https-boot?guid=guid-dbc85161-a46f-4c9f-97bd-2134b37c0dce&amp;msockid=1276c298736e61ae2941d4ff72c960c4"><strong>UEFI HTTPs Boot</strong>.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/1*kI5AkiuOvyxHBxgk2uGbig.png" /></figure><p>When the local EFI variables are a mess, this feature allows the firmware to initialize the network stack, connect to Wi-Fi, and pull a clean recovery image directly from Dell/Microsoft servers. Unlike a traditional “Local Recovery,” this doesn’t rely on the potentially corrupted hidden partitions on your NVMe drive.</p><ol><li><strong>Triggered:</strong> Dell SupportAssist OS Recovery via Network.</li><li><strong>Action:</strong> It automatically scanned the ESP, identified the missing BCD (Boot Configuration Data) entries, and re-registered bootmgfw.efi in the NVRAM.</li><li><strong>Result:</strong> The Windows Boot Manager was restored as the primary boot target.</li></ol><h3>After Windows booted (cleanup)</h3><ul><li>Set <strong>Windows Boot Manager</strong> as first boot option in BIOS</li><li>Left Ubuntu untouched for now</li><li>Will either:</li><li>reinstall Ubuntu cleanly later, or</li><li>remove its EFI entry deliberately</li></ul><p>No rushed fixes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3563ac9ce3ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Batch Converting .sog Splat files to .ply on Windows]]></title>
            <link>https://medium.com/@r.siddhesh96/batch-converting-sog-splat-files-to-ply-on-windows-a23c0b66f647?source=rss-497d95153c7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a23c0b66f647</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[gaussian-splatting]]></category>
            <category><![CDATA[3d-computer-vision]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Siddhesh Rane]]></dc:creator>
            <pubDate>Fri, 16 Jan 2026 14:20:08 GMT</pubDate>
            <atom:updated>2026-01-16T14:20:08.176Z</atom:updated>
            <content:encoded><![CDATA[<h3>Batch Converting .sog Splat files to .ply on Windows</h3><p>Today I was working with <strong>gsplat</strong> and ran into a bit of a hurdle: I had a folder full of .sog files that I needed to get into a standard .ply format for my pipeline.</p><p>If you haven’t heard of it, .sog is a compressed format often used in specific 3D Gaussian Splatting viewers. While it&#39;s great for saving space, most tools still expect the classic PLY.</p><p>I found a fantastic tool called <strong>gsbox</strong> by <a href="https://github.com/gotoeasy/gsbox">gotoeasy</a> that handles this perfectly. Here is how I set it up and automated the conversion for a whole directory.</p><p><strong>gsbox</strong> is a Swiss Army knife for splat formats. It can convert between .ply, .splat, .spx, .spz, and .sog. It even handles LOD (Level of Detail) cutting and joining.</p><h3>Setup</h3><ol><li>Download the latest release (I used v4.6.0 for Windows).</li><li>Unzip the folder.</li><li>Open PowerShell in that directory.</li></ol><h3>The Command</h3><p>The syntax for a single file is straightforward:</p><pre>.\gsbox.exe g2p -i input.sog -o output.ply</pre><p>I didn’t want to convert 10+ files manually, so I used a simple PowerShell loop. This script looks into my downloads folder, finds every .sog file, and runs the conversion while keeping the original filename.</p><pre>Get-ChildItem &quot;C:\Users\YourName\Downloads\sog_files\*.sog&quot; | ForEach-Object {<br>    .\gsbox.exe g2p -i $_.FullName -o ($_.FullName -replace &#39;\.sog$&#39;, &#39;.ply&#39;)<br>}</pre><p>The tool is surprisingly fast. For files with ~2.7 million splats, it was taking roughly <strong>2.8 to 5 seconds</strong> per file on my machine. It also automatically handles the <strong>SH Degree</strong> (Spherical Harmonics), defaulting to 3, which keeps the visual quality high during the transition.</p><p>If you are working with other formats, here are the shorthand commands in gsbox:</p><ul><li><strong>p2s</strong>: PLY to Splat</li><li><strong>s2z</strong>: Splat to SPZ (Compressed)</li><li><strong>k2p</strong>: K-Splat to PLY</li><li><strong>info</strong>: Get metadata about any splat file</li></ul><p>If you’re doing heavy lifting with Gaussian Splats, definitely add gsbox to your toolkit!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a23c0b66f647" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SuperPoint — Self-Supervised Interest Point Detection and Description]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://pub.aimind.so/superpoint-self-supervised-interest-point-detection-and-description-137e6f6df941?source=rss-497d95153c7a------2"><img src="https://cdn-images-1.medium.com/max/1395/1*lRwTPcdHOkgY01Q2FKxIZw.png" width="1395"></a></p><p class="medium-feed-snippet">I&#x2019;m on a quest to understand how deep learning is applied to classic computer vision problems like interest point detection, description&#x2026;</p><p class="medium-feed-link"><a href="https://pub.aimind.so/superpoint-self-supervised-interest-point-detection-and-description-137e6f6df941?source=rss-497d95153c7a------2">Continue reading on AI Mind »</a></p></div>]]></description>
            <link>https://pub.aimind.so/superpoint-self-supervised-interest-point-detection-and-description-137e6f6df941?source=rss-497d95153c7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/137e6f6df941</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[slam]]></category>
            <dc:creator><![CDATA[Siddhesh Rane]]></dc:creator>
            <pubDate>Thu, 15 May 2025 17:52:07 GMT</pubDate>
            <atom:updated>2025-05-19T18:09:35.947Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding OpenCV’s  recoverPose() — What Frame Is the Output In?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@r.siddhesh96/understanding-opencvs-recoverpose-what-frame-is-the-output-in-0816ed4cae24?source=rss-497d95153c7a------2"><img src="https://cdn-images-1.medium.com/max/792/1*B-PEznppqab9C4p2WfZCFw.png" width="792"></a></p><p class="medium-feed-snippet">If you have ever tried implementing Visual Odometry using OpenCV, you&#x2019;ve probably come across cv::recoverPose() function. It takes&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@r.siddhesh96/understanding-opencvs-recoverpose-what-frame-is-the-output-in-0816ed4cae24?source=rss-497d95153c7a------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@r.siddhesh96/understanding-opencvs-recoverpose-what-frame-is-the-output-in-0816ed4cae24?source=rss-497d95153c7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/0816ed4cae24</guid>
            <category><![CDATA[visual-odometry]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[3d-computer-vision]]></category>
            <category><![CDATA[opencv]]></category>
            <dc:creator><![CDATA[Siddhesh Rane]]></dc:creator>
            <pubDate>Fri, 02 May 2025 11:12:44 GMT</pubDate>
            <atom:updated>2025-05-04T20:33:06.795Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding DSAC — Making RANSAC Work Inside Deep Neural Networks]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://pub.aimind.so/understanding-dsac-making-ransac-work-inside-deep-neural-networks-4103d90fe4f3?source=rss-497d95153c7a------2"><img src="https://cdn-images-1.medium.com/max/2040/1*mGA972lJZ5hxMsQcolIZhA.jpeg" width="2040"></a></p><p class="medium-feed-snippet">I recently stumbled upon a really cool paper: &#x201C;DSAC&#x200A;&#x2014;&#x200A;Differentiable RANSAC for Camera Localization&#x201D; ([1611.05705] DSAC&#x200A;&#x2014;&#x200A;Differentiable&#x2026;</p><p class="medium-feed-link"><a href="https://pub.aimind.so/understanding-dsac-making-ransac-work-inside-deep-neural-networks-4103d90fe4f3?source=rss-497d95153c7a------2">Continue reading on AI Mind »</a></p></div>]]></description>
            <link>https://pub.aimind.so/understanding-dsac-making-ransac-work-inside-deep-neural-networks-4103d90fe4f3?source=rss-497d95153c7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4103d90fe4f3</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[ar]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <dc:creator><![CDATA[Siddhesh Rane]]></dc:creator>
            <pubDate>Wed, 30 Apr 2025 15:29:50 GMT</pubDate>
            <atom:updated>2025-05-07T14:34:06.189Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Using My Old Laptop As a Webcam Robot — Playing with PYSLAM]]></title>
            <link>https://medium.com/@r.siddhesh96/using-my-old-laptop-as-a-webcam-robot-playing-with-pyslam-420f1ec1a452?source=rss-497d95153c7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/420f1ec1a452</guid>
            <dc:creator><![CDATA[Siddhesh Rane]]></dc:creator>
            <pubDate>Wed, 16 Apr 2025 19:59:42 GMT</pubDate>
            <atom:updated>2025-04-16T19:59:42.665Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using My Old Laptop As a Webcam Robot — Playing with PYSLAM</h3><p>I wanted to test out some off-the-shelf monocular SLAM solutions on my remote ROS2 camera stream. Let’ start with <a href="https://github.com/luigifreda/pyslam">pyslam</a>, a full-featured Python-based SLAM pipeline.</p><h4><strong>Installing pyslam</strong></h4><p><a href="https://github.com/luigifreda/pyslam/tree/master">GitHub - luigifreda/pyslam: pySLAM is a visual SLAM pipeline in Python for monocular, stereo and RGBD cameras. It supports many modern local and global features, different loop-closing methods, a volumetric reconstruction pipeline, and depth prediction models.</a></p><p>However, my system had Python 3.12 by default, while pyslam (and its C++ bindings) expect Python 3.10. Here&#39;s a full dump of everything I had to do to get it working.</p><pre># Clone the repo<br>git clone https://github.com/luigifreda/pyslam.git<br>cd pyslam<br><br># Install Python 3.10 from deadsnakes PPA<br>sudo add-apt-repository ppa:deadsnakes/ppa<br>sudo apt update<br>sudo apt install python3.10 python3.10-venv python3.10-dev<br><br># Run the master install script which sets up venv, installs dependencies,<br># builds C++ modules, and pulls thirdparty libraries.<br>./install_all_venv.sh</pre><p>Updated pyenv-venv-create.sh directly with</p><pre># Modify pyenv-venv-create.sh to skip pyenv and just use python3.10<br># Here&#39;s the version I used:<br># --------------------------<br>ENV_NAME=${1:-pyslam}<br>ENVS_PATH=&quot;$HOME/.python/venvs&quot;<br>ENV_PATH=&quot;$ENVS_PATH/$ENV_NAME&quot;<br><br>mkdir -p &quot;$ENVS_PATH&quot;<br>if [ ! -d &quot;$ENV_PATH&quot; ]; then<br>    python3.10 -m venv &quot;$ENV_PATH&quot;<br>fi<br>source &quot;$ENV_PATH/bin/activate&quot;<br>pip install --upgrade pip setuptools wheel<br># --------------------------<br># (This ensures all builds happen in Python 3.10, not 3.12)</pre><p>And finally ran ./install_all_venv.sh</p><p><strong>AND I GOT ERRORS……….</strong></p><ul><li>The script builds native C++ modules using pybind11, so <strong>it’s critical</strong> that your active Python environment matches the expected version (3.10).</li><li>If Python 3.12 is used, you’ll get cryptic CMake or pybind11-related errors during build.</li><li>I installed Boost dev libraries manually because gtsam (one of the thirdparty deps) failed to link due to missing boost::timer symbols</li></ul><p>sudo apt install libboost-timer-dev libboost-chrono-dev</p><ul><li>I ran into build errors inside gtsam caused by <strong>GCC 13</strong>, which is the default on Ubuntu 24.04. These errors were related to template inlining, Eigen, and Spectra.</li></ul><pre># Install older compilers (GCC and G++)<br>sudo apt install gcc-11 g++-11<br><br># When building a specific CMake project, pass these variables:<br># Tell CMake to use g++-11 and gcc-11 instead of system default<br>export CC=/usr/bin/gcc-11<br>export CXX=/usr/bin/g++-11</pre><ul><li>Installed gtsam_factors library from thirdparty/</li></ul><pre>$cd thirdparty/gtsam_factors<br>$mkdir build &amp;&amp; cd build<br>$cmake ..   -DCMAKE_PREFIX_PATH=../../gtsam/install   -DPYTHON_EXECUTABLE=$(which python)<br>$make -j$(nproc)<br>$make install</pre><h4>Building ros2_pybindings for ROS 2 Jazzy (and fixing it)</h4><ul><li>ros2_pybindings is located in /pyslam/thirdparty/ . Created build dir and ran usual cmake .. &gt; make … but ran into issues because of ros2bag libraries.</li><li><strong>Build Fails due to Missing Headers:</strong></li><li>storage_options.hpp was <strong>not found</strong> in rosbag2_cpp</li><li>Fixed by switching include from: #include &lt;rosbag2_cpp/storage_options.hpp&gt;to #include &lt;rosbag2_storage/storage_options.hpp&gt; in ros2_bag_sync_reader.hpp</li><li>Also changed rosbag2_cpp::StorageOptions → rosbag2_storage::StorageOptions in ros2_bag_sync_reader.cpp</li><li><strong>Could not open .mcap with sqlite3 -&gt; </strong>Solution: Set storage_id: &quot;mcap&quot; in ros2_bag_sync_reader.cpp</li><li>Finally created a softlink in pyslam main directory to make .so from our installation available to scripts</li></ul><pre>ln -s thirdparty/ros2_pybindings/lib/ros2_pybindings.cpython-310-x86_64-linux-gnu.so ros2_pybindings.so</pre><h3><strong>TEST DRIVE</strong></h3><p>Ok, pyslam has a main config.yaml file, and that’s where we have to add configuarions for our input. If we run ./main_vo.py or any main scripts, you will notice that they are loaded from this file.</p><p>Right now it has no support for live feed, so let’s collect some data (in both mp4 and ros2bag).</p><h4><strong>Recording an MP4</strong></h4><p>Easy peasy. I used opencv script with timestamp outputs for this.</p><h4><strong>Recording ROS2 Bag File</strong></h4><p>I ran our camera publisher from previous blog on my old laptop and then ran this:</p><pre>ros2 bag record /camera/image_raw /camera/image_raw/compressed /camera/rgb/camera_info -o cam_data_bag</pre><p><strong>Editing the </strong><strong>config.yaml for ROS2BAG</strong></p><p>Commented type:VIDEO_DATASET and uncommented type:ROS2BAG_DATASET Then I removed their code and added these lines for under the ROS2BAG_DATASET</p><pre>type: ros2bag<br>sensor_type: mono # Here, &#39;sensor_type&#39; can be &#39;mono&#39;, &#39;stereo&#39;, or &#39;rgbd&#39; depending on the ros1bag content  <br>  base_path: /home/siddhesh/Downloads/cam_processing/src/webcam_listener_cpp/data/cam_data_bag/    # path of the folder containing the bag<br>  name: cam_data_bag_0.mcap                                           # final folder name of the bag<br>  settings: settings/my_webcam.yaml                  # do not forget to correctly set the corresponding camera settings file<br>  ros_settings:<br>    sync_queue_size: 100                                # for syncing the messages with the ApproximateTimeSynchronizer<br>    sync_slop: 0.05                                     # in seconds: delay with which messages can be synchronized<br>    topics: <br>      color_image: &#39;/camera/image_raw&#39;       # left color image<br>    environment_type: indoor  # Here, &#39;environment_type&#39; can be &#39;indoor&#39; or &#39;outdoor&#39;  <br>  fps: 30   </pre><h4>Deserialization failure (Fast-CDR):</h4><pre>Fast CDR exception deserializing message of type sensor_msgs::msg::dds_::Image_Deserialization failure (Fast-CDR):</pre><p>This was because initially I was using topic (/camera/image_raw/compressed) but I can’t use it directly.. <strong>@TODO Need a workaround here</strong>.</p><h3>WIP</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=420f1ec1a452" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using My Old Laptop As a Webcam Robot — Calibration + Compression]]></title>
            <link>https://medium.com/@r.siddhesh96/using-my-old-laptop-as-a-webcam-robot-calibration-compression-87729dd25052?source=rss-497d95153c7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/87729dd25052</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[opencv]]></category>
            <dc:creator><![CDATA[Siddhesh Rane]]></dc:creator>
            <pubDate>Thu, 10 Apr 2025 17:52:49 GMT</pubDate>
            <atom:updated>2025-04-16T14:43:35.178Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using My Old Laptop As a Webcam Robot — Calibration + Compression</h3><p>I know, it sounds stupid. But I wanted to run a bunch of computer vision/ VSLAM codes and was thinking of getting a <em>Rasberry-Pi + Cam</em> module. But then I saw something eating dust in the corner of my bookshelf — my old laptop! So I thought, why not just use that as an Image server (I know it’s an insult to my poor laptop, but hey it’s still better than eating dust!!). So this article is just my documentation of things I did with it. It’s going to be “WORK IN PROGRESS” blog for eternity. But I will keep updating this. :)</p><p>Some of the steps/commands will sound too obvious or basic, but who knows? they could be useful to someone.</p><blockquote>BEFORE BUYING ANY NEW HARDWARE, I WANT TO SEE HOW FAR I CAN GO WITH THE EXISTING ONES.</blockquote><h4>It has Accelerometer!</h4><pre>~$ udevadm info --export-db | grep -i accelerometer<br>E: NAME=&quot;ST LIS3LV02DL Accelerometer&quot;<br>E: ID_INPUT_ACCELEROMETER=1<br>E: ID_INPUT_ACCELEROMETER=1<br>E: ID_INPUT_ACCELEROMETER=1</pre><p>I checked /dev/input/ and there were multiple events… like event3 is for keyboard buttons, event4 is for touchpad, etc.</p><p>Turned out /dev/input/event6 is my Accelerometer.</p><p>I installed evtest ….. sudo apt install evtest and ran sudo evtest /dev/input/event6 and it displays accelerometer readings!</p><p><strong>Keyboard is broken and Bluetooth is not working</strong></p><p>Ok, so turned out my old laptop’s keyboard is not working properly and I want to use my bluetooth keyboard. And duh, apparently bluetooth is not discoverable and pairable on it.</p><pre>$bluetootctl<br># this opens an interactive shell<br>$power on<br>$agent on<br>$default-agent<br>$discoverable on<br>$pairable on</pre><p>and to make it permanently discoverable and pairable, open sudo nano /etc/bluetooth/main.conf and uncomment/modify these lines:</p><pre>[General]<br>DiscoverableTimeout = 0<br>AlwaysPairable = true</pre><p>and restart bluetooth with sudo systemctl restart bluetooth</p><h4>Camera Specs On The Laptop</h4><p>Installed sudo apt install v4l-utils and ran $v4l2-ctl --all and got some interesting facts about the camera on board.</p><ul><li><em>Driver Name: ucvideo uvc stands for USB Video Class</em></li><li>Bus info: usb-0000:00:14.0-3 It&#39;s connected over USB, not internal <em>MIPI or CSI</em> (as in embedded boards). USB limits latency and throughput, especially for raw formats. Check this blog for more details on MIPI <a href="https://www.e-consystems.com/blog/camera/technology/what-is-a-mipi-camera-how-does-mipi-camera-work/">What is a MIPI Interface? How does MIPI Camera Work? — e-con Systems</a></li></ul><p><strong>So in future, it’s going to be interesting to see how USB interface affects the performance.</strong></p><pre>Capabilities     : 0x84a00001<br>        Video Capture<br>        Metadata Capture<br>        Streaming<br>        Extended Pix Format</pre><ul><li><strong>Video Capture</strong>: Raw frames</li><li><strong>Metadata</strong>: Might include timestamps, exposure info</li><li><strong>Streaming</strong>: Real-time read (needed for ROS publishing)</li><li><strong>Extended Pix Format</strong>: Can handle compressed formats (e.g., MJPEG)</li></ul><p>Running $v4l2-ctl --device=/dev/vide0 --list-formats-ext shows that I have two formats available:</p><p><strong><em>[0]: ‘YUYV’ (YUYV 4:2:2)</em></strong></p><ul><li>Min resolution 640x480 @ 30fps</li><li>Max resolution 1280x720 @ 10fps</li></ul><p><strong><em>[1]: ‘MJPG’ (Motion-JPEG, compressed)</em></strong></p><ul><li>Min resolution 640x480 @ 30fps</li><li>Max resolution 1280x720 @ 10fps</li></ul><p>Thoughts: Maybe I can use YUYV for calibration, but does it work well on USB2 ?</p><pre>$sudo lsusb -t<br>Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/11p, 480M<br>    |__ Port 003: Dev 002, If 0, Class=Video, Driver=uvcvideo, 480M<br>    |__ Port 003: Dev 002, If 1, Class=Video, Driver=uvcvideo, 480M<br>    |__ Port 007: Dev 003, If 0, Class=Wireless, Driver=btusb, 12M<br>    |__ Port 007: Dev 003, If 1, Class=Wireless, Driver=btusb, 12M<br>Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 5000M</pre><p><strong>camera is connected via USB 2.0</strong> (480M — 480Mega<strong>bits = </strong>60MegaBytes). For each YUYV image, per frame size is 1280 x 720 x 2 (because its 16bits per pixels) = 1.85 MB and at 30 fps, it’s 55.5MBps…That’s super close to limit of USB2.0.</p><p><strong>CAMERA CONTROL INFO</strong></p><pre>Camera Controls<br><br>                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=3 value=3 (Aperture Priority Mode)<br>                                1: Manual Mode<br>                                3: Aperture Priority Mode<br>         exposure_time_absolute 0x009a0902 (int)    : min=10 max=2046 step=1 default=255 value=312 flags=inactive<br>     exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=1</pre><ul><li><em>auto_exposure </em>is currently is Aperture Priority Mode (What does it mean?).</li><li><em>exposure_time_absolute </em>sets how long the camera sensor is exposed to light (unit?)…. more details on <a href="https://peterklemperer.com/blog/2018/02/10/manual-exposure-control-of-opencv-video/">Manual Exposure Control of OpenCV Video | Peter F. Klemperer</a></li></ul><pre>white_balance_automatic: value=1 (enabled)<br>white_balance_temperature: 4600K (inactive)</pre><p>Auto WB enabled = consistent colors are <strong>not guaranteed</strong></p><p><strong>XServer and X11 port forwarding.</strong></p><p>My client laptop is running windows, so for x11 I had to install XMing (<a href="https://www.youtube.com/watch?v=FlHVuA_98SA&amp;t=151s">How to Use X11 Forwarding on Windows or Linux</a>) and I launched simple opencv display code with PuTTY SSH and it was horribly slow. So I am skipping GUI apps with SSH for now.</p><h3>Camera Calibration</h3><pre>def fourcc_to_string(fourcc):<br>    return &quot;&quot;.join([chr((int(fourcc) &gt;&gt; 8 * i) &amp; 0xFF) for i in range(4)])<br><br>cap = cv2.VideoCapture(0)<br># Get current resolution<br>width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)<br>height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)<br>fps = cap.get(cv2.CAP_PROP_FPS)<br>fourcc = int(cap.get(cv2.CAP_PROP_FOURCC))<br>fourcc_str = fourcc_to_string(fourcc)</pre><p>Printing this information gave me- <em>Resolution=640 x 480, FPS=30, FOURCC=YUYU</em> (List of FOURCC formats <a href="https://learn.microsoft.com/en-us/windows/win32/medfound/video-fourccs">Video FOURCCs — Win32 apps | Microsoft Learn</a>)</p><p>It’s cool that using commands like v4l2-ctl -c gain=64 I can change camera parameters and see the output directly using webcam softwares like cheese . Also, all available information and control commands can be found using v4l2-ctl --all</p><p>I tried manual exposure by setting v4l2-ctl -c auto_exposure=1 and then playing around with exposure_time_absolute and gain but no luck, image just becomes worse. So I am just going to leave it on Aperture priority mode for now</p><p>SO I collected 20 images. I am not happy with the image quality because I used display of checkerboard on ipad. This might become source of error in future, but for now I am just going to use it and write a simple python code to extract the intrinsics.</p><p>It works fine. I am getting a very small reprojection error (~0.02). I am going to move on for now.</p><p><strong>Writing Webcam Publisher.</strong></p><p>I am using a simple python node that will publish images from camera and intrinsics.</p><p>I failed to resolve the cv2 dependency issue in my virtual environment, so I am just going to run this code with python3 src/webcam_publisher/webcam_publisher/webcam_node.py .</p><p>This is the code: <a href="https://github.com/siddheshrane96/Camera-Publisher/blob/master/src/webcam_publisher/webcam_publisher/webcam_node.py">https://github.com/siddheshrane96/Camera-Publisher/blob/master/src/webcam_publisher/webcam_publisher/webcam_node.py</a></p><p>webcam failure debug with ssh</p><pre>$ls /dev/video* # should give 2-3 available cams<br>$fuser /dev/video0 #get pid<br>$kill -9 &lt;PID&gt;<br><br>### or via python<br>python3 -c &quot;import cv2; cap = cv2.VideoCapture(0); print(cap.isOpened()); cap.release()&quot;</pre><p><strong>Writing Subscriber</strong></p><p>My new laptop gave me nightmare when I was trying to access Nvidia drivers with Ubuntu. I don’t want to waste more time, I am using windows wsl2. For now I have installed ros2 jazzy on it (base version).</p><p>But connecting wsl2 to listen to old laptop ros topics is nightmare. Initially I wasn’t able to ping at all from ubuntu to windows. So I followed these steps:</p><ol><li>Open Windows Defender Firewall &gt; Adanved settings</li><li>Click on Inbound rules &gt; New Rule …</li><li>Select Custom &gt; Next &gt; All Programs &gt; Next &gt; Protocal type: ICMPv4 &gt; Leave Scope as it is &gt; Next &gt; Allow the connection &gt; Next &gt; Make sure all are selected (Domain, Private, Public) &gt; Next &gt; give it the name and click Finish</li></ol><p>With this I am able to at least ping from ubuntu.<br>I had high hopes that WSL2 (Windows Subsystem for Linux) would make life easier, but man… it turned out to be a rabbit hole of networking madness. Even though ROS 2 was working locally inside WSL2, the moment I tried to connect it to my old laptop over LAN, dead silence. The issue? WSL2 is essentially a virtualized environment and <strong>does not share the same IP network interface as your Windows machine</strong>. It lives behind a virtual NAT, which makes it invisible to devices on your LAN unless you jump through hoops.</p><p>I tried (honestly I didn’t properly try this, so I might come back to this later)</p><ul><li>Port forwarding using netsh</li><li>UDP multicast relays written in Python</li><li>Setting ROS environment variables like ROS_STATIC_PEERS and ROS_AUTOMATIC_DISCOVERY_RANGE</li><li>Disabling firewalls</li></ul><p>But DDS (the discovery protocol behind ROS 2) just wouldn’t behave. Even though ping from WSL2 to the old laptop started working eventually, <strong>ROS topics wouldn’t show up</strong>.</p><p><strong>Using Native Ubuntu Installation</strong></p><p>It just worked. Literally within 2 minutes: Both laptops were on the same Wi-Fi. I set the same ROS_DOMAIN_ID=42 on both.</p><pre>Exported ROS_LOCALHOST_ONLY=0<br>RMW_IMPLEMENTATION=rmw_fastrtps_cpp.</pre><p>Sourced the ROS setup file on each. Ran the publisher on the old laptop, and boom — ros2 topic list on the new laptop showed everything.</p><p>This is code for subscriber: <a href="https://github.com/siddheshrane96/webcam_processor/blob/master/src/webcam_listener/webcam_listener/webcam_listener.py">https://github.com/siddheshrane96/webcam_processor/blob/master/src/webcam_listener/webcam_listener/webcam_listener.py</a></p><p>This basic setup works.</p><h4>But source laptop is publishing images at 30fps, but on my subscriber laptop I receive them at 6fps only.</h4><p>On top of that I keep seeing this message after some time of running my code.<br><em>[RTPS_TRANSPORT_SHM Error] Failed init_port fastrtps_port7000: open_and_lock_file failed -&gt; Function open_port_internal<br>WARNING: topic [/camera/image_raw] does not appear to be published yet</em></p><h3>Image Size, Frame Rate, and Bandwidth Calculations</h3><p>Once the webcam publisher was working, I wanted to figure out <strong>why the subscriber was receiving frames at only ~6 Hz</strong>, even though I was publishing at 30 Hz. I suspected either a <strong>network bottleneck</strong> or <strong>system resource issue</strong> — so it was time to do some back-of-the-envelope math and test the actual connection.</p><h3>How Big is Each Frame?</h3><p>I’m using 640x480 resolution at 30 FPS. Since I’m sending raw RGB images (3 bytes per pixel),</p><ul><li>Each frame is: 640 x 480 x 3 = 921,600 bytes <strong><em>≈ 0.88 MB ≈ ~0.9 MB per frame.</em></strong></li><li>At 30 FPS: <strong><em>0.9 MB x 30 = 27 MB/s ≈ 216 Mbps</em></strong></li></ul><p>That’s the <strong>uncompressed bandwidth requirement</strong> of my image stream.</p><p>To check how much my network could actually handle, I ran an iperf3 test.</p><p><strong><em>On the publisher (old laptop): </em></strong><strong><em>iperf3 -s</em></strong></p><p><strong><em>On the subscriber (new laptop): </em></strong><strong><em>iperf3 -c &lt;IP of old laptop&gt;</em></strong></p><p>and I got</p><pre> ID] Interval           Transfer     Bitrate<br>[  5]   0.00-1.00   sec  4.38 MBytes  36.7 Mbits/sec                  <br>[  5]   1.00-2.00   sec  4.88 MBytes  40.9 Mbits/sec                  <br>[  5]   2.00-3.00   sec  5.25 MBytes  44.0 Mbits/sec                  <br>[  5]   3.00-4.00   sec  4.25 MBytes  35.7 Mbits/se</pre><p>And it makes sense why I see 6hz on receiver laptop: <strong><em>43 Mbps / 216 Mbps ≈ 0.2 → 30 FPS × 0.2 ≈ 6 FPS</em></strong></p><p>(And I know it was obvious that this won’t work in uncompressed format. But this was to demonstrate the need of compression.)</p><h3><strong>Image Compression</strong></h3><p>First I have to switch to Opencv in C++ now. Python days are over. I am planning to use</p><h4>ROS2 Package Setup (webcam_publisher_cpp)</h4><p>Created a new ROS2 package using ament_cmake.</p><ul><li><strong>Dependencies</strong>: <em>rclcpp, sensor_msgs, image_transport, cv_bridge, OpenCV</em>.</li><li>Used ament_target_dependencies() to avoid manually setting include paths or linking. Removed include_directories() for dependencies already handled by ament. If adding your own headers later: use install(DIRECTORY include/ ...) and target_include_directories()</li><li>Initially I was calling When calling image_transport::ImageTransport(shared_from_this()) inside the constructor, offcourse that’s crashed with a std::bad_weak_ptr (Because I was trying to pass shared_ptr before the object was even fully constructed and managed by shared_ptr..How idiot of me!)</li><li>Fix1: Either use delayed initialization (do this after construction in a separate init() method.</li><li>Fix2( better): Used the image_transport::create_publisher(this, topic, qos) API which avoids shared_from_this() altogether.</li><li>Used rclcpp::SensorDataQoS() to improve latency and drop tolerance.</li><li>To pass this QoS to image_transport, converted using:qos.get_rmw_qos_profile() This fixed compatibility since image_transport expects rmw_qos_profile_t.</li><li>Similarly wrote webcam_listener code.</li></ul><p><strong><em>Webcam publisher code with </em></strong><strong><em>image_transport </em></strong><a href="https://github.com/siddheshrane96/Camera-Publisher/blob/master/src/webcam_publisher_cpp/src/webcam_publisher.cpp">https://github.com/siddheshrane96/Camera-Publisher/blob/master/src/webcam_publisher_cpp/src/webcam_publisher.cpp</a></p><p><strong><em>Webcam subscriber code with </em></strong><strong><em>image_transport </em></strong><a href="https://github.com/siddheshrane96/webcam_processor/blob/master/src/webcam_listener_cpp/src/webcam_listener.cpp">https://github.com/siddheshrane96/webcam_processor/blob/master/src/webcam_listener_cpp/src/webcam_listener.cpp</a></p><h3>Compression + Quality Evaluation (PSNR + SSIM)</h3><p>Once the compressed transport was up and running, I wanted to quantify how much quality loss I’m getting due to JPEG compression. I wrote a image_quality_evaluator.cpp node that subscribes to both raw and compressed streams on /camera/image_raw.</p><p><strong><em>Evaluation code: </em></strong><a href="https://github.com/siddheshrane96/webcam_processor/blob/master/src/webcam_listener_cpp/src/image_qual_evaluation.cpp">https://github.com/siddheshrane96/webcam_processor/blob/master/src/webcam_listener_cpp/src/image_qual_evaluation.cpp</a></p><p><strong>What It Does:</strong></p><ul><li>Subscribes to/camera/image_raw with raw transport and /camera/image_raw with compressed transport.</li><li>Matches raw and compressed frames based on timestamp</li><li>Calculates: <strong>PSNR</strong> (Peak Signal-to-Noise Ratio) and<strong> SSIM</strong> (Structural Similarity Index)</li><li>I am getting:</li></ul><pre>[INFO] PSNR 40.627 dB<br>[INFO] SSIM: B=0.9414, G=0.9802, R=0.9645</pre><p>Compression is working great — visually lossless. JPEG (image_transport/compressed) is good enough for my vision tasks.</p><h4>CameraInfo Publishing in ROS2 (C++)</h4><p>Once I had the basic webcam publisher working, I wanted to <strong>publish the camera calibration intrinsics</strong> alongside the image stream, as required by any SLAM or stereo system. Here’s how I integrated that:</p><ol><li><em>I had previously calibrated my camera using OpenCV in Python, which gave me </em><em>camera_matrix and </em><em>dist_coeff. ROS2 uses YAML files for intrinsics, so I used this script </em><a href="https://github.com/siddheshrane96/Camera-Publisher/blob/master/src/webcam_publisher/calibration/camera_calib_to_yaml.py"><em>https://github.com/siddheshrane96/Camera-Publisher/blob/master/src/webcam_publisher/calibration/camera_calib_to_yaml.py</em></a><em> to convert the </em><em>.npz file to the standard YAML format used by </em><em>camera_info_manager</em></li><li><em>Load YAML in C++ Using </em><em>camera_info_manager Instead of manually reading the YAML file in C++, I used the standard and recommended method in ROS2: the </em><em>camera_info_manager package. It automatically parses the file and gives you a </em><em>sensor_msgs::msg::CameraInfo message that you can publish.: </em><a href="https://github.com/siddheshrane96/Camera-Publisher/blob/master/src/webcam_publisher_cpp/src/webcam_publisher.cpp">https://github.com/siddheshrane96/Camera-Publisher/blob/master/src/webcam_publisher_cpp/src/webcam_publisher.cpp</a></li><li>For running this node, You <strong>must</strong> prefix the YAML path with file:///, or ROS2 will treat it as invalid. eg:</li></ol><pre>ros2 run webcam_publisher_cpp webcam_publisher \<br>  --ros-args -p camera_info_url:=&quot;file:///absolute/path/to/calibration.yaml&quot;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87729dd25052" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>