Counting Products and Cartons with Cameras: How Missing-Item Checks Work
Business

Counting Products and Cartons with Cameras: How Missing-Item Checks Work

Name the counting job first, cover the layers a camera cannot see with a scale, and judge the system with challenge cartons per SKU, not with a net count difference.

Short answer

Product counting with a camera serves three different jobs: tracking items on a conveyor and counting each once as it crosses a virtual line, checking every slot of a carton before it is closed, and counting cartons on a pallet from the outside faces and the stacking pattern. A camera counts only what it sees, so hidden layers need a per-layer check or a checkweigher. Judge the system by counting error per 1,000 items, short-carton escape rate and false stop rate, per SKU and at full line speed.

How does product counting with a camera work, and which counting job is it for?

Product counting with a camera covers three different jobs, each with its own set-up: counting items passing a point on a conveyor, checking that a carton or tray holds the expected items before it is closed, and counting cartons on a pallet. Before buying a "product counting system", establish which job you mean:

  • Counting in the flow: items passing a point on a conveyor, to reconcile production with shipments.
  • Missing-item check in a case: the expected count and arrangement in a carton, tray or blister, to stop short cartons.
  • Pallet carton count: cartons on a pallet or in a stack, as a last check before dispatch.

If customers receive short cartons, the problem is usually the second job; if production numbers never match shipments, it is the first or the third.

What can a camera count reliably, and what can it not?

A camera counts only what it can see: it is reliable for items that stand apart from each other and the background, and not enough on its own for hidden, covered or background-coloured items. A camera looking down into a carton sees only the top layer; in a two-layer carton, a missing item underneath leaves no trace as long as the top layer is complete. That is geometry, not a model problem.

In return, a camera can separate touching items, count product types separately, say which slot is empty and keep a proof image of every decision; a photoelectric sensor or a scale cannot.

How does conveyor counting with vision work?

Conveyor counting vision draws a virtual line in the image, tracks each item from frame to frame and counts it once, when it crosses the line. The documentation for the LineZone counter in the open-source Supervision library shows the logic: it ignores detections without a confirmed tracker ID, counts each direction separately, and can require an object to be seen on the far side for several consecutive observations before a crossing counts. A box jittering on the line is not counted twice, and an item carried back by a reversing belt is counted in the other direction and subtracted.

The hard part is items that touch or overlap. With gaps between items and good contrast, classic blob analysis (thresholding, finding connected regions, filtering by area) is fast and easy to explain. The OpenCV watershed tutorial shows touching coins that still touch after thresholding, and separates them by combining a distance transform with marker-based watershed. When types are mixed or items partly overlap, you need an object detection model trained on labelled images. Overlap also disturbs tracking: the ByteTrack paper notes that most trackers discard low-score detections such as occluded objects, causing missed objects and fragmented trajectories. A broken track that resumes under a new ID can count one item twice.

When items travel as a bulk pile, density estimation can replace detecting each one. Lempitsky and Zisserman's Learning To Count Objects in Images estimates an image density whose integral over a region gives the number of objects in it. That is an estimate; if the count is the unit you sell, singulate the flow. Matching identities across several cameras is a separate topic, not covered here.

How do you set up a missing-item check before a carton is closed?

A missing-item check uses a camera looking straight down into the carton, before it is closed, to confirm that every slot of the expected pattern holds the right item. With a fixed pattern such as 3 by 4, each slot is checked: is there an item, is it the right one, is it sitting correctly? That beats a total count: one empty slot and one extra item give the right total and a wrong carton. The image is triggered by a carton-present sensor or encoder pulse, not a software timer.

In multi-layer cartons each layer is checked after it is placed, usually with a second camera at the layer-forming station. Where that is impractical, the camera checks the top layer and a checkweigher the total weight. The OIML R 51-1 recommendation defines a checkweigher as an automatic catchweigher that sub-divides prepackages into two or more sub-groups according to the difference between their mass and the nominal set point. A scale does not know where the gap is, and if one item weighs little next to normal item and packaging variation, it may miss the shortage altogether. Camera and scale are not substitutes; each covers the other's blind spot.

Can cartons on a pallet be counted with a camera?

