User Tools

Site Tools


notes:manual-calibration

Manual Calibration

Some notes on calibrating folk manually.

Folk needs to be able to map from camera coordinates to projector coordinates in order to be able to project onto the pages where it sees april tags. At the moment Folk can do this with four validly mapped point-pairs.

Folk reads a calibration from ~/generated-calibration.tcl. Here is an example:

  namespace eval generatedCalibration {
      variable cameraWidth 1280
      variable cameraHeight 720
      variable displayWidth 1920
      variable displayHeight 1080
      variable points { \
    {331 48 1736 771} \
          {236 407 1262 95} \
          {687 671 300 280} \
          {818 309 558 990} }
  }
  

Those point-pairs are arranged as {camera-x camera-y projector-x projector-y}.

For manual calibration, the goal is to find four that are correct for your system. You can do this by using the following two programs. One lets you pick a projector point using an april tag as a pointer. The other tells you where in camera-space the given april tag is. Both use the bottom left interior corner of the april tag as the reference.

When tag $this has corners /corners/ {
  lassign $corners a b c d
  set a [lmap l $a {int $l}]

  lassign $a a1 a2
  
  # you may want to play with these numbers a bit to get a comfy pointer range
  set g1 [- 2000 [* $a1 2]]
  set g2 [- 1300 [* $a2 2]]

  set guess "$g1 $g2"

  set v0 {50 50}
  set v1 {50 -50}
  
  Display::stroke [list [add $guess $v0] [sub $guess $v0]] 5 blue
  Display::stroke [list [add $guess $v1] [sub $guess $v1]] 5 blue

  Display::text 1350 730 1 "projector point is $guess" 0
}
When tag $this has corners /corners/ {
  lassign $corners a b c d
  set a [lmap l $a {int $l}]
  Display::text 1350 700 1 "camera point is $a" 0
  Claim camera point is $a
}

Then it's down to manually recording four point-mappings and you're good to go!

notes/manual-calibration.txt · Last modified: 2023/09/26 03:44 by osnr

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki