A Projector-Camera System for Augmented Card Playing and a Case Study with the Pelmanism Game

In this article, we propose a system for augmented card playing with a projector and a camera to add playfulness and increase communication among players of a traditional card game. The functionalities were derived on the basis of a user survey session with actual players. Playing cards are recognized using a video camera on the basis of a template matching without any artificial marker with an accuracy of > 0.96. Players are also tracked to provide person-dependent services using a video camera from the direction of their hands appearing over a table. These functions are provided as an API; therefore, the user of our system, i.e., a developer, can easily augment playing card games. The Pelmanism game was augmented on top of the system to validate the concept of augmentation. The results showed the feasibility of the system’s performance in an actual environment and the potential of enhancing playfulness and communication among players. Received on 14 April 2016; accepted on 02 July 2016; published on 17 May 2017


Introduction
Playing cards is popular worldwide regardless of age.Players can easily converse during games, with the result that playing cards appears to be the most popular recreational activity in many families [1].In addition, as Ono stated in her book [14], playing cards is effective in children's education because card games utilize a wide variety of cards, require skillful finger activity, and provide a child with a sense of competition.Thus, playing cards acts as multipurpose tools with a variety of benefits.
In addition, the popularity and feasibility of recent augmented reality (AR) technology inspired us to attempt to augment the playfulness and communication of playing cards that have many faces.The advancement of technologies such as image analysis and high performance devices has allowed us to obtain substantial amount of information in the real world.In addition, projectors are decreasing in size and increasing in intensity; therefore, many studies of AR technology with a projector-camera system such as chemical experiment support systems [18], cooking support systems [20], and handheld interfaces for interacting with arbitrary physical surfaces [24] have been conducted.In this article, we adopt the approach of using a projectorcamera system to achieve augmented card playing.A video camera is set above the table to recognize the cards and a players' hand.A video projector is used to project visual effects that aim to add playfulness and assist a player in recognizing cards to improve the accuracy of recognition.
The remainder of the article is organized as follows.We examine related work in Section 2. A user survey is presented in Section 3 to investigate users' requests for augmented card playing and the card recognition algorithm, followed by the design of a prototype system.Section 4 depicts an evaluation of the card recognition and augmentation of playfulness, for which the Pelmanism game is developed and tested as a case study.We discuss these results in Section 5. Finally, Section 6 concludes the article and discusses future directions.

Related Work
In the AR technology, a number of studies have been proposed to ascertain the benefits of digital information.For example, Sokan et al. developed a chemistry experiment support system [18], and Suzuki et al. proposed a cooking support system [20].These studies aim to support on-site safety training and train novices using a projector-camera system that recognizes a user's condition and provides digital information.
In addition, design guidelines for augmented reality games have been proposed by Wetzel et al [22].They argued that it is important to take advantage of the space and objects of reality, as in our study.Hinske et al. also augmented a traditional game environment digitally [9].However, we chose our augmentation policies based on a preliminary survey.We consider that the use of traditional and familiar tools is important, and therefore decided that we could not benefit from their guidelines.
Iwata et al. augmented the ancient Japanese game "Go" [10], and Suganuma et al. developed a support system for beginners of billiards [19].These studies relate to our study in terms of using traditional tools, focusing on original look-and-feel, and projecting onto an actual workspace.They suggest the suitability of a projectorcamera system for our system.Furthermore, there have been studies that combine card playing with information and communication technology (ICT).The EmoPoker system focuses on playing poker and aims at making players aware of their arousal levels by providing biofeedback [23].Surface-Poker, a multimodal interface system, uses physiological inputs and gestures to augment a traditional board game [4].These studies suggest the possibility that playing cards will become a powerful tool which used for augmenting communication and entertainment with ICT.Floerkmeier, et al. proposed Smart Playing Cards with a radio-frequency identification (RFID) system, in which an RFID tag is attached to each card to provide novice players with advice on strategy and automate scoring, for example [5].By contrast, our system takes an input from a video camera as a source of card-related information, with no need for specially manufactured cards.

