Endoscopes use extreme wide-angle lenses. Their raw video bends straight anatomy into curves and packs the gut wall into the edges of each frame. Standard video codecs ignore this geometry. They spend bits evenly across the pixel grid, even though a pixel near the frame edge stands for a very different piece of the scene than a pixel near the center. We propose a codec setting that corrects this. The camera's intrinsic calibration, meaning the lens model that maps each pixel to the direction of the incoming light ray, is turned into a per-block quantization map for an ordinary HEVC encoder. The output remains a standard bitstream that any clinic workstation can decode. What makes the idea testable, and not just plausible, is how we judge it. We do not score it on single-frame image quality. We score it on whether the compressed video still lets a system recognize the same mucosal site at a later visit, which is what long-term surveillance actually needs.
The motivation comes from a lesson in clinical research on short follow-up windows. Short-term surrogate measures can look excellent while the long-term outcome they were meant to predict does not move. Hu et al. meta-analyzed image-guided cardiac lead placement. Structural remodeling improved (risk ratio 1.33), but mortality showed no significant difference (risk ratio 0.69, p=0.24). Medical compression is usually declared "diagnostically safe" using comparable acute proxies: peak signal-to-noise ratio, structural similarity, or accuracy on a single frame. We ask whether those proxies predict cross-visit utility. We also ask whether calibration-guided bit allocation preserves that utility at a fixed bitrate.
Core Claim
In calibrated wide-angle endoscopic video, there are two claims. The first is that compression damage to cross-session relocalization is concentrated where the lens model stretches the image most. The second is that single-frame and same-session metrics rank codec settings differently from how cross-session relocalization ranks them.
The fix follows from those claims. It is a quantization map derived from the calibration. It equalizes compression error in the geometry where downstream analysis actually happens, not in raw pixel space. At matched bitrate, this map should beat uniform encoding, a hand-tuned radial heuristic, and rectify-then-compress on cross-visit relocalization. It should also stay decodable by unmodified HEVC decoders.
The mechanism is simple enough to write down. Downstream matchers compute features on rectified views, either a perspective view or local tangent-plane ("gnomonic") patches of the kind Billings used for pose estimation. A raw-pixel error then gets copied across every rectified pixel it is resampled into. The expected error in the analysis domain is therefore approximately:
$$ E = \sum_b w_b \, \sigma_b^2, \qquad w_b = \left|\det J_b\right|, $$
where $b$ indexes encoder blocks, $\sigma_b^2$ is the mean squared coding error in block $b$, and $J_b$ is the Jacobian of the calibrated map from raw pixels to the analysis domain, evaluated at the block center.
Coding error scales roughly with the square of the quantizer step, and in HEVC the step doubles every 6 quantization-parameter units. Equalizing $w_b \sigma_b^2$ across blocks therefore gives
$$ \Delta QP_b = -3 \log_2 \left( w_b / \bar{w} \right), $$
where $\Delta QP_b$ is the per-block offset from the rate-controlled base quantizer and $\bar{w}$ is the frame-mean weight. $w_b$ is clipped at a maximum field angle, because the perspective Jacobian diverges near 90°. The sign and size of the effect depend on which analysis domain is chosen. That choice is an experimental variable, not an assumption.
Research Program
The geometry comes from EndoMapper. It releases Kannala-Brandt fisheye calibrations for 10 colonoscopes and 8 gastroscopes, a photometric light-source model for vignetting, and, crucially, repeat procedures on the same patients spaced weeks apart. It also documents how hard cross-session recognition is even on uncompressed video. ORB-SLAM3 localizes only about 25% of frames and fragments into 133 sub-maps, and a ResNetV2-101 place recognizer reaches only 26.08% Top-1 accuracy. That dataset motivates the task and supplies the calibration. It contains no compression analysis, and filling that gap is what we do.
The closest prior work is Sakthi et al.. They showed that HEVC artifacts hurt peripheral zones of fisheye driving footage disproportionately. They found a roughly 10:1 "safe zone" for detection and cut inter-frame prediction error by 34.2% by restricting motion search to epipolar curves. Their study is on driving data, single-session, and evaluated by detection mAP. It measures the peripheral penalty but does not reallocate rate to counter it. We move to deformable medical anatomy, change the target to cross-visit re-identification, and turn their observation into an explicit calibration-derived allocation rule.
The work has three parts.
Measurement study. We encode EndoMapper sequences with x265 across a bitrate sweep. We then measure same-session metrics (PSNR, SSIM, frame-localization rate within one procedure) and cross-session metrics. The cross-session metrics are retrieval Top-1 and Recall@5 of the matching segment in the other visit, the inlier count of geometrically verified feature correspondences between visits, and the fraction of frames relocalized into the other visit's map. The key analysis is a rank correlation, over all codec configurations, between the acute metrics and the cross-session metrics. This tests the surrogate-decoupling hypothesis directly.
Allocation study. We compute weight maps for three analysis domains: the unit sphere, a single perspective plane, and local tangent-plane patches. We also compute a photometric variant that folds in EndoMapper's vignetting model, which lowers the priority of dark, noise-dominated corners. Each map is applied through x265's per-block quantization-offset interface under identical rate control.
Motion study. We test Sakthi-style epipolar-constrained motion search as an optional encoder-side arm. It is restricted so that it only chooses standard motion vectors and the bitstream stays compliant.
The synthetic colonoscopy simulator VR-Caps, which comes with ground truth, provides controlled checks. It lets us insert a synthetic lesion at a known field angle and know exactly where it sits.
Baselines
Naive reference points. The first is uncompressed video, which sets the ceiling on cross-session performance. For that ceiling, EndoMapper reports ORB-SLAM3 localizing about 25% of frames and ResNetV2-101 reaching 26.08% Top-1 EndoMapper. We will recompute this on our evaluation split with our stronger matching pipeline. The second reference point is standard x265 with uniform quantization at each target bitrate, which is what a clinic would deploy by default. The most relevant reported figure for how well uniform HEVC holds up comes from driving footage, not endoscopy. On WoodScape, HEVC-Intra at QP 30 reached 43.3x compression while YOLOv7 mAP fell only from 38.1 to 37.2 Sakthi et al.. We found no reported result on Lacuna for cross-session relocalization on compressed EndoMapper video, and producing that number is the first deliverable.
Rectify-then-compress. This baseline unwarps each frame to a perspective view using the Kannala-Brandt parameters, crops at a fixed field angle, and encodes with uniform x265. It is the strongest geometry-aware competitor that needs no new encoder logic.
Radial heuristic. This baseline raises or lowers quality with distance from the image center using a hand-tuned profile, with no calibration involved. It isolates whether the calibration is doing the work or whether any centre-to-edge shaping would do. Its profile gets the same tuning budget, a grid search on held-out procedures, that our only free parameter, the clipping angle, receives.
Learned region-of-interest coding. This baseline represents saliency-guided compression in the spirit of Xu et al., who used computer-aided segmentation of mammograms to code breast tissue losslessly at 6.412:1, and NEURAL, which prunes over 93% of chest X-ray pixels using report cross-attention. Here it is implemented as a polyp/mucosa segmentation map that drives the same quantization interface.
Ablations. The key ablation inverts the weight map, spending more bits where the Jacobian is small. If the inverted map helps as much as the proper one, the geometric argument is wrong.
Fairness and winning criterion. Every arm uses the same procedures, the same x265 preset, the same rate controller, and bitrates matched within 2%. All downstream matchers are frozen, so nothing is retrained per codec. We count the proposal as beating a baseline if it improves cross-session Recall@5 or verified inlier counts at equal bitrate, with the gain holding on patient-level bootstrap intervals. The alternative success mode is reaching the same cross-session performance at a meaningfully lower bitrate.
Why not just…?
Why not just rectify the video before compressing it? Perspective rectification of fisheye optics stretches the periphery toward infinity near 90° off-axis, so the periphery must be cropped. Baker et al. and Geyer et al. formalized this single-viewpoint projection geometry. In a tubular organ the wall appears mostly at the frame edge, so cropping discards the content EndoMapper's tracking relies on. Resampling before encoding also blurs fine vascular texture. These are arguments, not measurements, so rectify-then-compress is a full baseline at several crop angles. If it matches our method at equal bitrate, we will report it as the simpler answer.
Why not just use uniform HEVC at a safe bitrate? This is the most serious threat. Sakthi et al.'s 10:1 safe zone suggests modest compression may cost little. Endoscopic cross-session matching may also be so fragile already (26.08% Top-1 uncompressed) that compression adds little beyond that floor. The measurement study settles this. If cross-session metrics stay flat down to clinically relevant bitrates, the contribution becomes a documented safe operating range for longitudinal endoscopy archives, and the allocation work stops.
Why not just compress progressively or at lower resolution, as MIST does? MIST streams high-throughput JPEG 2000 sub-resolutions and cuts transmission by up to 96.10% without hurting segmentation or classification. It has no temporal prediction and no lens model, and its smallest sub-resolution drops mean SSIM to 0.83. We include per-frame HTJ2K at matched bitrate as an additional reference arm. We expect it to lose on bitrate because it cannot exploit redundancy between frames.
Why not just prune to what a saliency model finds important? Pruning of the kind done by NEURAL or by Shi et al., who preserved 98.25% ultrasound accuracy under 4:1 compression, bakes one model's current notion of salience into the archive. Tissue that model ignores today cannot be compared at the next visit. Our weight map depends only on optics, not on content, so it cannot discard a region because a classifier ignored it. The learned region-of-interest baseline tests whether content-aware allocation nonetheless relocalizes better.
Proposed Experiments
Decisive check 1: do acute metrics predict cross-visit utility? We compute the Spearman rank correlation, over all codec configurations and bitrates, between PSNR, SSIM, or same-session localization and the cross-session metrics. A low or unstable correlation would be the compression analogue of the result in Hu et al., and would argue that codec evaluation for surveillance must include cross-visit metrics.
Decisive check 2: rate–utility curves. We plot cross-session Recall@5 and verified inlier counts against bitrate for each arm. The claim holds if calibration-weighted allocation beats the uniform, radial-heuristic, and rectify-then-compress arms in the 5:1 to 40:1 range. It also requires that the inverted-weight ablation does not match it.
Decisive check 3: where the damage falls. We run a zonal analysis using concentric bands of field angle, adopting the elliptical-zone protocol of Sakthi et al. This tests whether cross-session inliers lost under uniform coding cluster in high-Jacobian regions, and whether our method recovers them there.
Decisive check 4: synthetic lesion recovery. In VR-Caps we plant small lesions at known field angles in two simulated visits. We then measure how often each codec preserves a correct cross-visit correspondence on the lesion, which separates geometric effects from the confounds of real clinical data.
Deployability check. Every bitstream must decode on stock FFmpeg with no GPU, and we will report the encoder-side overhead of computing the quantization map from the calibration file.
One limitation should be stated plainly. EndoMapper's revisits are weeks apart, not years apart. The experiments therefore test whether compression preserves the capability that long-term surveillance depends on. They do not test long-term clinical outcomes, and we will not claim they do.
References
- Comparative efficacy of image-guided techniques in cardiac resynchronization therapy: a meta-analysis
- SilhoNet-Fisheye: Adaptation of A ROI Based Object Pose Estimation Network to Monocular Fisheye Images
- EndoMapper dataset of complete calibrated endoscopy procedures
- Impact of Video Compression Artifacts on Fisheye Camera Visual Perception Tasks
- A New Diagnosis Loseless Compression Method for Digital Mammography Based on Multiple Arbitrary Shape ROIs Coding Framework
- NEURAL: Attention-Guided Pruning for Unified Multimodal Resource-Constrained Clinical Evaluation
- A Theory of Catadioptric Image Formation
- Catadioptric Camera Calibration
- Towards Resource-Efficient Streaming of Large-Scale Medical Image Datasets for Deep Learning
- Semantic-Attention Enhanced DSC-Transformer for Lymph Node Ultrasound Classification and Remote Diagnostics