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
Connect a grayscale or binary image to
Input Image (Binary Image).Provide the line position(s) to
Line Location (pixel). Use one value to inspect a single line or a list for multiple lines.Enter a threshold value in
Pixel Value Threshold(0β255). Higher values require stronger intensity changes to register as peaks.Run the flow. Inspect
Output Imagefor 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
Blurto reduce spurious edges before feeding into this block.Convert to a clear binary representation using
Image Thresholdwhen you want sharp, well-defined peaks.Use
HSV FilterorAdjust Colorsupstream to isolate the feature of interest and make peaks more distinct.To focus on a smaller area, crop the image first with
Image ROI SelectorImage ROIso line positions map consistently to the area of interest.Use
Show Imageto preview the annotatedOutput Imagein a larger viewer for easier inspection.If results need consistent sizing, apply
Image Resizebefore analysis so line coordinates behave predictably across different inputs.For point-level inspection after detection, use
Get Pixelon returned peak coordinates to read color or grayscale values.
π οΈ Troubleshooting
If you see an error about threshold range, ensure
Pixel Value Thresholdis between 0 and 255.If no peaks are detected but you expect some, try increasing image contrast with
Auto Contrastor sharpening usingContrast-Brightness-Gammabefore analysis.If detections appear on background noise, reduce noise using
Bluror 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?