How To: Denoise Low-Light Images#

Low-light or high-ISO plate images contain noise that confuses detectors. PhenoTypic offers several denoising approaches, each with different tradeoffs between speed and quality.

[1]:
from phenotypic.data import load_fungi_plate
from phenotypic.enhance import GaussianBlur, MedianFilter, VisuShrinkEnhancer
from phenotypic.correction import StableDenoise
[2]:
plate = load_fungi_plate()
plate.detect_mat.dash()

Data type cannot be displayed: application/vnd.plotly.v1+json

Option 1: GaussianBlur (fastest)#

Simple and fast. Blurs noise but also softens colony edges.

[3]:
result1 = GaussianBlur(sigma=2.0).apply(plate.copy())
result1.detect_mat.dash()

Data type cannot be displayed: application/vnd.plotly.v1+json

Option 2: MedianFilter (edge-preserving)#

Removes salt-and-pepper noise while keeping colony boundaries sharp.

[4]:
result2 = MedianFilter(width=5).apply(plate.copy())
result2.detect_mat.dash()

Data type cannot be displayed: application/vnd.plotly.v1+json

Option 3: VisuShrinkEnhancer (wavelet)#

Wavelet-based denoising. Preserves fine details better than spatial filters at the cost of speed.

[5]:
result3 = VisuShrinkEnhancer(wavelet="db2", mode="soft").apply(plate.copy())
result3.detect_mat.dash()

Data type cannot be displayed: application/vnd.plotly.v1+json

Option 4: StableDenoise (BM3D, highest quality)#

Variance-stabilized BM3D denoising. Best quality but slowest. Use for critical experiments where accuracy matters more than speed.

[6]:
result4 = StableDenoise(stage_arg="hard_thresholding").apply(plate.copy())
result4.detect_mat.dash()

Data type cannot be displayed: application/vnd.plotly.v1+json

Choosing a Method#

Method

Speed

Edge preservation

Best for

GaussianBlur

Fastest

Low

Quick preprocessing

MedianFilter

Fast

High

Salt-and-pepper noise

VisuShrinkEnhancer

Moderate

High

General noise, fine details

StableDenoise

Slow

Highest

Critical experiments