User Survey
We conducted a preliminary survey to understand users' requests for augmented card playing.Twelve university students (ages: 21-25 years) played four types of games, Pelmanism, Sevens, Old maid, and President, and expressed their opinions.Some of these are shown below: • "I want to decide the order of players automatically when a game starts." • "It is necessary to make it clear whose turn it is." • "I want the system to inform me regarding the outcome of my choice." • "Please give me hints." • "Visual effects make games funny." • "It is better if there is background music." Recognition of the cards' numbers and the suits is required to decide the order of players and to inform players of the outcome of their choice.To provide hints, it is necessary to recognize cards and players.In addition, a number of subjects pointed out that visual and auditory effects make a game more exciting.We specified three features as core functionalities of augmented card playing: • Recognition of cards, e.g., ace of hearts

• Recognition of players
• Visual and auditory effects A wide variety of functions, such as keeping score automatically, providing advice to beginners, and exciting players through feedback, can be implemented using these features.We show a concrete example of augmented card playing based on these core functionalities in later section.

Projector-camera System for Natural Augmentation of Card Playing
Our proposed system recognizes cards on a table using a video camera and provides various feedback to players through a projector facing down at the table and a loud speaker (see Figure 1).As described above, there have been studies that recognize cards using RFID tags [5,23]; however, the use of RFIDs raises three issues: the spatial resolution depends on the density of the RFID reader; the players' smooth operation might be inhibited by an attachment; and they are relatively expensive.These problems might lose the flavor of traditional card playing and its associated entertainment value.Meanwhile, recognizing objects with a camera and invisible makers [13] enables keeping the operation of the cards unchanged; however, specialized cards, i.e., cards painted in retroreflective material, must be provided.For these reasons, we use a video camera and recognize card playing directly through image processing.
Regarding presentation, we decided to adopt a tabletop projection approach owing to the applicability of existing tables and the low cognitive burden.Tabletop game playing can be augmented with a sophisticated tabletop display, but we prefer a projector to a tabletop display for installation in a home because of recent advances in small and high-intensity projector devices.
A head-mounted display can also handle rich content, but it imposes a burden on players such as excessive weightt and mismatching of the workspace and view [16].
A mobile phone can also be used to provide feedback by holding the terminal on the cards; however, this requires an explicit action from the user.In other words, it interrupts the flow of a game.We consider that this kind of interaction is suitable for on-demand feedback, e.g., providing the rules of a game, rather than continuous implicit feedback.Therefore, we chose a projector as the medium for presenting the information.Table 1 summarizes the characteristics of various presentation devices.

Card Recognition
We also investigated the states of cards in six types of typical games: Pelmanism, President, Old maid, Sevens, Porker, and Speed.Table 2 shows the status of the field.
Here, the numbers within brackets are the numbers of cards that can change at one time.
To develop a software platform for a wide variety of games, we extracted the required conditions of the system from Table 2.That is, the system must handle a wide field of view to recognize all 54 cards (13 each of Spades, Clubs, Hearts, and Diamonds, and two Jokers) on a game field; card recognition must not depend on the direction of cards while players are able to put cards on the game field without taking care of the directions, and cards could overlap in some sorts of games.In summary, the technical requirements include the ability to • recognize all cards at once • recognize any card direction in the plane surface

• handle face-down cards • handle overlapping cards
There are two approaches to recognizing face-down cards, 1) recording cards turned over by players and 2) setting a camera under a transparent table.To leverage an existing table for information projection, rather than acquiring a special transparent table with a transparent projector screen, adopted the first approach.Regarding overlapping cards, we used methods from object recognition.We tried machine learning using the patterns of the suit and the numbers in the corners (Figure 2-red circle), paying attention to Haar-like features [11], used primarily in face recognition [21].However, because the patterns of the cards are very simple, and the feature points are similar in many different parts of the image, it was difficult to recognize the cards with sufficient accuracy using this approach.Then, we focused on the means of recognizing cards using feature detection.Feature detection is an approach to recognize objects using discriminative points such as edges and corners.In this study, we paid attention to SIFT [12], SURF [2] and Ferns [15], which are used in road sign recognition [7].These methods can be used even if a portion of the target object is hidden and object is rotated.Hence, we considered that they were effective for complex patterns of cards such as J, Q, and K, but could not be applied to the simple cards, i.e., 1-10.However, these methods still encounter difficulty in recognizing overlapping cards because these methods use features of light and shade conjugation of images.The designs of some cards are sufficiently simple that these features are useless.Therefore, for the handling of overlapping cards, we decided not to recognize cards in an automatic manner; instead, the system provides the state of recognition to let a player adjust non overlapping cards Figure 3 illustrates the procedure for an image frame captured using a video camera, and brief descriptions are provided below:  Step 1: Rectangle detection / Correction.The whole desktop is captured by a video camera set above the desk, and bounding quadrilaterals to objects in the picture are drawn.Then, the system extracts the region of a card using length of each side of the quadrilaterals and converts them into rectangles using the perspective projection to compensate for distortion caused by the camera.

Suits and numbers in the corners
Step 2: Extraction of color regions.In the above process, the system recognizes all cards using the template matching.However, if the system uses template matching for all cards, the computational costs will become substantial.Therefore, the system initially classifies the playing cards by the area of RGB colors and proceeds to the next process as follows.First, extraction of blue regions allows the system to discriminate J, Q, and K.Then, through the extraction of red regions, the system extracts Ace to 10 of Hearts and Diamonds with Ace to 10 of Spades, Clubs, and Jokers remaining.Finally, J, Q, K, Jokers, and Aces of Spades are recognized by template matching.
Step 3: Identifying card number.We investigated a hierarchical rule-based method to identify the number of a card in a computationally cost-efficient manner (Figure 4), in which a node corresponds to a specific position of the mark.The pictures on cards and the arrangement of marks on each card are common on many types of cards.We leveraged this characteristic to identify the numbers on cards in real time.For example, our system checks the color of the central coordinate in the card.The color of the 4 of Diamonds is white, hence it is classified on the right branch of the classification tree.On the other hand, 5 of Spades is not white; therefore, the system classifies it on the left branch.
Step 4: Template matching.The system uses template matching to identify Ace to 10 of Spades, Clubs, Hearts, and Diamonds.If the system recognizes all cards using template matching, the number of template matching is 2916 (54 cards × 54 matchings).However, our method requires only 276 matchings (J, Q, K, Joker: 14 cards × 14 matchings, Ace to 10 of each suit: 40 cards ×2 matchings).The Step 2 and Step 3 decrease the amount of calculation by 90 %.
Step 5: Voting between frames.During a game, misrecognition of cards is caused by the sudden appearance of obstacles, such as a player's hand.Consequently, we applied a voting mechanism to the system's decisions per frame to eliminate unexpected recognition.The system assigns a value (zero to five) that shows the state of recognition of each card.This value is incremented every time the corresponding card is detected after Step 4, and decremented in the event that it is not detected.The system finally marks the card as "recognized," if the value is three or more.Hence, two consecutive detections can be ignored as "accidental".

Player Tracking
A player is recognized using the same camera as the cards, with the player tracked throughout a game.We assume that the position of a player does not change during a game.This allows us to focus on the player's position relative to a table.The recognition is achieved in two phases, as described below.
Registration.At the beginning of a game, players are requested to place their hands on a table.The system extracts flesh-colored regions and determines particular areas from captured images to be hands.The centroids of hands are recorded by the system as the positions of players (see G 1 -G 4 in Figure 5-left).
Identification.When a hand appears in a camera's field of view during a game, the system compares the position of the newly detected hand (G x in Figure 5-left) with the registered centroid of each player's hand.Then, the system regards the hand as the nearest player's hand (G 1 in Figure 5-left) and takes all operations as the actions of the player, until the hand leaves the capturing range.Recognition results, drawn as yellow circles in Figure 5right, are projected onto players' hands.This mechanism provides feedback to a user to enable him or her to retry in the event of failure of recognition.

Visual Effects
Two types of visual effects are provided as core functionalities based on the preliminary survey.
Light Frame Effect.This effect is intended to enhance the appearance of a game by turning a light around a card (Figure 6-left).The effect also notifies a player of the state of card recognition and urges the player not to overlap cards unconsciously because our proposed system cannot recognize such cards, as described in Section 3.3.
Spotlight Effect.Oval light is thrown on a desk.If a card is removed from the table, the system projects a portion of a background picture onto the desk, and the picture is completed in accordance with the progress of the game.In addition, the system can also project an image onto the position of each card.Figure 6right shows a scene, that is projected on the basis of the positions of cards removed in accordance with the progress of the game.This is achieved by recording the vertices of the four corners of a card when the card is recognized.

