User Guide - madesjardins/AiWarmachine GitHub Wiki

Camera Calibration

  1. The first thing you need to do, is set a camera for the top view. Press the "Add" button and choose the device id of your webcam. This value is still editable after selection, so don't worry if you have more than one webcam, you'll be able to cycle through them to find the correct one, but in general it's going to be 0.

image

  1. You'll need to print a checkerboard, ideally on matte photo paper, and fix it on a hard straight surface. You can use this one checkerboard_large_23x18.pdf or create your own. I taped mine on an old glass cutting board to make sure it was flat.

  2. Next, set the "Capture Resolution", "Focus" and "Zoom" in order to see all the battlefield as clearly as possible. These values are locked after calibration as they might influence the results. If your frame rate is terrible, switch the "FourCC" setting to "MJPG". Because the MicroQR codes we're using needs to be small enough to fit inside a 30 mm base, I suggest using a resolution of 2560x1440 as it's a good compromise, but it also work with 1920x1080 and 3840x2160. It's important to have good lighting conditions. Resolution will impact performance, but for what we're doing, it won't really impact gameplay. Checking the "Display actual resolution" or pressing F key on the camera feed will show original scale of the video. To have less noise, I suggest setting the "Gain" to zero and then adjust the "Exposure". The higher the exposure, the lower the noise, but this has a huge impact on capture frame rate. We only need the webcam to detect black and white stuff (MicroQR and Checkerboard), so adjust other settings to make them look good.

image

  1. For the 3 calibration images, I suggest putting down the checkerboard on the table and taking your webcam in your hand as I find this easier, but you can also keep your webcam mounted and move the checkerboard in front. Frame your checkerboard, then press the calibration images buttons one by one. Each time, you have 3 seconds to adjust and it will use the latest valid frame. You'll notice colored lines and dots on intersections when a frame is valid. If you used a different checkerboard than the one provided, make sure to update the "Number of squares W/H" with the proper numbers.

image

  • For the "Top" image, go as close as you can and try to fill le left edge with squares.
  • For the "Front" image, tilt your camera up and try to fill the bottom edge with squares.
  • For the "Side" image, go back to the top position and tilt the camera on the side, trying to fill the right edge with squares.

You're 3 images should look like this:

image

Once all three images are set, press "Calibrate" button. This will calculate the lens distortion and intrinsic camera parameters. You should see in the command prompt or terminal the calibration error. To give you a hint, my values for the different resolutions are:

  • 1920x1080: 0.014
  • 2560x1440: 0.019
  • 3840x2160: 0.033
  1. Name this camera and potentially add a model name too to make it easily identifiable later on. Press the "Save" button. Next time you open the app, you can press "Load" and select your saved camera to load it.

image

Table Calibration

This is not really a table calibration, more a camera/projector/table alignment process, but the expression feels nice.

  1. If you unmounted the webcam for the camera calibration process, mount it back as described in the Setup Guide.

  2. Measure in mm the width (horizontal in camera) and length (vertical in camera) of your play area in real life. Try to be as precise as you can. Then choose a "Resolution Factor" which gives you approximately your projector resolution when you multiply the dimensions by this number. A value of 2 should be good for an HD projector.

image

  1. Align the corners with colored circle in the camera viewport with your table corners. First, click and drag the corners approximately, then use the "Display actual resolution" or F-key to align them as precisely as you can. Use the W, A, S, and D keys to move the last selected corner by one pixel if you need to. You can change your camera gain or brightness to help you temporarily align all 4 corners.

image

  1. Once all 4 corners in the camera viewport have been aligned, it's time to do the same with the projector. I find this step is easier when the lights are off. Open your projector and put the "Projector" dialog full screen on the projector output/monitor (for example, my 3rd monitor is also what I output to my projector) by pressing the F-key in it. Press the C-key to show the corners and you should at least see the borders on the table. The B-key makes the borders bolder if you need to. Like earlier, place the corners by clicking and dragging them approximately first in the "Projector" dialog. Even though corners are important too for the projector, I find it more important that the edges match as much as possible. Once done, you can press C-key inside the projector viewport to hide the borders.

image

  1. Press "Calibrate" button to lock your values and start the MicroQR scanner. Place a marker on the table at various positions or place multiple markers at once to verify the circle offset around your marker.

image

If you find it to pronounced in certain areas, press the "Uncalibrate" button for your table and adjust the projector corners a little. Repeat steps 8 and 9 until you are satisfied. It's possible the edges end up a tiny bit inside, don't worry, it's for the greater good.

If you need additional help for step 9, you can use the "Test Position" option in the "Debug" tab, simply check "Active" and put in a position. This will display a + sign in the camera viewport and project a + sign through the projector based on an in-game position. This is also a good test to verify how good your setup is by measuring in real life the projection. You can use the Page Up/Down keys in the position boxes change values by 10mm or the arrows for 1mm increment. Every time you load a table, you should verify the camera corners and projector borders as your mount, just like mine, might not be perfectly tight.

image

Voice recognition and narration

It's now time to choose your mic input and narrator. I find using a gaming headset or earbuds with mic works best as the music you're listening to and the narrator's voice won't interfere with the voice recognition.

  1. If you set your headset through windows, then using device 0 should be the good mic, otherwise, check in the dropdown menu for your device. Once you find it, use the "Test" button and say something like: "Hello, my name is {YOUR_NAME}, how are you ?". You should see written what you just said. You can have fun and try a bunch of stuff. Once satisfied, simply press "Stop" to stop the voice recognition.

image

  1. The virtual narrator is like the host of the game. By now you should have at least one voice in there to test out. Simply choose an entry in the dropdown menu and press "Speak" to test the sentence next to it. Once again, you can try a bunch of stuff to figure what narrator you would like.

image