System designExplainer

Capture call returns vs image ready: cutting cycle time

Capture call returns vs image ready: the DMA, debayer and copy time between them, worked ms math per interface, and when to start robot motion.

LumaSpec Vision9 min read Share on LinkedIn

On this page 9 sections
  1. 01The decision: start the motion at the capture return
  2. 02What each call is waiting on
  3. 03The gap in milliseconds: transfer arithmetic
  4. 04Worked example: hiding a 12 MB USB3 transfer under a robot departure
  5. 05Putting the overlap into code
  6. 06When the usual answer is wrong
  7. 07Shrinking the gap when you cannot hide it
  8. 08Checks before you commit
  9. 09Questions

You press capture, the call returns, and the blocking wait happens later, when you ask for the pixels. Frame-handle camera SDKs split acquisition into two calls: the capture call returns once exposure and onboard acquisition finish, and the image getter returns once the pixels sit in host memory, after payload transfer, any color conversion and the copy. Between those two returns sits real time — about 30 ms for a 12 MB USB3 frame, 120 ms for the same bytes on GigE — and most programs pay it as dead cycle time. This explainer is for engineers writing pick, inspect or scan cycles against a camera SDK. It maps what each call waits on, converts frame size and link speed into milliseconds, and shows where robot and conveyor motion can run inside the gap.

The decision: start the motion at the capture return

When the capture call returns, the exposure is closed and the sensor has been read out. Nothing you do to the part after that instant can change the image. So send the robot departure, the conveyor step or the indexer command at the capture return, and let the blocking image getter run underneath the move. Transfer, debayer and host copy then hide inside motion time instead of adding to the cycle. Overlapping the processing stage the same way is the argument made in vision picking request timing: overlap processing and motion, and the two overlaps stack.

The rule carries one condition: the exposure sequence must be complete. A single 2D shot is finished when the call returns; an HDR bracket or a 3D sweep is finished when its capture call returns, and not one exposure sooner. Motion before the return smears or warps the data; motion after it cannot. Where the camera itself must stay still, 3D camera mounting: stillness during capture decides image quality covers the vibration side of that requirement.

What each call is waiting on

The capture call covers exposure, sensor readout and onboard acquisition, and hands back a frame object; the pixels are still in camera or SDK-internal memory. The image getter — the call that returns the pixel array — blocks until processing and copying finish, then holds a handle to the data in host memory. Until it returns, the buffer is not yours to read.

Frame-handle interfaces of this shape are the norm on stereo and structured-light 3D cameras; a laser galvanometer stereo camera is programmed through exactly this two-stage pattern.

3D sensorsHikrobot MV-DLS300P-04 Laser galvanometer stereo cameraMV-DLS300P-04
Type
Stereo / structured light
$16,579.00 · quotedView and quote

Streaming area scan cameras express the same split differently. The camera signals the end of exposure while the frame is still crossing the link, and host code unblocks from the arrival queue some milliseconds later; that difference is what camera frame timing jitter: acquisition vs arrival time isolates and what GigE Vision frame arrival jitter: isolate camera and host timing splits into camera-side and host-side parts. What the trigger call starts, versus when exposure physically begins, is a separate delay — trigger call versus exposure time: understand capture timing covers it.

Put the whole path in one place:

t_image_ready = t_capture_return + t_retrieve t_retrieve = frame_bytes / sustained_payload + t_convert frame_bytes = width * height * bytes_per_pixel

Bytes per pixel: 1 for 8-bit mono or raw Bayer, 3 for RGB, 4 for RGBA. The conversion term t_convert is zero when you ship raw Bayer and debayer on the host instead of paying RGBA across the link.

The gap in milliseconds: transfer arithmetic

Sustained payload — the number you divide by — is line rate minus encoding (8b/10b on USB3 and CoaXPress, 64b/66b on 10GigE) and protocol overhead. The values below are the planning rates we size links with:

Interface Sustained payload (typical) 12 MB mono frame 48 MB RGBA frame
GigE ≈ 100 MB/s ≈ 120 ms ≈ 480 ms
USB3 ≈ 400 MB/s ≈ 30 ms ≈ 120 ms
10GigE ≈ 1,000 MB/s ≈ 12 ms ≈ 48 ms
CoaXPress CXP-12, one link ≈ 1,100 MB/s ≈ 11 ms ≈ 44 ms

The color decision is visible in the table: raw Bayer crosses at one byte per pixel and converts on the host, RGBA crosses at four. For a 12 MP frame on GigE that is the difference between 120 ms and 480 ms of link time.

Worked example: hiding a 12 MB USB3 transfer under a robot departure

Inputs, each with its source:

  • Image size: 4000 × 3000 pixels, the resolution the LS-CMR-0166 outputs.
  • Bit depth: 8-bit mono, the output format chosen for this station.
  • Sustained USB3 payload: 400 MB/s, typical for the interface.
  • Acquisition to the capture return: 50 ms, measured on the station.
  • Robot departure move: 250 ms, from the motion program.
  • Inspection processing after the getter: 80 ms, measured.
Area scan cameras12 MP USB3 area scan camera, IMX226, 1/1.7" rolling shutter, 30 fps, 4000 × 3000 resolution (LS-CMR-0166)LS-CMR-0166
Sensor format
1/1.7"
Interface
USB3
Resolution
12 MP
Shutter
Rolling
$560.00View partBuild a system with it

Arithmetic:

frame_bytes = 4000 * 3000 * 1 B = 12 MB t_retrieve = 12 MB / 400 MB/s = 0.030 s = 30 ms

Sequential cycle: 50 ms acquisition + 30 ms retrieval + 80 ms processing + 250 ms departure = 410 ms per part. Overlapped, the departure starts at the capture return (t = 50 ms) and ends at t = 300 ms, while retrieval and processing finish at 50 + 30 + 80 = 160 ms — inside the move. The cycle is then 50 + 250 = 300 ms.

The saving is 110 ms per part, 27% of 410 ms. Per hour: 3600 s ÷ 0.410 s = 8,780 parts against 3600 ÷ 0.300 s = 12,000 parts, a 37% throughput gain from moving one command earlier in the sequence.

Decision rule: the overlap hides the gap completely while t_retrieve + t_process ≤ t_departure — here 110 ms ≤ 250 ms. Shorten the move to 90 ms and 20 ms of gap surfaces again; the fix is then fewer bytes or a faster link, not more overlap.

Putting the overlap into code

# illustrative pseudocode; names are generic, not from one SDK
frame  = camera.capture(settings)   # returns when acquisition ends
robot.depart_async()                # scene is frozen; start the move
image  = frame.get_image()          # blocks for t_retrieve
result = inspect(image)

Three rules make it work:

  1. The motion command must be asynchronous. A blocking move call deletes the win — you have relocated the wait, not removed it.
  2. Keep long work out of any frame-arrival callback. Copy the buffer and return, or you invite torn frames in a camera callback: copy the buffer before you queue it; a queue you fail to requeue fast enough then shows the duplicate-frame symptom traced in latest image only returns duplicate frames: drain the buffer queue.
  3. Prove the result with timestamps: log the capture return, the getter return and the inspection end over 100 cycles. The getter column should read about 30 ms and the cycle about 300 ms. A getter column near zero with a long capture column means your SDK carries the transfer inside capture — overlap motion with that call instead.

One further dependency: the robot must be back on pose before the next exposure starts, which is the constraint behind camera locate snapshot position: why the robot must return first.

When the usual answer is wrong

  • You measured with the vendor's viewer. Viewers pipeline transfer, conversion and display internally and may not render every frame, while application code pays those stages in series. The symptom is traced in 3D camera capture time slower in the API than in the viewer.
  • The blur is in the exposure, not the transfer. A smeared part means exposure overlapped motion — fix it the way cap the maximum auto exposure time to stop motion blur shows; no overlap arithmetic cures it.
  • The robot carries the camera. Moving during the getter cannot hurt the image already taken, but the same move can shake a second station's capture — check both stations.
  • The cycle is capped elsewhere. Some 3D cameras limit frame rate in software-trigger mode regardless of your overlap; see 3D camera frame rate low on software trigger: mode and data streams.
  • Safety: the overlap is ordinary interlocked motion. It must not become a route around light curtains or area scanners, and camera timing is never a safety function.