Prototype System Implementation
A prototype system was implemented using Microsoft Visual C++ 2010, DX library to develop visual effects and OpenCV2.3 as an image processing library.We chose BICYCLE RIDER BACK as our target card set for recognition, because they are the most popular in the world.The system consists of an XGA (1024 × 768) 3000 lm projector and a Quad-VGA (1280 × 960) 15 fps camera.Both of them are connected to a desktop PC with Intel Core i3 3.07 GHz of CPU and 4 GB of RAM running Windows 7.

API for Augmented Card Game Developers
A wide variety of playing card games exist, each game with its own characteristics.Additionally, there are different rules depending on the person, home, and local community.To adapt to these situations, the software platform provides the three functionalities described in Sections 3.3-3.5 as APIs.People who want to develop an augmented cards game can obtain information regarding cards and players using APIs to be able to focus on developing the game process and their own visual effects.The information includes the number of cards the system recognizes, the positions of all cards regardless of the two sides, the ID of the player who had just put his or her hand on a table, and player position.The information is obtained per image frame by passing an IplImage structure of OpenCV, as well as activating visual effects per frame.

Basic Performance Evaluation in Card Recognition
We examined the basic performance of the card recognition functionality, i.e., the accuracy and the processing time, in an ideal environment without the projector light.
Method.In the evaluation of recognition accuracy, 54 types of cards were dealt into the capturing range of a camera at random positions and angles 100 times per card, and a successful recognition ratio was calculated.If a card was not thrown into the capturing range of the camera face up, we dealt it again.Therefore, we evaluated card recognition accuracy 5,400 times (54 cards ×100 times).
Regarding the processing speed, we attempted to recognize all the 54 cards at a time to observe the recognition speed under a strict condition, i.e., the maximum number of cards.Additionally, we evaluated the processing time of J, Q, K, and 8 of Spades.J, Q and K were chosen because their processing time is theoretically the shortest, because they could skip step (3) in Section 3.3, whereas 8 of Spades was the longest because it requires the additional step.
Result.In the 5,400 throwings, the system could recognize the cards 5,191 times.Table 3 summarizes the recall, i.e., the ratio of correctly recognized number of cards to the original number.This result indicates that the number of times our system erroneously detects the cards is low.The 10 of Spades had the lowest recall because the system often misrecognized it as 8 of Spades.
The system could recognize the other cards with a recall of > 0.90 and with total accuracy of > 0.96 (Table 3).
The processing time per frame was 935 ms when the system recognized 54 types of cards at a time.When J, Q, or K of Spades was provided separately, the system required 33 ms per frame.In the case of 8 of spades, it took 34 ms.From a comparison of the processing time when the system recognized all of the cards at once with that of the case of only one card, we found that the most time-consuming processing was the rectangle detection.Therefore, it is necessary to review the process of rectangle detection to shorten the processing time.

Overview of the Application
We developed an augmented card game on top of the proposed platform.Here, we chose the Pelmanism game, owing to the popularity of the game in Japan with people of all ages.Pelmanism game is a memory game.At the beginning of the game, all cards are set face down on the table, and players take turns turning two cards.When a player turns the cards over, the player receives a score and removes the two cards from the table.On the basis of the preliminary survey described in Section 3.1, we determined the principle of augmentation as follows: • Automatic equivalence check of the numbers on the two cards and score management

• Winner celebration
The system recognizes all card faces at once; therefore, when a player turns two cards over, our application checks the equivalence of their numbers.In addition, our application can keep score by counting the number of correct answers for each player.When they are correct, i.e., equivalent, a bell sounds, and a circular image is projected (Figure 7-left), while a buzzer sound and a cross image is generated for an erroneous choice (Figure 7-right).In many card games, there is only one winner, and all of the other players are losers.Hence, despite winning a game, a winner often does not have anyone to share the victory with.Therefore, we developed a function to   present a congratulation message to the position of the winner's hand, which is tracked by a player recognition function.Figure 8 shows the message of congratulations.

