For a project I am working on I'd like to be able to detect unique icons/barcodes in video footage. Suppose you have 10 people in the frame where each person is wearing a t-shirt with a similar but unique identifier (something like a barcode) and the programme is to detect each unique identifier.

Here are three options I'm working with now and associated drawbacks:

  1. Using brute force feature matching (SURF, SIFT or ORB) - not sure how accurate this would be in real-world scenarios as people move and rotate so to if the identifiers are very similar can this still achieve good accuracy?
    1. Training tiny YOLO model. Now this seems like a good option but is not very scalable and it just seems like there's a simpler solution
    2. Simple template matching - is not a very good option due to changing perspective, size and angles

Any advise would be highly appreciated!


I'd like to add some images for context. The idea is that each person would have a logo with a unique binary patter around it. See images below:

Unique ID-1 Unique ID-2

As you can see the two are similar but not the same due to the stripes around it.

I'm applying an Adoptive Gaussian Blur to it and getting 'barcode' like images that are clearly different

Unique ID-1 Unique ID-2

Now, it doesn't seem to me that normal SURF matching would be able to recognise the subtle difference in two images at least not reliably

  • $\begingroup$ You actually threshoulded borders, this will create more keypoints and slow down surf. You could use some of the tips in here to detect circles and arcs. $\endgroup$ Apr 16, 2019 at 13:57
  • $\begingroup$ Adaptive Threshold Mean actually gives me solid lines, so a quick fix there. The bigger problem, at least from my perspective is actually matching keypoints correctly. i.e. as these are just solid round lines, how can I force SURF to look not just at individual keypoints but also at the length and position of white gaps (as would with barcode scenario) $\endgroup$ Apr 16, 2019 at 14:29

1 Answer 1


Well, the first thing you need to consider about bar codes/QR Codes is that they are usually black with white background.

If T-Shirts or Unique tags are been used, they should follow this pattern (or any one). You should be able to easily detect these. Take for example this image processing class at the end there is a bar-code example, which here I reproduce:

0 - Given a image:


1 - You can binarize by converting to grayscale and then performing adaptive threshoulding, which is basically a clustering algorithm for pixels:

enter image description here

2 - Then you can filter blobs by eccentricity

enter image description here

3 - Then by major axis:

enter image description here

4 - And finally by orientation

enter image description here

This is a basic algorithm for segmenting bar-codes on hard surfaces. A T-shirt will render distorted bar-codes, but if you can narrow down the search region by detecting probable bar-codes in binary images you probably will get a large speed-up for then use of more complex algorithms such as the ones you propose.


1 - Add a FCN to regenerate image distorted by T-Shirt surface before step (3) in the previous algorithm

2 - Train a CNN to detect bar-code blobs on binary images (substituting steps 2,3 and 4)


I will add another answer since you changed a bit the question by giving examples. Your unique identifiers seen to be compose of a fixed center (equal to all identifiers) with concentric arcs of 3 different radius $r_1 < r_2 < r_3$ and the arcs with radius $r_2$ and $r_3$ are punctured with holes that are supposed to make them different from in each identifier.

You can use threshoulding and Hough transform to identify the circles, you can use the center as reference to calculate the angular distance between the holes. Then you can differ an identifier from another by:

  • Counting holes and then
  • Analyzing their angular distance

You can also use the arcs to predict/calculate the transformations suffered by the identifier by image distortions (rotation, shifting, non-linear transformation) and correct them.

  • $\begingroup$ Thank you, this is very helpful! A couple of follow up questions: 1) could you provide more info on the FCN suggestion, I'm not familiar with the acronym 2) How much slower would my implementation be using a CNN? $\endgroup$ Apr 16, 2019 at 11:13
  • $\begingroup$ Fully Convolutional Network $\endgroup$ Apr 16, 2019 at 12:59
  • $\begingroup$ CNNs are actually not that slow. You can run Yolo up to 1500 FPS with proper CPU and settings.It depends on the architecture $\endgroup$ Apr 16, 2019 at 13:01
  • $\begingroup$ Thanks, I've added some reference 'barcodes' that I was referring to earlier. Do you think CNN would pick up subtle differences as depicted? $\endgroup$ Apr 16, 2019 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.