Yes, but since a camera sees only the outside faces, a pallet carton count is a calculation from the known stacking pattern on single-product pallets, and a label-reading job on mixed pallets. On a single-product pallet, layers and arrangement are read from two or four faces and compared with the pattern. A missing carton in the middle shows on no face, so counting layer by layer during palletising beats counting a wrapped pallet. On mixed pallets, label product codes are read and matched to the dispatch order.

Photoelectric sensor, checkweigher or camera: which fits which counting job?

A photoelectric sensor is enough for single-file, spaced, same-type items; a checkweigher is enough when total weight reliably reveals a shortage; a camera wins when items touch, types are mixed, or you need the position of the gap or a proof image. Yabanova and Yumurtacı's paper on counting moving products draws the same line: standard-shaped products passing one at a time are easily counted with reflective photoelectric sensors, while irregular products that move in groups and change position call for infrared-based systems or machine vision.

Counting jobPhotoelectric sensorCheckweigherCameraWhere to start
Single-file, spaced, same-type flowEnoughNot neededNot neededSensor; a sensor pair if items can move backwards
Touching items, random orientationCounts touching items as oneNot suitableBlob analysis or detection model plus trackingOpen up the flow first, otherwise camera
Bulk flowNot suitableTotal massEstimated count by density methodsSingulate if the count is the selling unit
Single-layer carton, tray or blisterNot suitableCatches a shortage if the weight gap is large enoughShows the empty slot and wrong itemCamera with proof image
Multi-layer cartonNot suitableCatches a total shortageSees only the visible layerCamera per layer, or top-layer camera plus checkweigher
Single-product palletNot suitableRough checkOutside faces plus stacking patternCount layer by layer while palletising
Mixed palletNot suitableRough checkThrough label and barcode readingMatch carton by carton to the dispatch order

How do lighting, camera position and packaging affect the count?

Lighting and camera position often decide accuracy before the model does: no method reliably counts an item that does not stand out from its background.

  • Glossy stretch or shrink film: direct light causes glare; diffuse dome lighting or a polarising filter reduces it.
  • Transparent packaging or products: a backlight for a silhouette, or angled light that picks out edges.
  • Dark items on a dark belt: a different belt colour, a backlight, or a depth camera that measures height.
  • Camera position: straight down for cartons and trays; for flow counting, just after an accelerating belt that opens up the gaps.

Resolution, exposure and triggering are covered in our article on the engineering reality of computer vision for quality control.

How is the count connected to the line and to ERP?

A count is useful only when it is recorded against its production order and SKU; a bare counter value reconciles nothing.

  • Recipe selection: expected count and pattern load from the SKU of the active order in MES, ERP or the PLC, not by operator choice.
  • Short carton: reject or stop, with a separate sensor confirming the reject gate fired.
  • Uncertain result: an image that cannot be evaluated (glare, skewed carton) is not a pass; the carton goes to a manual check, and that rate is tracked.
  • Pushing counts: at order close, counted, rejected and manually checked quantities go to MES or ERP.
  • Proof image: stored with order, SKU, time and carton label number, so a customer claim can be answered with that carton's picture.

What data does a pilot need, and how is success measured?

A pilot needs complete and deliberately short cartons for every SKU, images at line speed, access to sensor and PLC signals and a line owner who signs off results, but no large labelled archive. Success is three separate numbers, with targets set from your own error costs and measured baseline, not a vendor brochure:

  1. Counting error per 1,000 items: the same flow is counted independently, by hand or from video, and misses and double counts are added up separately. Net difference misleads: 10 misses and 10 double counts give zero.
  2. Short-carton escape rate: in a challenge test, how many of 100 deliberately short cartons got through. Spread the empty slots across corners, middle and bottom layer.
  3. False stop rate: how many of 1,000 complete cartons were stopped or rejected for no reason.

Report each number per SKU and at full line speed. The line team, not the system's builders, should feed in challenge cartons at random times. Writing acceptance criteria and sizing the sample are covered in our article on acceptance tests for a vision inspection pilot.

Hypothetical example: how do you measure missing packs in a biscuit carton?

The following example is hypothetical; the numbers only illustrate the method. A biscuit maker packs 24 packs per carton in two layers of 3 by 4 and runs two SKUs on one line at 20 cartons per minute. It installs a camera that looks at each layer after placement and keeps its end-of-line checkweigher.

