pyflink.multimodal.operators.image_sharpness#
- image_sharpness(*columns, max_edge=None, allow_upscale=False, concurrency=None)[source]#
Compute a raw sharpness metric using Laplacian variance.
The result is in
[0, +inf)and larger values usually indicate sharper images. This is a low-cost focus measure, not an absolute quality score: thresholds depend on image scale, texture, contrast, and noise.- Parameters
*columns – Optional image columns. When provided, the UDF is applied directly (syntactic sugar).
max_edge – Cap the longest edge to this many pixels before computing sharpness.
None(default) preserves the original scale.allow_upscale – When
max_edgeis set, allow upscaling smaller images. DefaultFalse.concurrency – UDF concurrency.
Noneuses the framework default.
- Returns
A UDF producing
float64.
- Example::
>>> # As a reusable variable >>> sharpness = image_sharpness(max_edge=512) >>> df = df.with_columns("sharpness", sharpness(col("img"))) >>> >>> # Inline >>> df = df.with_columns("sharpness", image_sharpness(col("img"), max_edge=512))