QRNet: A Quaternion-Based Retinex Framework for Enhanced Wireless Capsule Endoscopy Image Quality

Vladimir Frants, Sos С. AgaianBioengineering 2025 · DOI

TL;DR

This paper introduces QRNet, a novel deep learning framework that uses quaternion math and a Retinex-inspired approach to significantly improve the image quality of wireless capsule endoscopy (WCE). By preserving color fidelity and enhancing details in challenging low-light conditions, QRNet promises to improve the accuracy of diagnosing gastrointestinal abnormalities.

What Problem Does This Paper Address?

Wireless capsule endoscopy (WCE) is a revolutionary non-invasive tool for visualizing the gastrointestinal (GI) tract. However, WCE images often suffer from poor quality due to uneven illumination, non-Lambertian tissue reflections, and limited camera capabilities. These issues can lead to missed diagnoses, with rates as high as 1-20%. Traditional image enhancement methods, including Retinex-based techniques, often fail to preserve crucial color information and anatomical details, which are vital for accurate medical diagnosis. This paper aims to bridge this gap by developing an enhancement method specifically tailored for the unique challenges of WCE imaging.

Methods

The core of QRNet lies in its quaternion-based Retinex framework. Instead of processing RGB channels independently, QRNet encodes them into a purely imaginary quaternion. This allows it to preserve the critical inter-channel relationships essential for color constancy. The framework decomposes the input image into two components: a reflectance map (capturing stable color and texture) and an illumination map (representing lighting conditions).

Key methodological components include:

  • Quaternion Representation: Encoding RGB as a quaternion (0 + Ri + Gj + Bk) to maintain color fidelity.
  • Retinex Decomposition: Separating the image into reflectance and illumination components.
  • Wavelet Transform: Applying the Haar wavelet transform to both components to separate low-frequency illumination details from high-frequency structural features.
  • SSM Mamba-based Encoder-Decoder: Two specialized modules process the reflectance and illumination components separately. The reflectance denoiser focuses on noise removal and texture preservation, while the illumination corrector stabilizes lighting.
  • Quaternion Wavelet Attention (QWA) Module: This module uses wavelet-transformed sub-bands to guide an attention mechanism, allowing the network to selectively emphasize relevant features (e.g., edges in reflectance, brightness in illumination) and suppress noise.
  • Multi-term Loss Function: A combination of pixel-wise reconstruction loss, perceptual loss (using VGG16), frequency-domain loss (FFT), and structural similarity loss (SSIM) is used to ensure accurate reconstruction, perceptual similarity, and smooth transitions.

Datasets

The study utilizes two publicly available datasets for training and evaluation:

  • Kvasir-Capsule (KC) dataset: This dataset contains anatomical categories and luminal findings. For this study, 2000 images were used for training and 400 for testing. Synthetic low-light conditions were simulated through gamma corrections and brightness reductions. An additional external validation set of 100 naturally low-light images was also used.
  • Red Lesion Endoscopy (RLE) dataset: This dataset focuses on red lesion segmentation. 946 images were used for training and 337 for testing, with the same low-light augmentation applied. Segmentation masks were provided for evaluating lesion detection.

Key Insights and Ideas

  • Quaternion Math is Key for Color Fidelity: The paper strongly suggests that processing color information as quaternions, rather than independent RGB channels, is crucial for maintaining accurate color representation in medical imaging, especially under challenging lighting. This preserves the subtle color variations that are vital for diagnosis.
  • Decomposition is More Than Just Enhancement: By explicitly decomposing the image into reflectance and illumination, QRNet can apply specialized processing to each component, leading to more targeted and effective enhancement without compromising diagnostic information.
  • Wavelet Attention Bridges Frequency Domains: The integration of wavelet transforms with attention mechanisms allows the model to effectively leverage both high-frequency structural details and low-frequency illumination patterns, leading to a more comprehensive enhancement.
  • Clinical Relevance Extends Beyond Image Quality: The paper demonstrates that improved image quality directly translates to better performance in downstream tasks like lesion segmentation, highlighting the practical clinical impact of the proposed method.

Key Results

QRNet achieved state-of-the-art results on both datasets:

  • Kvasir-Capsule Dataset:
    • PSNR: 37.781 dB (highest)
    • SSIM: 0.976 (highest)
    • LPIPS: 0.022 (lowest)
    • Lesion segmentation accuracy: improved by up to 5% when using TransUNet.
  • Red Lesion Endoscopy (RLE) Dataset:
    • PSNR: 34.030 dB (highest)
    • SSIM: 0.936 (highest)
    • LPIPS: 0.055 (lowest)
  • Ablation Studies: Removing quaternion representation, wavelet decomposition, or the FFT loss term led to noticeable drops in performance, underscoring the importance of each component.

Qualitatively, QRNet produced visually superior results, preserving natural color balance and enhancing subtle details without introducing artifacts like oversaturation or color shifts, which were observed in competing methods.

Limitations and Future Work

  • Dataset Diversity: The experiments primarily relied on two datasets. The authors suggest future work could involve acquiring specialized data for more extreme real-world conditions (e.g., highly occluded views, very low-light scenarios) to further validate robustness.
  • Parameter Tuning: Certain hyperparameters might require tailored settings for specific clinical contexts. Research into adaptive parameter selection or automated hyperparameter search is suggested.
  • Boundary Handling: Like many enhancement methods, QRNet may have reduced effectiveness in regions with poorly defined or heavily obscured boundaries. Advanced multi-scale techniques or refined diffusion mechanisms could be explored.
  • Broader Modalities: The conceptual Retinex-inspired design could potentially be extended to other medical imaging modalities (e.g., colonoscopy, bronchoscopy) where color fidelity and detail preservation are critical.
  • Real-time Processing: Investigating real-time processing capabilities for live endoscopic procedures is a promising future direction.
  • Automated Quality Assessment: Developing automated quality assessment metrics for clinical deployment is also suggested.

Summary updated

Abstract

Wireless capsule endoscopy (WCE) offers a non-invasive diagnostic alternative for the gastrointestinal tract using a battery-powered capsule. Despite advantages, WCE encounters issues with video quality and diagnostic accuracy, often resulting in missing rates of 1-20%. These challenges stem from weak texture characteristics due to non-Lambertian tissue reflections, uneven illumination, and the necessity of color fidelity. Traditional Retinex-based methods used for image enhancement are suboptimal for endoscopy, as they frequently compromise anatomical detail while distorting color. To address these limitations, we introduce QRNet, a novel quaternion-based Retinex framework. QRNet performs image decomposition into reflectance and illumination components within hypercomplex space, maintaining inter-channel relationships that preserve color fidelity. A quaternion wavelet attention mechanism refines essential features while suppressing noise, balancing enhancement and fidelity through an innovative loss function. Experiments on Kvasir-Capsule and Red Lesion Endoscopy datasets demonstrate notable improvements in metrics such as PSNR (+2.3 dB), SSIM (+0.089), and LPIPS (-0.126). Moreover, lesion segmentation accuracy increases by up to 5%, indicating the framework's potential for improving early-stage lesion detection. Ablation studies highlight the quaternion representation's pivotal role in maintaining color consistency, confirming the promise of this advanced approach for clinical settings.
BibTeX
@inproceedings{frants2025qrnet,
  author = {Vladimir Frants and Sos С. Agaian},
  title = {{QRNet: A Quaternion-Based Retinex Framework for Enhanced Wireless Capsule Endoscopy Image Quality}},
  booktitle = {Bioengineering},
  year = {2025},
  doi = {10.3390/bioengineering12030239},
}
Figure