User Study
Evaluation of the Pelmanism game was conducted to evaluate the enhancement of playfulness and mediation of communication among players.
Method.Eleven subjects (ages: 21-25 years), divided into groups of 4, 3, and 4 people, were invited to participate in the evaluation.They knew each other and ordinarily conversed well.Two subjects were female.They played the augmented Pelmanism game and filled out a questionnaire with eight items on a five point Likert scale (Table 4).Here, a rating of 5 is "Strongly agree," 3 is "Neither agree nor disagree," and 1 is "Strongly disagree."Moreover, we counted the number of card turnings to observe the failure of recognition in an actual playing condition.This is because we considered that the accuracy of card recognition declines with the light of the projector and the shadows of players.When the system failed to recognize a card, we asked the subjects to replace the card, and we counted the number of times a player replaced a card twice.
Result. Figure 9 shows the mean score of each questionnaire.The result of questions 1 and 2 showed that the subjects were almost satisfied with the speed and recall of card recognition.We could also obtain their opinions, such as "The speed of card recognition was sufficient," "The Light Frame Effect was good, but I think the showier, the better," and "Player recognition was useful." In the trials of the three groups, the number of rectangle detections was 449, the sum of the number of times when players turned over cards (348) and then replaced cards (101) if the system failed in detecting the cards.The system detected cards successfully 348 times out of 449 attempts.Hence, the detection rate of the cards in the rectangle detection process was 0.78.The number of failures in equality decisions on a pair of cards was 17, indicating that the system mistook one card for another in Step 2 through 5, as described in Section 3.3.The recall of false recognition of cards was 0.10 (17 times × 2 cards / 348), and the recognition rate of playing cards as a whole was 0.70 ((348 times -17 times × 2 cards) / 449).As defined above, we counted the chance of detection against an incorrect detection as "two," which appears as multiplication by two. ,-./0.123

Improvement of Recognition of 10 of Spades
In the basic performance evaluation, the recognition accuracy of 10 of Spades was poor, and our system mistook the 10 of Spades for the 8 of Spades.Following the algorithm in Section 3.3, the system misrecognized at Step 3 owing to the difference in the size of the mark of the suit, i.e., the size of the mark for 10 of Spades is slightly larger than that of Clubs, Hearts, and Diamonds.Here, the center of the red circles in Figure 10 shows the position to be checked to identify cards numbers.As described in Figure 4, the system judges the card as the 10 of Spades if the color of the pixel is white, but as the 8 of Spades otherwise.Thus, when the rectangle detection wavered, the position of interest might be different from what the system was intended to be, and thus the pixel might be "black."This issue might be addressed by decreasing the size of the suits; however, there is a risk of lowering the recognition accuracy of the other card suits.Therefore, we redesigned the recognition algorithm to enable a "double check" to be performed.Here, the system performs template matching with the 10 of Spades when a card is once identified as the 8 of Spades.Re-evaluation of the two cards showed that the recall of 8 and 10 of Spades were 0.95 and 0.98, respectively.This means that the recall of the 10 of Spades was improved without degrading that of the 8 of Spades.
The coordinate to distinguish 10 of spades and 8 of spades

Implications from the Application Case Study
Applicability of the System to an Actual Environment.Throughout the evaluation in an actual environment, the recognition of cards was obstructed by the light of the projector and the shadows of the players because the colors of the cards changed considerably.Regardless of this issue, the questionnaire survey showed that the subjects were almost satisfied with the speed and accuracy of the card recognition.We considered that the players accepted the performance of the system through visual feedback, even though the accuracy was not perfect.However, advising a beginner and keeping a score necessarily requires 100% accuracy.To address this issue fundamentally, a compensation method must be applied that estimates the state of a non-projection surface from the one covered with light and shadows, as proposed by Fujii et al [6].The results of these questions showed that the system performed well in the improvement of playfulness and communication among players.Regarding the winner celebration functionality, people often asked us the purpose, because of its strangeness.However, once we explained the purpose of the functionality, as described above, they seemed to find it of interest.We received a number of opinions on back ground music from the preliminary survey.In addition to the visual effects, auditory effects would expand the possibilities of card games.

