A raw image pointer tells you where a buffer starts, not how many bytes it contains or how those bytes represent measurements. This matters when coordinate and intensity data share an acquisition: a plausible preview can hide an incorrectly sized application buffer. Use the checks below to separate a format mismatch, an incorrect copy length, and a genuinely incomplete acquisition before interpreting any samples.
Start with the symptom and the byte counts
If an image appears to contain only part of its expected data, first compare quantities expressed in bytes. An SDK may report pixels, samples, elements, image bytes, or transport payload bytes. These values are not interchangeable.
The most likely causes should be checked in this order:
| Likely cause | What to inspect | Corrective action |
|---|---|---|
| Element count mistaken for byte count | Units of the length property and copy argument | Calculate bytes using the documented element size |
| Application configured for a different format | Delivered format versus destination type | Match channel count, storage width and packing |
| Only one plane or component accessed | Plane list and component descriptors | Read every required plane using its own layout |
| Row padding ignored | Reported row stride versus active row bytes | Preserve the stride or copy active rows individually |
| Buffer accessed after release | Ownership and callback lifetime | Process while owned or make an independent copy |
| Incomplete acquisition | Completion status and received image bytes | Investigate transport only after layout checks pass |
A buffer containing one eighth of the expected bytes does not, by itself, prove transport loss. For four channels stored in sixteen-bit containers, copying one byte per pixel produces exactly that ratio.
If the application cannot identify the delivered format at all, start with diagnosing unknown pixel formats. The procedure here assumes you can obtain a format descriptor and need to validate the buffer against it.
Record the delivered metadata before changing settings
Capture one completed frame and record its metadata alongside the pointer. Read the delivered frame descriptor, not just the requested acquisition settings or preview configuration.
Record these fields where the SDK provides them:
- Width and height of the delivered image.
- Exact pixel-format identifier and enabled components.
- Channel meanings, order and signedness.
- Valid bits per sample and storage bits per sample.
- Packed or unpacked representation.
- Plane count, plane offsets and row strides.
- Image-data length, total payload length and completion status.
- Frame identifier and the buffer ownership rules.
Do not infer a format from the appearance of a preview. Display software can normalize coordinate values, select one channel, or convert an image for viewing.
Similarly, four channels do not automatically mean three coordinates followed by intensity. Confirm the component definitions, coordinate scale, offset, invalid-value convention and byte order in manufacturer documentation.
For stereo acquisitions, verifying raw streams and calibration metadata addresses a separate question: whether the chosen streams and calibration belong together. Correct calibration cannot repair an incorrectly interpreted memory layout.
Calculate the tightly packed image size
For an unpacked, interleaved image whose channels all use the same byte-aligned storage width, calculate the active image bytes as follows:
These equations do not describe every packed format. When samples cross byte boundaries, use the documented packing rules or an SDK conversion function.
Consider a hypothetical image with these properties:
- Width: 640 pixels.
- Height: 480 pixels.
- Channels: 4, interleaved.
- Storage width: 16 bits per channel.
- No row padding.
The arithmetic is:
The pixel count is only 640 × 480 = 307,200. Treating that value as a byte count copies 307,200 / 2,457,600 = 1/8 of the image.
By contrast, retaining all four channels but allocating eight-bit rather than sixteen-bit storage gives half the required bytes. That distinction helps identify which assumption is wrong.
Check stride, planes and payload boundaries
The tightly packed size is a baseline, not necessarily the actual memory span. A row stride may include padding after the active pixels.
For the preceding example, suppose the reported stride is 5,184 bytes. Each row then contains 5,184 − 5,120 = 64 padding bytes. A buffer reserving that stride for every row occupies:
Some interfaces do not expose padding after the final row. For a positive-stride plane, the minimum span needed to access all active pixels is:
Use the SDK's documented length convention when comparing either result with its reported buffer size. Do not reject a valid buffer merely because it omits unused final-row padding.
Planar storage requires a different calculation. A plane may contain only one component, and different components can have different strides or dimensions. Validate each plane separately, including its offset within any shared allocation. Never assume the first plane contains every enabled channel.
Also distinguish image bytes from total payload bytes. Payloads can include metadata or additional components. A larger payload does not justify reading all of it as pixels.
Build the destination view without changing the source meaning
A native image view needs more than a base pointer. Its dimensions, channel count, scalar type and row step must describe the actual source memory.
For the hypothetical unpacked image above, the view would need four channels with sixteen-bit unsigned storage and the reported row stride. This remains an example, not a format claim for any particular sensor.
In managed code, check the following boundaries before constructing a native view or copying data:
- Perform size calculations using checked arithmetic and a sufficiently wide integer type.
- Confirm that the copy API's length argument counts bytes or elements, as documented.
- Verify the accessible source span against the plane's documented length.
- Allocate a destination large enough for the chosen layout.
- Keep the source frame owned until every reader has finished.
An array of sixteen-bit elements has twice as many bytes as elements. A copy overload accepting such an array may count elements rather than bytes. Do not transfer a byte count unchanged between different overloads.
If the destination is tightly packed but the source is padded, copy each active row separately. If a documented conversion function repacks the source, retrieve the output descriptor again rather than reusing the original stride.
For encoded files, the rules differ: image bytes versus pixel data explains why a file buffer cannot automatically become a raw image view.
Separate lifetime faults from incomplete acquisition
A non-null pointer is not evidence that the memory remains valid. Some acquisition systems return buffers to a pool when a frame object is released or a callback ends.
A lifetime fault may appear as changing values, repeated frames, or intermittent corruption rather than a predictable size ratio. To isolate it, make an owned copy while the frame is valid, then process that copy after releasing the acquisition object. Avoid retaining a borrowed pointer across asynchronous work unless the SDK explicitly supports that ownership pattern.
If the owned copy remains stable but the frame reports incomplete acquisition, investigate the transport path. Compare completion status, frame identifiers and received image bytes across repeated captures. Change one setting at a time and preserve the corresponding metadata.
Do not start by increasing network or host buffers when the acquired image is complete and the application copies too few bytes. For queue ownership problems involving several cameras, use the checks in multi-camera callbacks and buffer queues.
Choose hardware by required data, not by channel assumptions
Buffer validation should normally be completed before replacing hardware. A different sensor will not correct an application that confuses sample counts with byte counts.
When selecting a new acquisition method, compare the measurement you need before choosing an interface:
| Required information | Category to investigate | Compatibility question |
|---|---|---|
| Measured surface coordinates or range | 3D sensors | Which coordinate, depth and intensity components are actually available? |
| Conventional intensity or color imagery | Area scan cameras | Which delivered pixel formats and storage layouts are supported? |
Browse 3D sensors for depth-measurement hardware. The MV-DPS200P-02 is a projected structured-light 3D camera.
- Type
- Stereo / structured light
The MV-DT01WMU is a ToF sensing camera. Its listing represents another acquisition approach, not evidence of compatibility with the example buffer format.
- Type
- Depth / ToF camera
For conventional image acquisition, compare area scan cameras in the camera finder. Before selecting either approach, obtain confirmation of the required raw components, SDK access, stride reporting and buffer lifetime behavior.
Verify the fix with a controlled capture
Use a fixed scene and disable optional image transformations during the first validation pass. Repeat the test after reconnecting or restarting acquisition so saved settings cannot conceal a startup mismatch.
Work through this acceptance checklist:
- Delivered format matches the reader. Compare the frame descriptor with the destination scalar type and channel layout.
- Counts use explicit units. Record pixels, samples, active image bytes and payload bytes separately.
- Every required plane is present. Verify its dimensions, offset, stride and accessible span.
- The full active image is copied. Inspect samples from the first row, middle rows and final row.
- Ownership survives processing. Confirm that delayed processing uses retained or independently owned memory.
- Saved raw data has a descriptor. Store format, dimensions, strides, byte order and measurement scaling alongside it.
- Acquisition completes repeatedly. Confirm stable status and counts across successive frames.
For the unpadded worked example, an owned raw copy should contain 2,457,600 bytes. File size is not an equivalent test if the chosen file format adds headers or compresses data.
When exporting measurements, saving high-bit-depth images without losing intensity data covers preservation after acquisition. First establish that the complete source buffer reaches your application.
Know when the simple calculation is wrong
The width × height × channels × bytes-per-channel calculation is appropriate only for the layout it describes. Packed samples, separate planes, compressed components, variable-length point records and metadata-bearing payloads need their documented rules instead.
A correct byte count also does not prove correct coordinates. Signedness, endianness, scale, invalid-value handling and coordinate frames can all produce incorrect measurements from a complete buffer.
Before ordering, prepare a short compatibility specification covering the required measurements, delivered formats, component access and ownership model. Use the camera configurator to begin hardware selection, or send those requirements through application support when raw-data compatibility needs confirmation.
Questions
Why does my copied image contain only one eighth of the expected data?
A pixel count used as a byte count can produce this ratio when each pixel occupies eight bytes. Four unpacked channels with sixteen-bit storage are one example. Check the delivered format and copy API units before concluding that the camera or transport discarded data.
Can I calculate the buffer size from width and height alone?
Only when the memory is tightly packed, byte-aligned and described by the assumed channel layout. Row padding increases the required span, while planar or packed formats need different calculations. Use the delivered plane descriptors and documented length conventions rather than relying on dimensions alone.
Is it safe to process an acquisition pointer without copying it?
A raw pointer carries no ownership, length or format information. Direct access is appropriate only while the source buffer remains valid and the reader uses its actual layout. For delayed or asynchronous processing, retain ownership through the documented SDK mechanism or create an independent copy.
Why are the values wrong when the buffer length is correct?
A view can apply the wrong channel count, scalar type or row step even when its pointer is valid. Coordinate scale, byte order and invalid-value handling can also change the interpretation. Validate storage first, then apply the documented measurement conversion and coordinate conventions.
What should I confirm before buying a replacement depth sensor?
Request the exact delivered pixel formats, component and plane organization, row-stride reporting, payload-length definitions and buffer ownership rules. For coordinate data, also confirm units, scale, signedness and invalid measurements. A category label alone does not establish compatibility with an existing raw-image reader.

