robokudo.annotators.blur

Image blur detection for RoboKudo.

This module provides an annotator for calculating and visualizing image blur metrics using the Laplacian variance method. It can optionally halt pipeline execution if blur exceeds a threshold.

Note

The blur metric is calculated using the Laplacian operator variance, where:

  • Higher values indicate sharper images

  • Lower values indicate more blur

Classes

BlurAnnotator

Annotator for calculating and visualizing image blur metrics.

Module Contents

class robokudo.annotators.blur.BlurAnnotator(name='BlurAnnotator', descriptor=Descriptor())

Bases: robokudo.annotators.core.BaseAnnotator

Annotator for calculating and visualizing image blur metrics.

This annotator:

  • Calculates a blur metric using Laplacian variance

  • Visualizes the blur value on the image

  • Optionally halts pipeline if blur exceeds threshold

Warning

Setting return_failure_above_threshold to True will stop pipeline advancement when the blur threshold is exceeded.

class Descriptor

Bases: robokudo.annotators.core.BaseAnnotator.Descriptor

Configuration descriptor for blur detection.

class Parameters

Parameters for configuring blur detection behavior.

Variables:
  • blur_threshold – Threshold for acceptable blur level, defaults to 100

  • return_failure_above_threshold – If True, return FAILURE when blur exceeds threshold

blur_threshold = 100
return_failure_above_threshold = True
parameters
compute_bluriness(img)

Compute the blur metric for an image.

Uses Laplacian variance to measure image sharpness:

  • Converts image to grayscale

  • Computes Laplacian operator

  • Returns variance of Laplacian values

Parameters:

img (numpy.ndarray) – Input image in BGR format

Returns:

Blur metric value (higher = sharper)

Return type:

float

update()

Update blur detection and visualization.

Creates visualizations containing:

  • Color image with blur metric overlay

  • Point cloud data

Returns:

SUCCESS if blur is acceptable, FAILURE if above threshold (if configured)

Return type:

py_trees.common.Status