Augmentation of Playfulness and
Explicit Augmentation of the Rule.The proposed system augmented the Pelmanism game, adding playfulness and increasing communication among players without changing the contents of the game itself.This can be considered implicit augmentation.We can also consider that functions for augmenting the contents of the game in an explicit manner.Pelmanism is popular regardless of age, and people play together; however, there is an ability gap in Pelmanism.For example, when adults and children play the game together, the gap might prevent them from enjoying.
As described previously, our system can recognize cards once revealed and provide a player a hint at any time.Based on this feature, the system provides a winning player hints to miss a chance to obtain a score and a losing player hints to obtain a score.Figure 11left shows the hint when a player opens a card.When a player reveals a Jack card, the system chooses two cards, another Jack card and a different number card, and provides Light Frame Effects.This time, the system presents both true and false hints.Hence, the probability of obtaining a score is 0.5.The system knows what cards these are because players have opened them before.When a developer develops an augmented Pelmanism game to decrease the ability gap, he or she only regulates the probability of the truth or lie depending on the target player.Another effect of narrowing such a gap was found in [17], which reported that the amount of conversation had been increased and the communication had become active.Considerations on the API.We found it easy to use the card recognition and user tracking functionalities in the development of the Pelmanism game, because we only had to call dedicated functions by passing a captured frame as an argument, i.e., an IplImage structure of OpenCV in the prototype implementation.The current API provides only the information regarding cards that are face up; however, through application development, we found that the moment at which a card was turned over could appear in various types of card applications, and thus it could be provided as an API to a developer.

Possible Future Applications
The proposed augmented Pelmanism game was initially developed to enhance playing card experiences.However, the game can also be used for elder care.The College of Occupational Therapists Limited (COT) suggests the Pelmanism game as an activity that assists in maintaining cognitive abilities [3].Especially, we consider that the "hint" functionality proposed in Section 5.2 allows elderly people to compete with each other equally if a hint is given based on their cognitive ability.This motivates elderly people to participate to the game, rather than make them give up because of a feeling of inferiority.
The essence of the Pelmanism game is a matching game.Henderson and Wellington [8] proposes to use the Pelmanism game as a language (word) game to lower the language barrier in learning and teaching science.In the idea, the pairs of a common name of an animal and its scientific name, a chemical name and its symbol, etc. form matching pairs.Our proposed system focused on playing card itself and did not have an aspect of learning; however, the framework of the system can be leveraged to turn our system into an edutainment one if specific modules for recognizing the words, symbols, and figures on the cards are investigated.

Conclusion
In this article, we proposed a system for augmentation of playing card games with a projector-camera system.On the basis of a preliminary survey, we implemented relevant functions, such as card recognition, player recognition, and visual effects.Cards were recognized with an accuracy of 0.96 in an ideal environment, whereas the accuracy decreased to 0.70 in an actual playing environment.As follow-ups, we improved the recognition of the 10 of Spades by introducing a doublecheck mechanism to avoid misrecognition of the 10 of Spades as the 8 of Spades, which showed a great improvement of its recognition rate from 0.75 to 0.96.
The Pelmanism game was augmented on top of the system as a case study.We received highly positive feedback on the improvement of playfulness and communication amongst the players.Additionally, we showed an explicit augmentation of Pelmanism by presenting a hint and a lie to narrow the skill gap among players.These augmentations were easily achieved using APIs that provide the positions and the numbers or suits of cards and the positions of particular players.
Future work includes the development of functionalities, such as the recognition of overlapping cards, improvement of the recognition of cards under projected light, and audio and visual effects to add playfulness.

Figure 1 .
Figure 1.Appearance of the system

Figure 2 .
Figure 2. Suits and numbers used in machine learning with Haar-like features.

Figure 4 .
Figure 4. Tree of card number recognition: the system checks blue circles and does not need to check card directions, because cards are vertically symmetric.

Figure 5 .
Figure 5. Concept of identifying a player (left), a message to urge players to put their hands on the desk, and the projection to inform players of recognition result (right).

Figure 8 .
Figure 8. Message to celebrate the winner.

Figure 10 .
Figure 10.The reason the system mistook the 10 of Spades as the 8 of Spades.
Communication among Players.Almost all subjects gave the scores > 3 for questions 6 and 8 in the user study of Section 4.2.

Figure 11 .
Figure 11.A hint is projected with light (left) and the hint is shown to be true when the player turns over the card (right).

Table 2 .
Status of the field in card games Note: numbers in brackets indicate the number of cards that can be changed at one time.

Table 4 .
Questionnaires to evaluate the prototype system