Setting the camera's Width and Height looks like the way to a smaller picture, and it fails in a specific way: those nodes crop the sensor, they never resize it. Pixels outside the window are not read out, so the field of view shrinks with the resolution and the part that filled the frame no longer fits. When you need the whole field in a smaller image, the scaling happens off the sensor: as binning or decimation on the camera, or as a pixel-skip map or an interpolated resize on the host. This guide shows where each route lives, what skipping and blending cost in detail and CPU, how both move a fisheye calibration, and how to size the shrink from the smallest feature you must still detect.
Width and Height set a window, not a scale
An area scan camera reads out a rectangle of its sensor. Width and Height size that rectangle; the horizontal and vertical offset features place it. Nothing in that chain changes a pixel's size, so a 640 × 480 setting is a 640 × 480 patch of the original image, not a scaled copy. The field of view shrinks by the window ratio: 640 of 1984 columns is 32 % of the width, and 480 of 1264 rows is 38 % of the height.
To keep the trimmed window centered, place it half the trim in from each edge:
A 1984 × 1264 frame trimmed to 640 × 480 centers at (1984 - 640)/2 = 672 horizontally and (1264 - 480)/2 = 392 vertically. Those are exactly the numbers a centered 640 × 480 window demands. If your offsets differ, your window is off center, and so is everything you measure in it.
Two node-order traps bite here. Devices step Width, Height and the offsets in fixed increments, often 4 or 8 pixels. Host libraries also pad buffers to multiples of 16; the buffer alignment vs crop guide shows how padding and cropping interact. And offsets reset to zero unless Width and Height are set first, which the offsets reset guide covers.
Crop is the right tool when the part leaves margins you will never inspect — the ROI cropping at the source guide covers that case and its frame-rate gain. When the part fills the frame, no window helps; you need a resize.
Resizing happens off the sensor
True scaling exists in three places. On the camera: many sensors offer binning, which sums adjacent pixels, and some offer decimation, which skips them; both cut the image before it reaches the link. In your library as a map: a 4000 × 3000 image object can be mapped to a 1000 × 750 object that samples every fourth row and column. And as a resize with interpolation: the library computes new pixel values as weighted averages of neighbours. OpenCV's resize function carries the usual choices, compared flag by flag in the OpenCV interpolation guide.
The skip route is nearly free: one input pixel becomes one output pixel. The blend route reads four input pixels per output pixel for linear interpolation and sixteen for bicubic, so it runs a few times slower. That is irrelevant for a triggered snap and real on a 100 fps line.
What skipping costs: dropped and dashed features
Nearest-neighbour downsampling keeps one input pixel per output pixel and discards the rest. At a factor of 4 it keeps 1 of every 16 pixels. A one-pixel scratch survives only where its row and column both land on a sampled line: (1/4) × (1/4) = 1/16, about 6 % of positions. Where it survives it shows at full contrast; everywhere else it is gone. The result is a defect that flickers in and out between frames, and thin strokes on text or codes that turn into dashes.
Periodic patterns alias next: grids, bristles and fine pitches fold into moiré, because skipping cannot average a period away. And factors are rarely clean. 1984 ÷ 640 = 3.1, so rows are skipped in a 3-3-3-4 cycle and straight edges wobble by a pixel.
Skipping also cannot recover contrast the lens never delivered. If the optics already fade at the sensor pitch, no resize brings detail back; that limit sits in the optics, as the lens resolution guide explains. Depth data behaves the same way — the point-cloud decimation guide shows the shifted-point version of the same effect.
What blending costs: CPU and softened edges
An interpolated resize computes pixel values that never existed. Linear blends the four neighbours; bicubic blends sixteen and adds sharpening. Two costs follow. Compute: per output pixel, memory traffic rises from one read to four or sixteen reads plus multiplies — a few times the skip cost. Contrast: a one-pixel scratch spread over a 4 × 4 output block contributes about 1/16 of its darkness, faint but uniform, with no dashes and no flicker.
Blended values are wrong when pixels carry data. Heights, counts and temperatures must not be averaged into numbers nobody measured; keep such frames native or skip them, and the grayscale height-map guide shows the kind of pipeline that cares. For lens measurements, run the metrology at native resolution and resize only what you display or archive. Detector input is the exception: pick one target size, train at that size, and the resize becomes part of the model contract. When the downscale should suppress aliasing rather than merely shrink, an area-average mode beats skipping — the antialiasing guide says when warps and downscales need it.
Worked example: 4000 × 3000 down to 1000 × 750, hunting a 0.4 mm crack
The case: a 4000 × 3000 camera watches a 200 mm × 150 mm field and must feed a detector that takes 1000 × 750, with a 0.4 mm crack as the smallest defect that has to stay detectable. Camera and full resolution come from the catalog below; the field, the target and the crack are example inputs.
The example camera:
- Sensor format
- 1/1.7"
- Interface
- USB3
- Resolution
- 12 MP
- Shutter
- Rolling
Object-side pixel scale: 200 mm ÷ 4000 px = 0.05 mm/px. At full resolution the crack spans 0.4 ÷ 0.05 = 8 px — comfortable. The detection rule used throughout: keep about 3 px across the smallest feature at the final scale. Two pixels is the sampling minimum; three leaves margin for noise and thresholding.
Crop route. A centered 1000 × 750 window sits at (4000 - 1000)/2 = 1500 and (3000 - 750)/2 = 1125, and covers 1000 × 0.05 = 50 mm by 750 × 0.05 = 37.5 mm. A 200 mm part fails the window immediately — crop is out.
Skip route, factor 4. Scale becomes 0.05 × 4 = 0.2 mm/px and the crack spans 0.4 ÷ 0.2 = 2 px: the sampling minimum with no margin, plus the 1-in-16 erasure risk from the section above.
Blend route, factor 4. Same 0.2 mm/px, same 2 px across the crack, but both output pixels are blended and stable. Detection is possible and thin; a threshold change or slight defocus eats the margin.
Decision. At factor 4, the smallest feature that keeps 3 px of margin is 3 × 0.2 mm = 0.6 mm, so the 0.4 mm crack does not qualify. Resize at factor 2 instead: 0.1 mm/px, 0.4 ÷ 0.1 = 4 px, a 2000 × 1500 output that still carries the whole field. If the detector cannot take 2000 × 1500, keep the crack tool at full resolution and resize only its coarse pass. Crop returns only if the part shrinks below 50 mm across.
Starting from a feature size and a field instead of a camera in hand? The resolution calculator runs the same arithmetic the other way:
Why a host-side resize never speeds up the link
Resizing after transfer changes no bytes on the wire: the camera ships every pixel regardless. Byte math for the example: 4000 × 3000 = 12,000,000 px, about 12 MB per frame at 8 bits mono and double that in colour. Thirty of those frames are 12 MB × 30 = 360 MB/s, right at USB 3's practical ceiling, so the 30 fps catalog rate is the link talking, not the sensor. The GigE sibling runs the same IMX226 sensor and tops out at 9 fps:
- Sensor format
- 1/1.7"
- Lens mount
- C-mount
- Interface
- GigE
- Resolution
- 12 MP
A 12 MB frame over GigE's roughly 110 MB/s usable rate takes 0.11 s, a ceiling near 9 fps — the card above sits exactly there. Shrink to 2000 × 1500 on the camera, by crop or by binning or decimation, and the payload falls to 3 MB: 110 ÷ 3 ≈ 37 fps of ceiling, until the sensor's readout becomes the limit. Nothing done in code after the transfer moves any of these numbers.
Fisheye: every geometry change moves the calibration
Set offsets on a fisheye image and the distortion model's center moves with the window. A crop by (offsetX, offsetY) puts the principal point at cx - offsetX, cy - offsetY in output pixels. Increments rarely allow an exactly centered window, so the model now assumes a center that is not there: undistorted lines bow and pose solvers drift. That is the mechanism behind an image that comes out wrong whenever the offsets are slightly off.
A resize divides the pixel-space intrinsics instead. At factor s, the focal lengths become fx/s and fy/s and the principal point cx/s, cy/s. Coefficients fitted in normalized coordinates survive; ones stored in pixel units do not. Either way, re-fit or re-scale — never reuse.
With a fisheye, make the geometry change in the order that keeps one model: undistort at full resolution, then resize the rectified image. After rectification the frame is ordinary geometry and any resize is safe. The remap is constant per resolution, so build it once and pay only the per-frame remap. The fisheye pixel-mapping guide shows how the remap is built, and the distortion-model mismatch guide shows what breaks when model and image disagree.
Which route to use
| Route | Field of view | Bytes on the link | Detail | Use when |
|---|---|---|---|---|
| Camera crop (Width, Height, offsets) | Shrinks to the window | Falls with window area | Native pixels | The part leaves margins you will never inspect |
| Camera binning | Full field | Falls with the factor | Sums pixels; SNR rises | Low light and the sensor offers it |
| Camera decimation or host skip map | Full field | Falls only on-camera | Drops and dashes detail | Speed first, values must stay unblended |
| Host interpolated resize | Full field | Unchanged | Smooth, slightly soft | Detector input, display, archive |
The short version: measurement runs native or binned, never interpolated on the measured path. Fisheye undistorts first and resizes second. Detector input picks one fixed target size and trains at that size. Preview skips, because it is free. And when the field of view can shrink, that is not a resize problem at all — crop and take the frame rate with it.
Checks before you commit the smaller size
- Smallest feature ÷ final pixel scale ≥ 3 px. Below that, detection lives on luck; the worked example's 0.4 mm crack fell to 2 px at factor 4.
- Set Width and Height first, then the offsets, centered with (full - window)/2 and inside the device's increments. Off-center windows move a fisheye principal point.
- Restart the stream and read the delivered buffer's dimensions back from the library; never slice a buffer to the values you configured.
- Recalibrate or re-scale after any geometry change: crop shifts the principal point by the offsets, resize divides pixel-space intrinsics by the factor.
- Measure the frame rate before and after. A host-side resize moves nothing; a crop or camera-side decimation moves the wire ceiling.
- Remember the lens. Resizing cannot fix contrast the optics never delivered; if the lens is the limit, the machine vision lenses category is where the fix lives.
If the conclusion is that the camera in hand carries more pixels than the wire or the pipeline can use, size the next one from the feature math above: the camera finder filters by resolution and interface, and the configurator pairs the body with a lens that resolves it. The cameras topic collects the other node-order and buffer traps.
Questions
Why does setting Width and Height to half the sensor size not produce a scaled image?
Width and Height carry no scale meaning on an area sensor: they set how many pixels are read out, always at the native pitch. No GenICam feature shrinks a full field into fewer pixels. Half-size output comes from one of three places: a half-size window, which is a crop; a binning or decimation feature, if the sensor offers one; or a resize after transfer in your own code. Counting pixels across the smallest feature at the final scale, as the worked example does, tells you which of the three survives your smallest defect.
The captured image does not match the configured Width and Height — why?
Buffer geometry follows the acquisition stream, not your assumptions. Resolution-related settings take effect only once re-applied and the stream restarted, so read the delivered frame's dimensions back from your library instead of slicing the buffer to the configured values. If they still disagree, check the device's increment rules for Width, Height and the offsets, and confirm the byte-per-frame math against the pixel format — an 8-bit frame and a 10-bit frame of the same resolution differ in size.
Can the camera resize the image on its own?
Many sensors offer binning or decimation features, which act before the link. Binning sums adjacent pixels on the chip: 2 × 2 binning halves both dimensions and sums four pixels' worth of charge, a real gain in low light. Decimation skips pixels on the chip and cuts the payload like host-side nearest-neighbour, with the same aliasing risk. When the feature exists it beats any host-side resize, because the link never carries the full frame at all. Not every model offers both, so check the feature list of the camera you are sizing.
When is nearest-neighbour the right choice?
When speed matters and the values are not measurements: live preview and focus checks, gating frames before a heavier step, or feeding a detector that was trained on exactly that resampled geometry. It is also the only resize that never invents pixel values, which matters when pixels carry heights, counts or temperatures — blending them would produce numbers that were never measured.
Which interpolation suits OCR and text?
Linear usually reads better than nearest-neighbour, because it keeps thin strokes continuous instead of breaking them into dashes. Bicubic adds sharpness at higher CPU cost and can ring at high-contrast edges. Downscaling text past about 2 output pixels per stroke loses it in any method — if a code or character must survive, keep at least 3 pixels across its narrowest stroke, or shorten the working distance.