Shrinking the gap when you cannot hide it

Cut bytes first, because it is free: region of interest, binning — the readout side of which 4x4 binning vs 2x2: sensor readout decides your frame rate covers — and 8-bit mono or Bayer output instead of RGB. On 3D profilers, onboard data reduction cuts what crosses the link at all; 3D profiler profile rate: how onboard data reduction enables speed quantifies it.

Raise the link second. A 20 MP color camera on GigE illustrates the ceiling. At 8-bit RGB, that resolution is about 60 MB of payload, roughly 600 ms of transfer at 100 MB/s. Put large color frames on 10GigE, or ship Bayer and convert on the host. For a middle ground on cabling, 5GBASE-T camera interface: bandwidth, cables and distance details that link class. On the host side, a dual 10GigE frame grabber such as the MV-GT1102P keeps the receive side at link speed.

Frame grabbersHikrobot MV-GT1102P Dual 10GigE Frame GrabberMV-GT1102P
Interface
10GigE
Ports
2 ports
$2,029.00View partBuild a system with it

Checks before you commit

  • Release notes: confirm which call blocks on the transfer in your SDK version.
  • Measure retrieval time over 100 cycles; use the median.
  • Test retrieval plus processing against the move time you hide it under.
  • Confirm the capture call has returned before any motion command, on every path including retries.
  • Check host headroom: frame bytes × frame rate must stay under the sustained payload of link and card.
  • Confirm the robot is on pose before the next trigger.

Next step: pick the camera and link in the camera finder, size the whole station in the configurator starting at the camera step, or send the cycle-time numbers to our applications desk for a second opinion.

Questions

How do I measure the gap between capture return and image ready?

Timestamp three points in one cycle: the capture call's return, the image getter's return, and the end of your processing. The difference between the first two is the transfer-plus-copy time you can hide under motion. Log 100 cycles and take the median, not the minimum, because host scheduling shows up as outliers. If the getter returns almost instantly and the capture call is the slow one, your SDK carries the transfer inside capture, so overlap motion with that call instead.

How long does a 12 MP frame take to reach host memory?

A 4000 × 3000 frame at 8-bit mono is 12 MB. At the sustained payloads used for sizing — about 100 MB/s on GigE, 400 MB/s on USB3 and 1,000 MB/s on 10GigE — that is roughly 120 ms, 30 ms and 12 ms. An RGB version of the same frame is 36 MB and triples those times; RGBA at four bytes per pixel quadruples them. Pixel count, bit depth and link speed set the whole budget.

Is it safe for the robot to move while the image getter is still blocking?

For the image, yes: once the capture call has returned, the exposure is closed and later motion cannot touch those pixels. Two limits apply. Move only after the call returns on multi-exposure HDR or 3D captures, never inside the bracket. And the overlap is ordinary interlocked motion — it must not become a route around light curtains or area scanners, because camera timing is not a safety function.

Why is my capture slower through my code than in the vendor viewer?

Viewers pipeline internally: they overlap transfer, conversion and display, and they may render at display rate rather than show every frame. Application code that calls capture, then the getter, then processes, pays those stages one after the other. Measure the three timestamps before concluding the camera is slow; the usual finding is that the stages are healthy but stacked. The same stacking explains the API-versus-viewer capture-time gap seen on 3D cameras.

Does a faster NIC or frame grabber shorten the gap?

Only when the link is the bottleneck. Retrieval time equals frame bytes divided by sustained payload, so going from GigE at about 100 MB/s to 10GigE at about 1,000 MB/s cuts a 12 MB transfer from 120 ms to 12 ms. If profiling shows the host copy or color conversion dominating instead, the card changes little — cut bytes with a region of interest, binning or mono output.