Touch Calibration

The WiimoteWhiteboard software has two graphical user interfaces: the main control panel and a four-point calibration form. The purpose of the calibration form is to obtain the four pairs of points needed to compute the homography matrix described earlier. It is a full-screen window that displays four crosshairs sequentially at known locations near each corner of the display. The user places the IR pen at each crosshair location, activates the LED, the camera sees the dot, the software pairs the dot location with the known display coordinates of the crosshair, and then proceeds to the next crosshair. Once all four points have been registered, we have enough information to compute the homography matrix and can begin simulating the mouse.

Let's begin by creating our Calibration Form. First we need add a new Windows Form to our project. In the Solution Explorer, right-click on your project name, which should bring up a menu. Navigate to Add →New Item, select Windows Form from the choice of templates, and name it CalibrationForm.cs or CalibrationForm.vb, depending on your language of choice.

We must set up the form's properties so it will show up as a full-screen window. To do this, set the FormBorderStyle property to None, and StartPosition to Manual. Later, in code, we will manually assign the window position and size to cover the screen.

We want to be able to draw into this form, and one way to do that is to draw into a PictureBox object. From the Toolbox panel, select ...

Get Coding4Fun now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.