How do PrefOccurrence and MinOccurrence work
As the toolkit scans the images in a document, it assigns a “hit-count” to each barcode-like pattern it finds. The hit-count for a very clear barcode will typically be in the region 20 to 100, depending on the size of the barcode and the settings used within the sdk. The PrefOccurrence and MinOccurrence properties specify hit-count levels for the toolkit to use when deciding which barcodes to report and which to ignore. The PrefOccurrence property is the “preferred occurrence” for a barcode and currently defaults to value of 5. Any barcode with a hit-count greater than or equal to PrefOccurrence will be reported by the toolkit. Some documents contain difficult to read barcodes with very low hit-counts – lower than PrefOccurrence. In this case, if all of the barcodes have hit-counts lower than PrefOccurrence, then the toolkit will report the barcode with the most hits – so long as this figure is greater than or equal to MinOccurrence (minimum occurrence).
Consider the case of a 3 page document with barcodes on each page:
Page 1: Barcode 0001 with hit-count 12
Page 2: Barcode 0002 with hit-count 4
Page 3: Barcode 0003 with hit-count 7
With default settings except for MultipleRead = true, the toolkit will only report the barcodes on pages 1 and 3 because the barcode on page 2 has a hit-count less then PrefOccurrence (5).
If we now set PageNo = 2 (so we only scan page 2) then the barcode “0002” is reported, because no other barcodes were found with a hit-count >= PrefOccurrence (5) and the hit-count for this barcode is >= MinOccurrence (2).
With PageNo back to 0 (scan all pages) and PrefOccurrence = 4 the toolkit will report all 3 barcodes because all the hit-counts are now >= PrefOccurrence (4).
In conclusion, the purpose of MinOccurrence is to allow the capture of poor quality barcodes whilst minimising the number of false positive readings in documents containing good quality barcodes.