Histogram On Line

This function block analyzes pixel values along a specified straight line in a grayscale (or binary) image. It detects rising/falling edges above a chosen threshold, visualizes the evaluated line and detected peaks on the image, and returns peak locations and counts for further processing.

πŸ“₯ Inputs (sockets)

Input Image (Binary Image) Accepts a grayscale or binary image to analyze.

Line Location (pixel) One or multiple pixel positions specifying the line(s) to evaluate. You can provide a single number or a list of numbers.

Pixel Value Threshold Threshold value used to decide which pixel transitions count as peaks. Valid range is 0–255.

πŸ“€ Outputs (sockets)

Output Image Annotated image showing the evaluated line(s) and marked peaks.

Peak Count Number of peaks found along each evaluated line (single number or list).

Peak Start Locations Start coordinates for each detected peak (single list or list-of-lists).

Peak End Locations End coordinates for each detected peak (single list or list-of-lists).

Peak Mean Locations Mean/centroid coordinates for each detected peak (single list or list-of-lists).

πŸ•ΉοΈ Controls

Line Direction Dropdown Choose whether the evaluation line is vertical or horizontal. This affects how the line position is interpreted.

(Other visual/interaction controls may appear through the interface for selecting line direction and viewing results.)

🎨 Features

  • Visual annotations on the source image: evaluated line is drawn and peak start/end/mean points are marked with distinct colors.

  • Supports multiple lines in a single run by providing a list to the Line Location (pixel) input.

  • Handles both vertical and horizontal measurements.

  • Threshold validation ensures values are in the 0–255 range and guards against invalid input.

πŸ“ Usage Instructions

  1. Connect a grayscale or binary image to Input Image (Binary Image).

  2. Provide the line position(s) to Line Location (pixel). Use one value to inspect a single line or a list for multiple lines.

  3. Enter a threshold value in Pixel Value Threshold (0–255). Higher values require stronger intensity changes to register as peaks.

  4. Run the flow. Inspect Output Image for visual markers and read counts/locations from the other outputs.

πŸ“Š Evaluation

When executed, the block examines pixel intensity profiles along the specified line(s), detects transition edges around the chosen threshold, draws the evaluated line and peak markers on the image, and returns peak counts and locations suitable for downstream processing or logging.

πŸ’‘ Tips and Tricks

  • Preprocess noisy images with Blur to reduce spurious edges before feeding into this block.

  • Convert to a clear binary representation using Image Threshold when you want sharp, well-defined peaks.

  • Use HSV Filter or Adjust Colors upstream to isolate the feature of interest and make peaks more distinct.

  • To focus on a smaller area, crop the image first with Image ROI Select or Image ROI so line positions map consistently to the area of interest.

  • Use Show Image to preview the annotated Output Image in a larger viewer for easier inspection.

  • If results need consistent sizing, apply Image Resize before analysis so line coordinates behave predictably across different inputs.

  • For point-level inspection after detection, use Get Pixel on returned peak coordinates to read color or grayscale values.

πŸ› οΈ Troubleshooting

  • If you see an error about threshold range, ensure Pixel Value Threshold is between 0 and 255.

  • If no peaks are detected but you expect some, try increasing image contrast with Auto Contrast or sharpening using Contrast-Brightness-Gamma before analysis.

  • If detections appear on background noise, reduce noise using Blur or tighten the threshold value.

  • When line positions exceed image bounds, ensure your Line Location (pixel) values are within image width (for vertical) or height (for horizontal). The block will clamp out-of-range values but it’s better to supply valid positions.

Last updated

Was this helpful?