A droplet can change shape without changing the measurement you need: its lowest visible foreground pixel. When the background is clearly separated, segmenting the droplet and measuring its selected connected component is usually more direct than matching a fixed outline. This procedure is for developers building live inspection software. You will define the coordinate convention, select the correct object, resolve flat-tip ambiguity and measure processing time without confusing it with display performance.
Define exactly which point you need
Use an explicit coordinate contract before writing the measurement code. A common image convention places the origin at the upper-left pixel, with X increasing rightward and Y increasing downward. Under that convention, the lowest foreground pixel has the greatest Y coordinate.
Record these decisions with the measurement:
- Coordinates are zero-based integer pixel indices.
- The measured object is one selected connected component, not every dark pixel in the image.
- The tip is the selected component's lowest occupied row.
- When that row contains several foreground pixels, a documented rule chooses X.
- Missing or ambiguous objects produce an invalid result, not an invented coordinate.
A displayed image may be resized, flipped or rotated. Keep measurement coordinates in the acquisition image, then transform them for the overlay. The guide to barcode coordinate indexing explains the same distinction between array indices and drawing coordinates.
Also distinguish an attached droplet from a detached leading droplet. If both appear, deciding which one counts is an inspection requirement, not something a maximum-Y calculation can determine.
Choose acquisition and lighting for a stable boundary
Start with area scan cameras that provide the required image dimensions, exposure control and acquisition rate. Use the camera finder to narrow the hardware after establishing those requirements.
For silhouette measurement, backlights place the object against a bright background. Check that the actual droplet produces a stable boundary: transparent materials can create bright interiors, dark rims or reflections rather than a solid silhouette. Compare candidate illumination arrangements using the approach in the lens and lighting selection test plan.
The LS-CMR-0166 lists 30 fps and a rolling shutter. Evaluate motion distortion and exposure requirements before selecting it for a moving-droplet measurement.
- Sensor format
- 1/1.7"
- Interface
- USB3
- Resolution
- 12 MP
- Shutter
- Rolling
The LS-BKL-1468 is a red flat backlight. It is an illumination candidate, not a guarantee that a particular liquid will form a usable silhouette.
- Size
- 100-200 mm
- Type
- Standard
- Voltage
- 24 V
These parts do not establish the performance of the hypothetical timing example later. Confirm the complete acquisition configuration independently.
If physical position matters, choose object-space sampling before selecting resolution. For example, covering a 24 mm field with a target sampling of 0.02 mm per pixel requires:
This is a sampling requirement, not a promise of 0.02 mm measurement accuracy. Edge contrast, motion, optics and calibration also contribute. Use the resolution calculator to explore the sampling requirement, then review camera selection for dimensional inspection.
Segment the droplet and select its component
Use the following sequence on each acquired frame. Preserve an unmodified image for debugging and keep its frame identifier with the result.
- Read the actual pixel array. Confirm width, height, pixel format and row stride. Do not interpret an encoded file or transport buffer as a tightly packed grayscale image. The image bytes and pixel data guide covers this distinction.
- Apply a search region. Include the expected droplet motion and shape variation, with margin below the expected tip. A region that clips the object can return a plausible but false extreme point.
- Threshold the foreground. For a dark silhouette, classify pixels below the chosen intensity threshold as foreground. Fix exposure and lighting during initial validation so threshold changes are not hiding acquisition changes.
- Label connected components. State whether you use four-neighbor or eight-neighbor connectivity. Eight-neighbor connectivity joins diagonal contacts; four-neighbor connectivity does not. Neither choice corrects a poor threshold.
- Select the relevant component. Apply allowable position, area and association rules. During tracking, compare with the previous accepted location, while retaining a separate reacquisition procedure.
- Check validity before measuring. Reject clipping, unresolved component ambiguity and implausible jumps. Return a status alongside the coordinates so downstream software can distinguish absence from success.
Do not assume that the largest component is always the droplet. A nozzle, support or connected liquid column may occupy more pixels. Likewise, the lowest component might be a satellite droplet or contamination.
Shape-independent selection does not mean selection without constraints. A broad position gate and a plausible area range can tolerate changing outlines without requiring a fixed shape template. Validate those gates across the materials and operating conditions you intend to support.
Extract maximum Y and define the X tie rule
After selecting a component, its lowest row is straightforward:
The Y coordinate is unique, but X may not be. A flattened tip can occupy several adjacent pixels. An irregular boundary can also produce separate runs on the same bottom row.
One deterministic rule is:
- Split the bottom-row pixels into contiguous horizontal runs.
- Select the longest run.
- If several runs have equal length, select the leftmost run.
- Return the run midpoint, rounded downward to an integer.
Suppose the selected component reaches row 742. Its bottom-row foreground pixels occupy columns 310 through 313 and columns 330 through 332. The first run contains four pixels; the second contains three. Therefore:
The returned point, (311, 742), belongs to the component. By contrast, averaging every bottom-row X value could place the coordinate in a background gap.
Other tie rules can be valid, including the leftmost foreground pixel or a run nearest the previous tip. Choose one according to the measurement requirement and keep it consistent. A history-based rule needs an explicit initialization and reacquisition policy.
Full contour tracing is unnecessary for this measurement. Connected-component statistics can identify the bottom row, followed by a scan of that row. Contours become useful when you also need curvature, perimeter, orientation or a fitted boundary.
Keep cleanup from moving the measured tip
Erosion removes foreground pixels near a boundary. It can suppress a thin connection, but it can also shorten the droplet or remove its terminal feature completely. A square erosion kernel of size 3 by 3 can retreat a broad horizontal boundary by one pixel; narrow features can disappear instead.
Dilation adds foreground pixels and can move the lowest point downward. Opening combines erosion and dilation, but it does not guarantee restoration of the original tip. A small terminal feature removed during erosion may remain missing.
Prefer rejecting unrelated components through location and area rules when that solves the problem. If a modified mask helps identify the object, measure the corresponding component in the original threshold mask only when that correspondence is unambiguous.
Even without morphology, one foreground noise pixel can move an extreme point. Correct unstable illumination, thresholding or contamination before adding a temporal filter. Filtering coordinates changes the meaning and latency of the reported measurement; it does not repair the current frame's boundary.
Benchmark acquisition, processing and display separately
There is no reliable minimum processor or memory specification based only on image dimensions and frame rate. Pixel conversion, memory allocation, copying, component labeling and display scaling all affect performance.
Consider a hypothetical grayscale stream of 1440 by 1080 pixels at 60 frames per second:
At one byte per pixel, the image data alone represents approximately 93.3 MB/s using decimal megabytes. Transport overhead and intermediate buffers add traffic. Storing the same samples in two bytes per pixel doubles that image-data rate.
Measure each stage independently:
| Stage | Record | What the measurement reveals |
|---|---|---|
| Acquisition delivery | Frame IDs, timestamps and incomplete frames | Missing frames or irregular delivery |
| Pixel preparation | Conversion and copying time | Format or memory overhead |
| Segmentation and selection | Thresholding and component-labeling time | Main image-processing cost |
| Tip extraction | Bottom-row search time | Incremental measurement cost |
| Display | Overlay, scaling and presentation time | User-interface overhead |
| End-to-end path | Image event to usable result | Application latency and queue growth |
For a serial processing worker handling every frame, average processing must stay below the frame interval, with margin for variation. Report median, 95th-percentile and maximum observed times rather than only an average. Distinguish processing duration from acquisition age: a fast algorithm can still receive an old queued frame.
Process every required frame, but display only the most recent completed result if the interface does not need every image. For example, a 15 Hz preview can accompany a faster measurement stream. Keep display work off the acquisition callback and associate each overlay with its own frame identifier.
Use a bounded queue and document its overflow behavior. Dropping old frames may suit a live preview, but an inspection requiring every droplet must detect and report any loss. Avoid repeatedly allocating full-frame buffers when reusable buffers are available.
Verify coordinates against controlled test masks
Begin with synthetic binary masks whose expected answer is known. This isolates coordinate logic from lighting and threshold errors.
- Single-pixel tip: Confirm the returned point exactly matches its column and row.
- Flat bottom: Test odd and even run lengths to verify midpoint rounding.
- Two bottom runs: Verify longest-run selection and the leftmost tie rule.
- Diagonal boundary: Check the chosen connectivity convention.
- Distractor component: Add a lower object and confirm selection still follows the stated object rule.
- Empty or clipped object: Confirm an invalid status replaces the coordinate.
Then validate recorded images containing the real range of shapes. Save the selected mask, reported point, threshold, frame identifier and rejection reason. Repeated measurements of a stationary target help expose threshold sensitivity and coordinate jitter, although they do not establish absolute physical accuracy.
If processing uses an unscaled crop, restore full-image coordinates by adding the crop offset:
This simple addition is not sufficient after binning, resizing, rotation or geometric correction. Review ROI, binning and subsampling before changing acquisition geometry. Retest coordinate mapping whenever the acquisition configuration changes.
Check the limits before deployment
Maximum Y answers a narrow question: where does the selected binary object extend furthest downward? It does not automatically locate a physical liquid apex, compensate for blur or distinguish overlapping droplets.
If the needed point is the leading detached droplet rather than the attached liquid body, change component selection first. If the required precision is finer than one pixel, define a subpixel edge model and validate its bias separately. Do not label an interpolated coordinate as the lowest foreground pixel.
Before deployment, confirm:
- The target component remains identifiable across material and shape changes.
- The threshold remains valid across the allowed lighting and exposure range.
- The X tie rule is documented and tested.
- No boundary-changing cleanup silently changes the measurement.
- Cropping and display transformations preserve coordinate meaning.
- Sustained operation meets latency and frame-loss requirements.
- Missing, ambiguous and clipped objects have explicit output states.
Use the lighting finder to compare illumination options, then start the camera configuration with your field of view, sampling target and measured timing requirements. For help reviewing the setup, send representative images and the coordinate acceptance criteria through application support.
Questions
Do I need contour tracing to find the droplet tip?
Not necessarily. For a clearly segmented object, connected-component selection followed by a search of its lowest occupied row is sufficient. Trace the contour when the inspection also requires boundary shape, curvature, perimeter or a fitted geometric model.
Which X coordinate should I return for a flat droplet tip?
Use a deterministic rule that returns an actual foreground pixel. One option selects the longest contiguous run on the lowest row and returns its midpoint rounded downward. Define how equal-length runs are resolved, and test the rule on flat and split tips.
Should I erode the mask before measuring the lowest pixel?
Erosion changes the foreground boundary and may remove the narrow feature you want to measure. It can help identify an object in some images, but its output should not automatically become the measurement mask. Validate any cleanup against the original segmented boundary.
Can displaying live video reduce measurement throughput?
It can, especially when resizing, conversion or rendering runs in the acquisition callback. Measure display time separately from segmentation and coordinate extraction. A lower-rate preview can show recent completed frames while measurement continues, provided frame identifiers keep images and overlays matched.
Does one-pixel sampling establish physical measurement accuracy?
No. Pixel spacing describes sampling, while accuracy also depends on optics, calibration, motion, contrast and the boundary definition. Establish a pixel-level acceptance test first, then validate any conversion to physical distance against a suitable reference across the operating range.

