Filter Image Using Sato Filter
SUMMARY
Filter Image Using Sato Filter applies Sato filter for multi-scale ridge detection.
Sato filter is designed to detect ridges and valleys at multiple scales, useful for detecting fine structures like vessels or fibers. This filter is optimized for general ridge detection and performs well on a variety of biological and industrial images where linear or curved structures need to be enhanced. It's particularly effective for structures that are elongated but may have varying contrast or width.
Use this Skill when you want to detect ridges and fine linear structures at multiple scales.
The Skill
from telekinesis import pupil
ridges = pupil.filter_image_using_sato(
image=image,
scale_start=1,
scale_end=10,
scale_step=2,
detect_black_ridges=True,
border_type="reflect",
constant_value=0.0,
)Example
Input Image

Original grayscale image (pcb_top_gray.png, normalized to 0-1 range)
Filtered Image

Sato filter highlighting thin, bright ridge-like PCB structures such as traces and IC pins.
The Code
from telekinesis import pupil
from datatypes import io
import pathlib
from loguru import logger
DATA_DIR = pathlib.Path("path/to/telekinesis-data")
# Load image
filepath = str(DATA_DIR / "images" / "pcb_top_gray.webp")
image = io.load_image(filepath=filepath, as_gray=True)
logger.success(f"Loaded image from {filepath}")
# Apply Sato filter for multi-scale ridge detection
filtered_image = pupil.filter_image_using_sato(
image=image,
scale_start=1,
scale_end=12,
scale_step=1,
detect_black_ridges=False,
border_type="reflect",
border_value=0.0,
)
# Access results
filtered_image_np = filtered_image.to_numpy()
logger.success("Applied Sato filter. Filtered output image shape: {}", filtered_image_np.shape)The Explanation of the Code
The code begins by importing the necessary modules: pupil for image processing operations, io for data handling, pathlib for path management, and loguru for logging.
from telekinesis import pupil
from datatypes import io
import pathlib
from loguru import loggerNext, an image is loaded from a .png file using the io.load_image function. The image is loaded in grayscale mode using as_gray=True, which is appropriate for Sato ridge detection that operates on spatial derivatives.
DATA_DIR = pathlib.Path("path/to/telekinesis-data")
# Load the grayscale image
filepath = str(DATA_DIR / "images" / "pcb_top_gray.webp")
image = io.load_image(filepath=filepath, as_gray=True)The main operation uses the filter_image_using_sato Skill from the pupil module. This Skill applies the Sato filter for multi-scale ridge detection to enhance fine linear structures. The parameters can be tuned to control scale range, ridge polarity, and border handling depending on the characteristics of the input image.
filtered_image = pupil.filter_image_using_sato(
image=image,
scale_start=1,
scale_end=12,
scale_step=1,
detect_black_ridges=False,
border_type="reflect",
border_value=0.0,
)Finally, the filtered image is converted to a NumPy array using to_numpy() for further processing, visualization, or downstream tasks.
filtered_image_np = filtered_image.to_numpy()
logger.success(f"Output image shape: {filtered_image_np.shape}")This operation is particularly useful in robotics and vision pipelines for ridge detection, fiber detection, crack detection, and PCB trace analysis, where enhancing multi-scale linear structures is required.
Running the Example
Runnable examples are available in the Telekinesis examples repository. Follow the README in that repository to set up the environment. Once set up, you can run this specific example with:
cd telekinesis-examples
python examples/pupil_examples.py --example filter_image_using_satoHow to Tune the Parameters
The filter_image_using_sato Skill has 6 parameters that control the multi-scale ridge detection:
scale_start (default: 1):
- The minimum scale (sigma) for structure detection
- Units: Sigma (pixels)
- Increase to skip very thin ridges; Decrease to capture finest linear details
- Typical range: 1–5 (min: 1, max: 5)
- Determines the finest ridge width to detect
scale_end (default: 10):
- The maximum scale (sigma) for structure detection
- Units: Sigma (pixels)
- Increase to detect wider ridges and fibers; Decrease for faster processing
- Typical range: 5–20 (min: 5, max: 20)
- Determines the thickest ridge width to detect
scale_step (default: 2):
- The step size between scales
- Units: Sigma steps
- Increase for faster processing; Decrease for finer scale sampling
- Typical range: 1–5 (min: 1, max: 5)
- Use 2 for efficiency, 1 for maximum precision
detect_black_ridges (default: True):
- Whether to detect dark ridges instead of bright
- Set True for dark ridges on bright background; False for bright ridges on dark background
- Use cases: True for cracks on surfaces, False for traces on dark PCB
border_type (default: "reflect"):
- The padding mode for image borders
- Options: "reflect", "constant", "wrap", "nearest", "mirror"
- Use "reflect" for most cases
border_value (default: 0.0):
- The value used for constant padding mode
- Units: Intensity (0–1 normalized)
- Typical range: 0.0–1.0 (min: 0.0, max: 1.0)
- Only used when border_type="constant"
TIP
Best practice: Set scale_start and scale_end to span the expected range of ridge widths. Use scale_step=2 for efficiency.
Where to Use the Skill in a Pipeline
Filter Using Sato is commonly used in the following pipelines:
- Fiber detection - Detect fibrous structures in materials
- Crack detection - Identify cracks and linear defects
- Ridge enhancement - Enhance ridge patterns in various images
- Biological imaging - Detect fibers and elongated structures
- Industrial inspection - Find linear features or defects
Related skills to build such a pipeline:
filter_image_using_gaussian_blur: Pre-smoothfilter_image_using_frangi: Alternative for vessel structuresfilter_image_using_morphological_close: Post-process results
Alternative Skills
| Skill | vs. Filter Using Sato |
|---|---|
| filter_image_using_frangi | Frangi is optimized for vessels. Use Sato for general ridges, Frangi for biological vessels. |
| filter_image_using_hessian | Hessian is simpler. Use Sato for better ridge detection, Hessian for speed. |
| filter_image_using_meijering | Meijering is optimized for neurites. Use Sato for general ridges. |
When Not to Use the Skill
Do not use Filter Using Sato when:
- You're detecting blob-like structures (Use blob detectors instead)
- You need simple edge detection (Use Sobel or Canny)
- Structures are not ridge-like (Use appropriate filters)
- You need very fast processing (Sato is computationally expensive)

