MVisionPro Engineering Library · guide

Deciding how many pixels a feature needs before you choose a camera

In short

First decide the job: spotting a feature, measuring it in calibrated millimetres, or rejecting parts on it. If the tool for that job publishes a pixel minimum, use it as your budget. Otherwise use our rule of thumb: 3 px for presence, 5 px for detection, 10 px for size. The calculator gives the nominal pixel count across the feature and the resolution one axis needs. Then test detection, measurement error and reject errors separately, with your real tool on representative parts.

One pixel count, three questions

Sampling is how many pixels land on each millimetre of the part. Object-pixel size is the distance on the part that one image pixel represents. Sampling times a feature's width gives pixels per feature. The field of view reference page has the formulas.

A feature is detected when the algorithm tells it from the background often enough. That must hold under the variation you specified: lighting, surface finish, orientation and part-to-part spread. Sampling is one input, next to contrast and the tool. The rate comes from a run on real parts.

A feature is measurable when three more things are in place. The tool fits a defined edge or model. A calibration maps image coordinates to millimetres. A test states the error, or the measurement uncertainty of a result. Whole-system accuracy depends on the part edge, calibration target, lens, mounting, image quality and tool, and only a test shows it.

A part is rejectable when a decision threshold sits on that measurement. Someone must also have counted how often it passes bad parts and rejects good ones.

Mixing the three up causes the usual failure: a camera chosen for the first question and judged on the third at acceptance.

Where 3, 5 and 10 pixels come from

Our budgets of 3, 5 and 10 px come from engineering practice, not physics. So does our 16 px per character height for text and codes. A line-scan selection note gives a rule of the same kind: at least 3 or 4 pixels across the smallest defect (Teledyne DALSA application note). The note still ends with a test.

Pixel minimums belong to algorithms. The ReadIDMax tool for linear codes lists at least 1.6 px of module width among its input requirements (Cognex documentation). The BOA Spot ID product states 1.5 px per bar or space for 1D codes and 2 px per cell for 2D (Teledyne DALSA documentation). Each figure is stated for that decoder and code type only.

What sub-pixel localization can and cannot do

Sub-pixel localization estimates a position between pixel centres by fitting a model to the pixels around it. It places a correlation peak in Cognex search tools, and refines a corner from local image gradients in OpenCV's cornerSubPix. Like reading a ruler between two marks, it estimates from samples you already have. The pixel pitch, the spacing between pixels, does not change. The estimate's bias and spread depend on edge shape, signal-to-noise ratio, optics and calibration. A clean edge and a soft one with the same pixel count can come out differently. On an edge, the sub-pixel gain runs across the edge, not along it. Measure that error on your own parts before you quote it.

Worked example: a 0.2 mm scratch and a 0.05 mm interval

StepScratch, MV-CA050-12UMSmall field, MV-CH120-10UMOrigin
Field of view160 × 133.9 mm20 × 14.6 mmwidth assumed, height from sensor aspect ratio
Working distance500 mm300 mmassumption
Sampling across the width15.3 px/mm204.8 px/mmcalculated
Object pixel65.4 µm4.9 µmcalculated
Feature0.2 mm scratch0.05 mm intervalassumption
Nominal pixels across the feature3.1 px10.2 pxcalculated
Pixel budget chosen5 px10 pxassumption
Smallest feature at that budget0.33 mm48.8 µmcalculated
Pixels needed across the width4000 px4000 pxcalculated
Camera pixels across the width2448 px4096 pxdatasheet

The scratch spans 3.1 px: just above our 3 px presence line, below the 5 px budget. So this camera falls short of the 4000 px that budget needs. Neither number is a detection rate. The scratch's contrast and orientation, the lighting, the lens and the algorithm are not given here, and each moves the result.

The small-field case needs the same 4000 px from very different geometry, and calls for very different checks. The 0.05 mm interval spans 10.2 px, and a 10 mm diameter would span 2048 px (calculated). The calculator returns calibration_required, and rightly so. You get a 4.9 µm object pixel, but nothing on edge bias, repeatability or whether the part is in tolerance. The drawing must still say whether 0.05 mm is a total width or a ± band. Here it is only a sampled interval.

Calculate for your case

Both links carry the whole scenario in the address. Open the scratch case or the small-field case and put in your own values. Both set the speed to 0 mm/s, so enter your line speed if you also need the exposure limit.

The page also has a measurement mode that the links do not open. You type in an accuracy target and the pixels you want across it. For the small-field case, a 0.05 mm target with 10 px allows at most 5 µm per pixel: 4000 px across 20 mm, or 200 px/mm (calculated). This camera gives 204.8 px/mm. That is a sampling requirement: accuracy still needs calibration.

The public optics API has no accuracy-target parameter. For a tolerance question, use the page, or send us the tolerance with the drawing and we will run the case.

Equipment that fits this example

The table's cameras are named for their pixel counts only. MV-CA050-12UM has 2448 × 2048 px and MV-CH120-10UM has 4096 × 3000 px, both with 3.45 µm pixels (datasheet).

For the scratch case, MV-CH240-10YM-C-NN has 5312 × 4608 px at 2.74 µm (datasheet), more than the 4000 px needed across the width. That solves the arithmetic only. The focal length for the same field, the mount and whether the lens's image circle covers the sensor are still open. Send us the part number, and we will confirm the pairing.

Common mistakes

When this rule breaks

The sampling formulas work one axis at a time and know nothing about optics. A feature at an angle shows a different width on the axis you entered. Enter that projected width.

At the same local magnification, a feature keeps its nominal count anywhere in the frame. Only a specific cause changes it, such as distortion, a perspective angle or a different projected width. Corner brightness and contrast, and the contrast the lens transfers, can still drop on their own. Check the same feature at the centre and the edge with your lens and mounting. A detection can fail in a weak corner at the same nominal count.

The arithmetic also returns counts below two pixels as readily as above. What such a count is worth depends on the signal, the optics and the algorithm.

Lens contrast at your feature size, lighting and focus all act before the sensor samples anything. So an object-pixel figure cannot say what the system can tell apart. Motion uses up the same budget: blur in pixels is speed times exposure time times pixels per millimetre. Defocus changes edge contrast, not the pixel pitch. The exposure and strobe article and the depth-of-field article cover both.

Next step

Write down four things before you ask for a camera: the field on a named axis, the smallest feature you must act on, the decision you will make, and the tool that will make it. Send them with your parts. We will recalculate the nominal sampling and write a test plan for that decision: what to run on representative parts and what result counts as a pass.

Sources

Related

How this material was prepared

Prepared by MVisionPro from the stated sources and the MVisionPro calculation engine. A physical test is claimed only when the material says so explicitly. Read the editorial method.

Editorial status: verified. Content updated 2026-09-23.