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
| Step | Scratch, MV-CA050-12UM | Small field, MV-CH120-10UM | Origin |
|---|---|---|---|
| Field of view | 160 × 133.9 mm | 20 × 14.6 mm | width assumed, height from sensor aspect ratio |
| Working distance | 500 mm | 300 mm | assumption |
| Sampling across the width | 15.3 px/mm | 204.8 px/mm | calculated |
| Object pixel | 65.4 µm | 4.9 µm | calculated |
| Feature | 0.2 mm scratch | 0.05 mm interval | assumption |
| Nominal pixels across the feature | 3.1 px | 10.2 px | calculated |
| Pixel budget chosen | 5 px | 10 px | assumption |
| Smallest feature at that budget | 0.33 mm | 48.8 µm | calculated |
| Pixels needed across the width | 4000 px | 4000 px | calculated |
| Camera pixels across the width | 2448 px | 4096 px | datasheet |
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
- A camera is accepted because it beats the required resolution on one axis. That is only the sampling check. The second axis, lens contrast, motion blur and focus spread are still open. Look at an image of the part first.
- A decoder's minimum is carried into surface or dimensional work, where it fails quietly. ReadIDMax's 1.6 px holds for that tool, on symbols whose geometry it knows. Take a scratch or gauging tool's budget from its own documentation or a test on your samples.
- The object pixel is taken as the measurement error, and nobody can hold the spec. A fitted edge's error comes from calibration, edge definition and repeatability. Measure it with a calibration and repeated runs on your own parts.
- An example link's result is taken as a tolerance answer. The link opens the defect mode, where 0.05 mm is just a feature width. For a tolerance-based requirement, switch to the measurement mode.
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
- MVisionPro engineering calculator and Hikrobot catalog records (datasheet fields); calculations, the tool page and the public API were verified on 2026-09-21
- Teledyne DALSA, How to Select the Right Line Scan Camera for Your Application (section “Size (in sensor pixels)”, at least 3 or 4 pixels over the minimum defect): https://www.edmundoptics.com/document/download/545862 (checked 2026-09-21)
- Cognex, Calibration Accuracy (system accuracy depends on edge, target, lens, mounting, image quality and tool; the only way to determine it is to test): https://docs.cognex.com/is_613/web/EN/ise/Content/How_To/Calibration/CalibrationAccuracy.htm (checked 2026-09-21)
- Cognex, Sub-Pixel Accuracy (the location of the correlation-score peak is estimated with a mathematical model): https://docs.cognex.com/cvl_900/web/en/cvl_vision_tools/Content/Topics/VisionTools/Sub_Pixel_Accuracy.htm (checked 2026-09-21)
- Cognex, Sub-Pixel Edge Peak Detection (the meaningful sub-pixel component of an edge is perpendicular to that edge): https://docs.cognex.com/cvl_900/web/en/cvl_vision_tools/Content/Topics/VisionTools/Sub_Pixel_Edge_Peak_Dete.htm (checked 2026-09-21)
- OpenCV feature-detection reference, cornerSubPix (iterative refinement from local gradients with a search window and termination criteria): https://docs.opencv.org/3.0-beta/modules/imgproc/doc/feature_detection.html?highlight=cv2.cornersubpix (checked 2026-09-21)
- Edmund Optics, Resolution (an object-pixel calculation alone does not state what the system can distinguish): https://www.edmundoptics.com/knowledge-center/application-notes/imaging/resolution/ (checked 2026-09-21)
- Edmund Optics, MTF Curves and Lens Performance: https://www.edmundoptics.com/knowledge-center/application-notes/imaging/mtf-curves-and-lens-performance/ (checked 2026-09-21)
- Edmund Optics, Lens Performance Curves (distortion as field-dependent magnification): https://www.edmundoptics.com/knowledge-center/application-notes/imaging/lens-performance-curves/ (checked 2026-09-21)
- Cognex ReadIDMax reference (at least 1.6 px module width among the listed linear-code input requirements of that tool): https://support.cognex.com/docs/is_651/web/EN/ise/Content/Reference/ReadIDMax.htm (checked 2026-09-21)
- Teledyne DALSA BOA Spot ID announcement (1.5 px per bar or space for 1D and 2 px per cell for 2D for that product): https://www.teledynedalsa.com/en/news/newsroom/teledyne-dalsa-s-new-low-cost-id-vision-sensors-enable-faster-more-accurate-inspection/ (checked 2026-09-21)
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.