'How to efficiently find and parse custom data pattern (like QR-codes) in video frame?

I got an interesting challenge for you.

I want to transfer big amounts of data through a video medium (say, computer monitor facing a another computer's webcam). Please don't ask why, I am aware there are much better ways to transfer data, this is my only option.

What I want is pretty much exactly like QR-Codes, but with a much bigger capacity for data. QR-Codes can encode upto 2,953 bytes, the custom format I came up with can encode up to ~12,805 bytes using a 200x200 PNG image.

How I did this wasn't very hard, I basically generate an image where each three pixels represent one byte (instead of QR-Code's 8 pixels per byte) and using a combination of seven predefined colors, I can represent all 256 byte combinations.

The Challenge

But anyways, that's not the part I am struggling with.

The part I want some guidance with is how to write the code that will actually parse each frame from the target's webcam, find my data pattern marks in the frame, and parse the pixels.

What I Tried

I tried to do this the naive way, just looping pixel by pixel, but that's hopelessly slow and ineffecient, there has to be a better and faster way to find, detect, and parse data patterns in an image frame.

I tried Googling this problem, but all I got was "how to write QR reader app" and stuff like that - meaning, just how to create a basic app that uses QR as a format, not how to create a 'custom' QR-like reader..

I also noticed this question, and it is the closest existing question I could find that discusses what I want to do. I am referencing this here to help you understand what I am trying to achieve.

Programming Language

I thought of using C# to write this program, but am open to suggestions for other languages that might be better at handling this task.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source