An image subtraction algorithm is used in this project to recognize a moving object. The major reason for using this algorithm is that it is simple and can be implemented by the limited real-time processing capabilities of the image processing board. It turned out to work acceptably well. This method is used for recognizing the pinball and flippers. It simply compares the previous frame image with the current one. The result of the subtraction is visible from the monitor, which shows the same data as is ``seen'' by the computer, i.e. if something is moving, then a white pixel shows up on the screen in that position.
The two most recently acquired frames are subtracted in real time (continuous subtraction) using the FG-100-V image processing module. In the operating mode shown in Figure 5 (), the MUX (multiplexer) control bits are set to Mode 6; specifying that it is to input LUT select bits in the LUT six most significant memory bit-planes and the six most significant bits of data from the A/D (the analog-to-digital) converter to the Feedback/Input LUT (Look-Up Table).
Figure 5: Real-Time Subtraction Using Mode 6
In order to do this real-time operation, the LUT is programmed to update each pixel in the frame memory as follows ():
These operations are done in parallel, using the input data (frame memory pixel and video input) to index the new pixel.
A simplified example in Figure 6 illustrates how real-time subtraction is implemented. This example has 4 bit planes instead of 12: 2 bits for A/D and 2 bits for memory. For example, the values 10 (binary) for A/D and 11 (binary) for MEM go to the LUT. The programmable input LUT maps the concatenation of the old and new A/D values into the concatenation of the new A/D and output value. This output value is the function THRESHOLD( ABS(OLD-NEW) ), where THRESHOLD(X) is ``If X is greater than or equal to the threshold value, the output will be 11, otherwise the output will be 00.'' In other words, if the result of subtraction is greater than equal to the threshold value, 10, then the output value will be 11 , otherwise it will be 00.
Now the value 11 is displayed as a white pixel, which represents a part of a moving object and the value 00 is displayed as a black pixel which is the normal background of the screen. Two bits from A/D (10 in the example) and the result of subtraction (01 in the example) go to the frame memory. The top two bits from A/D will be taken as memory bits for the next frame processing and the bottom two bits from THRESHOLD(MEM-A/D) will be displayed. However, what is stored in the LUT is the output value, 1000 as circled in Figure 6 , not A/D with the result of subtraction, which is 1001.
Figure 6: Example of 4-bit LUT ( d = TRESHOLD(MEM-A/D) )