Skip to main content

Overview

The Photo module provides advanced computational photography algorithms:
  • Image inpainting
  • Denoising
  • HDR (High Dynamic Range) imaging
  • Seamless cloning
  • Non-photorealistic rendering

Image Inpainting

Overview

Inpainting restores missing or damaged regions in images using information from surrounding areas.

Basic Inpainting

Inpainting Methods

INPAINT_NS (Navier-Stokes):
  • Based on fluid dynamics
  • Better for textured regions
INPAINT_TELEA:
  • Fast Marching Method
  • Better for smooth regions

Image Denoising

Non-Local Means Denoising

Grayscale Images

Color Images

Video Denoising

Parameters

  • h: Filter strength (3-10 typical)
    • Higher = more denoising, more blur
    • Lower = less denoising, preserves detail
  • templateWindowSize: Usually 7
  • searchWindowSize: Usually 21
    • Larger = better quality, slower

HDR Imaging

Capture HDR from Multiple Exposures

Tone Mapping

Convert HDR to displayable LDR (8-bit):

Tone Mapping Algorithms

Reinhard

Mantiuk

Exposure Alignment

Seamless Cloning

Paste Object Seamlessly

Cloning Modes

NORMAL_CLONE:
  • Standard seamless cloning
  • Preserves source texture
MIXED_CLONE:
  • Mixes source and destination
  • Better for transparent objects
MONOCHROME_TRANSFER:
  • Transfer only colors
  • Preserves destination texture

Illumination Change

Non-Photorealistic Rendering

Edge Preserving Filter

Detail Enhancement

Pencil Sketch

Stylization

Complete Example: HDR Processing

Performance Tips

Reduce Resolution

Downscale for faster denoising/HDR

Adjust Parameters

Smaller search windows = faster processing

GPU Acceleration

Use cv::cuda for compatible functions

ROI Processing

Process only regions of interest

Best Practices

Denoising

  • Start with h=3, increase if needed
  • Use colored version for color images
  • Multi-frame for video (better quality)

HDR

  • Use 3-5 exposures with 1-2 EV spacing
  • Align images before merging
  • Experiment with tone mapping algorithms

Seamless Cloning

  • Create accurate masks
  • Position carefully for best results
  • Try different cloning modes

See Also