CodeRigor

GUIDED LESSON / 1 OF 6

Define a marker worth recording

Specify the input, event and failure cases before opening a camera.

What moves through this step
  1. 01Printed marker
  2. 02Validated label
  3. 03Cooldown policy
  4. 04JSONL event

Make the result concrete

Place a printed QR marker on a project box, point a camera at it, and get one readable event such as BOX_A. Holding the marker in view should not fill the log with hundreds of copies. Moving it away and returning after five seconds may create another event.

Our marker format is CRIGOR: followed by one to twenty-four uppercase letters, digits, underscores or hyphens; the first character after the colon is a letter or digit. A decoded web address is ordinary untrusted text. This program never follows it, executes it or treats it as a filename.

The downloadable project has a camera-independent policy in journal.py, a camera adapter in camera.py and desktop tests. Unzip it into a new directory and run:

Bash
python3 -m unittest -v

The tests need only Python's standard library. A passing test establishes the label and timing policy; it does not establish camera compatibility or recognition accuracy.

Sketch the event

A record contains the approved label, a monotonic elapsed-time value and a UTC timestamp added at the camera boundary. UTC is useful to a reader. A monotonic clock measures the cooldown because wall time can be adjusted.

Try it

Write down what should happen for an empty result, a marker held for four seconds, a different marker and a return after five seconds. Keep those four cases beside your camera during the final build. If Python functions and files are unfamiliar, follow the preparation links first.