For flow counting, 10,000 packs on the conveyor before packing are counted independently from video. The system counts 9,994, a net difference of only 6, but the video shows 11 packs missed and 5 counted twice. The counting error is (11 + 5) / 10,000, or 1.6 per 1,000 packs.

In the challenge test, the line team feeds in 200 short cartons at random times during a shift, with the empty slot in different positions. The system stops 196: an escape rate of 4 / 200 = 2%. All four gaps sat in the corner with the strongest film glare, so the lighting angle is changed and the test repeated. The 9,600 complete cartons in the same 8-hour shift produce 12 false stops, or 1.25 per 1,000. Split by SKU, 10 of the 12 come from the glossy second product; the average had hidden it. Acceptance is decided per SKU.

What makes a quote bigger or smaller?

The number of SKUs and patterns, line speed, inspection points and integration depth set the size of the job, so a price is written item by item after the keşif (the discovery look at your line). Checking every layer, multi-face pallet counting, glossy or transparent packaging, bulk flow and a new reject mechanism make it bigger. A good quote itemises hardware (cameras, lenses, lighting, enclosure, trigger sensor), sample collection and labelling, software, PLC and ERP integration, commissioning with the challenge test, and monitoring after go-live.

Why do counting projects fail?

They usually fail on measurement and set-up, not on the model:

  • Assuming a top-down camera also checks the bottom layer of a multi-layer carton.
  • Reporting counting error as a net difference.
  • Triggering on a timer instead of the carton's position.
  • Not measuring false stops, so operators bypass a system that stops too often.
  • Storing proof images without order and carton number.

Hatson Tech builds counting and missing-item checks like these as part of its image recognition and computer vision service. If you would like to look at the counting job on your line and which method fits it, the first meeting and the keşif are free.

Key takeaways

  • Conveyor counting, missing-item checks in a case and pallet carton counts are different jobs; write down which one you are solving before choosing a system.
  • In the flow, track each item and count it once when it crosses a virtual line; keep the two directions separate so items carried back are subtracted.
  • A top-down camera sees only the top layer; check each layer of a multi-layer carton or combine the camera with a checkweigher.
  • Measure counting error per 1,000 items by adding misses and double counts separately, never as a net difference.
  • Measure the escape rate with deliberately short cartons and the false stop rate with complete ones, per SKU and at full line speed.
  • Tie every count to its production order and SKU, and store each proof image with the carton number so customer claims can be checked.

Frequently asked questions

How much does a carton counting system cost?

There is no fixed price. The number of SKUs and patterns, line speed, how many viewpoints are needed, glossy or transparent packaging, the reject mechanism and the ERP integration drive the cost. A quote should be written after seeing the line, with hardware, software, integration and commissioning itemised separately.

Can we use the cameras already on our line?

Sometimes. An existing camera works if it looks at the product from the right angle, can be triggered by carton position and gives a sharp image at line speed. Security cameras rarely meet these conditions: their angles are oblique and their exposure is not set for moving products. Start the pilot with existing images and add lighting or cameras if they fall short.

Do we still need a camera if we have a checkweigher?

A checkweigher catches a missing item when one item's weight stands out clearly from the normal variation of items and packaging. It does not show which slot is empty, a wrong item or an upside-down item, and it gives no proof image for a customer claim. For light items and mixed cartons, a camera closes that gap.

Will a counting camera replace the operator?

It takes over the counting and the check, not the operator. Inspecting stopped cartons, reviewing images that could not be evaluated, setting up new SKUs and watching that the reject mechanism works remain the line team's job. A well-built system points the operator's attention at the cartons that need it.

Can the counts be sent to our ERP?

Yes. Counted and rejected quantities can be written to MES or ERP with the production order and SKU when the order closes. That needs a way in, such as an ERP interface or a staging table; which route to use is settled during the discovery work.

Do we have to rebuild the system when a new product is added?

No, but a new SKU must be set up before it reaches the line: its pattern, expected count and, where needed, sample images. For packaging similar to existing products this is a short job; very different gloss, colour or size may need lighting changes and new labelled samples. Run a short challenge test for the new product too.

All articles