JP2011096227A - Program, device, system and method of image recognition - Google Patents

Program, device, system and method of image recognition Download PDF

Info

Publication number
JP2011096227A
JP2011096227A JP2010133510A JP2010133510A JP2011096227A JP 2011096227 A JP2011096227 A JP 2011096227A JP 2010133510 A JP2010133510 A JP 2010133510A JP 2010133510 A JP2010133510 A JP 2010133510A JP 2011096227 A JP2011096227 A JP 2011096227A
Authority
JP
Japan
Prior art keywords
image
target
captured image
area
marker
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2010133510A
Other languages
Japanese (ja)
Other versions
JP4878396B2 (en
Inventor
Satoru Osako
悟 尾迫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nintendo Co Ltd
Original Assignee
Nintendo Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nintendo Co Ltd filed Critical Nintendo Co Ltd
Priority to JP2010133510A priority Critical patent/JP4878396B2/en
Priority to EP10188871.7A priority patent/EP2395474A3/en
Priority to US12/914,037 priority patent/US9256797B2/en
Priority to US12/915,696 priority patent/US8731332B2/en
Publication of JP2011096227A publication Critical patent/JP2011096227A/en
Application granted granted Critical
Publication of JP4878396B2 publication Critical patent/JP4878396B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

<P>PROBLEM TO BE SOLVED: To shorten a time required for detection while maintaining the detection accuracy of an object in image recognition processing. <P>SOLUTION: A game device 1 acquires a captured image captured by a camera. The game device 1 first detects an object area including a predetermined imaging object in the captured image on the basis of pixel values obtained at a first interval in the captured image. The game device 1 then detects the predetermined imaging object from the image in the object area on the basis of pixel values obtained at a second interval smaller than the first interval in the captured image within the object area. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、撮像手段によって撮像された画像から所定の撮像対象を認識するための画像認識プログラム、画像認識装置、画像認識システム、および画像認識方法に関する。   The present invention relates to an image recognition program, an image recognition apparatus, an image recognition system, and an image recognition method for recognizing a predetermined imaging target from an image captured by an imaging unit.

従来、カメラ等の撮像手段によって撮像された画像(撮像画像)から所定の撮像対象を検出する技術がある。例えば、非特許文献1には、拡張現実感技術において、カメラによる撮像画像に含まれるマーカに対して画像認識処理を行うことが記載されている。非特許文献1では、撮像画像に対して固定の閾値を用いて2値化を行うことで連結領域を抽出し、抽出された連結領域から大きさおよび形状が適切なものを選出してマーカ候補とし、マーカ候補に対してパターンマッチングを行うことによってマーカを検出することが記載されている。   Conventionally, there is a technique for detecting a predetermined imaging target from an image (captured image) captured by an imaging unit such as a camera. For example, Non-Patent Document 1 describes performing an image recognition process on a marker included in an image captured by a camera in augmented reality technology. In Non-Patent Document 1, binarization is performed on a captured image using a fixed threshold value to extract a connected region, and an appropriate size and shape are selected from the extracted connected regions and marker candidates are selected. And detecting a marker by performing pattern matching on the marker candidate.

加藤博一,MarkBillinghurst,浅野浩一,橘啓八郎、「マーカー追跡に基づく拡張現実感システムとそのキャリブレーション」、日本バーチャルリアリティ学会論文誌 Vol.4 No.4、1999年Hirokazu Kato, MarkBillinghurst, Koichi Asano, Keihachiro Tachibana, “Augmented Reality System Based on Marker Tracking and Its Calibration”, Transactions of the Virtual Reality Society of Japan, Vol. 4 No. 4, 1999

非特許文献1に記載の認識方法では、入力された撮像画像のそのままの画素単位で画像認識処理を行っている。そのため、入力された画像が高解像度(高精度)になると、画像認識処理に要する時間が長くなってしまうという課題がある。一方、入力された撮像画像の画素単位よりも粗い精度で(粗い画素単位で)単に画像認識処理を行うと、マーカの検出精度が低くなってしまうという課題がある。   In the recognition method described in Non-Patent Document 1, image recognition processing is performed in units of pixels of an input captured image as they are. Therefore, when the input image becomes high resolution (high accuracy), there is a problem that the time required for the image recognition processing becomes long. On the other hand, if image recognition processing is simply performed with coarser accuracy (in coarser pixel units) than the pixel unit of the input captured image, there is a problem that the marker detection accuracy is lowered.

それ故、本発明は、対象の検出精度を維持しつつ、検出に要する時間を短縮することができる画像認識プログラム、画像認識装置、画像認識システム、および画像認識方法を提供することを目的とする。   Therefore, an object of the present invention is to provide an image recognition program, an image recognition apparatus, an image recognition system, and an image recognition method capable of reducing the time required for detection while maintaining the detection accuracy of an object. .

本発明は、上記の課題を解決するために、以下の(1)〜(14)の構成を採用した。   The present invention employs the following configurations (1) to (14) in order to solve the above problems.

(1)
本発明は、撮像手段によって撮像された撮像画像に含まれる所定の撮像対象を検出する情報処理装置のコンピュータにおいて実行される画像認識プログラムである。画像認識プログラムは、画像取得手段と、領域検出手段と、対象検出手段としてコンピュータを機能させる。画像取得手段は、撮像手段によって撮像された撮像画像を取得する。領域検出手段は、撮像画像において第1の間隔で得られる画素値に基づいて、当該撮像画像のうちで所定の撮像対象を含む対象領域を検出する。対象検出手段は、対象領域内の撮像画像において第1の間隔よりも小さい第2の間隔で得られる画素値に基づいて、当該対象領域の画像から所定の撮像対象を検出する。
(1)
The present invention is an image recognition program that is executed in a computer of an information processing apparatus that detects a predetermined imaging target included in a captured image captured by an imaging unit. The image recognition program causes the computer to function as image acquisition means, area detection means, and object detection means. The image acquisition unit acquires a captured image captured by the imaging unit. The area detecting unit detects a target area including a predetermined imaging target in the captured image based on the pixel values obtained at the first interval in the captured image. The target detection unit detects a predetermined imaging target from the image of the target region based on pixel values obtained at a second interval smaller than the first interval in the captured image in the target region.

上記「撮像手段」は、情報処理装置が予め備えているものであってもよいし、情報処理装置とは別体で構成されるものであってもよい。また、情報処理手段が撮像手段を予め備えている場合、撮像手段は、情報処理装置に固定的に取り付けられていてもよいし、重宝処理装置に対して着脱可能であってもよい。また、撮像手段は、情報処理装置の動作に連動して動作してもよいし、情報処理装置の動作とは独立して動作するものであってもよい。
上記「所定の撮像対象」は、後述する実施形態においてはマーカ51に含まれる第1図形55であるが、認識処理によって認識することが可能な物であれば、どのような物であってもよい。例えば、「所定の撮像対象」は、ユーザ(プレイヤ)の顔や体の一部であってもよい。
上記「情報処理装置」とは、後述する実施形態に記載のゲーム装置の他、コンピュータプログラムを実行することによって情報処理を行う任意のコンピュータを含む概念である。また、上記「情報処理装置」は、携帯型か否かを問わない。
上記「画像認識プログラム」とは、一例としては、後述する実施形態に記載のゲームプログラムであるが、パーソナルコンピュータや携帯端末において実行されるアプリケーションプログラムを含む概念である。
上記「画像取得手段」は、情報処理装置内に備えられた撮像手段から内部バス等を介して撮像画像を取得してもよいし、情報処理装置の外部の撮像手段から通信によって撮像画像を取得してもよいし、撮像画像によって撮像された撮像画像を記憶した記憶媒体が情報処理装置に装着されることによって当該記憶媒体から撮像画像を取得してもよい。
上記「画素値」とは、画素に設定される色や輝度等を示す値であればどのような情報であってもよい。
上記「領域検出手段」は、所定の撮像対象を含む対象領域を検出するものであればよく、対象領域を検出する具体的な方法はどのような方法であってもよい。
上記「第2の間隔」は、上記「第1の間隔」よりも小さければどのような長さであってもよい。また、後述する実施形態のように、撮像対象を検出する処理において複数種類の処理が実行される場合、その内の少なくとも1つの処理が、第2の間隔で得られる画素値に基づいて行われればよい。
上記「対象検出手段」は、対象領域から所定の撮像対象を検出するものであればよく、所定の撮像対象を検出する具体的な方法はどのような方法であってもよい。
上記「所定の撮像対象を検出する」とは、後述する実施形態や下記(2)のように、撮像画像内における所定の撮像対象の位置(および/または向き)を算出することの他、撮像画像内に所定の撮像対象が存在するか否かを判断する(所定の撮像対象が存在することを検出する)ことを含む概念である。つまり、対象検出手段の検出結果は、撮像画像内における所定の撮像対象の位置および/または向きの情報であってもよいし、撮像画像内に撮像対象が存在するか否かを示す情報であってもよい。
The “imaging means” may be provided in advance in the information processing apparatus, or may be configured separately from the information processing apparatus. Further, when the information processing means includes the imaging means in advance, the imaging means may be fixedly attached to the information processing apparatus or may be detachable from the treasure processing apparatus. The imaging unit may operate in conjunction with the operation of the information processing apparatus, or may operate independently of the operation of the information processing apparatus.
In the embodiment described later, the “predetermined imaging target” is the first graphic 55 included in the marker 51. However, any object can be used as long as it can be recognized by the recognition process. Good. For example, the “predetermined imaging target” may be a part of the face or body of the user (player).
The “information processing apparatus” is a concept including an arbitrary computer that performs information processing by executing a computer program, in addition to the game apparatus described in the embodiments described later. Further, it does not matter whether the “information processing apparatus” is portable.
The “image recognition program” is, for example, a game program described in an embodiment described later, but includes a concept including an application program executed on a personal computer or a portable terminal.
The “image acquisition unit” may acquire a captured image from an imaging unit provided in the information processing apparatus via an internal bus or the like, or acquire a captured image by communication from an imaging unit outside the information processing apparatus. Alternatively, the captured image may be acquired from the storage medium by attaching the storage medium storing the captured image captured by the captured image to the information processing apparatus.
The “pixel value” may be any information as long as it is a value indicating the color, brightness, or the like set for the pixel.
The “region detection means” may be any device that detects a target region including a predetermined imaging target, and any specific method for detecting the target region may be used.
The “second interval” may be any length as long as it is smaller than the “first interval”. Further, as in the embodiment described later, when a plurality of types of processing are executed in the processing for detecting the imaging target, at least one of the processing is performed based on the pixel value obtained at the second interval. That's fine.
The “target detection means” may be any means that detects a predetermined imaging target from the target region, and any specific method for detecting the predetermined imaging target may be used.
The above-mentioned “detecting a predetermined imaging target” refers to imaging in addition to calculating the position (and / or orientation) of the predetermined imaging target in the captured image as in the embodiments described later and (2) below. This is a concept including determining whether or not a predetermined imaging target exists in an image (detecting the presence of a predetermined imaging target). That is, the detection result of the target detection unit may be information on the position and / or orientation of a predetermined imaging target in the captured image, or information indicating whether or not the imaging target exists in the captured image. May be.

上記(1)の構成によれば、領域検出手段によってまず低い精度で対象領域が検出された後、対象領域から所定の撮像対象を検出する処理が高い精度で行われる。これによれば、対象領域の検出処理が低い精度で行われるとともに、所定の撮像対象を検出する処理の処理範囲が対象領域内に限られるので、認識処理を短時間で行うことができる。また、所定の撮像対象を検出する処理は高い精度で行われるので、所定の撮像対象を精度良く検出することができる。したがって、上記(1)の構成によれば、対象の検出精度を維持しつつ、検出に要する時間を短縮することができる認識処理を提供することができる。   According to the configuration of (1) above, after the target region is first detected with low accuracy by the region detection means, the process of detecting a predetermined imaging target from the target region is performed with high accuracy. According to this, the detection process of the target area is performed with low accuracy, and the processing range of the process for detecting the predetermined imaging target is limited to the target area, so that the recognition process can be performed in a short time. In addition, since the process for detecting the predetermined imaging target is performed with high accuracy, the predetermined imaging target can be detected with high accuracy. Therefore, according to the configuration of (1) above, it is possible to provide a recognition process that can reduce the time required for detection while maintaining the detection accuracy of the target.

(2)
対象検出手段は、撮像画像内における所定の撮像対象の位置を第2の間隔で得られる画素値に基づいて算出することによって当該撮像対象を検出してもよい。
(2)
The target detection unit may detect the imaging target by calculating a position of a predetermined imaging target in the captured image based on pixel values obtained at the second interval.

上記(2)の構成によれば、撮像画像内における所定の撮像対象の位置を高い精度で正確に算出することができる。上記(2)の構成のように、撮像対象の検出結果として上記位置を算出する場合には、算出される位置の精度と、算出に要する時間が重要になる。そのため、上記(2)の構成のように所定の撮像対象の位置を算出する場合は、検出精度を維持しつつ、検出に要する時間を短縮することができる本発明が特に有効である。   According to the configuration of (2) above, the position of the predetermined imaging target in the captured image can be accurately calculated with high accuracy. As in the configuration (2), when the position is calculated as the detection result of the imaging target, the accuracy of the calculated position and the time required for the calculation are important. Therefore, when the position of a predetermined imaging target is calculated as in the configuration (2) above, the present invention that can reduce the time required for detection while maintaining the detection accuracy is particularly effective.

(3)
所定の撮像対象は、複数の内部図形が描かれた図形を含んでいてもよい。このとき、対象検出手段は、対象領域の画像から複数の内部図形をそれぞれ検出し、第2の間隔で得られる画素値に基づいて各内部図形の中心位置をそれぞれ算出することによって所定の撮像対象の位置を検出する。
(3)
The predetermined imaging target may include a figure in which a plurality of internal figures are drawn. At this time, the target detection means detects a plurality of internal figures from the image of the target area, and calculates the center position of each internal figure based on the pixel values obtained at the second interval, thereby obtaining a predetermined imaging target. The position of is detected.

上記「内部図形」は、所定の撮像対象の内部に描かれた図形であればよく、後述する実施形態においては複数個の白丸(図6)であるが、その形状、数、大きさ、色はどのようなものであってもよい。
上記「内部図形の中心位置」とは、内部図形の厳密な意味での中心の位置である必要はなく、各種の演算によって算出することが可能な、内部図形の中央付近の位置であればよい。例えば、「内部図形の中心位置」は、内部図形の輪郭を表す画素の平均値として算出されてもよいし、撮像画像の各画素に何らかの重みが付される場合には、内部図形の領域内の各画素の重心位置として算出されてもよい。
The “internal figure” may be a figure drawn inside a predetermined imaging target, and in the embodiment described later, it is a plurality of white circles (FIG. 6), but its shape, number, size, color May be anything.
The “center position of the internal figure” does not have to be the exact center position of the internal figure, and may be any position near the center of the internal figure that can be calculated by various calculations. . For example, the “center position of the internal graphic” may be calculated as an average value of pixels representing the outline of the internal graphic, or when some weight is given to each pixel of the captured image, May be calculated as the barycentric position of each pixel.

上記(3)の構成によれば、所定の撮像対象の輪郭ではなく、内部図形の中心位置によって所定の撮像対象の位置が検出される。ここで、撮像画像にぶれが生じている場合には所定の撮像対象の輪郭を正確に検出することが困難であるので、輪郭からでは所定の撮像対象の位置を正確に検出することができない。これに対して、上記中心位置は、撮像画像にぶれが生じていても正確に算出されるので、上記(3)の構成によれば、撮像画像にぶれが生じている場合でも、所定の撮像対象の位置を正確に算出することができる。   According to the configuration of (3) above, the position of the predetermined imaging target is detected not by the contour of the predetermined imaging target but by the center position of the internal figure. Here, when the captured image is blurred, it is difficult to accurately detect the contour of the predetermined imaging target. Therefore, the position of the predetermined imaging target cannot be accurately detected from the contour. On the other hand, the center position is accurately calculated even when the captured image is blurred. Therefore, according to the configuration of (3) above, even when the captured image is blurred, a predetermined imaging is performed. The position of the target can be calculated accurately.

(4)
画像認識プログラムは、領域検出手段によって検出された対象領域において、所定の撮像対象の輪郭を抽出する輪郭抽出手段としてコンピュータをさらに機能させてもよい。このとき、対象検出手段は、輪郭抽出手段によって抽出された輪郭内の領域から複数の内部図形をそれぞれ検出する。
(4)
The image recognition program may further cause the computer to function as a contour extracting unit that extracts a contour of a predetermined imaging target in the target region detected by the region detecting unit. At this time, the object detection unit detects a plurality of internal figures from the region in the contour extracted by the contour extraction unit.

上記(4)の構成によれば、輪郭抽出手段によって抽出された輪郭内の領域から内部図形が検出されるので、内部図形を検出する範囲を適切に決定することができる。これによれば、内部図形の検出処理を無駄な領域に対して行わずに済むので、認識処理をより効率良く行うことができる。   According to the configuration of (4) above, since the internal graphic is detected from the area within the contour extracted by the contour extracting means, the range for detecting the internal graphic can be appropriately determined. According to this, since it is not necessary to perform the internal graphic detection process on the useless area, the recognition process can be performed more efficiently.

(5)
輪郭抽出手段は、撮像画像において第1の間隔よりも小さく第2の間隔よりも大きい第3の間隔で得られる画素値に基づいて所定の撮像対象の輪郭を抽出してもよい。
(5)
The contour extracting unit may extract a contour of a predetermined imaging target based on pixel values obtained at a third interval that is smaller than the first interval and larger than the second interval in the captured image.

上記(5)の構成によれば、輪郭の抽出処理は内部図形の検出処理よりも低い精度で行われるので、輪郭の抽出処理をより短時間で行うことができる。その結果、認識処理をより短時間で行うことができる。   According to the configuration of (5) above, the contour extraction process is performed with lower accuracy than the internal graphic detection process, and therefore the contour extraction process can be performed in a shorter time. As a result, the recognition process can be performed in a shorter time.

(6)
画像認識プログラムは、輪郭抽出手段によって抽出された輪郭が所定の撮像対象を表すか否かを判定する対象判定手段としてコンピュータを機能させてもよい。このとき、対象検出手段は、対象判定手段によって所定の撮像対象を表すと判定される輪郭に対応する領域内から複数の内部図形をそれぞれ検出する。
(6)
The image recognition program may cause the computer to function as an object determination unit that determines whether the contour extracted by the contour extraction unit represents a predetermined imaging target. At this time, the target detection unit detects a plurality of internal figures from the area corresponding to the contour determined to represent the predetermined imaging target by the target determination unit.

上記(6)の構成によれば、抽出された輪郭に基づいて、対象領域内に所定の撮像対象が含まれるか否かを判定することができる。そして、対象領域内に所定の撮像対象が含まれない場合には、その対象領域については内部図形の検出処理が行われない。したがって、上記(6)の構成によれば、所定の撮像対象を含まない対象領域を、内部図形の検出処理の対象から除くことができるので、内部図形の検出処理が無駄に行われることを防止することができる。これによれば、認識処理を効率良く行うことができ、認識処理をより短時間で行うことができる。特に、上記(5)と(6)との構成を組み合わせる場合には、(低精度で行われるため)相対的に高速に行われる輪郭の抽出処理によって、(高精度で行われるため)相対的に時間の要する内部図形の検出処理を省略することができるので、認識処理をより効率良く行うことができる。   According to the configuration of (6) above, it is possible to determine whether or not a predetermined imaging target is included in the target region based on the extracted contour. When a predetermined imaging target is not included in the target area, the internal graphic detection process is not performed for the target area. Therefore, according to the configuration of (6) above, since the target area that does not include the predetermined imaging target can be excluded from the target of the internal graphic detection process, the internal graphic detection process is prevented from being wasted. can do. According to this, the recognition process can be performed efficiently, and the recognition process can be performed in a shorter time. In particular, when the configurations of (5) and (6) above are combined, the contour extraction processing performed at a relatively high speed (because it is performed at a low accuracy) causes a relative (because it is performed at a high accuracy). Therefore, it is possible to omit the time-consuming process of detecting the internal figure, so that the recognition process can be performed more efficiently.

(7)
対象検出手段は、内部領域検出手段と、位置算出手段とを有していてもよい。内部領域検出手段は、対象領域において複数の内部図形の領域をそれぞれ検出する。位置算出手段は、内部領域検出手段によって検出された各領域の中心位置をそれぞれ算出する。
(7)
The object detection unit may include an internal region detection unit and a position calculation unit. The internal area detection means detects a plurality of internal graphic areas in the target area. The position calculation means calculates the center position of each area detected by the internal area detection means.

上記(7)の構成によれば、内部図形の領域を検出し、検出した領域の中心位置を算出することによって、内部図形の中心位置を容易に算出することができる。   With configuration (7) above, the center position of the internal graphic can be easily calculated by detecting the area of the internal graphic and calculating the center position of the detected area.

(8)
内部領域検出手段は、撮像画像において第1の間隔よりも小さく第2の間隔よりも大きい第4の間隔で得られる画素値に基づいて複数の内部図形の領域をそれぞれ検出してもよい。
(8)
The internal region detection means may detect a plurality of internal graphic regions based on pixel values obtained at a fourth interval smaller than the first interval and larger than the second interval in the captured image.

上記(8)の構成によれば、内部図形の領域の検出処理は、中心位置の算出処理よりも低い精度で行われるので、内部図形の領域の検出処理をより短時間で行うことができる。その結果、認識処理をより短時間で行うことができる。   According to the configuration of (8), the internal graphic area detection process is performed with a lower accuracy than the center position calculation process, and therefore the internal graphic area detection process can be performed in a shorter time. As a result, the recognition process can be performed in a shorter time.

(9)
対象検出手段は、内部領域検出手段によって検出された領域の個数が、所定範囲内の個数であるか否かを判定する個数判定手段をさらに有していてもよい。このとき、位置算出手段は、所定範囲内の個数の領域が検出された対象領域について、内部領域検出手段によって検出された各領域の中心位置を算出する。
(9)
The object detection unit may further include a number determination unit that determines whether or not the number of regions detected by the internal region detection unit is a number within a predetermined range. At this time, the position calculation means calculates the center position of each area detected by the internal area detection means for the target area where the number of areas within the predetermined range is detected.

上記(9)の構成によれば、内部領域検出手段によって検出された領域の個数が適切な数であるか否かを判定することができる。そして、領域の個数が適切でない場合には、その対象領域については所定の撮像対象が含まれないと判断され、中心位置の算出処理が行われない。したがって、上記(9)の構成によれば、所定の撮像対象を含まない対象領域を、中心位置の算出処理の対象から除くことができるので、当該算出処理が無駄に行われることを防止することができる。これによれば、認識処理を効率良く行うことができ、認識処理をより短時間で行うことができる。特に、上記(8)と(9)との構成を組み合わせる場合には、(低精度で行われるため)相対的に高速に行われる内部図形の領域の検出処理によって、(高精度で行われるため)相対的に時間の要する中心位置の算出処理を省略することができるので、認識処理をより効率良く行うことができる。   With configuration (9) above, it is possible to determine whether or not the number of regions detected by the internal region detection means is an appropriate number. If the number of regions is not appropriate, it is determined that the target region does not include a predetermined imaging target, and the center position calculation process is not performed. Therefore, according to the configuration of (9) above, it is possible to exclude a target area that does not include a predetermined imaging target from the center position calculation processing target, thereby preventing the calculation processing from being performed wastefully. Can do. According to this, the recognition process can be performed efficiently, and the recognition process can be performed in a shorter time. In particular, in the case of combining the configurations of (8) and (9) above (because it is performed with low accuracy), it is performed with high accuracy (by being performed with high accuracy) by the detection processing of the area of the internal figure performed at a relatively high speed. ) Since the calculation process of the center position which requires a relatively long time can be omitted, the recognition process can be performed more efficiently.

(10)
領域検出手段は、第1の間隔で隣接する画素間における画素値に基づいて所定の撮像対象の輪郭を抽出することによって対象領域を検出してもよい。
(10)
The area detecting means may detect the target area by extracting a predetermined contour of the imaging target based on a pixel value between adjacent pixels at the first interval.

上記(10)の構成によれば、所定の撮像対象の輪郭を抽出することによって対象領域を容易に検出することができる。   According to the configuration of (10) above, the target region can be easily detected by extracting the contour of the predetermined imaging target.

(11)
領域検出手段は、画像取得手段によって取得された撮像画像の各画素のうち第1の間隔で配置される画素に関する画素値に基づいて対象領域を検出してもよい。このとき、対象検出手段は、画像取得手段によって取得された撮像画像の各画素のうち第2の間隔で配置される画素に関する画素値に基づいて所定の撮像対象を検出する。
(11)
The region detection unit may detect the target region based on pixel values relating to pixels arranged at the first interval among the pixels of the captured image acquired by the image acquisition unit. At this time, the target detection unit detects a predetermined imaging target based on pixel values relating to pixels arranged at the second interval among the pixels of the captured image acquired by the image acquisition unit.

上記(11)の構成によれば、対象領域の検出処理と、所定の撮像対象の検出処理とで同じ撮像画像を用いることができる。これによれば、低解像度の画像を生成する必要がないので、認識処理をより簡単により短時間で行うことができる。   According to the configuration of (11) above, the same captured image can be used in the target region detection processing and the predetermined imaging target detection processing. According to this, since it is not necessary to generate a low-resolution image, the recognition process can be performed more easily and in a shorter time.

(12)
情報処理装置がアクセス可能な記憶手段から、所定の撮像対象を表すパターン画像を取得するパターン取得手段としてコンピュータをさらに機能させてもよい。このとき、対象検出手段は、対象領域の画像とパターン画像とを比較することによって対象領域内に所定の撮像対象が含まれるか否かを判断する。
(12)
The computer may further function as a pattern acquisition unit that acquires a pattern image representing a predetermined imaging target from a storage unit accessible by the information processing apparatus. At this time, the target detection unit determines whether or not a predetermined imaging target is included in the target region by comparing the image of the target region with the pattern image.

上記(12)の構成によれば、いわゆるパターンマッチングの手法によって、所定の撮像対象を容易に検出することができる。   With configuration (12) above, it is possible to easily detect a predetermined imaging target by a so-called pattern matching technique.

(13)
対象検出手段は、第2の間隔で得られる画素値に基づいて対象領域の画像から所定の撮像対象の輪郭を抽出し、抽出された輪郭に基づいて、撮像画像内における所定の撮像対象の位置を算出してもよい。
(13)
The target detection means extracts a contour of a predetermined imaging target from the image of the target region based on the pixel value obtained at the second interval, and based on the extracted contour, the position of the predetermined imaging target in the captured image May be calculated.

上記(13)の構成によれば、所定の撮像対象の輪郭に基づいて、撮像画像内における所定の撮像対象の位置を容易に算出することができる。   With configuration (13) above, it is possible to easily calculate the position of the predetermined imaging target in the captured image based on the contour of the predetermined imaging target.

(14)
画像認識プログラムは、位置関係算出手段と、表示制御手段としてコンピュータをさらに機能させてもよい。位置関係算出手段は、対象検出手段によって所定の撮像対象が検出された場合、当該所定の撮像対象と撮像手段との位置関係を対象検出手段による検出結果に基づいて算出する。表示制御手段は、仮想空間に配置される仮想オブジェクトを表す仮想画像を位置関係に基づいて生成し、撮像画像に対して仮想画像を合成した画像を表示手段に表示させる。
(14)
The image recognition program may further cause the computer to function as a positional relationship calculation unit and a display control unit. The positional relationship calculation unit calculates the positional relationship between the predetermined imaging target and the imaging unit based on the detection result of the target detection unit when a predetermined imaging target is detected by the target detection unit. The display control unit generates a virtual image representing a virtual object arranged in the virtual space based on the positional relationship, and causes the display unit to display an image obtained by synthesizing the virtual image with the captured image.

上記(14)の構成によれば、撮像画像と仮想画像とを合成した合成画像を表示する拡張現実感技術において、高速でかつ精度の良い認識処理を用いることができる。なお、拡張現実感技術においては、撮像画像と仮想画像とを位置がずれることなく正確に合成するためには、認識処理において所定の撮像対象を正確に検出することが要求される。そのため、上記(1)の構成による高速でかつ精度の良い認識処理が特に有効である。   With configuration (14) above, high-speed and accurate recognition processing can be used in augmented reality technology that displays a composite image obtained by combining a captured image and a virtual image. In augmented reality technology, in order to accurately synthesize a captured image and a virtual image without shifting the position, it is required to accurately detect a predetermined imaging target in the recognition process. Therefore, a high-speed and accurate recognition process with the configuration (1) is particularly effective.

また、本発明は、上記各手段と同等の手段を備える画像認識装置の形態で実施されてもよい。この画像認識装置においては、画像認識プログラムを実行するコンピュータによって上記各手段が実現されてもよいし、専用回路によって上記各手段の一部または全部が実現されてもよい。また、本発明は、上記各手段を備える1以上の情報処理装置からなる画像認識システムの形態で実施されてもよい。このとき、1以上の情報処理装置は、有線または無線通信によって直接通信を行ってもよいし、ネットワークを介して通信を行ってもよい。さらに、本発明は、上記各手段によって行われる画像認識方法の形態で実施されてもよい。   Further, the present invention may be implemented in the form of an image recognition apparatus that includes means equivalent to the above-described means. In this image recognition apparatus, each means described above may be realized by a computer that executes an image recognition program, or a part or all of each means described above may be realized by a dedicated circuit. Further, the present invention may be implemented in the form of an image recognition system including one or more information processing apparatuses including the above-described units. At this time, the one or more information processing apparatuses may perform direct communication via wired or wireless communication, or may perform communication via a network. Furthermore, the present invention may be implemented in the form of an image recognition method performed by each of the above means.

本発明によれば、領域検出手段によってまず低い精度で対象領域を検出した後、対象領域から所定の撮像対象を検出する処理を高い精度で行うことによって、対象の検出精度を維持しつつ、検出に要する時間を短縮することができる。   According to the present invention, first, a target region is detected with low accuracy by the region detection means, and then processing for detecting a predetermined imaging target from the target region is performed with high accuracy, thereby detecting the target while maintaining the detection accuracy. Can be shortened.

本実施形態に係るゲーム装置の外観図External view of game device according to this embodiment ゲーム装置の内部構成の一例を示すブロック図Block diagram showing an example of the internal configuration of the game device ゲーム装置を使用する例を示す図The figure which shows the example which uses a game device ゲーム装置に表示されるゲーム画像の一例を示す図The figure which shows an example of the game image displayed on a game device 本実施形態における画像認識処理で用いられる対象領域を示す図The figure which shows the object area | region used by the image recognition process in this embodiment. 本実施形態において用いられるマーカを示す図The figure which shows the marker used in this embodiment 左右の輪郭がぼけた第1図形の画像を示す図The figure which shows the image of the 1st figure with which the right-and-left outline was blurred 第1図形の一部における内部図形の中心位置を示す図The figure which shows the center position of the internal figure in a part of 1st figure 第1図形内の各内部図形の中心点を示す図The figure which shows the center point of each internal figure in the 1st figure ゲームプログラムによる処理において用いられる各種データを示す図The figure which shows the various data which are used in the processing with the game program ゲーム装置において実行されるゲーム処理の流れを示すメインフローチャートMain flowchart showing the flow of game processing executed in the game device 図11に示す認識処理(ステップS2)の流れを示すフローチャートThe flowchart which shows the flow of the recognition process (step S2) shown in FIG. 撮像画像においてステップS11の処理において画素値が参照される画素を示す図The figure which shows the pixel to which a pixel value is referred in the process of step S11 in a captured image. 図12に示すマーカ検出処理(ステップS15)の流れを示すフローチャートThe flowchart which shows the flow of the marker detection process (step S15) shown in FIG. ステップS21の処理対象となる領域の一例を示す図The figure which shows an example of the area | region used as the process target of step S21. 撮像画像においてステップS21の処理において画素値が参照される画素を示す図The figure which shows the pixel to which a pixel value is referred in the process of step S21 in a captured image. 第1図形を表す撮像画像の一例を示す図The figure which shows an example of the captured image showing a 1st figure 図17に示す各直線L1〜L4によって算出される4つの頂点P11〜P14を示す図The figure which shows the four vertexes P11-P14 calculated by each straight line L1-L4 shown in FIG. ステップS27で設定される所定領域の一例を示す図The figure which shows an example of the predetermined area | region set by step S27 本実施形態における変形例で用いられるマーカを示す図The figure which shows the marker used by the modification in this embodiment 本実施形態の変形例におけるマーカ検出処理の流れを示すフローチャートThe flowchart which shows the flow of the marker detection process in the modification of this embodiment 本実施形態の変形例におけるマーカを示す図The figure which shows the marker in the modification of this embodiment 本実施形態の他の変形例におけるマーカを示す図The figure which shows the marker in the other modification of this embodiment

[ゲーム装置のハードウェア構成]
以下、図面を参照して、本発明の一実施形態に係る画像認識プログラムおよび画像認識装置について説明する。本発明は、表示装置に画像を表示させる任意の情報処理装置(コンピュータ)において画像認識プログラムが実行されることによって実現することができるが、本実施形態では、情報処理装置の一例として図1に示すゲーム装置1を用いる場合について説明する。
[Hardware configuration of game device]
Hereinafter, an image recognition program and an image recognition apparatus according to an embodiment of the present invention will be described with reference to the drawings. The present invention can be realized by executing an image recognition program in an arbitrary information processing apparatus (computer) that displays an image on a display device. In the present embodiment, FIG. The case where the game apparatus 1 shown is used will be described.

図1は、本実施形態に係るゲーム装置1の外観図である。ここでは、ゲーム装置の一例として、携帯ゲーム装置を示す。なお、ゲーム装置1は、カメラを内蔵しており、当該カメラによって画像を撮像し、撮像した画像を画面に表示したり、撮像した画像のデータを保存したりする撮像装置としても機能する。   FIG. 1 is an external view of a game apparatus 1 according to the present embodiment. Here, a portable game device is shown as an example of the game device. Note that the game apparatus 1 has a built-in camera, and functions as an imaging apparatus that captures an image with the camera, displays the captured image on a screen, and stores data of the captured image.

図1において、ゲーム装置1は折り畳み型の携帯ゲーム装置であり、開いた状態(開状態)のゲーム装置1を示している。ゲーム装置1は、開いた状態においてもユーザが両手または片手で把持することができるようなサイズで構成される。   In FIG. 1, a game apparatus 1 is a foldable portable game apparatus, and shows the game apparatus 1 in an open state (open state). The game apparatus 1 is configured in such a size that the user can hold it with both hands or one hand even in an open state.

ゲーム装置1は、下側ハウジング11および上側ハウジング21を有する。下側ハウジング11と上側ハウジング21とは、開閉可能(折り畳み可能)に連結されている。図1の例では、下側ハウジング11および上側ハウジング21は、それぞれ横長の長方形の板状に形成され、互いの長辺部分で回転可能に連結されている。通常、ユーザは、開状態でゲーム装置1を使用する。また、ユーザは、ゲーム装置1を使用しない場合には閉状態としてゲーム装置1を保管する。また、図1に示した例では、ゲーム装置1は、上記閉状態および開状態のみでなく、下側ハウジング11と上側ハウジング21とのなす角度が閉状態と開状態との間の任意の角度において、連結部分に発生する摩擦力などによってその開閉角度を維持することができる。つまり、上側ハウジング21を下側ハウジング11に対して任意の角度で静止させることができる。   The game apparatus 1 includes a lower housing 11 and an upper housing 21. The lower housing 11 and the upper housing 21 are connected so as to be openable and closable (foldable). In the example of FIG. 1, the lower housing 11 and the upper housing 21 are each formed in a horizontally-long rectangular plate shape, and are coupled so as to be rotatable at their long side portions. Normally, the user uses the game apparatus 1 in the open state. Further, when the user does not use the game apparatus 1, the user stores the game apparatus 1 in a closed state. In the example shown in FIG. 1, the game apparatus 1 is not limited to the closed state and the open state, and the angle formed by the lower housing 11 and the upper housing 21 is an arbitrary angle between the closed state and the open state. The opening / closing angle can be maintained by a frictional force generated in the connecting portion. That is, the upper housing 21 can be made stationary with respect to the lower housing 11 at an arbitrary angle.

下側ハウジング11には、下側LCD(Liquid Crystal Display:液晶表示装置)12が設けられる。下側LCD12は横長形状であり、長辺方向が下側ハウジング11の長辺方向に一致するように配置される。なお、本実施形態では、ゲーム装置1に内蔵されている表示装置としてLCDを用いているが、例えばEL(Electro Luminescence:電界発光)を利用した表示装置等、他の任意の表示装置を利用しても良い。また、ゲーム装置1は、任意の解像度の表示装置を利用することができる。なお、下側LCD12には、内側カメラ23または外側カメラ25で撮像されている画像がリアルタイムに表示される。   The lower housing 11 is provided with a lower LCD (Liquid Crystal Display) 12. The lower LCD 12 has a horizontally long shape, and is arranged such that the long side direction coincides with the long side direction of the lower housing 11. In the present embodiment, an LCD is used as the display device built in the game apparatus 1, but other arbitrary display devices such as a display device using EL (Electro Luminescence) are used. May be. The game apparatus 1 can use a display device having an arbitrary resolution. Note that an image captured by the inner camera 23 or the outer camera 25 is displayed on the lower LCD 12 in real time.

下側ハウジング11には、入力装置として、各操作ボタン14A〜14Kおよびタッチパネル13が設けられる。図1に示されるように、各操作ボタン14A〜14Kのうち、方向入力ボタン14A、操作ボタン14B、操作ボタン14C、操作ボタン14D、操作ボタン14E、電源ボタン14F、スタートボタン14G、およびセレクトボタン14Hは、下側ハウジング11の内側主面上に設けられる。内側主面とは、上側ハウジング21と下側ハウジング11とを折り畳んだときに内側となる面である。図1に示す例では、方向入力ボタン14Aおよび電源ボタン14Fは、下側ハウジング11の内側主面の中央付近に設けられる下側LCD12に対して、左右一方側(図1では左側)の当該主面上に設けられる。また、操作ボタン14B〜14E、スタートボタン14G、およびセレクトボタン14Hは、下側LCD12に対して左右他方側(図1では右側)となる下側ハウジング11の内側主面上に設けられる。方向入力ボタン14A、操作ボタン14B〜14E、スタートボタン14G、およびセレクトボタン14Hは、ゲーム装置1に対する各種操作を行うために用いられる。方向入力ボタン14Aは、例えば選択操作等に用いられる。各操作ボタン14B〜14Eは、例えば決定操作やキャンセル操作等に用いられる。電源ボタン14Fは、ゲーム装置1の電源をオン/オフするために用いられる。   The lower housing 11 is provided with operation buttons 14A to 14K and a touch panel 13 as input devices. As shown in FIG. 1, among the operation buttons 14A to 14K, a direction input button 14A, an operation button 14B, an operation button 14C, an operation button 14D, an operation button 14E, a power button 14F, a start button 14G, and a select button 14H. Is provided on the inner main surface of the lower housing 11. The inner main surface is a surface that becomes the inner side when the upper housing 21 and the lower housing 11 are folded. In the example shown in FIG. 1, the direction input button 14 </ b> A and the power button 14 </ b> F are on the left and right sides (left side in FIG. 1) of the main LCD 14 with respect to the lower LCD 12 provided near the center of the inner main surface of the lower housing 11. Provided on the surface. In addition, the operation buttons 14B to 14E, the start button 14G, and the select button 14H are provided on the inner main surface of the lower housing 11 that is on the other side of the lower LCD 12 (right side in FIG. 1). The direction input button 14A, the operation buttons 14B to 14E, the start button 14G, and the select button 14H are used for performing various operations on the game apparatus 1. The direction input button 14A is used for, for example, a selection operation. The operation buttons 14B to 14E are used for, for example, a determination operation or a cancel operation. The power button 14F is used for turning on / off the power of the game apparatus 1.

なお、図1においては、操作ボタン14I〜14Kの図示を省略している。例えば、Lボタン14Iは、下側ハウジング11の上側面の左端部に設けられ、Rボタン14Jは、下側ハウジング11の上側面の右端部に設けられる。Lボタン14IおよびRボタン14Jは、撮影機能を有するゲーム装置1に対して、例えば撮影指示操作(シャッター操作)を行うために用いられる。さらに、音量ボタン14Kは、下側ハウジング11の左側面に設けられる。音量ボタン14Kは、ゲーム装置1が備えるスピーカの音量を調整するために用いられる。   In FIG. 1, the operation buttons 14I to 14K are not shown. For example, the L button 14I is provided at the left end portion of the upper side surface of the lower housing 11, and the R button 14J is provided at the right end portion of the upper side surface of the lower housing 11. The L button 14I and the R button 14J are used, for example, to perform a shooting instruction operation (shutter operation) on the game apparatus 1 having a shooting function. Furthermore, the volume button 14K is provided on the left side surface of the lower housing 11. The volume button 14K is used to adjust the volume of the speaker provided in the game apparatus 1.

また、ゲーム装置1は、各操作ボタン14A〜14Kとは別の入力装置としてさらに、画面上における任意の位置を指定可能な入力装置であるポインティングデバイスの一例として、タッチパネル13を備えている。タッチパネル13は、下側LCD12の画面上を覆うように装着されている。なお、本実施形態では、タッチパネル13は、例えば抵抗膜方式のタッチパネルが用いられる。ただし、タッチパネル13は、抵抗膜方式に限らず、任意の方式のタッチパネルを用いることができる。また、本実施形態では、タッチパネル13として、例えば下側LCD12の解像度と同じ解像度(検出精度)のものを利用する。ただし、必ずしもタッチパネル13の解像度と下側LCD12の解像度とが一致している必要はない。また、下側ハウジング11の右側面には、挿入口(図1では破線で示している)が設けられている。挿入口は、タッチパネル13に対する操作を行うために用いられるタッチペン27を収納することができる。なお、タッチパネル13に対する入力(タッチ入力)は、通常タッチペン27を用いて行われるが、タッチペン27に限らずユーザの指でタッチパネル13を操作することも可能である。   In addition, the game apparatus 1 includes a touch panel 13 as an example of a pointing device that is an input device that can specify an arbitrary position on the screen as an input device different from the operation buttons 14A to 14K. The touch panel 13 is mounted so as to cover the screen of the lower LCD 12. In the present embodiment, for example, a resistive film type touch panel is used as the touch panel 13. However, the touch panel 13 is not limited to the resistive film type, and any type of touch panel can be used. In the present embodiment, the touch panel 13 having the same resolution (detection accuracy) as that of the lower LCD 12 is used, for example. However, the resolution of the touch panel 13 and the resolution of the lower LCD 12 are not necessarily matched. An insertion port (shown by a broken line in FIG. 1) is provided on the right side surface of the lower housing 11. The insertion opening can accommodate a touch pen 27 used for performing an operation on the touch panel 13. In addition, although the input (touch input) with respect to the touch panel 13 is normally performed using the touch pen 27, not only the touch pen 27 but the touch panel 13 can also be operated with a user's finger | toe.

また、下側ハウジング11の右側面には、メモリカード28を収納するための挿入口(図1では二点鎖線で示している)が設けられている。この挿入口の内側には、ゲーム装置1とメモリカード28とを電気的に接続するためのコネクタ(図示せず)が設けられる。メモリカード28は、例えばSD(Secure Digital)メモリカードであり、コネクタに着脱自在に装着される。メモリカード28は、例えば、ゲーム装置1によって撮像された画像を記憶(保存)したり、他の装置で生成された画像をゲーム装置1に読み込んだりするために用いられる。   Further, on the right side surface of the lower housing 11, an insertion slot (indicated by a two-dot chain line in FIG. 1) for storing the memory card 28 is provided. A connector (not shown) for electrically connecting the game apparatus 1 and the memory card 28 is provided inside the insertion slot. The memory card 28 is, for example, an SD (Secure Digital) memory card, and is detachably attached to the connector. The memory card 28 is used, for example, for storing (saving) an image captured by the game apparatus 1 or reading an image generated by another apparatus into the game apparatus 1.

さらに、下側ハウジング11の上側面には、メモリカード29を収納するための挿入口(図1では、一点鎖線で示している)が設けられている。この挿入口の内側にも、ゲーム装置1とメモリカード29とを電気的に接続するためのコネクタ(図示せず)が設けられる。メモリカード29は、ゲームプログラム等の情報処理プログラムを記録した記録媒体であり、下側ハウジング11に設けられた挿入口に着脱自在に装着される。   Further, an insertion slot (indicated by a one-dot chain line in FIG. 1) for accommodating the memory card 29 is provided on the upper side surface of the lower housing 11. A connector (not shown) for electrically connecting the game apparatus 1 and the memory card 29 is also provided inside the insertion slot. The memory card 29 is a recording medium on which an information processing program such as a game program is recorded, and is detachably attached to an insertion port provided in the lower housing 11.

下側ハウジング11と上側ハウジング21との連結部の左側部分には、3つのLED15A〜15Cが取り付けられる。ここで、ゲーム装置1は、他の機器との間で無線通信を行うことが可能であり、第1LED15Aは、ゲーム装置1の電源がオンである場合に点灯する。第2LED15Bは、ゲーム装置1の充電中に点灯する。第3LED15Cは、無線通信が確立している場合に点灯する。したがって、3つのLED15A〜15Cによって、ゲーム装置1の電源のオン/オフ状況、充電状況、および、通信確立状況をユーザに通知することができる。   Three LEDs 15 </ b> A to 15 </ b> C are attached to the left portion of the connecting portion between the lower housing 11 and the upper housing 21. Here, the game apparatus 1 can perform wireless communication with other devices, and the first LED 15A is lit when the power of the game apparatus 1 is on. The second LED 15B is lit while the game apparatus 1 is being charged. The third LED 15C is lit when wireless communication is established. Therefore, the three LEDs 15A to 15C can notify the user of the power on / off status of the game apparatus 1, the charging status, and the communication establishment status.

一方、上側ハウジング21には、上側LCD22が設けられる。上側LCD22は横長形状であり、長辺方向が上側ハウジング21の長辺方向に一致するように配置される。なお、下側LCD12と同様、上側LCD22に代えて、他の任意の方式および任意の解像度の表示装置を利用しても良い。なお、上側LCD22上を覆うように、タッチパネルを設けてもかまわない。上側LCD22には、例えば、各操作ボタン14A〜14Kやタッチパネル13の役割をユーザに教えるための操作説明画面が表示される。   On the other hand, the upper housing 21 is provided with an upper LCD 22. The upper LCD 22 has a horizontally long shape and is arranged such that the long side direction coincides with the long side direction of the upper housing 21. As in the case of the lower LCD 12, instead of the upper LCD 22, a display device having any other method and any resolution may be used. A touch panel may be provided so as to cover the upper LCD 22. On the upper LCD 22, for example, an operation explanation screen for teaching the user the roles of the operation buttons 14A to 14K and the touch panel 13 is displayed.

また、上側ハウジング21には、2つのカメラ(内側カメラ23および外側カメラ25)が設けられる。図1に示されるように、内側カメラ23は、上側ハウジング21の連結部付近の内側主面に取り付けられる。一方、外側カメラ25は、内側カメラ23が取り付けられる内側主面の反対側の面、すなわち、上側ハウジング21の外側主面(ゲーム装置1が閉状態となった場合に外側となる面であり、図1に示す上側ハウジング21の背面)に取り付けられる。なお、図1においては、外側カメラ25を破線で示している。これによって、内側カメラ23は、上側ハウジング21の内側主面が向く方向を撮像することが可能であり、外側カメラ25は、内側カメラ23の撮像方向の逆方向、すなわち、上側ハウジング21の外側主面が向く方向を撮像することが可能である。このように、本実施形態では、2つの内側カメラ23および外側カメラ25の撮像方向が互いに逆方向となるように設けられる。例えば、ユーザは、ゲーム装置1からユーザの方を見た景色を内側カメラ23で撮像することができるとともに、ゲーム装置1からユーザの反対側の方向を見た景色を外側カメラ25で撮像することができる。   The upper housing 21 is provided with two cameras (an inner camera 23 and an outer camera 25). As shown in FIG. 1, the inner camera 23 is attached to the inner main surface near the connecting portion of the upper housing 21. On the other hand, the outer camera 25 is a surface on the opposite side of the inner main surface to which the inner camera 23 is attached, that is, the outer main surface of the upper housing 21 (the outer surface when the game apparatus 1 is in a closed state, It is attached to the rear surface of the upper housing 21 shown in FIG. In FIG. 1, the outer camera 25 is indicated by a broken line. As a result, the inner camera 23 can capture an image in the direction in which the inner main surface of the upper housing 21 faces, and the outer camera 25 can rotate in the direction opposite to the image capturing direction of the inner camera 23, that is, the outer main surface of the upper housing 21. It is possible to image the direction in which the surface faces. Thus, in the present embodiment, the two inner cameras 23 and the outer cameras 25 are provided so that the imaging directions are opposite to each other. For example, the user can take an image of a scene viewed from the game apparatus 1 with the inner camera 23 and can also capture an image of the scene viewed from the game apparatus 1 on the opposite side of the user with the outer camera 25. Can do.

なお、上記連結部付近の内側主面には、音声入力装置としてマイク(図2に示すマイク43)が収納されている。そして、上記連結部付近の内側主面には、マイク43がゲーム装置1外部の音を検知できるように、マイクロフォン用孔16が形成される。マイク43を収納する位置およびマイクロフォン用孔16の位置は必ずしも上記連結部である必要はなく、例えば下側ハウジング11にマイク43を収納し、マイク43を収納位置に対応させて下側ハウジング11にマイクロフォン用孔16を設けるようにしても良い。   Note that a microphone (a microphone 43 shown in FIG. 2) is accommodated as an audio input device on the inner main surface near the connecting portion. A microphone hole 16 is formed on the inner main surface near the connecting portion so that the microphone 43 can detect the sound outside the game apparatus 1. The position where the microphone 43 is housed and the position of the microphone hole 16 do not necessarily have to be the connecting portion. For example, the microphone 43 is housed in the lower housing 11, and A microphone hole 16 may be provided.

また、上側ハウジング21の外側主面には、第4LED26(図1では、破線で示す)が取り付けられる。第4LED26は、内側カメラ23または外側カメラ25によって撮影が行われた(シャッターボタンが押下された)時点で点灯する。また、内側カメラ23または外側カメラ25によって動画が撮影される間点灯する。第4LED26によって、ゲーム装置1による撮影が行われた(行われている)ことを撮影対象者や周囲に通知することができる。   A fourth LED 26 (shown by a broken line in FIG. 1) is attached to the outer main surface of the upper housing 21. The fourth LED 26 is turned on at the time when photographing is performed by the inner camera 23 or the outer camera 25 (the shutter button is pressed). Further, it is lit while a moving image is shot by the inner camera 23 or the outer camera 25. The fourth LED 26 can notify the subject to be photographed and the surroundings that photographing by the game apparatus 1 has been performed (performed).

また、上側ハウジング21の内側主面の中央付近に設けられる上側LCD22に対して、左右両側の当該主面に音抜き孔24がそれぞれ形成される。音抜き孔24の奥の上側ハウジング21内にはスピーカが収納されている。音抜き孔24は、スピーカからの音をゲーム装置1の外部に放出するための孔である。   In addition, with respect to the upper LCD 22 provided near the center of the inner main surface of the upper housing 21, sound release holes 24 are formed in the main surfaces on both the left and right sides. A speaker is housed in the upper housing 21 behind the sound release hole 24. The sound release hole 24 is a hole for releasing sound from the speaker to the outside of the game apparatus 1.

以上に説明したように、上側ハウジング21には、画像を撮像するための撮像手段である内側カメラ23および外側カメラ25と、主に操作説明画面を表示するための表示手段である上側LCD22とが設けられる。一方、下側ハウジング11には、ゲーム装置1に対する操作入力を行うための入力装置(タッチパネル13および各操作ボタン14A〜14K)と、撮像された画像を表示するための表示手段である下側LCD12とが設けられる。したがって、ゲーム装置1を使用する際には、ユーザは、下側LCD12に表示される撮像画像(カメラによって撮像された画像)を見ながら、下側ハウジング11を把持して入力装置に対する入力を行うことができる。   As described above, the upper housing 21 includes the inner camera 23 and the outer camera 25 that are imaging means for capturing an image, and the upper LCD 22 that is a display means for mainly displaying an operation explanation screen. Provided. On the other hand, the lower housing 11 has an input device (touch panel 13 and operation buttons 14A to 14K) for performing an operation input to the game apparatus 1 and a lower LCD 12 which is a display means for displaying a captured image. And are provided. Therefore, when using the game apparatus 1, the user grasps the lower housing 11 and performs input to the input device while viewing the captured image (image captured by the camera) displayed on the lower LCD 12. be able to.

次に、図2を参照して、ゲーム装置1の内部構成を説明する。図2は、ゲーム装置1の内部構成の一例を示すブロック図である。   Next, the internal configuration of the game apparatus 1 will be described with reference to FIG. FIG. 2 is a block diagram illustrating an example of the internal configuration of the game apparatus 1.

図2において、ゲーム装置1は、CPU31、メインメモリ32、メモリ制御回路33、保存用データメモリ34、プリセットデータ用メモリ35、メモリカードインターフェース(メモリカードI/F)36、メモリカードI/F37、無線通信モジュール38、ローカル通信モジュール39、リアルタイムクロック(RTC)40、電源回路41、インターフェース回路(I/F回路)42、第1GPU(Graphics Processing Unit)45、第2GPU46、第1VRAM(Video RAM)47、第2VRAM48、およびLCDコントローラ49等の電子部品を備えている。これらの電子部品は、電子回路基板上に実装されて、下側ハウジング11(または上側ハウジング21でも良い)内に収納される。   2, the game apparatus 1 includes a CPU 31, a main memory 32, a memory control circuit 33, a storage data memory 34, a preset data memory 35, a memory card interface (memory card I / F) 36, a memory card I / F 37, Wireless communication module 38, local communication module 39, real-time clock (RTC) 40, power supply circuit 41, interface circuit (I / F circuit) 42, first GPU (Graphics Processing Unit) 45, second GPU 46, first VRAM (Video RAM) 47 The second VRAM 48 and the LCD controller 49 are provided. These electronic components are mounted on an electronic circuit board and housed in the lower housing 11 (or the upper housing 21).

CPU31は、所定のプログラム(ここでは、本実施形態に係る画像表示プログラム)を実行するための情報処理手段である。本実施形態では、画像表示プログラムの一例としてゲームプログラムがゲーム装置1内のメモリ(例えば保存用データメモリ34)やメモリカード28および/または29に記憶されており、CPU31は、当該ゲームプログラムを実行することによって、後述するゲーム処理を実行する。なお、CPU31によって実行されるプログラムは、ゲーム装置1内のメモリに予め記憶されていても良いし、メモリカード28および/または29から取得されても良いし、他の機器との通信によって他の機器から取得されても良い。   The CPU 31 is information processing means for executing a predetermined program (here, the image display program according to the present embodiment). In the present embodiment, as an example of the image display program, a game program is stored in a memory (for example, the storage data memory 34) or the memory card 28 and / or 29 in the game apparatus 1, and the CPU 31 executes the game program. By doing so, a game process to be described later is executed. Note that the program executed by the CPU 31 may be stored in advance in a memory in the game apparatus 1, may be acquired from the memory card 28 and / or 29, or may be obtained by communication with other devices. It may be acquired from the device.

CPU31には、メインメモリ32、メモリ制御回路33、およびプリセットデータ用メモリ35が接続される。メモリ制御回路33には、保存用データメモリ34が接続される。メインメモリ32は、CPU31のワーク領域やバッファ領域として用いられる記憶手段である。すなわち、メインメモリ32は、上記ゲーム処理に用いられる各種データを記憶したり、外部(メモリカード28および29や他の機器等)から取得されるプログラムを記憶したりする。本実施形態では、メインメモリ32として、例えばPSRAM(Pseudo−SRAM)を用いる。保存用データメモリ34は、CPU31によって実行されるプログラムや内側カメラ23および外側カメラ25によって撮像された画像のデータ等を記憶するための記憶手段である。保存用データメモリ34は、不揮発性の記憶媒体によって構成されており、本実施形態では例えばNAND型フラッシュメモリで構成される。メモリ制御回路33は、CPU31の指示に従って、保存用データメモリ34に対するデータの読み出しおよび書き込みを制御する回路である。プリセットデータ用メモリ35は、ゲーム装置1において予め設定される各種パラメータ等のデータ(プリセットデータ)を記憶するための記憶手段である。プリセットデータ用メモリ35としては、SPI(Serial Peripheral Interface)バスによってCPU31と接続されるフラッシュメモリを用いることができる。   A main memory 32, a memory control circuit 33, and a preset data memory 35 are connected to the CPU 31. A storage data memory 34 is connected to the memory control circuit 33. The main memory 32 is a storage means used as a work area or buffer area for the CPU 31. That is, the main memory 32 stores various data used for the game processing, and stores programs acquired from the outside (memory cards 28 and 29, other devices, etc.). In the present embodiment, for example, a PSRAM (Pseudo-SRAM) is used as the main memory 32. The storage data memory 34 is a storage unit for storing a program executed by the CPU 31, data of images taken by the inner camera 23 and the outer camera 25, and the like. The storage data memory 34 is configured by a nonvolatile storage medium, and is configured by, for example, a NAND flash memory in the present embodiment. The memory control circuit 33 is a circuit that controls reading and writing of data with respect to the storage data memory 34 in accordance with instructions from the CPU 31. The preset data memory 35 is storage means for storing data (preset data) such as various parameters set in advance in the game apparatus 1. As the preset data memory 35, a flash memory connected to the CPU 31 via an SPI (Serial Peripheral Interface) bus can be used.

メモリカードI/F36および37は、それぞれCPU31に接続される。メモリカードI/F36は、コネクタに装着されたメモリカード28に対するデータの読み出しおよび書き込みを、CPU31の指示に応じて行う。また、メモリカードI/F37は、コネクタに装着されたメモリカード29に対するデータの読み出しおよび書き込みを、CPU31の指示に応じて行う。本実施形態では、内側カメラ23および外側カメラ25によって撮像された画像データや他の装置から受信された画像データがメモリカード28に書き込まれたり、メモリカード28に記憶された画像データがメモリカード28から読み出されて保存用データメモリ34に記憶されたり、読み出された画像データがメモリカード28から読み出されて他の装置へ送信されたりする。また、メモリカード29に記憶された各種プログラムが、CPU31によって読み出されて実行されたりする。   Memory card I / Fs 36 and 37 are each connected to CPU 31. The memory card I / F 36 reads and writes data to and from the memory card 28 attached to the connector according to instructions from the CPU 31. The memory card I / F 37 reads and writes data to and from the memory card 29 attached to the connector in accordance with instructions from the CPU 31. In the present embodiment, image data captured by the inner camera 23 and the outer camera 25 and image data received from other devices are written to the memory card 28, or image data stored in the memory card 28 is stored in the memory card 28. And stored in the storage data memory 34, or the read image data is read from the memory card 28 and transmitted to another device. Various programs stored in the memory card 29 are read out and executed by the CPU 31.

なお、ゲームプログラムは、メモリカード29等の外部記憶媒体を通じてコンピュータシステムに供給されるだけでなく、有線または無線の通信回線を通じてコンピュータシステムに供給されても良い。また、ゲームプログラムは、コンピュータシステム内部の不揮発性記憶装置に予め記録されていても良い。なお、ゲームプログラムを記憶する情報記憶媒体としては、上記不揮発性記憶装置に限らず、CD−ROM、DVD、あるいはそれらに類する光学式ディスク状記憶媒体でも良い。   Note that the game program may be supplied not only to the computer system through an external storage medium such as the memory card 29 but also to the computer system through a wired or wireless communication line. The game program may be recorded in advance in a nonvolatile storage device inside the computer system. The information storage medium for storing the game program is not limited to the above-described nonvolatile storage device, and may be a CD-ROM, a DVD, or an optical disk storage medium similar to them.

無線通信モジュール38は、例えばIEEE802.11.b/gの規格に準拠した方式により、無線LANに接続する機能を有する。また、ローカル通信モジュール39は、所定の通信方式により同種のゲーム装置との間で無線通信を行う機能を有する。無線通信モジュール38およびローカル通信モジュール39は、CPU31に接続される。CPU31は、無線通信モジュール38を用いてインターネットを介して他の機器との間でデータを送受信したり、ローカル通信モジュール39を用いて同種の他のゲーム装置との間でデータを送受信したりすることができる。   The wireless communication module 38 is, for example, IEEE 802.11. It has a function of connecting to a wireless LAN by a method compliant with the b / g standard. Further, the local communication module 39 has a function of performing wireless communication with the same type of game device by a predetermined communication method. The wireless communication module 38 and the local communication module 39 are connected to the CPU 31. The CPU 31 transmits / receives data to / from other devices via the Internet using the wireless communication module 38, and transmits / receives data to / from other game devices of the same type using the local communication module 39. be able to.

また、CPU31には、RTC40および電源回路41が接続される。RTC40は、時間をカウントしてCPU31に出力する。例えば、CPU31は、RTC40によって計時された時間に基づいて、現在時刻(日付)等を計算することもできる。電源回路41は、ゲーム装置1が有する電源(典型的には電池であり、下側ハウジング11に収納される)から供給される電力を制御し、ゲーム装置1の各部品に電力を供給する。   Further, the RTC 40 and the power supply circuit 41 are connected to the CPU 31. The RTC 40 counts the time and outputs it to the CPU 31. For example, the CPU 31 can calculate the current time (date) based on the time counted by the RTC 40. The power supply circuit 41 controls power supplied from a power supply (typically a battery, which is stored in the lower housing 11) of the game apparatus 1, and supplies power to each component of the game apparatus 1.

また、ゲーム装置1は、マイク43およびアンプ44を備えている。マイク43およびアンプ44は、それぞれI/F回路42に接続される。マイク43は、ゲーム装置1に向かって発声されたユーザの音声を検知して、当該音声を示す音声信号をI/F回路42に出力する。アンプ44は、I/F回路42から音声信号を増幅してスピーカ(図示せず)から出力させる。I/F回路42は、CPU31に接続される。   Further, the game apparatus 1 includes a microphone 43 and an amplifier 44. The microphone 43 and the amplifier 44 are each connected to the I / F circuit 42. The microphone 43 detects the voice of the user uttered toward the game apparatus 1 and outputs a voice signal indicating the voice to the I / F circuit 42. The amplifier 44 amplifies the audio signal from the I / F circuit 42 and outputs it from a speaker (not shown). The I / F circuit 42 is connected to the CPU 31.

また、タッチパネル13は、I/F回路42に接続される。I/F回路42は、マイク43およびアンプ44(スピーカ)の制御を行う音声制御回路と、タッチパネル13の制御を行うタッチパネル制御回路とを含む。音声制御回路は、音声信号に対するA/D変換およびD/A変換を行ったり、音声信号を所定の形式の音声データに変換したりする。タッチパネル制御回路は、タッチパネル13からの信号に基づいて所定の形式のタッチ位置データ(後述する検出座標データ)を生成してCPU31に出力する。タッチ位置データは、タッチパネル13の入力面に対して入力が行われた位置としてタッチパネル13が検出した位置の座標を示すデータである。なお、タッチパネル制御回路は、タッチパネル13からの信号の読み込み、および、検出座標データの生成を所定時間に1回の割合で繰り返し行う。   The touch panel 13 is connected to the I / F circuit 42. The I / F circuit 42 includes a sound control circuit that controls the microphone 43 and the amplifier 44 (speaker), and a touch panel control circuit that controls the touch panel 13. The voice control circuit performs A / D conversion and D / A conversion on the voice signal, or converts the voice signal into voice data of a predetermined format. The touch panel control circuit generates touch position data (detected coordinate data described later) in a predetermined format based on a signal from the touch panel 13 and outputs it to the CPU 31. The touch position data is data indicating the coordinates of the position detected by the touch panel 13 as the position where the input is performed on the input surface of the touch panel 13. The touch panel control circuit repeatedly reads signals from the touch panel 13 and generates detected coordinate data at a rate of once per predetermined time.

操作ボタン14は、上記各操作ボタン14A〜14Kから構成され、CPU31に接続される。操作ボタン14からCPU31へは、各操作ボタン14A〜14Kに対する入力状況(押下されたか否か)を示す操作データが出力される。CPU31は、操作ボタン14から操作データを取得することによって、操作ボタン14に対する入力に応じた処理を実行する。   The operation button 14 includes the operation buttons 14A to 14K and is connected to the CPU 31. From the operation button 14 to the CPU 31, operation data indicating an input status (whether or not the button is pressed) for each of the operation buttons 14A to 14K is output. The CPU 31 obtains operation data from the operation button 14 to execute processing corresponding to the input to the operation button 14.

内側カメラ23および外側カメラ25は、それぞれCPU31に接続される。内側カメラ23および外側カメラ25は、CPU31の指示に応じて画像を撮像し、撮像した画像データをCPU31に出力する。本実施形態では、CPU31は、内側カメラ23および外側カメラ25のいずれか一方に対して撮像指示を行い、撮像指示を受けたカメラが画像を撮像して画像データをCPU31に送る。なお、内側カメラ23および外側カメラ25は動画の撮影も可能である。すなわち、内側カメラ23および外側カメラ25は、繰り返し撮像を行って撮像データをCPU31へ繰り返し送ることも可能である。   The inner camera 23 and the outer camera 25 are each connected to the CPU 31. The inner camera 23 and the outer camera 25 capture an image in accordance with an instruction from the CPU 31 and output the captured image data to the CPU 31. In the present embodiment, the CPU 31 issues an imaging instruction to either the inner camera 23 or the outer camera 25, and the camera that has received the imaging instruction captures an image and sends the image data to the CPU 31. Note that the inner camera 23 and the outer camera 25 can also shoot moving images. That is, the inner camera 23 and the outer camera 25 can repeatedly perform imaging and repeatedly transmit imaging data to the CPU 31.

第1GPU45には第1VRAM47が接続され、第2GPU46には第2VRAM48が接続される。第1GPU45は、CPU31からの指示に応じて、メインメモリ32に記憶されている表示画像を生成するためのデータに基づいて第1の表示画像を生成し、第1VRAM47に描画する。第2GPU46は、第1GPU45と同様に、CPU31からの指示に応じて第2の表示画像を生成し、第2VRAM48に描画する。第1VRAM47および第2VRAM48は、LCDコントローラ49に接続されている。   A first VRAM 47 is connected to the first GPU 45, and a second VRAM 48 is connected to the second GPU 46. In response to an instruction from the CPU 31, the first GPU 45 generates a first display image based on data for generating a display image stored in the main memory 32 and draws the first display image in the first VRAM 47. Similar to the first GPU 45, the second GPU 46 generates a second display image in accordance with an instruction from the CPU 31 and draws it in the second VRAM 48. The first VRAM 47 and the second VRAM 48 are connected to the LCD controller 49.

LCDコントローラ49は、レジスタ491を含む。レジスタ491は、CPU31からの指示に応じて0または1の値を記憶する。LCDコントローラ49は、レジスタ491の値が0の場合は、第1VRAM47に描画された第1の表示画像を下側LCD12に出力し、第2VRAM48に描画された第2の表示画像を上側LCD22に出力する。また、レジスタ491の値が1の場合は、第1VRAM47に描画された第1の表示画像を上側LCD22に出力し、第2VRAM48に描画された第2の表示画像を下側LCD12に出力する。例えば、CPU31は、内側カメラ23および外側カメラ25のいずれかから取得した画像を下側LCD12に表示させ、所定の処理によって生成した操作説明画面を上側LCD22に表示させることも可能である。   The LCD controller 49 includes a register 491. The register 491 stores a value of 0 or 1 according to an instruction from the CPU 31. When the value of the register 491 is 0, the LCD controller 49 outputs the first display image drawn in the first VRAM 47 to the lower LCD 12 and outputs the second display image drawn in the second VRAM 48 to the upper LCD 22. To do. If the value of the register 491 is 1, the first display image drawn in the first VRAM 47 is output to the upper LCD 22, and the second display image drawn in the second VRAM 48 is output to the lower LCD 12. For example, the CPU 31 can cause the lower LCD 12 to display an image acquired from either the inner camera 23 or the outer camera 25 and cause the upper LCD 22 to display an operation explanation screen generated by a predetermined process.

[ゲーム処理の概要]
次に、図3から図9を参照して、上記ゲームプログラムによって実行されるゲーム処理中において行われるゲーム処理について説明する。ゲームプログラムは、カメラによって撮像された現実空間の画像(撮像画像)に対して画像認識処理を行い、画像認識処理の結果に基づいて仮想空間の画像(仮想画像)を撮像画像に対して合成したゲーム画像を表示し、プレイヤにゲームをプレイさせるものである。
[Overview of game processing]
Next, with reference to FIG. 3 to FIG. 9, the game process performed during the game process executed by the game program will be described. The game program performs image recognition processing on the real space image (captured image) captured by the camera, and synthesizes the virtual space image (virtual image) with the captured image based on the result of the image recognition processing. The game image is displayed and the player is allowed to play the game.

図3は、ゲーム装置を使用する例を示す図である。本実施形態においては、図3に示すように、プレイヤ(ユーザ)は、所定の撮像対象としてのマーカ51を任意の場所(図3では机50の上)に設置しておき、ゲーム装置1を用いてマーカ51およびその周辺を撮像する。撮像に用いられるカメラは、内側カメラ23および外側カメラ25のいずれであっても良いが、ここでは、外側カメラ25を用いる場合を例として説明する。マーカ51は、本実施形態では所定の模様(図6参照)が描かれた薄板状のものが用いられる。   FIG. 3 is a diagram illustrating an example of using a game device. In the present embodiment, as shown in FIG. 3, the player (user) installs the marker 51 as a predetermined imaging target at an arbitrary location (on the desk 50 in FIG. 3), and the game apparatus 1 The marker 51 and its surroundings are imaged using it. The camera used for imaging may be either the inner camera 23 or the outer camera 25. Here, the case where the outer camera 25 is used will be described as an example. In this embodiment, the marker 51 is a thin plate on which a predetermined pattern (see FIG. 6) is drawn.

図4は、ゲーム装置に表示されるゲーム画像の一例を示す図である。図4は、図3に示すように机50の上に置かれたマーカ51をゲーム装置1が撮像する場合に、ゲーム装置1の上側LCD22に表示されるゲーム画像を示す。なお、本実施形態ではゲーム画像が上側LCD22に表示されるものとするが、ゲーム画像は下側LCD12に表示されてもよい。図4に示すように、上側LCD22には、仮想空間における仮想オブジェクトの画像(仮想画像)として大砲52の画像が撮像画像に合成されて表示される。これによって、実際の机50の上に大砲52が存在するかのような画像を表示することができる。なお、図4では、仮想オブジェクトの一例として大砲52の画像が表示されるが、仮想オブジェクトはどのようなものであってもよい。このように、本実施形態においては、拡張現実感技術を用いて、仮想オブジェクトがあたかも現実空間に存在するかのようなゲーム画像が表示される。   FIG. 4 is a diagram illustrating an example of a game image displayed on the game device. FIG. 4 shows a game image displayed on the upper LCD 22 of the game apparatus 1 when the game apparatus 1 images the marker 51 placed on the desk 50 as shown in FIG. In this embodiment, the game image is displayed on the upper LCD 22, but the game image may be displayed on the lower LCD 12. As shown in FIG. 4, an image of the cannon 52 is combined with a captured image and displayed on the upper LCD 22 as a virtual object image (virtual image) in the virtual space. Thus, an image as if the cannon 52 is present on the actual desk 50 can be displayed. In FIG. 4, an image of the cannon 52 is displayed as an example of the virtual object, but the virtual object may be anything. Thus, in this embodiment, a game image as if a virtual object exists in the real space is displayed using augmented reality technology.

なお、撮像画像に対して仮想画像を合成した画像(合成画像)は、例えば次の処理によって生成することができる。すなわち、ゲーム装置1はまず、カメラによる撮像画像から、その中に含まれるマーカ51を認識する(画像)認識処理を実行する。ここでは、認識処理の処理結果として、撮像画像内におけるマーカ51の位置および向きを示す情報が算出される。マーカ51が認識された場合、ゲーム装置1は、認識処理の処理結果であるマーカ51の位置および向きから、ゲーム装置1(カメラ)とマーカ51との位置関係を算出する。さらに、ゲーム装置1は、位置関係に基づいて仮想空間における仮想カメラの位置および姿勢を算出する。仮想カメラの位置および姿勢は、仮想空間における仮想カメラと仮想オブジェクトとの位置関係が、現実空間におけるゲーム装置1とマーカ51との位置関係に一致するように算出される。仮想カメラの位置が決まると、ゲーム装置1は、仮想カメラの位置から仮想オブジェクトを見た仮想画像を生成し、撮像画像に対して仮想画像を合成する。以上の処理によって、ゲーム装置1は合成画像を生成して表示することができる。なお、上記位置関係から仮想カメラの位置を算出する処理は、従来の拡張現実感技術における処理と同様であってもよい。   Note that an image obtained by combining a virtual image with a captured image (synthesized image) can be generated by, for example, the following process. That is, the game apparatus 1 first executes (image) recognition processing for recognizing the marker 51 included therein from the image captured by the camera. Here, information indicating the position and orientation of the marker 51 in the captured image is calculated as the processing result of the recognition process. When the marker 51 is recognized, the game apparatus 1 calculates the positional relationship between the game apparatus 1 (camera) and the marker 51 from the position and orientation of the marker 51 that is the processing result of the recognition process. Furthermore, the game apparatus 1 calculates the position and orientation of the virtual camera in the virtual space based on the positional relationship. The position and orientation of the virtual camera are calculated so that the positional relationship between the virtual camera and the virtual object in the virtual space matches the positional relationship between the game apparatus 1 and the marker 51 in the real space. When the position of the virtual camera is determined, the game apparatus 1 generates a virtual image in which the virtual object is viewed from the position of the virtual camera, and synthesizes the virtual image with the captured image. Through the above processing, the game apparatus 1 can generate and display a composite image. Note that the process of calculating the position of the virtual camera from the above positional relationship may be the same as the process in the conventional augmented reality technology.

[画像認識処理の概要]
以上のように、本実施形態では、ゲーム装置1は撮像画像から認識処理によってマーカ51を検出する。認識処理においてマーカ51を正確に検出することができなければ、仮想画像を正確に生成することができず、撮像画像上の正しい位置に仮想画像を合成することができなくなってしまい、合成画像の現実味(リアルさ)が薄れてしまう。そこで、本実施形態では、マーカ51を正確にかつ効率良く検出するべく、ゲーム装置1は以下の認識処理を実行する。
[Overview of image recognition processing]
As described above, in the present embodiment, the game apparatus 1 detects the marker 51 from the captured image by the recognition process. If the marker 51 cannot be accurately detected in the recognition process, the virtual image cannot be generated accurately, and the virtual image cannot be synthesized at the correct position on the captured image. Reality will fade. Therefore, in the present embodiment, the game apparatus 1 executes the following recognition process in order to detect the marker 51 accurately and efficiently.

(複数種類の精度を用いた認識処理)
図5は、本実施形態における画像認識処理で用いられる対象領域を示す図である。本実施形態では、認識処理を行うべき撮像画像が取得されると、ゲーム装置1はまず、撮像画像のうちでマーカ51を含む領域(「対象領域」と呼ぶ)54を検出する処理(領域検出処理)を行う(図5に示す表の上欄参照)。この領域検出処理は、撮像画像全体の領域53に対して行われ、後述するマーカ検出処理よりも低い精度で行われる。ここで、「低い精度」とは、処理において画素値を参照する画素の間隔を相対的に大きくすることを意味する。例えば本実施形態では、ゲーム装置1は、撮像画像の画素3つ分の間隔で画素値を参照して(すなわち、画素を2つとばしで画素値を参照して)領域検出処理を行う。このように、対象領域54の検出処理は低い精度で行われるので、当該検出処理は比較的高速に行われる。
(Recognition processing using multiple types of accuracy)
FIG. 5 is a diagram showing a target area used in the image recognition processing in the present embodiment. In the present embodiment, when a captured image to be recognized is acquired, the game apparatus 1 first detects a region (referred to as “target region”) 54 including the marker 51 in the captured image (region detection). Process) (see the upper column of the table shown in FIG. 5). This region detection process is performed on the region 53 of the entire captured image, and is performed with lower accuracy than the marker detection process described later. Here, “low accuracy” means relatively increasing the interval between pixels that refer to pixel values in the processing. For example, in the present embodiment, the game apparatus 1 performs region detection processing with reference to pixel values at intervals of three pixels of the captured image (that is, with reference to pixel values by skipping two pixels). Thus, since the detection process of the target area 54 is performed with low accuracy, the detection process is performed at a relatively high speed.

上記対象領域54が検出されると、ゲーム装置1は、対象領域54の画像からマーカ51を検出する処理(マーカ検出処理)を行う。マーカ検出処理は、(撮像画像全体の領域53ではなく)対象領域54のみを対象として行われ、かつ、上記領域検出処理よりも高い精度で行われる(図5に示す下欄参照)。つまり、マーカ検出処理においては、参照される画素が領域検出処理よりも細かく、換言すれば、画素値を参照する画素の間隔が領域検出処理よりも小さい。具体的には、本実施形態では、ゲーム装置1は、撮像画像の画素1つ分の間隔で画素値を参照して(すなわち、全ての画素の画素値を参照して)領域検出処理を行う。このように、マーカ検出処理は高い精度で行われるので、検出結果として得られるマーカ51の位置および向きは精度良く算出される。また、マーカ検出処理は対象領域54のみに対して行われるので、ゲーム装置1は、撮像画像全体の領域53に対して処理が行われる場合に比べて高速に処理を行うことができる。   When the target area 54 is detected, the game apparatus 1 performs a process of detecting the marker 51 from the image of the target area 54 (marker detection process). The marker detection process is performed only for the target area 54 (not the area 53 of the entire captured image), and is performed with higher accuracy than the area detection process (see the lower column in FIG. 5). That is, in the marker detection process, the referenced pixel is finer than the area detection process, in other words, the interval between the pixels that refer to the pixel value is smaller than the area detection process. Specifically, in the present embodiment, the game apparatus 1 performs region detection processing with reference to pixel values at intervals of one pixel of the captured image (that is, with reference to pixel values of all pixels). . Thus, since the marker detection process is performed with high accuracy, the position and orientation of the marker 51 obtained as a detection result are calculated with high accuracy. In addition, since the marker detection process is performed only on the target area 54, the game apparatus 1 can perform the process at a higher speed than when the process is performed on the area 53 of the entire captured image.

以上のように、本実施形態では、ゲーム装置1は、まず対象領域54を検出する処理を行い、対象領域54に対してマーカ51の検出処理を行う。そのため、必要な領域(すなわち、対象領域)のみに対してマーカ51の検出処理を行うことができ、マーカ51の検出処理を短時間で行うことができる。また、対象領域54の検出処理は低い精度で行われるので、この検出処理も短時間で行うことができ、認識処理全体としても短時間で処理を行うことができる。さらに、マーカ51の検出処理は高精度で行われるので、認識結果として得られるマーカ51の位置および向きは高精度で算出することができる。つまり、本実施形態によれば、撮像画像からマーカ51を検出する認識処理を高速かつ精度良く行うことができる。   As described above, in the present embodiment, the game apparatus 1 first performs the process of detecting the target area 54 and performs the process of detecting the marker 51 for the target area 54. Therefore, the marker 51 detection process can be performed only on the necessary area (that is, the target area), and the marker 51 detection process can be performed in a short time. Further, since the detection process of the target area 54 is performed with low accuracy, this detection process can be performed in a short time, and the entire recognition process can be performed in a short time. Furthermore, since the detection process of the marker 51 is performed with high accuracy, the position and orientation of the marker 51 obtained as a recognition result can be calculated with high accuracy. That is, according to the present embodiment, recognition processing for detecting the marker 51 from the captured image can be performed at high speed and with high accuracy.

なお、本実施形態においては、上記マーカ検出処理内においても、異なる精度で処理が行われる。すなわち、マーカ検出処理には複数の処理が含まれており、各処理は異なる精度で実行される。これら各処理の詳細について後述する。   In the present embodiment, processing is performed with different accuracy even in the marker detection processing. That is, the marker detection process includes a plurality of processes, and each process is executed with different accuracy. Details of these processes will be described later.

(内部図形の中心位置によってマーカを検出する認識処理)
また、本実施形態における認識処理では、複数の内部図形が描かれた図形を含むマーカ51を用いて、内部図形の中心位置を算出することでマーカ51の検出を行う。図6は、本実施形態において用いられるマーカを示す図である。図6に示すように、マーカ51は、第1図形55と第2図形57とを含む。第1図形55は、複数個(図6では8個)の白い円形の図形56が内部に描かれている。本実施形態では、この白い円形の図形56が内部図形である。また、本実施形態では、8つの内部図形56は、四角形(正方形)の4頂点と4辺の中点との位置に配置されている。なお、第1図形は内部に複数の図形(内部図形)が描かれたものであればどのようなものであってもよく、内部図形の位置、形状、大きさ、および色はどのようなものでもよい。また、第2図形57は図6では矢印を表す図形であるが、第2図形57はどのような図形であってもよい。
(Recognition process to detect a marker by the center position of internal figure)
Further, in the recognition processing in the present embodiment, the marker 51 is detected by calculating the center position of the internal figure using the marker 51 including the figure in which a plurality of internal figures are drawn. FIG. 6 is a diagram showing markers used in the present embodiment. As shown in FIG. 6, the marker 51 includes a first graphic 55 and a second graphic 57. The first graphic 55 has a plurality (eight in FIG. 6) of white circular graphics 56 drawn therein. In the present embodiment, the white circular graphic 56 is an internal graphic. In the present embodiment, the eight internal figures 56 are arranged at the positions of the four vertices of a quadrangle (square) and the midpoints of the four sides. The first figure may be any figure as long as a plurality of figures (internal figures) are drawn inside, and the position, shape, size, and color of the internal figure are any. But you can. The second graphic 57 is a graphic representing an arrow in FIG. 6, but the second graphic 57 may be any graphic.

なお、本実施形態では図6に示すマーカ51を用いるので、上述の領域検出処理においては、ゲーム装置1はマーカ51の第1図形55の領域を対象領域として検出する。そして、上述のマーカ検出処理においては第1図形55の検出を高精度で行うことでマーカ51の位置および向きを検出する。   In the present embodiment, since the marker 51 shown in FIG. 6 is used, in the region detection process described above, the game apparatus 1 detects the region of the first graphic 55 of the marker 51 as the target region. In the marker detection process described above, the position and orientation of the marker 51 are detected by detecting the first graphic 55 with high accuracy.

ここで、上記マーカ51の位置を検出するために、マーカ51の第1図形55の輪郭を検出する方法を考える。図7は、左右の輪郭がぼけた第1図形55の画像を示す図である。カメラによって撮像される撮像画像は、いわゆる手ブレ等の原因で画像にぶれが生じて、輪郭が不明確になることがある。例えば、画像の撮像時に左右にカメラ(ゲーム装置1)が動いてしまうと、図7に示すように、輪郭が左右にぼけて不明確になる。このように撮像画像にぶれが生じて輪郭が不明確になる場合には、上述の輪郭を検出する方法では、輪郭を正確に検出することが難しいため、図形の位置を正確に算出することができない。輪郭は、例えば画素間における画素値(輝度値あるいは色値等)の差に基づいて検出することができるが、撮像画像にぶれが生じる場合、検出される輪郭の位置は画像の内容や閾値等に応じて大きく変化してしまう。例えば図7に示す画像の例で言えば、図7に示す点線58が輪郭として検出される場合や、点線59が輪郭として検出されたりする場合がある。これらの場合、第1図形55の横方向に関する長さは正しく算出されず、第1図形55の位置を正確に算出することができない。このように、輪郭を検出して輪郭からマーカの位置を算出する方法では、撮像画像にぶれが生じている場合にマーカの位置を正確に算出することができないおそれがある。   Here, in order to detect the position of the marker 51, a method of detecting the contour of the first graphic 55 of the marker 51 is considered. FIG. 7 is a diagram illustrating an image of the first graphic 55 in which the left and right contours are blurred. The captured image captured by the camera may be blurred due to a so-called camera shake or the like, resulting in an unclear outline. For example, if the camera (game device 1) moves left and right when an image is captured, the outline is blurred left and right and becomes unclear as shown in FIG. In this way, when the captured image is blurred and the contour becomes unclear, it is difficult to accurately detect the contour by the above-described method of detecting the contour, and therefore it is possible to accurately calculate the position of the figure. Can not. The contour can be detected based on, for example, a difference in pixel values (luminance value, color value, etc.) between pixels, but when the captured image is blurred, the position of the detected contour is the content of the image, the threshold value, etc. It will change greatly according to. For example, in the example of the image shown in FIG. 7, the dotted line 58 shown in FIG. 7 may be detected as a contour, or the dotted line 59 may be detected as a contour. In these cases, the length of the first graphic 55 in the horizontal direction is not correctly calculated, and the position of the first graphic 55 cannot be accurately calculated. As described above, in the method of detecting the contour and calculating the position of the marker from the contour, the position of the marker may not be accurately calculated when the captured image is blurred.

そこで、本実施形態における認識処理では、ゲーム装置1は、第1図形55の内部図形56を検出し、各内部図形56の中心位置を算出することによってマーカ51を検出する。図8は、第1図形55の一部における内部図形56の中心位置を示す図である。上述のマーカ検出処理において、ゲーム装置1は、内部図形56の領域(輪郭)を検出し、検出した領域の中心点Pを算出する(図8参照)。ここで、図8において、撮像画像にぶれが生じているために図8に示す白の点線が輪郭として検出された場合でも、図8に示す黒の点線が輪郭として検出された場合でも、中心点Pは同じ位置となる。   Therefore, in the recognition processing in the present embodiment, the game apparatus 1 detects the internal graphic 56 of the first graphic 55 and detects the marker 51 by calculating the center position of each internal graphic 56. FIG. 8 is a diagram showing the center position of the internal graphic 56 in a part of the first graphic 55. In the marker detection process described above, the game apparatus 1 detects the area (contour) of the internal graphic 56 and calculates the center point P of the detected area (see FIG. 8). Here, in FIG. 8, even if the white dotted line shown in FIG. 8 is detected as a contour due to blurring in the captured image, the center is the same regardless of whether the black dotted line shown in FIG. 8 is detected as a contour. Point P is at the same position.

図9は、第1図形55内の各内部図形56の中心点を示す図である。本実施形態においては、各内部図形56の中心点P1〜P8がそれぞれ算出される。ここで、第1図形55の左右方向の長さは、点P1から点P3までの長さ等によって表される。この長さは、図8に示す白の点線が輪郭として検出される場合でも、黒の点線が輪郭として検出される場合でも、同じになる。つまり、この長さは、撮像画像にぶれが生じている場合でも正確に算出することができる。   FIG. 9 is a diagram showing the center point of each internal graphic 56 in the first graphic 55. In the present embodiment, the center points P1 to P8 of each internal graphic 56 are calculated. Here, the length in the left-right direction of the first graphic 55 is represented by the length from the point P1 to the point P3, and the like. This length is the same whether the white dotted line shown in FIG. 8 is detected as a contour or the black dotted line is detected as a contour. That is, this length can be accurately calculated even when the captured image is blurred.

詳細は後述するが、本実施形態では、ゲーム装置1は、各内部図形56の中心点P1〜P8からマーカ51の4点の位置を特定する。この4点の位置は、8個の内部図形56によって表される四角形(正方形)の4つの頂点の位置である。この4点の位置によって、マーカ51の位置および向きが特定される。ただし、上記4点の位置は正方形の各頂点であるため、マーカ51が90°、180°または270°回転した状態と回転しない状態とで同じ値となるので、上記4点の位置では、上下左右の4方向に関するマーカ51の向きを特定することができず、マーカ51の向きを一意に特定することができない。そのため、ゲーム装置1は、第2図形57を検出することによって、マーカ51の向きを一意に特定する。なお、第2図形57を用いてマーカ51の向きを特定する方法については後述する。   Although details will be described later, in the present embodiment, the game apparatus 1 specifies the positions of the four points of the marker 51 from the center points P1 to P8 of each internal graphic 56. The positions of the four points are the positions of four vertices of a quadrangle (square) represented by the eight internal figures 56. The position and orientation of the marker 51 are specified by the positions of these four points. However, since the positions of the four points are the vertices of the square, the marker 51 has the same value when rotated by 90 °, 180 °, or 270 ° and when it does not rotate. The direction of the marker 51 with respect to the four left and right directions cannot be specified, and the direction of the marker 51 cannot be uniquely specified. Therefore, the game apparatus 1 uniquely identifies the direction of the marker 51 by detecting the second graphic 57. A method for specifying the orientation of the marker 51 using the second graphic 57 will be described later.

以上のように、本実施形態では、マーカ検出処理において、ゲーム装置1は、各内部図形56の中心点P1〜P8を算出する。そして、中心点P1〜P8からマーカ51の4点の位置を特定することで、マーカ51の位置を算出する。ここで、上記中心点P1〜P8は、撮像画像にぶれが生じている場合でも正確に算出されるので、ゲーム装置1は、撮像画像にぶれが生じている場合でも、中心点P1〜P8を用いることによってマーカ51の位置を正確に算出することができる。   As described above, in the present embodiment, in the marker detection process, the game apparatus 1 calculates the center points P <b> 1 to P <b> 8 of each internal graphic 56. And the position of the marker 51 is calculated by specifying the positions of the four points of the marker 51 from the center points P1 to P8. Here, since the center points P1 to P8 are accurately calculated even when the captured image is blurred, the game apparatus 1 uses the center points P1 to P8 even when the captured image is blurred. By using it, the position of the marker 51 can be accurately calculated.

[ゲーム処理の詳細]
次に、図10〜図15を参照して、ゲームプログラムによって実行されるゲーム処理の詳細を説明する。まず、ゲーム処理において用いられる各種データについて説明する。図10は、ゲームプログラムによる処理において用いられる各種データを示す図である。図10において、ゲーム装置1のメインメモリ32には、ゲームプログラム61、撮像画像データ62、およびゲーム処理データ63が記憶される。
[Details of game processing]
Next, the details of the game process executed by the game program will be described with reference to FIGS. First, various data used in the game process will be described. FIG. 10 is a diagram showing various data used in the processing by the game program. In FIG. 10, a game program 61, captured image data 62, and game process data 63 are stored in the main memory 32 of the game apparatus 1.

ゲームプログラム61は、後述するゲーム処理(図11)をゲーム装置1のCPU31に実行させるためのプログラムである。ゲームプログラム61は、メモリカード29からその一部または全部が適宜のタイミングで読み込まれることによってメインメモリ32に記憶される。ゲームプログラム61には、ゲームを進行させるためのプログラムの他、上述の画像認識処理を実行するためのプログラムが含まれる。   The game program 61 is a program for causing the CPU 31 of the game apparatus 1 to execute a game process (FIG. 11) described later. The game program 61 is stored in the main memory 32 by being partially or entirely read from the memory card 29 at an appropriate timing. The game program 61 includes a program for executing the above-described image recognition processing in addition to a program for progressing the game.

撮像画像データ62は、カメラ(内側カメラ23または外側カメラ25)によって撮像された画像(撮像画像)を示すデータである。撮像画像データ62としては、カメラから取得された最新の画像データのみが記憶されてもよいし、新しいものから順にそれぞれ所定個数の画像データが記憶されてもよい。   The captured image data 62 is data indicating an image (captured image) captured by the camera (the inner camera 23 or the outer camera 25). As the captured image data 62, only the latest image data acquired from the camera may be stored, or a predetermined number of image data may be stored in order from the newest.

ゲーム処理データ63は、ゲーム処理において用いられる各種のデータである。ゲーム処理データ63には、対象領域データ64、輪郭データ65、内部領域データ66、中心位置データ67、頂点データ68、および認識結果データ69が含まれる。なお、ゲーム処理データ63には、上記の他、ゲームに登場する各種オブジェクト(上記大砲52等)に関するデータや、BGM等の音声データ等、ゲームに必要な各種データが記憶される。   The game process data 63 is various data used in the game process. The game processing data 63 includes target area data 64, contour data 65, internal area data 66, center position data 67, vertex data 68, and recognition result data 69. In addition to the above, the game processing data 63 stores various data necessary for the game, such as data related to various objects appearing in the game (the cannon 52 and the like) and sound data such as BGM.

対象領域データ64は、上述した対象領域、すなわち、撮像画像内における上記第1図形55の領域を示すデータである。対象領域データ64は上述の領域検出処理によって得られる。なお、本実施形態では、領域検出処理においては、低い精度で検出処理が行われるので、実際には第1図形55でない領域も第1図形55の領域として検出される場合がある。そのため、領域検出処理においては複数の領域が対象領域として検出される場合がある。この場合、検出された領域毎の対象領域データ64がメインメモリ32に記憶される(つまり、複数の対象領域データが記憶される)。なお、対象領域データ64は、領域を示すものであればよく、領域の輪郭のみを示すものであってもよいし、領域に対応する各画素を示すものであってもよい。   The target area data 64 is data indicating the above-described target area, that is, the area of the first graphic 55 in the captured image. The target area data 64 is obtained by the area detection process described above. In the present embodiment, since the detection process is performed with low accuracy in the area detection process, an area that is not the first graphic 55 may actually be detected as an area of the first graphic 55. Therefore, in the area detection process, a plurality of areas may be detected as target areas. In this case, target area data 64 for each detected area is stored in the main memory 32 (that is, a plurality of target area data is stored). Note that the target area data 64 is not limited as long as it indicates an area, may indicate only the outline of the area, or may indicate each pixel corresponding to the area.

輪郭データ65は、撮像画像内における上記第1図形55の輪郭を示すデータである。輪郭データ65は、上記対象領域データ64と同様、第1図形55の領域を示すデータであるが、対象領域データ64よりも高精度で検出される点で異なる。   The contour data 65 is data indicating the contour of the first graphic 55 in the captured image. The contour data 65 is data indicating the region of the first graphic 55 as with the target region data 64, but differs in that it is detected with higher accuracy than the target region data 64.

内部領域データ66は、上記第1図形55内の内部図形56の領域を示すデータである。上述のように、第1図形55には複数個(8個)の内部図形56が含まれている。そのため、マーカ検出処理において8個の内部図形56が正しく検出されれば、8個の内部領域データ66がメインメモリ32に記憶される。ただし、実際には8個全ての内部図形56が検出されない場合もある。この場合、検出された内部図形56の個数と同数の内部領域データ66がメインメモリ32に記憶される。なお、内部領域データ66は、領域を示すものであればよく、領域の輪郭のみを示すものであってもよいし、領域に対応する各画素を示すものであってもよい。   The internal area data 66 is data indicating the area of the internal graphic 56 in the first graphic 55. As described above, the first graphic 55 includes a plurality (eight) internal figures 56. Therefore, if eight internal figures 56 are correctly detected in the marker detection process, eight internal area data 66 are stored in the main memory 32. However, in fact, all eight internal figures 56 may not be detected. In this case, the same number of internal area data 66 as the number of detected internal figures 56 is stored in the main memory 32. It should be noted that the internal region data 66 only needs to indicate the region, and may indicate only the outline of the region, or may indicate each pixel corresponding to the region.

中心位置データ67は、各内部図形56の中心位置をそれぞれ示すデータである。中心位置データ67は、マーカ検出処理において検出された内部図形56の数と同数の中心位置を示す。   The center position data 67 is data indicating the center position of each internal graphic 56. The center position data 67 indicates the same number of center positions as the number of internal figures 56 detected in the marker detection process.

頂点データ68は、8個の内部図形56によって表される四角形(正方形)の4つの頂点の位置を示すデータである。詳細は後述するが、4つの頂点は、8つの内部図形56の各中心位置に基づいて算出される。   The vertex data 68 is data indicating the positions of four vertices of a quadrangle (square) represented by the eight internal figures 56. Although details will be described later, the four vertices are calculated based on the center positions of the eight internal figures 56.

認識結果データ69は、認識処理の結果として出力される、マーカ51の位置および向きを示すデータである。詳細は後述するが、マーカ51の位置および向きは、上記頂点データ68が示す4つの頂点と、撮像画像における第1図形55に対する第2図形57の向きとに基づいて算出される。   The recognition result data 69 is data indicating the position and orientation of the marker 51 output as a result of the recognition process. Although details will be described later, the position and orientation of the marker 51 are calculated based on the four vertices indicated by the vertex data 68 and the orientation of the second graphic 57 with respect to the first graphic 55 in the captured image.

次に、ゲーム装置1において行われるゲーム処理の詳細を、図11〜図16を用いて説明する。図11は、ゲーム装置1において実行されるゲーム処理の流れを示すメインフローチャートである。電源ボタン14Fが押下されることによってゲーム装置1の電源が投入されると、ゲーム装置1のCPU31は、各種アプリケーションの起動を指示するためのメニュー画面(例えば、各アプリケーションを表す画像(アイコン)を含む画像)を表示する。ユーザは、メニュー画面においてゲームプログラム61を起動する指示、例えば、ゲームプログラム61のアイコンを選択する指示を行う。メニュー画面において、ゲームプログラム61の起動が指示されると、CPU31は、メインメモリ32等の初期化を行った後、図11に示す処理を行うためのゲームプログラム61の実行を開始する。本実施形態においては、ゲームプログラム61の実行によって、CPU31が請求項に記載の各手段として機能することとなる。つまり、ゲームプログラム61は、請求項に記載の各手段としてCPU31を機能させる。   Next, details of the game process performed in the game apparatus 1 will be described with reference to FIGS. FIG. 11 is a main flowchart showing a flow of game processing executed in the game apparatus 1. When the power of the game apparatus 1 is turned on by pressing the power button 14F, the CPU 31 of the game apparatus 1 displays a menu screen (for example, an image (icon) representing each application) for instructing activation of various applications. Image). The user gives an instruction to start the game program 61 on the menu screen, for example, an instruction to select an icon of the game program 61. When the activation of the game program 61 is instructed on the menu screen, the CPU 31 initializes the main memory 32 and the like, and then starts executing the game program 61 for performing the processing shown in FIG. In the present embodiment, execution of the game program 61 causes the CPU 31 to function as each unit recited in the claims. That is, the game program 61 causes the CPU 31 to function as each unit recited in the claims.

まずステップS1において、CPU31は、撮像画像が取得されたか否かを判定する。すなわち、カメラ(本実施形態では外側カメラ25)から撮像画像のデータが送られてきたか否かを判定する。また、撮像画像のデータがカメラから送られてきた場合、CPU31は、当該データを撮像画像データ62としてメインメモリ32に記憶する。なお、本実施形態においては、ステップS1〜S7の処理ループは、1フレーム時間(1/60秒)に1回の割合で実行されるのに対して、カメラはそれよりも少ない頻度(数フレーム時間に1回程度)で撮像画像を送るものとする。ただし、他の実施形態においては、1フレーム時間(または1フレーム時間より短い時間)に1回の割合で撮像画像が取得されてもよい。ステップS1の判定結果が肯定である場合、ステップS2の処理が実行される。一方、ステップS1の判定結果が否定である場合、ステップS2からS4の処理がスキップされて後述するステップS5の処理が実行される。   First, in step S1, the CPU 31 determines whether a captured image has been acquired. That is, it is determined whether captured image data is sent from the camera (outer camera 25 in the present embodiment). When captured image data is sent from the camera, the CPU 31 stores the data as captured image data 62 in the main memory 32. In the present embodiment, the processing loop of steps S1 to S7 is executed at a rate of once per frame time (1/60 seconds), whereas the camera has a lower frequency (several frames). Assume that the captured image is sent once a hour). However, in other embodiments, the captured image may be acquired once per frame time (or shorter than one frame time). If the determination result of step S1 is affirmative, the process of step S2 is executed. On the other hand, when the determination result of step S1 is negative, the process of steps S2 to S4 is skipped and the process of step S5 described later is executed.

ステップS2において、CPU31は、ステップS1で取得された撮像画像に対する認識処理を実行する。認識処理においては、撮像画像内にマーカ51の画像が含まれるか否かが判定され、マーカ51の画像が含まれる場合には撮像画像内におけるマーカ51の向きおよび位置が算出される。以下、図12を参照して、認識処理の詳細を説明する。   In step S2, the CPU 31 executes a recognition process for the captured image acquired in step S1. In the recognition process, it is determined whether or not the image of the marker 51 is included in the captured image. If the image of the marker 51 is included, the direction and position of the marker 51 in the captured image are calculated. The details of the recognition process will be described below with reference to FIG.

図12は、図11に示す認識処理(ステップS2)の流れを示すフローチャートである。認識処理においては、まずステップS11において、CPU31は、上述の領域検出処理を実行する、すなわち、第1図形55を含む領域(対象領域)を検出する。上述のように、ステップS11の領域検出処理は低い精度で行われる。具体的には、CPU31は、撮像画像において画素3つ分の間隔で得られる画素値に基づいて、当該撮像画像から対象領域を検出する。より具体的には、CPU31は、撮像画像データ62をメインメモリ32から読み出し、画像データが示す各画素の各画素値から、画素3つ分の間隔で画素値を抽出する。そして、抽出した画素値に基づいて対象領域を検出する。図13は、撮像画像においてステップS11の処理において画素値が参照される画素を示す図である。図13においては、斜線で示される画素が、画素値が参照される画素である。   FIG. 12 is a flowchart showing the flow of the recognition process (step S2) shown in FIG. In the recognition process, first, in step S <b> 11, the CPU 31 executes the above-described area detection process, that is, detects an area (target area) including the first graphic 55. As described above, the region detection process in step S11 is performed with low accuracy. Specifically, the CPU 31 detects a target area from the captured image based on pixel values obtained at intervals of three pixels in the captured image. More specifically, the CPU 31 reads the captured image data 62 from the main memory 32, and extracts pixel values at intervals of three pixels from each pixel value of each pixel indicated by the image data. Then, the target area is detected based on the extracted pixel value. FIG. 13 is a diagram illustrating pixels whose pixel values are referred to in the process of step S11 in the captured image. In FIG. 13, pixels indicated by diagonal lines are pixels whose pixel values are referred to.

また、本実施形態では、隣接する画素の画素値(本実施形態では輝度値。ただし、色値でもよい)の差を用いて対象領域が検出される。すなわち、本実施形態では、黒色の第1図形55の周囲には白い枠が形成される(図6参照)ので、隣接する画素よりも輝度値が所定値以上低い画素を検出することで、第1図形55の輪郭部分の画素を検出することができる。なお、上記「隣接する画素」とは、画素値が参照される各画素の間で隣接する画素である。図13の例で言えば、斜線で示されるある画素と、画素3つ分離れた位置の(斜線で示される)画素とが、上記「隣接する画素」である。輪郭部分の画素を検出した後、CPU31は、検出された画素のうちで隣接する画素同士を1つの集合とすることで、1つの対象領域を特定する。特定された対象領域を形成する各画素を示すデータは、対象領域毎に1つの対象領域データ64としてメインメモリ32に記憶される。なお、特定された対象領域が大きすぎたり小さすぎたりする場合には、CPU31は当該対象領域を除外し、当該対象領域を示す対象領域データ64を記憶しないようにしてもよい。上記ステップS11の次にステップS12の処理が実行される。   In the present embodiment, the target area is detected using a difference between pixel values of adjacent pixels (in this embodiment, a luminance value, but may be a color value). That is, in this embodiment, since a white frame is formed around the black first graphic 55 (see FIG. 6), the first pixel 55 is detected by detecting a pixel whose luminance value is lower than a predetermined value by a predetermined value. Pixels in the outline portion of one figure 55 can be detected. The “adjacent pixels” are pixels adjacent to each other whose pixel values are referred to. In the example of FIG. 13, a certain pixel indicated by hatching and a pixel (indicated by hatching) at a position separated by three pixels are the “adjacent pixels”. After detecting the pixels in the contour portion, the CPU 31 specifies one target region by setting adjacent pixels among the detected pixels as one set. Data indicating each pixel forming the specified target area is stored in the main memory 32 as one target area data 64 for each target area. If the specified target area is too large or too small, the CPU 31 may exclude the target area and not store the target area data 64 indicating the target area. Following step S11, the process of step S12 is executed.

なお、上記ステップS11における対象領域の検出方法はどのような方法であってもよい。例えば他の実施形態においては、CPU31は、画素値を所定の閾値で2値化することによって第1図形55の輪郭を検出し、検出された輪郭内の領域を対象領域としてもよい。また、他の実施形態においては、CPU31は、パターンマッチングの手法によって対象領域を検出してもよい。すなわち、第1図形55のパターン画像を予めメインメモリ32に記憶しておき、撮像画像の領域内から当該パターン画像と一致(類似)する領域を検出することによって、対象領域を検出してもよい。この場合、パターンマッチングの処理は、従来の拡張現実感技術における処理と同様であってもよい。   In addition, what kind of method may be sufficient as the detection method of the object area | region in said step S11. For example, in another embodiment, the CPU 31 may detect the contour of the first graphic 55 by binarizing the pixel value with a predetermined threshold, and may set the region within the detected contour as the target region. In another embodiment, the CPU 31 may detect the target region by a pattern matching method. That is, the pattern image of the first graphic 55 may be stored in the main memory 32 in advance, and the target region may be detected by detecting a region that matches (similar) the pattern image from the region of the captured image. . In this case, the pattern matching process may be the same as the process in the conventional augmented reality technology.

また、本実施形態では、上記ステップS11ではCPU31は第1図形55の領域を対象領域として検出したが、他の実施形態においては、第1図形55および第2図形57を含むマーカ51の領域を対象領域として検出するようにしてもよい。   In this embodiment, the CPU 31 detects the area of the first graphic 55 as the target area in step S11. However, in other embodiments, the area of the marker 51 including the first graphic 55 and the second graphic 57 is detected. You may make it detect as an object area | region.

また、本実施形態では、上述のように低い精度で対象領域の検出が行われ、対象領域の検出処理では、マーカ51の第1図形55とその周囲の白枠との輝度差を用いている。そのため、マーカ51の白枠が細すぎると低い精度では撮像画像において白枠が現れず、対象領域を正確に検出することができなくなるおそれがある。したがって、マーカ51の白枠は、低い精度でも撮像画像上に現れるように、ある程度の太さに設定されることが好ましい。なお、白枠の太さは、ゲーム装置1の使用時におけるカメラからマーカ51までの距離として想定される距離の範囲や、撮像画像の解像度や、マーカ51の大きさ等に応じて適宜決められる。   In the present embodiment, the target area is detected with low accuracy as described above. In the target area detection processing, the luminance difference between the first graphic 55 of the marker 51 and the surrounding white frame is used. . Therefore, if the white frame of the marker 51 is too thin, the white frame does not appear in the captured image with low accuracy, and the target area may not be accurately detected. Therefore, the white frame of the marker 51 is preferably set to a certain thickness so that it appears on the captured image even with low accuracy. The thickness of the white frame is appropriately determined according to the range of distance assumed as the distance from the camera to the marker 51 when the game apparatus 1 is used, the resolution of the captured image, the size of the marker 51, and the like. .

ステップS12において、CPU31は、ステップS11で対象領域が検出されたか否かを判定する。ステップS11において対象領域が検出されなかった場合、ステップS13の処理が実行される。一方、ステップS11において対象領域が1つ以上検出された場合、ステップS14の処理が実行される。   In step S12, the CPU 31 determines whether or not the target area has been detected in step S11. If the target area is not detected in step S11, the process of step S13 is executed. On the other hand, when one or more target areas are detected in step S11, the process of step S14 is executed.

ステップS13において、CPU31は、マーカ51の認識が失敗したと判断する。すなわち、CPU31は、認識失敗を示すデータを認識結果データ69としてメインメモリ32に記憶する。ステップS13の後、CPU31は認識処理を終了する。   In step S13, the CPU 31 determines that recognition of the marker 51 has failed. That is, the CPU 31 stores data indicating recognition failure in the main memory 32 as recognition result data 69. After step S13, the CPU 31 ends the recognition process.

ステップS14において、CPU31は、ステップS11で検出された対象領域のうち1つを選択する。なお、ステップS11で複数の対象領域が検出される場合、ステップS14〜S16の処理ステップが繰り返し実行される。この場合、ステップS14においては、当該処理ステップにおいてまだ選択されていない対象領域が選択される。ステップS14の次にステップS15の処理が実行される。   In step S14, the CPU 31 selects one of the target areas detected in step S11. When a plurality of target areas are detected in step S11, the processing steps in steps S14 to S16 are repeatedly executed. In this case, in step S14, a target area that has not yet been selected in the processing step is selected. Following step S14, the process of step S15 is executed.

ステップS15において、CPU31は、ステップS14で選択された対象領域に対してマーカ検出処理を実行する。マーカ検出処理は、対象領域からマーカ51を検出し、マーカ51の位置および向きを算出する処理である。以下、図14を参照して、マーカ検出処理の詳細を説明する。   In step S15, the CPU 31 executes a marker detection process on the target area selected in step S14. The marker detection process is a process for detecting the marker 51 from the target region and calculating the position and orientation of the marker 51. Details of the marker detection process will be described below with reference to FIG.

図14は、図12に示すマーカ検出処理(ステップS15)の流れを示すフローチャートである。マーカ検出処理においては、まずステップS21において、CPU31は、中程度の精度で第1図形55の輪郭を抽出する。ここで、「中程度の精度」とは、上記ステップS11の処理における精度よりは高く、後述するステップS23およびS25の処理における精度よりは低いという意味である。つまり、本実施形態では、マーカ検出処理において、2段階の精度で処理が行われ、ステップS21の処理は低い方の精度で行われる。以下、ステップS21の処理の詳細を説明する。   FIG. 14 is a flowchart showing the flow of the marker detection process (step S15) shown in FIG. In the marker detection process, first, in step S21, the CPU 31 extracts the contour of the first graphic 55 with medium accuracy. Here, “medium accuracy” means higher than the accuracy in the processing of step S11 and lower than the accuracy in the processing of steps S23 and S25 described later. That is, in this embodiment, in the marker detection process, the process is performed with two levels of accuracy, and the process of step S21 is performed with the lower accuracy. Details of the processing in step S21 will be described below.

上記ステップS21の処理は、ステップS11で検出された対象領域内を処理対象とするが、上記ステップS11の処理とステップS21の処理とでは処理を行う精度が異なる。そこで、ステップS21においては、CPU31はまず、ステップS11で検出された対象領域に対応する、ステップS21の処理対象となる領域を決定する。すなわち、ステップS11で得られる対象領域データ64により示される各画素から、ステップS21の処理対象となる領域を決定する。より具体的には、CPU31は、低精度の処理(ステップS11)で参照される画素(図13に示す斜線の画素)と、その周囲8つの画素(図13に示す一点鎖線で囲まれる画素)とを関連付けておく。そして、ステップS11で検出された対象領域内の画素と、当該画素に対応する周囲8つの画素とからなる領域を、ステップS21の処理対象の領域とする。図15は、ステップS21の処理対象となる領域の一例を示す図である。図15においては、ステップS11で画素Q1〜Q3が検出され、画素Q1〜Q3よりも右側の領域が対象領域として検出された場合を想定する。この場合、図15に示す一点鎖線よりも右の領域A1がステップS21の処理対象の領域となる。   The process of step S21 is performed in the target area detected in step S11, but the accuracy of the process is different between the process of step S11 and the process of step S21. Therefore, in step S21, the CPU 31 first determines a region to be processed in step S21 corresponding to the target region detected in step S11. That is, the region to be processed in step S21 is determined from each pixel indicated by the target region data 64 obtained in step S11. More specifically, the CPU 31 refers to pixels (hatched pixels shown in FIG. 13) that are referred to in the low-precision processing (step S11) and eight surrounding pixels (pixels surrounded by a one-dot chain line shown in FIG. 13). Are associated with each other. Then, an area composed of the pixels in the target area detected in step S11 and the surrounding eight pixels corresponding to the pixel is set as a process target area in step S21. FIG. 15 is a diagram illustrating an example of a region to be processed in step S21. In FIG. 15, it is assumed that the pixels Q1 to Q3 are detected in step S11, and the region on the right side of the pixels Q1 to Q3 is detected as the target region. In this case, the area A1 to the right of the alternate long and short dash line shown in FIG. 15 is the process target area in step S21.

処理対象となる領域が決定されると、CPU31は、中程度の精度で第1図形55の輪郭を抽出する。本実施形態では、この輪郭の抽出処理は、撮像画像における各画素の画素値のうち、画素2つ分の間隔で得られる画素値に基づいて行われる。図16は、撮像画像においてステップS21の処理において画素値が参照される画素を示す図である。例えば図15に示す領域A1がステップS21の処理対象の領域となる場合、図16に示す斜線で示される画素が、輪郭の抽出処理において画素値が参照される画素である。   When the area to be processed is determined, the CPU 31 extracts the contour of the first graphic 55 with medium accuracy. In the present embodiment, this contour extraction process is performed based on pixel values obtained at intervals of two pixels among pixel values of each pixel in the captured image. FIG. 16 is a diagram illustrating pixels whose pixel values are referred to in the process of step S21 in the captured image. For example, when the area A1 shown in FIG. 15 is the area to be processed in step S21, the pixels indicated by diagonal lines in FIG. 16 are pixels whose pixel values are referred to in the contour extraction process.

なお、ステップS21における輪郭の抽出処理は、上記ステップS11における対象領域の検出方法と同様、輝度値の差を用いた方法で行われてもよいし、それ以外の方法で行われてもよい。ステップS21で抽出された輪郭を形成する各画素のデータは、輪郭データ65としてメインメモリ32に記憶される。ステップS21の次にステップS22の処理が実行される。   Note that the contour extraction process in step S21 may be performed by a method using a difference in luminance values as in the method of detecting the target region in step S11, or may be performed by other methods. Data of each pixel forming the contour extracted in step S21 is stored in the main memory 32 as contour data 65. Following step S21, the process of step S22 is executed.

ステップS22において、CPU31は、ステップS21で抽出された輪郭が第1図形55を表すか否かを判定する。本実施形態では、ステップS22の判定は、CPU31は上記輪郭が四角形を表すか否かによって行われる。すなわち、CPU31は、輪郭データ65をメインメモリ32から読み出し、上記輪郭を形成する各画素を直線で近似することによって、当該各画素で形成される多角形を算出する。そして、算出された多角形が四角形となるか否かによって、上記輪郭が第1図形55を表すか否かを判定する。ステップS22の判定結果が肯定となる場合、ステップS23の処理が実行される。一方、ステップS22の判定結果が否定となる場合、後述するステップS30の処理が実行される。   In step S <b> 22, the CPU 31 determines whether or not the contour extracted in step S <b> 21 represents the first graphic 55. In the present embodiment, the determination in step S22 is performed by the CPU 31 depending on whether the outline represents a quadrangle. In other words, the CPU 31 reads out the contour data 65 from the main memory 32 and approximates each pixel forming the contour with a straight line, thereby calculating a polygon formed by each pixel. Then, whether or not the contour represents the first graphic 55 is determined based on whether or not the calculated polygon is a quadrangle. If the determination result of step S22 is affirmative, the process of step S23 is executed. On the other hand, when the determination result of step S22 is negative, a process of step S30 described later is executed.

なお、上記ステップS22では、抽出された輪郭が第1図形55を表すか否かの判定は、当該輪郭が四角形となるか否かによって行われたが、他の方法によって行われてもよい。例えば、他の実施形態において、マーカ51の大きさが既知である場合には、上記の判定は、抽出された輪郭の大きさ(面積や周の長さ)が所定値以上であるか否か等によって行われてもよい。   In step S22, whether or not the extracted contour represents the first graphic 55 is determined based on whether or not the contour is a quadrangle, but may be performed by other methods. For example, in another embodiment, when the size of the marker 51 is known, the above determination is made as to whether or not the size (area or circumference) of the extracted contour is a predetermined value or more. Etc. may be performed.

ステップS23において、CPU31は、高精度で内部図形56の領域を検出する。ここで、「高精度」とは、上記ステップS11の処理およびステップS21の処理における精度より高いという意味である。本実施形態では、CPU31は、画素1つ分の間隔で画素値を参照して、つまり、ステップS23の処理対象となる領域内の全画素の画素値を参照して、内部図形56の領域を検出する。   In step S23, the CPU 31 detects the area of the internal graphic 56 with high accuracy. Here, “high accuracy” means higher than the accuracy in the process of step S11 and the process of step S21. In the present embodiment, the CPU 31 refers to the pixel values at intervals of one pixel, that is, refers to the pixel values of all the pixels in the region to be processed in step S23, and determines the region of the internal graphic 56. To detect.

ステップS23の処理対象となる領域は、ステップS21で抽出された輪郭が表す領域内を対象として行われるが、上記ステップS21の処理とステップS23の処理とでは処理を行う精度が異なる。そこで、ステップS23においては、ステップS21と同様、処理対象となる領域を決定する必要がある。この処理対象となる領域の決定は、ステップS21と同様の方法で行うことができる。すなわち、CPU31は、中精度の処理(ステップS21)で参照され得る基準画素と、それに対応する3つの画素(例えば、基準画素の右、下、および右下の画素)とを関連付けておく。そして、ステップS21で抽出された輪郭内に含まれる基準画素と、当該基準画素に対応する3つの画素とをステップS23の処理対象とする。   The region to be processed in step S23 is performed within the region represented by the contour extracted in step S21, but the processing accuracy is different between the processing in step S21 and the processing in step S23. Therefore, in step S23, as in step S21, it is necessary to determine a region to be processed. The area to be processed can be determined by the same method as in step S21. That is, the CPU 31 associates the reference pixel that can be referred to in the medium-precision processing (step S21) and the corresponding three pixels (for example, the right, lower, and lower right pixels of the reference pixel). Then, the reference pixel included in the contour extracted in step S21 and the three pixels corresponding to the reference pixel are set as processing targets in step S23.

処理対象となる領域が決定されると、CPU31は、高精度で内部図形56の領域を検出する。ここで、内部図形56の領域の検出は、上記ステップS11における対象領域の検出方法と同様、輝度値の差を用いた方法で行われてもよいし、それ以外の方法で行われてもよい。なお、ステップS23で検出すべき内部図形56は白色でその周囲が黒色であるので、輝度値の差を用いる方法を採用する場合には、CPU31は、隣接する画素よりも輝度値が所定値以上高い画素を検出することが好ましい。また、本実施形態では、CPU31は、内部図形56の領域を表す情報として、内部図形56の輪郭を表す(複数の)画素を検出するものとする。ステップS23で検出された内部図形56の領域を示す各画素のデータは、内部領域データ66としてメインメモリ32に記憶される。また、ステップS23において複数の内部図形56が検出される場合は、1つの内部図形につき1つの内部領域データ66がメインメモリ32に記憶される。以上のステップS23の次にステップS24の処理が実行される。   When the area to be processed is determined, the CPU 31 detects the area of the internal graphic 56 with high accuracy. Here, the detection of the area of the internal graphic 56 may be performed by a method using a difference in luminance value as in the method of detecting the target area in step S11, or may be performed by other methods. . Since the internal figure 56 to be detected in step S23 is white and the surrounding area is black, when adopting a method using a difference in luminance value, the CPU 31 has a luminance value equal to or greater than a predetermined value compared to adjacent pixels. It is preferable to detect high pixels. In the present embodiment, the CPU 31 detects (a plurality of) pixels representing the contour of the internal graphic 56 as information indicating the area of the internal graphic 56. Data of each pixel indicating the area of the internal graphic 56 detected in step S23 is stored in the main memory 32 as internal area data 66. When a plurality of internal figures 56 are detected in step S23, one internal area data 66 is stored in the main memory 32 for each internal figure. Following step S23, the process of step S24 is executed.

なお、他の実施形態においては、上記ステップS23において、CPU31は、検出された領域の形状および/または大きさに関して条件を設定しておき、条件を満たさない領域を除外するようにしてもよい。すなわち、CPU31は、輝度差を用いて検出された領域のうち、形状が円形でない領域、および、大きさが所定の範囲以内でない領域については、内部領域データ66を記憶しないようにしてもよい。   In another embodiment, in step S23, the CPU 31 may set conditions regarding the shape and / or size of the detected area, and exclude areas that do not satisfy the condition. That is, the CPU 31 may not store the internal region data 66 for regions that are not circular in shape and regions that are not within a predetermined range among regions detected using the luminance difference.

ステップS24において、CPU31は、ステップS23で所定個数の領域が検出されたか否かを判定する。ここで、所定個数とは、第1図形55内に描かれた内部図形56の数、すなわち8個である。具体的には、CPU31は、メインメモリ32に記憶された内部領域データ66の数が8個であるか否かを判定する。ステップS24の判定結果が肯定となる場合、ステップS25の処理が実行される。一方、ステップS24の判定結果が否定となる場合、後述するステップS30の処理が実行される。   In step S24, the CPU 31 determines whether or not a predetermined number of areas have been detected in step S23. Here, the predetermined number is the number of internal figures 56 drawn in the first figure 55, that is, eight. Specifically, the CPU 31 determines whether or not the number of internal area data 66 stored in the main memory 32 is eight. If the determination result of step S24 is affirmative, the process of step S25 is executed. On the other hand, when the determination result of step S24 is negative, a process of step S30 described later is executed.

ステップS25において、CPU31は、内部図形56の中心位置を高精度で算出する。内部図形56の中心位置は、ステップS23で検出された領域、すなわち、内部図形56の輪郭を表す各画素に基づいて算出される。中心位置の具体的な算出方法はどのような方法であってもよく、例えば、内部図形56の輪郭を表す各画素の位置座標の平均値を算出することで中心位置を得ることができる。本実施形態においては、CPU31は、内部領域データ66をメインメモリ32から読み出し、内部領域データ66が示す各画素の平均値を算出する。なお、内部領域データ66は8個記憶されているので、各データ毎に平均値を算出する処理が行われる。算出された8種類の平均値を示すデータは、中心位置データ67としてメインメモリ32に記憶される。ステップS25の次にステップS26の処理が実行される。   In step S25, the CPU 31 calculates the center position of the internal figure 56 with high accuracy. The center position of the internal graphic 56 is calculated based on the area detected in step S23, that is, each pixel representing the outline of the internal graphic 56. The specific method for calculating the center position may be any method. For example, the center position can be obtained by calculating the average value of the position coordinates of each pixel representing the contour of the internal graphic 56. In the present embodiment, the CPU 31 reads the internal area data 66 from the main memory 32 and calculates the average value of each pixel indicated by the internal area data 66. Since eight internal area data 66 are stored, an average value is calculated for each data. Data indicating the calculated eight kinds of average values is stored in the main memory 32 as the center position data 67. Following step S25, the process of step S26 is executed.

ステップS26において、CPU31は、ステップS25で算出された中心位置から、マーカ51の位置を表す4つの頂点の位置を算出する。ここで、4つの頂点とは、8つの内部図形56が頂点および辺の中点となる四角形の頂点である。以下、図17および図18を参照して、4つの頂点の算出方法を説明する。   In step S26, the CPU 31 calculates the positions of the four vertices representing the position of the marker 51 from the center position calculated in step S25. Here, the four vertices are quadrangular vertices in which the eight internal figures 56 are the vertices and the midpoints of the sides. Hereinafter, a method for calculating the four vertices will be described with reference to FIGS. 17 and 18.

図17は、第1図形を表す撮像画像の一例を示す図である。図17において、点P1〜P8は、8つの内部図形56の中心位置として上記ステップS26で算出された位置を表す点である。ステップS26においては、CPU31は、まず、8つの中心位置のうち3つを通る4本の直線L1〜L4を算出する。具体的には、CPU31は、点P1〜P3を通る直線L1と、点P1,P4,およびP6を通る直線L2と、点P6〜P8を通る直線L3と、点P3,P5,およびP8を通る直線L4とを算出する。各直線L1〜L4は、最小二乗法等を用いて3点を通る近似直線としてそれぞれ算出することができる。   FIG. 17 is a diagram illustrating an example of a captured image representing the first graphic. In FIG. 17, points P <b> 1 to P <b> 8 are points representing the positions calculated in step S <b> 26 as the center positions of the eight internal figures 56. In step S26, the CPU 31 first calculates four straight lines L1 to L4 passing through three of the eight central positions. Specifically, the CPU 31 passes a straight line L1 passing through points P1 to P3, a straight line L2 passing through points P1, P4, and P6, a straight line L3 passing through points P6 to P8, and points P3, P5, and P8. A straight line L4 is calculated. Each of the straight lines L1 to L4 can be calculated as an approximate straight line passing through three points using a least square method or the like.

図18は、図17に示す各直線L1〜L4によって算出される4つの頂点P11〜P14を示す図である。各直線L1〜L4が算出されると、CPU31は、各直線L1〜L4によって形成される四角形の頂点P11〜P14を算出する。すなわち、CPU31は、直線L1と直線L2との交点P11、直線L1と直線L4との交点P12、直線L2と直線L3との交点P13、および、直線L3と直線L4との交点P14をそれぞれ算出する。以上によって、4つの頂点P11〜P14を算出することができる。算出された4つの頂点の位置を示すデータは、頂点データ68としてメインメモリ32に記憶される。ステップS26の次にステップS27の処理が実行される。   FIG. 18 is a diagram showing four vertices P11 to P14 calculated by the straight lines L1 to L4 shown in FIG. When the straight lines L1 to L4 are calculated, the CPU 31 calculates square vertices P11 to P14 formed by the straight lines L1 to L4. That is, the CPU 31 calculates an intersection point P11 between the straight line L1 and the straight line L2, an intersection point P12 between the straight line L1 and the straight line L4, an intersection point P13 between the straight line L2 and the straight line L3, and an intersection point P14 between the straight line L3 and the straight line L4. . As described above, the four vertices P11 to P14 can be calculated. Data indicating the calculated positions of the four vertices is stored in the main memory 32 as vertex data 68. Following step S26, the process of step S27 is executed.

上記ステップS26で4つの頂点を算出することによって、マーカ51内の4点の位置を算出できたことになる。ここで、マーカ51内の4点の位置によって、マーカ51の位置および向きを算出することができる。ただし、上記4点の位置は正方形の各頂点であり、マーカ51が90°、180°または270°回転した状態と回転しない状態とで同じ値となる。そのため、上記4点の位置では、上下左右の4方向に関するマーカ51の向きを特定することができず、マーカ51の向きを一意に特定することができない。そこで、CPU31は、下記ステップS27〜S29の処理によって、上下左右の4方向に関するマーカ51の向きを特定し、マーカ51の向きを一意に特定する。なお、マーカ51の上下左右の4方向のうちどの方向から撮像するかが予め決まっている(既知である)場合や、上下左右の4方向に関するマーカ51の向きを意識しない場合(マーカ51が90°、180°または270°回転した状態と回転しない状態とを同じ状態とみなす場合)には、CPU31は、下記ステップS27〜S29の処理を省略し、上記4点の位置を認識結果として用いてもよい。   By calculating the four vertices in step S26, the positions of the four points in the marker 51 can be calculated. Here, the position and orientation of the marker 51 can be calculated from the positions of the four points in the marker 51. However, the positions of the four points are the vertices of the square, and the same value is obtained when the marker 51 is rotated by 90 °, 180 °, or 270 ° and when it is not rotated. For this reason, at the positions of the four points, it is impossible to specify the orientation of the marker 51 in the four directions of up, down, left, and right, and the orientation of the marker 51 cannot be uniquely specified. Therefore, the CPU 31 specifies the orientation of the marker 51 with respect to the four directions of up, down, left, and right by the processing of the following steps S27 to S29, and uniquely specifies the orientation of the marker 51. It should be noted that from which one of the four directions of the upper, lower, left, and right sides of the marker 51 is determined in advance (known), or when the direction of the marker 51 in the four directions of the upper, lower, left, and right is not conscious (the marker 51 is 90 In the case where the state rotated by °, 180 ° or 270 ° and the state not rotated are regarded as the same state), the CPU 31 omits the processing of the following steps S27 to S29 and uses the positions of the four points as the recognition result. Also good.

ステップS27において、CPU31は、第1図形55の周囲の領域から第2図形57を検出する。本実施形態においては、CPU31は、ステップS26で算出された4つの頂点で形成される四角形を基準として、当該四角形の上下左右の4方向に位置する4つの所定領域内から第2図形57を検出する。第2図形57は第1図形55の隣に位置しており(図6参照)、4つの頂点によって第1図形55の位置が特定されているので、上記4つの所定領域について検出処理を行えば、第2図形57を検出することができるからである。   In step S <b> 27, the CPU 31 detects the second graphic 57 from the area around the first graphic 55. In the present embodiment, the CPU 31 detects the second graphic 57 from four predetermined areas located in the four directions, up, down, left, and right, of the quadrangle formed by the four vertices calculated in step S26. To do. The second graphic 57 is located next to the first graphic 55 (see FIG. 6), and the position of the first graphic 55 is specified by the four vertices. This is because the second figure 57 can be detected.

図19は、ステップS27で設定される所定領域の一例を示す図である。図19においては、直線L5〜L8で囲まれる領域αが上記所定領域である。所定領域αは、4つの頂点P11〜P14で形成される四角形の4辺のうち、辺P11−P12の側に設定される所定領域である。また、直線L5〜L8は、それぞれ、4つの頂点P11〜P14で形成される四角形に対して所定領域αが位置する側を上方向とした場合における所定領域αの下辺、上辺、右辺、および左辺である。所定領域αの4辺である直線L5〜L8は、例えば次のように設定することができる。下辺である直線L5は、直線L1に平行で、直線L1に垂直な方向に直線L1から所定の第1距離だけ離れた位置に設定される。また、上辺である直線L6は、直線L1に平行で、直線L1に垂直な方向に直線L1から所定の第2距離(第1距離よりも大きい)だけ離れた位置に設定される。また、右辺である直線L7は、頂点P11〜P14で形成される四角形の右辺である直線L4に平行で、直線L1の方向に関して直線L4から所定の第3距離だけ離れた位置に設定される。左辺である直線L8は、頂点P11〜P14で形成される四角形の左辺である直線L2に平行で、直線L1の方向に関して直線L2から所定の第4距離だけ離れた位置に設定される。以上のようにして、所定領域αを算出することができる。また、他の3つの所定領域についても所定領域αと同様に算出することができる。   FIG. 19 is a diagram illustrating an example of the predetermined area set in step S27. In FIG. 19, an area α surrounded by straight lines L5 to L8 is the predetermined area. The predetermined area α is a predetermined area set on the side P11-P12 among the four sides of the quadrangle formed by the four vertices P11 to P14. Further, the straight lines L5 to L8 are respectively the lower side, the upper side, the right side, and the left side of the predetermined region α when the side where the predetermined region α is located is upward with respect to the quadrangle formed by the four vertices P11 to P14. It is. The straight lines L5 to L8 that are the four sides of the predetermined region α can be set as follows, for example. The straight line L5 that is the lower side is set at a position parallel to the straight line L1 and separated from the straight line L1 by a predetermined first distance in a direction perpendicular to the straight line L1. The straight line L6 that is the upper side is set at a position that is parallel to the straight line L1 and that is separated from the straight line L1 by a predetermined second distance (greater than the first distance) in a direction perpendicular to the straight line L1. Further, the straight line L7 that is the right side is parallel to the straight line L4 that is the right side of the quadrangle formed by the vertices P11 to P14, and is set at a position separated from the straight line L4 by a predetermined third distance in the direction of the straight line L1. The straight line L8 that is the left side is set to a position that is parallel to the straight line L2 that is the left side of the quadrangle formed by the vertices P11 to P14 and that is separated from the straight line L2 by a predetermined fourth distance in the direction of the straight line L1. As described above, the predetermined area α can be calculated. Further, the other three predetermined areas can be calculated in the same manner as the predetermined area α.

上記4つの所定領域内から第2図形57を検出する方法はどのような方法であってもよいが、本実施形態においては、パターンマッチングの手法によって第2図形57を検出する。すなわち、第2図形57のパターン画像を予めメインメモリ32に記憶しておき、CPU31は、各所定領域内から当該パターン画像と一致(類似)する領域を検出することによって第2図形57を検出する。また、第2図形57を検出する処理の精度は、どのような精度で行われてもよい。なお、この処理は、処理対象となる範囲を上記所定領域に絞って行うことができるので、必ずしも高い精度で行う必要はない。   Any method may be used to detect the second graphic 57 from within the four predetermined areas. In the present embodiment, the second graphic 57 is detected by a pattern matching technique. That is, the pattern image of the second graphic 57 is stored in the main memory 32 in advance, and the CPU 31 detects the second graphic 57 by detecting an area that matches (similar to) the pattern image from within each predetermined area. . Further, the accuracy of the process of detecting the second graphic 57 may be performed with any accuracy. Note that this processing can be performed by narrowing the range to be processed to the predetermined region, and thus does not necessarily have to be performed with high accuracy.

上記ステップS27の具体的な処理としては、CPU31はまず、頂点データ68をメインメモリ32から読み出して、上記4つの頂点に基づいて上記4つの所定領域を特定する。次に、第2図形57のパターン画像をメインメモリ32から読み出して、特定した4つの所定領域内から、当該パターン画像と一致する部分を検出する。ステップS27の処理の次にステップS28の処理が実行される。   As a specific process of step S27, the CPU 31 first reads the vertex data 68 from the main memory 32 and specifies the four predetermined areas based on the four vertices. Next, the pattern image of the second graphic 57 is read from the main memory 32, and a portion that matches the pattern image is detected from the four specified areas. Following step S27, step S28 is executed.

ステップS28において、CPU31は、上記ステップS27において第2図形57が検出されたか否かを判定する。すなわち、上記4つの所定領域のうちに、第2図形57が検出された領域があったか否かを判定する。ステップS28の判定結果が肯定となる場合、ステップS29の処理が実行される。一方、ステップS28の判定結果が否定となる場合、後述するステップS30の処理が実行される。   In step S28, the CPU 31 determines whether or not the second graphic 57 has been detected in step S27. That is, it is determined whether or not there is an area where the second graphic 57 is detected among the four predetermined areas. If the determination result of step S28 is affirmative, the process of step S29 is executed. On the other hand, when the determination result of step S28 is negative, a process of step S30 described later is executed.

ステップS29において、CPU31は、(上下左右の4方向に関する)マーカ51の向きを特定する。ここで、上記4つの頂点で形成される四角形から見て、第2図形57が検出された所定領域がある方向(当該四角形から見て所定領域がどちらの方向にあるか)がわかれば、撮像画像内において第1図形55に対して第2図形57が配置される方向がわかったことになるので、マーカ51の向きを特定することができる。つまり、ステップS29においては、撮像画像内において第1図形55に対して第2図形57が配置される方向に応じてマーカ51の向きが特定される。   In step S <b> 29, the CPU 31 specifies the orientation of the marker 51 (related to the four directions of up, down, left, and right). Here, if the direction in which the predetermined area in which the second graphic 57 is detected is found as seen from the quadrangle formed by the four vertices (which direction the predetermined area is from when viewed from the square) is known, imaging is performed. Since the direction in which the second graphic 57 is arranged with respect to the first graphic 55 in the image is known, the direction of the marker 51 can be specified. That is, in step S29, the orientation of the marker 51 is specified according to the direction in which the second graphic 57 is arranged with respect to the first graphic 55 in the captured image.

なお、本実施形態においては、上記4つの頂点を結ぶ2つのベクトルV1およびV2によってマーカ51の位置および向きを表すものとする。具体的には、ベクトルV1は、第1図形55に対して第2図形57が配置される方向を上方向とした場合において、左上の頂点を始点とし、右上の頂点を終点とするベクトルとする。また、ベクトルV2は、上記の場合において、左下の頂点を始点とし、右下の頂点を終点とするベクトルとする。上記のようにベクトルV1およびV2を想定した場合において、第2図形57が検出された所定領域が、例えば図19に示す直線L1の側に位置する場合、図19に示す直線L1が上記4つの頂点で形成される四角形の上辺となる。したがって、この場合、ベクトルV1は、点P11を始点とし点P12を終点とするベクトルとして算出され、ベクトルV2は、点P13を始点とし点P14を終点とするベクトルV2として算出される。これらベクトルV1およびV2によって、マーカ51の位置および向きを表すことができる。   In the present embodiment, the position and orientation of the marker 51 are represented by the two vectors V1 and V2 connecting the four vertices. Specifically, when the direction in which the second graphic 57 is arranged with respect to the first graphic 55 is the upward direction, the vector V1 is a vector having the upper left vertex as the start point and the upper right vertex as the end point. . In the above case, the vector V2 is a vector having a lower left vertex as a start point and a lower right vertex as an end point. Assuming the vectors V1 and V2 as described above, when the predetermined area where the second graphic 57 is detected is located on the side of the straight line L1 shown in FIG. 19, for example, the straight line L1 shown in FIG. This is the upper side of the quadrangle formed by the vertices. Therefore, in this case, the vector V1 is calculated as a vector having the point P11 as a start point and the point P12 as an end point, and the vector V2 is calculated as a vector V2 having the point P13 as a start point and the point P14 as an end point. The position and orientation of the marker 51 can be represented by these vectors V1 and V2.

上記ステップS29においては、CPU31は、上記4つの頂点で形成される四角形に対する第2図形57が検出された所定領域の方向に応じた向きとなるように、当該4つの頂点を用いてベクトルV1およびV2を算出する。算出された各ベクトルV1およびV2を示すデータはメインメモリ32に記憶される。以上のステップS29の後、CPU31はマーカ検出処理を終了する。   In step S29, the CPU 31 uses the four vertices to generate a vector V1 and a vector V1 so that the second figure 57 with respect to the quadrangle formed by the four vertices is oriented according to the direction of the predetermined area. V2 is calculated. Data indicating the calculated vectors V1 and V2 is stored in the main memory 32. After step S29 described above, the CPU 31 ends the marker detection process.

一方、ステップS30において、CPU31は、今回のマーカ検出処理の処理対象である対象領域には第1図形55が無いと判断する。この場合、今回のマーカ検出処理におけるステップS21〜S28で算出された各種データ65〜68はメインメモリ32から削除される。ステップS30の後、CPU31はマーカ検出処理を終了する。   On the other hand, in step S <b> 30, the CPU 31 determines that there is no first graphic 55 in the target region that is the processing target of the current marker detection process. In this case, the various data 65 to 68 calculated in steps S <b> 21 to S <b> 28 in the current marker detection process are deleted from the main memory 32. After step S30, the CPU 31 ends the marker detection process.

上記マーカ検出処理によれば、CPU31は、対象領域の画像から複数の内部図形をそれぞれ検出し(ステップS23)、各内部図形の中心位置をそれぞれ算出することによってマーカ51を検出する(ステップS25およびS26)。このように、内部図形の中心位置を用いることによって、撮像画像にぶれが生じている場合でもマーカ51の位置を正確に算出することができる。   According to the marker detection process, the CPU 31 detects a plurality of internal figures from the image of the target area (step S23), and detects the marker 51 by calculating the center position of each internal figure (steps S25 and S25). S26). Thus, by using the center position of the internal figure, the position of the marker 51 can be accurately calculated even when the captured image is blurred.

また、上記ステップS21〜S23の一連の処理によれば、対象領域内から第1図形55の輪郭が抽出され(ステップS21)、抽出された輪郭が第1図形55を表すか否かが判定される(ステップS22)。そして、抽出された輪郭が第1図形55を表す場合に、当該輪郭に対応する領域内から複数の内部図形56が検出される(ステップS23)。つまり、第1図形55を表すと判定される輪郭に対応する領域内から内部図形56が検出される。これによれば、内部図形56を検出する処理の前に、第1図形55を含まない対象領域を除くことができるので、内部図形56を検出する処理を無駄に行うことを防止することができ、認識処理を効率良く行うことができる。さらに、本実施形態によれば、輪郭の抽出処理は、内部図形56を検出する処理よりも高速に行うことができるので、ゲーム装置1は、認識処理をより短時間で行うことができる。   Further, according to the series of processes in steps S21 to S23, the contour of the first graphic 55 is extracted from the target area (step S21), and it is determined whether or not the extracted contour represents the first graphic 55. (Step S22). When the extracted contour represents the first graphic 55, a plurality of internal graphics 56 are detected from the area corresponding to the contour (step S23). That is, the internal graphic 56 is detected from the area corresponding to the contour determined to represent the first graphic 55. According to this, since the target area that does not include the first graphic 55 can be removed before the process of detecting the internal graphic 56, it is possible to prevent the process of detecting the internal graphic 56 from being performed wastefully. The recognition process can be performed efficiently. Furthermore, according to the present embodiment, the contour extraction process can be performed at a higher speed than the process of detecting the internal graphic 56, so that the game apparatus 1 can perform the recognition process in a shorter time.

また、上記ステップS23〜S25の一連の処理によれば、対象領域において複数の内部図形56の領域がそれぞれ検出され(ステップS23)、検出された領域の個数が所定個数であるか否かが判定される(ステップS24)。そして、検出された領域の個数が所定個数である場合、当該領域の中心位置が算出される(ステップS25)。つまり、所定個数の領域が検出された対象領域について、内部図形56の中心位置が算出される。これによれば、内部図形56の中心位置を算出する処理の前に、第1図形55を含まない対象領域を除くことができるので、中心位置を算出する処理を無駄に行うことを防止することができ、認識処理を効率良く行うことができる。   Further, according to the series of processing of steps S23 to S25, a plurality of internal figures 56 are respectively detected in the target area (step S23), and it is determined whether or not the number of detected areas is a predetermined number. (Step S24). If the number of detected areas is a predetermined number, the center position of the area is calculated (step S25). That is, the center position of the internal graphic 56 is calculated for the target area where a predetermined number of areas are detected. According to this, since the target area that does not include the first graphic 55 can be removed before the process of calculating the center position of the internal graphic 56, it is possible to prevent the process of calculating the center position from being performed wastefully. Recognition processing can be performed efficiently.

また、上記マーカ検出処理においては、内部図形56の検出処理(ステップS23)を行う精度と、内部図形56の中心位置の算出処理(ステップS25)を行う精度とは同じであった。ここで、他の実施形態においては、CPU31は、内部図形56の中心位置の算出処理を行う精度よりも低い精度で内部図形56の検出処理を行うようにしてもよい。つまり、内部図形56の検出処理に用いられる画素値の間隔を、中心位置の算出処理において用いられる画素値の間隔よりも大きくしてもよい。これによれば、内部図形56の検出処理をより高速に行うことができ、認識処理をより高速に行うことができる。なお、このとき、内部図形56の検出処理は、第1図形55の輪郭の抽出処理(ステップS21)と同じ精度で行われてもよいし、当該抽出処理よりも高い精度で行われてもよい。   In the marker detection process, the accuracy of performing the internal graphic 56 detection process (step S23) is the same as the accuracy of performing the central position calculation process (step S25) of the internal graphic 56. Here, in another embodiment, the CPU 31 may perform the detection process of the internal graphic 56 with a lower accuracy than the accuracy of performing the calculation process of the center position of the internal graphic 56. That is, the interval between the pixel values used for the internal graphic 56 detection process may be larger than the interval between the pixel values used in the center position calculation process. According to this, the detection process of the internal figure 56 can be performed at higher speed, and the recognition process can be performed at higher speed. At this time, the detection processing of the internal graphic 56 may be performed with the same accuracy as the contour extraction processing (step S21) of the first graphic 55, or may be performed with higher accuracy than the extraction processing. .

図12の説明に戻り、ステップS15のマーカ検出処理の次にステップS16の処理が実行される。ステップS16において、CPU31は、ステップS11で検出された全ての対象領域についてマーカ検出処理を行ったか否かを判定する。ステップS16の判定結果が肯定となる場合、ステップS17の処理が実行される。一方、ステップS16の判定結果が否定となる場合、上記ステップS14の処理が再度実行される。以降、ステップS16において全ての対象領域についてマーカ検出処理を行ったと判定されるまで、ステップS14〜S16の処理が繰り返し行われる。これによって、ステップS11で検出された各対象領域についてマーカ検出処理を行われる。   Returning to the description of FIG. 12, the process of step S16 is executed after the marker detection process of step S15. In step S16, the CPU 31 determines whether marker detection processing has been performed for all target regions detected in step S11. If the determination result of step S16 is affirmative, the process of step S17 is executed. On the other hand, if the determination result of step S16 is negative, the process of step S14 is executed again. Thereafter, the processes in steps S14 to S16 are repeated until it is determined in step S16 that the marker detection process has been performed for all target regions. Thereby, marker detection processing is performed for each target region detected in step S11.

ステップS17において、CPU31は、上記ステップS15のマーカ検出処理においてマーカ51が検出されたか否かを判定する。具体的には、CPU31は、メインメモリ32に認識結果データ69が記憶されているか否かによってマーカ51が検出されたか否かを判定する。ステップS17の判定結果が肯定となる場合、ステップS18の処理が実行される。一方、ステップS17の判定結果が否定となる場合、上記ステップS13の処理が再度実行される。つまり、ステップS17の判定結果が否定となる場合、マーカ51の認識が失敗したと判断され、認識処理が終了する。   In step S17, the CPU 31 determines whether or not the marker 51 has been detected in the marker detection process in step S15. Specifically, the CPU 31 determines whether or not the marker 51 is detected based on whether or not the recognition result data 69 is stored in the main memory 32. If the determination result of step S17 is affirmative, the process of step S18 is executed. On the other hand, if the determination result of step S17 is negative, the process of step S13 is executed again. That is, when the determination result of step S17 is negative, it is determined that the recognition of the marker 51 has failed, and the recognition process ends.

ステップS18において、CPU31は、ステップS15のマーカ検出処理で得られたマーカ51の位置および向きを示す情報を認識結果として記憶する。すなわち、マーカ検出処理のステップS29で算出されたベクトルV1およびV2を示すデータを、認識結果データ69としてメインメモリ32に記憶する。ステップS18の後、CPU31は認識処理を終了する。   In step S18, the CPU 31 stores information indicating the position and orientation of the marker 51 obtained by the marker detection process in step S15 as a recognition result. That is, data indicating the vectors V1 and V2 calculated in step S29 of the marker detection process is stored in the main memory 32 as the recognition result data 69. After step S18, the CPU 31 ends the recognition process.

なお、1つの撮像画像からステップS11で検出される複数の対象領域に対して、マーカ検出処理によってベクトルV1およびV2が算出される可能性がある。つまり、1回の認識処理において、ベクトルV1およびV2の組がメインメモリ32に複数組記憶される場合がある。この場合、いずれか1組が正しいマーカ51を表し、他の組は誤検出によって算出されたものである。したがって、上記の場合、CPU31は、マーカ検出処理において得られた各図形(第1図形55、内部図形56、第2図形57)の形状および配置等に基づいて、正しいマーカ51を表すベクトルV1およびV2を選出するようにしてもよい。例えば、ステップS21で抽出される第1図形55の輪郭や、ステップS23で検出される各内部図形56の配置や、ステップS27で検出される第2図形57の、パターン画像に対する類似度等に基づいて、正しいベクトルV1およびV2を選出することができる。CPU31は、選出されたベクトルV1およびV2を示すデータを認識結果データ69としてメインメモリに記憶する。これによって、認識処理において(誤検知によって)複数組のベクトルV1およびV2が得られた場合でも、正しい認識結果を得ることができる。なお、他の実施形態においては、1回の認識処理において複数組のベクトルV1およびV2が得られた場合には、CPU31は、認識が失敗したと判断するようにしてもよい。   Note that the vectors V1 and V2 may be calculated by marker detection processing for a plurality of target areas detected in step S11 from one captured image. That is, a plurality of sets of vectors V 1 and V 2 may be stored in the main memory 32 in one recognition process. In this case, one set represents the correct marker 51, and the other set is calculated by erroneous detection. Therefore, in the above case, the CPU 31 determines the vector V1 representing the correct marker 51 based on the shape and arrangement of each figure (first figure 55, internal figure 56, second figure 57) obtained in the marker detection process. You may make it select V2. For example, based on the outline of the first graphic 55 extracted in step S21, the arrangement of each internal graphic 56 detected in step S23, the similarity of the second graphic 57 detected in step S27 to the pattern image, and the like. Thus, the correct vectors V1 and V2 can be selected. The CPU 31 stores data indicating the selected vectors V1 and V2 as recognition result data 69 in the main memory. Thereby, even when a plurality of sets of vectors V1 and V2 are obtained (by erroneous detection) in the recognition process, a correct recognition result can be obtained. In another embodiment, when a plurality of sets of vectors V1 and V2 are obtained in one recognition process, the CPU 31 may determine that the recognition has failed.

上記認識処理によれば、撮像画像において第1の間隔(画素3つ分の間隔)で得られる画素値に基づいて、対象領域を検出する処理が行われる(ステップS11)。そして、対象領域内の撮像画像において第1の間隔よりも小さい第2の間隔(画素1つまたは2つ分の間隔)で得られる画素値に基づいて、当該対象領域の画像から第1図形55を検出する処理が行われる。これによれば、対象領域を検出する処理を短時間で行うことによって、認識処理を高速に行うことができる。また、第1図形55の検出処理は高精度で行われるので、第1図形55を高精度で正確に検出することができる。つまり、上記認識処理によれば、撮像画像から第1図形55を検出する処理を高速かつ精度良く行うことができる。   According to the recognition process, a process of detecting a target area is performed based on pixel values obtained at a first interval (an interval corresponding to three pixels) in a captured image (step S11). Then, based on pixel values obtained at a second interval (an interval of one or two pixels) smaller than the first interval in the captured image in the target region, the first graphic 55 is obtained from the image of the target region. A process of detecting is performed. According to this, the recognition process can be performed at high speed by performing the process of detecting the target region in a short time. In addition, since the first graphic 55 is detected with high accuracy, the first graphic 55 can be accurately detected with high accuracy. That is, according to the recognition process, the process of detecting the first graphic 55 from the captured image can be performed at high speed and with high accuracy.

なお、本実施形態では、ステップS2の認識処理が1フレーム時間内に実行され、ステップS1〜S7の処理ループ内で認識処理が完了されるものとした。ここで、撮像画像の解像度やCPU31等の処理能力によっては、1回の認識処理が1フレーム時間で完了することが困難な場合もある。そのため、他の実施形態においては、認識処理は、1フレーム時間を周期として実行される表示処理(ステップS5)等の処理とは必ずしも同じ周期で実行されなくてもよい。つまり、1回のステップS2の処理では、認識処理全体のうちの一部の処理だけが実行されてもよい。この場合、1回のステップS2で実行される処理は、ステップS1〜S7の一連の処理が1フレーム時間内に完了することができるような処理量に調整される。換言すれば、認識処理は、ステップS1〜S7(S2を除く)の処理ループとは別に並列的に実行され、CPU31がアイドル状態のときに実行されてもよい。   In this embodiment, the recognition process in step S2 is executed within one frame time, and the recognition process is completed in the process loop of steps S1 to S7. Here, depending on the resolution of the captured image and the processing capability of the CPU 31, etc., it may be difficult to complete one recognition process in one frame time. Therefore, in other embodiments, the recognition process does not necessarily have to be executed in the same cycle as the display process (step S5) or the like executed with one frame time as a cycle. That is, in one process of step S2, only a part of the entire recognition process may be executed. In this case, the processing executed in one step S2 is adjusted to a processing amount such that the series of processing in steps S1 to S7 can be completed within one frame time. In other words, the recognition process may be executed in parallel separately from the processing loop of steps S1 to S7 (except S2), and may be executed when the CPU 31 is in an idle state.

図11の説明に戻り、ステップS2の認識処理の次にステップS3の処理が実行される。ステップS3において、CPU31は、ステップS2の認識処理が成功したか否かを判定する。ステップS3の判定は、メインメモリ32に記憶されている認識結果データ69がマーカ51の位置および向きを示すか否かによって行うことができる。ステップS3の判定結果が肯定となる場合、ステップS4の処理が実行される。一方、ステップS3の判定結果が否定となる場合、ステップS4の処理がスキップされて後述するステップS5の処理が実行される。   Returning to the description of FIG. 11, the process of step S3 is executed after the recognition process of step S2. In step S3, the CPU 31 determines whether or not the recognition process in step S2 has succeeded. The determination in step S3 can be made based on whether or not the recognition result data 69 stored in the main memory 32 indicates the position and orientation of the marker 51. If the determination result of step S3 is affirmative, the process of step S4 is executed. On the other hand, when the determination result of step S3 is negative, the process of step S4 is skipped and the process of step S5 described later is executed.

ステップS4において、CPU31は、ステップS2の認識結果に基づいて、仮想カメラの位置および姿勢を算出する。仮想カメラは、仮想空間の画像を生成する場合における視点、視線方向、および視野角を定めるために仮想空間に設定されるものである。ステップS4においては、CPU31は、まず、ステップS2の認識結果であるマーカ51の位置および向きから、ゲーム装置1(カメラ)とマーカ51との位置関係を算出する。この位置関係は、例えば、ゲーム装置1およびマーカ51の一方を基準としたときの他方の3次元の位置および姿勢として表される。次に、CPU31は、上記位置関係に基づいて仮想空間における仮想カメラの位置および姿勢を算出する。仮想カメラの位置および姿勢は、仮想空間における仮想カメラと、仮想空間におけるマーカ51に対応する位置との位置関係が、現実空間におけるゲーム装置1とマーカ51との位置関係に一致するように算出される。なお、ステップS4における処理は、例えば上述の非特許文献1に記載されているような従来の拡張現実感技術で用いられる処理と同様の方法であってもよい。また、上記ステップS2における認識処理が失敗であった場合、CPU31は、仮想カメラの位置および姿勢の算出を行わず、認識処理が最後に成功した時に算出された仮想カメラの位置および姿勢を用いる。ステップS4の次にステップS5の処理が実行される。   In step S4, the CPU 31 calculates the position and orientation of the virtual camera based on the recognition result in step S2. The virtual camera is set in the virtual space in order to determine a viewpoint, a line-of-sight direction, and a viewing angle when generating an image of the virtual space. In step S4, the CPU 31 first calculates the positional relationship between the game apparatus 1 (camera) and the marker 51 from the position and orientation of the marker 51 that is the recognition result in step S2. This positional relationship is represented, for example, as the other three-dimensional position and orientation when one of the game apparatus 1 and the marker 51 is used as a reference. Next, the CPU 31 calculates the position and orientation of the virtual camera in the virtual space based on the positional relationship. The position and orientation of the virtual camera are calculated so that the positional relationship between the virtual camera in the virtual space and the position corresponding to the marker 51 in the virtual space matches the positional relationship between the game apparatus 1 and the marker 51 in the real space. The The process in step S4 may be the same method as the process used in the conventional augmented reality technology as described in Non-Patent Document 1 described above, for example. If the recognition process in step S2 fails, the CPU 31 does not calculate the position and orientation of the virtual camera, and uses the position and orientation of the virtual camera calculated when the recognition process was last successful. Following step S4, the process of step S5 is executed.

ステップS5において、CPU31はゲーム制御処理を実行する。ゲーム制御処理は、ユーザ(プレイヤ)の入力等に応じて仮想空間内のオブジェクトを動作させること等によってゲームを進行させる処理である。具体的には、ゲーム制御処理には、ユーザの入力に従ってプレイヤキャラクタの動作を制御したり、ゲームプログラム61において定められた制御ルールに従ってオブジェクト(図4に示す大砲52等)の動作を制御したりする処理が含まれる。また、CPU31は、ゲーム装置1に設けられた各種入力装置(タッチパネル13、各操作ボタン14A〜14L)に対する操作結果の他、上記認識結果データ69をゲーム入力として用いてもよい。例えば、認識結果データ69から算出される仮想カメラの位置がプレイヤキャラクタの位置として用いられてもよい。ステップS5の次にステップS6の処理が実行される。   In step S5, the CPU 31 executes a game control process. The game control process is a process for advancing the game by operating an object in the virtual space according to a user (player) input or the like. Specifically, in the game control process, the movement of the player character is controlled according to the user input, or the movement of the object (cannon 52 shown in FIG. 4) is controlled according to the control rules defined in the game program 61. Processing is included. Further, the CPU 31 may use the recognition result data 69 as a game input in addition to the operation results for various input devices (the touch panel 13 and the operation buttons 14A to 14L) provided in the game apparatus 1. For example, the position of the virtual camera calculated from the recognition result data 69 may be used as the position of the player character. Following step S5, the process of step S6 is executed.

ステップS6において、CPU31は、撮像画像と仮想空間における仮想オブジェクトの画像(仮想画像)とを合成した合成画像を生成して表示装置(上側LCD22)に表示する。すなわち、CPU31は、まず、ステップS4で設定された仮想カメラの位置および姿勢に基づいて仮想画像を生成する。これによって、仮想カメラの位置から見た仮想オブジェクトの画像が生成される。次に、CPU31は、生成された仮想オブジェクトの画像を撮像画像に対して合成し、合成画像を生成・表示する。なお、合成画像の生成に用いられる撮像画像は、取得された最新の撮像画像でもよいし、認識処理が成功であった最新の撮像画像でもよい。なお、合成画像の生成処理は、従来における拡張現実感技術と同様の処理であってもよい。ステップS6の次にステップS7の処理が実行される。   In step S <b> 6, the CPU 31 generates a composite image obtained by combining the captured image and the virtual object image (virtual image) in the virtual space, and displays the composite image on the display device (upper LCD 22). That is, the CPU 31 first generates a virtual image based on the position and orientation of the virtual camera set in step S4. Thereby, an image of the virtual object viewed from the position of the virtual camera is generated. Next, the CPU 31 combines the generated virtual object image with the captured image, and generates and displays a combined image. The captured image used for generating the composite image may be the latest acquired captured image or the latest captured image for which the recognition process has been successful. Note that the composite image generation process may be the same process as in the conventional augmented reality technology. Following step S6, the process of step S7 is executed.

ステップS7において、CPU31は、ゲームを終了するか否かを判定する。ステップS7の判定は、例えば、ゲームがクリアされたか否か、ゲームオーバーとなったか否か、プレイヤがゲームを中止する指示を行ったか否か等によって行われる。ステップS7の判定結果が否定である場合、ステップS1の処理が再度実行される。以降、ステップS7でゲームを終了すると判定されるまで、ステップS1〜S7の処理ループが繰り返し実行される。一方、ステップS7の判定結果が肯定である場合、CPU31は、図11に示すゲーム処理を終了する。以上で、ゲーム処理の説明を終了する。   In step S7, the CPU 31 determines whether or not to end the game. The determination in step S7 is made based on, for example, whether or not the game has been cleared, whether or not the game is over, and whether or not the player has given an instruction to stop the game. If the determination result of step S7 is negative, the process of step S1 is executed again. Thereafter, the processing loop of steps S1 to S7 is repeatedly executed until it is determined in step S7 that the game is to be ended. On the other hand, when the determination result of step S7 is affirmative, the CPU 31 ends the game process shown in FIG. This is the end of the description of the game process.

上記ゲーム処理によれば、撮像画像から第1図形55の領域を検出する対象検出処理(ステップS11)と、検出した領域から第1図形55を含むマーカ51を検出するマーカ検出処理(ステップS15)とで、処理の精度を変えることによって、認識処理を高速かつ精度良く行うことができる。また、第1図形55内の内部図形56の中心位置を算出し、中心位置に基づいてマーカ51上の位置(4つの頂点)を算出することによって、撮像画像にぶれが生じている場合でも、マーカ51の位置を正確に算出することができる。   According to the above game process, the target detection process (step S11) for detecting the area of the first graphic 55 from the captured image, and the marker detection process (step S15) for detecting the marker 51 including the first graphic 55 from the detected area. Thus, recognition processing can be performed at high speed and with high accuracy by changing the processing accuracy. Further, by calculating the central position of the internal graphic 56 in the first graphic 55 and calculating the position (four vertices) on the marker 51 based on the central position, even when the captured image is blurred, The position of the marker 51 can be accurately calculated.

なお、上記ステップS3〜S6の一連の処理によれば、マーカ51が検出された場合(ステップS3でYesの場合)、マーカ51と外側カメラ25との位置関係が、認識処理における処理結果(マーカ51の検出結果)に基づいて算出される(ステップS4)。そして、仮想空間に配置される仮想オブジェクトを表す仮想画像が上記位置関係に基づいて生成され、撮像画像に対して仮想画像を合成した画像が表示装置に表示される(ステップS5)。このように、本実施形態では、いわゆる拡張現実感技術において、上述の認識処理を用いることができる。ここで、本実施形態のように拡張現実感技術を用いる場合には、認識処理においてマーカ51の位置および向きを正確に算出することが好ましい。また、本実施形態のようなゲーム処理においては、処理が遅れることによってゲーム操作に対する応答性が悪くなったり、ゲーム進行が遅れたりすることは好ましくなく、認識処理は高速に行われることが好ましい。したがって、拡張現実感技術を用いたゲーム処理には、高速でかつ精度良く行うことができる本実施形態における認識処理が特に有効である。   Note that, according to the series of processing in steps S3 to S6, when the marker 51 is detected (Yes in step S3), the positional relationship between the marker 51 and the outer camera 25 is the processing result in the recognition processing (marker 51) (step S4). Then, a virtual image representing a virtual object placed in the virtual space is generated based on the positional relationship, and an image obtained by combining the captured image with the virtual image is displayed on the display device (step S5). Thus, in the present embodiment, the above recognition process can be used in so-called augmented reality technology. Here, when using augmented reality technology as in this embodiment, it is preferable to accurately calculate the position and orientation of the marker 51 in the recognition process. Further, in the game processing as in the present embodiment, it is not preferable that the response to the game operation is deteriorated or the game progress is delayed due to the delay of the processing, and the recognition processing is preferably performed at high speed. Therefore, the recognition process according to the present embodiment, which can be performed at high speed and with high accuracy, is particularly effective for game processing using augmented reality technology.

[変形例]
上記実施形態は本発明を実施する一例であり、他の実施形態においては例えば以下に説明する構成で本発明を実施することも可能である。
[Modification]
The above-described embodiment is an example for carrying out the present invention. In other embodiments, the present invention can be implemented with, for example, the configuration described below.

(他の認識方法を用いた変形例)
上記実施形態においては、内部図形56を有する第1図形55を撮像対象とし、内部図形56の中心位置を算出することによって第1図形55を検出する認識方法が用いられた。ここで、撮像対象を認識する方法は、上述の内部図形56の中心位置を算出する方法に限らず、他の方法であってもよい。以下、他の認識方法を用いた変形例として、パターンマッチングの手法による認識方法を用いる変形例について説明する。
(Modifications using other recognition methods)
In the above embodiment, the recognition method is used in which the first graphic 55 having the internal graphic 56 is taken as an imaging target, and the first graphic 55 is detected by calculating the center position of the internal graphic 56. Here, the method of recognizing the imaging target is not limited to the method of calculating the center position of the internal graphic 56 described above, and may be another method. Hereinafter, a modified example using a recognition method based on a pattern matching technique will be described as a modified example using another recognition method.

図20は、本実施形態における変形例で用いられるマーカを示す図である。本変形例では、図6に示すマーカ51に代えて、図20に示すマーカ71が用いられる。マーカ71は、複数の内部図形を有しておらず、内部に所定の図形(図20では矢印)が描かれた第3図形72を含む。本変形例では、第3図形72が認識処理で認識(検出)すべき対象である。なお、所定の図形はどのようなものであってもよいが、マーカ71の向きを特定することができるように、所定角度回転させた場合に回転前と同じ形状とならない図形であることが好ましい。   FIG. 20 is a diagram illustrating markers used in a modification example of the present embodiment. In this modification, a marker 71 shown in FIG. 20 is used instead of the marker 51 shown in FIG. The marker 71 does not have a plurality of internal figures, but includes a third figure 72 in which a predetermined figure (arrow in FIG. 20) is drawn. In this modification, the third graphic 72 is a target to be recognized (detected) by the recognition process. The predetermined figure may be any shape, but is preferably a figure that does not have the same shape as before rotation when rotated by a predetermined angle so that the orientation of the marker 71 can be specified. .

図21は、本実施形態の変形例におけるマーカ検出処理の流れを示すフローチャートである。なお、本変形例における認識処理は、マーカ検出処理を除いて図12に示す認識処理と同じである。したがって、本変形例においても、低精度で領域検出処理(ステップS11)が実行される。   FIG. 21 is a flowchart showing the flow of marker detection processing in a modification of the present embodiment. Note that the recognition process in the present modification is the same as the recognition process shown in FIG. 12 except for the marker detection process. Therefore, also in this modification, the area detection process (step S11) is executed with low accuracy.

本変形例のマーカ検出処理においては、まずステップS41において、CPU31は、高精度でマーカ71の第3図形72の輪郭を抽出する。つまり、CPU31は、対象領域内において画素1つ分の間隔で画素値を参照して、第3図形72の輪郭を抽出する。なお、輪郭の抽出方法は、上記ステップS21と同様の方法である。また、抽出された輪郭を形成する各画素のデータはメインメモリ32に記憶される。ステップS41の次にステップS42の処理が実行される。   In the marker detection process of this modification, first, in step S41, the CPU 31 extracts the contour of the third graphic 72 of the marker 71 with high accuracy. That is, the CPU 31 refers to the pixel value at an interval of one pixel in the target area and extracts the outline of the third graphic 72. Note that the contour extraction method is the same as that in step S21. Further, data of each pixel forming the extracted contour is stored in the main memory 32. Following step S41, the process of step S42 is executed.

ステップS42において、CPU31は、ステップS21で抽出された輪郭がマーカを表すか否かを判定する。ステップS42の判定は、上述のステップS22の判定処理とは輪郭の精度が異なるが、上述のステップS22の判定処理と同じ方法で行うことができる。ステップS42の判定結果が肯定となる場合、ステップS43の処理が実行される。一方、ステップS42の判定結果が否定となる場合、後述するステップS47の処理が実行される。   In step S42, the CPU 31 determines whether or not the contour extracted in step S21 represents a marker. The determination in step S42 can be performed in the same manner as the determination process in step S22 described above, although the contour accuracy is different from the determination process in step S22 described above. If the determination result of step S42 is affirmative, the process of step S43 is executed. On the other hand, when the determination result of step S42 is negative, a process of step S47 described later is executed.

ステップS43において、CPU31は、第3図形72を表すパターン画像をメインメモリ32から読み出す。なお、第3図形72を表すパターン画像は1種類でも良いし、あるパターン画像と、それに対して90°、180°、および270°回転させた3つ画像との合計4種類のパターン画像が用意されていてもよい。ステップS43の次にステップS44の処理が実行される。   In step S <b> 43, the CPU 31 reads a pattern image representing the third graphic 72 from the main memory 32. Note that the pattern image representing the third graphic 72 may be one type, or a total of four types of pattern images are prepared: a pattern image and three images rotated by 90 °, 180 °, and 270 °. May be. Following step S43, the process of step S44 is executed.

ステップS44において、CPU31は、対象領域内において第3図形72に関するパターンマッチングを行う。すなわち、対象領域内から、ステップS43で読み出したパターン画像と一致(類似)する領域を検出する。なお、ステップS44におけるパターンマッチングは、どのような精度で行われてもよく、必ずしも高精度で行われる必要はない。ステップS44の次にステップS45の処理が実行される。   In step S44, the CPU 31 performs pattern matching on the third graphic 72 in the target area. That is, an area that matches (similar) the pattern image read in step S43 is detected from the target area. Note that the pattern matching in step S44 may be performed with any accuracy, and is not necessarily performed with high accuracy. Following step S44, the process of step S45 is executed.

ステップS45において、CPU31は、ステップS44におけるパターンマッチングによって、対象領域内に第3図形72が検出されたか否かを判定する。ステップS45の判定結果が肯定である場合、ステップS46の処理が実行される。一方、ステップS45の判定結果が否定である場合、ステップS47の処理が実行される。   In step S45, the CPU 31 determines whether or not the third graphic 72 is detected in the target area by the pattern matching in step S44. If the determination result of step S45 is affirmative, the process of step S46 is executed. On the other hand, if the determination result of step S45 is negative, the process of step S47 is executed.

ステップS46において、CPU31は、ステップS44におけるパターンマッチングの結果に基づいてマーカ71の位置および向きを特定する。すなわち、CPU31は、ステップS41で抽出された第3図形72の輪郭から4つの頂点の位置を算出するとともに、撮像画像と一致した時のパターン画像の向きに基づいて上下左右の4方向に関する第3図形72の向きを算出する。さらに、算出された4つの頂点の位置と、上記4方向に関する第3図形72の向きとから、第3図形72に関して上述のベクトルV1およびV2を算出する。これによって、マーカ71の位置および向きを特定することができる。ステップS46の後、CPU31はマーカ検出処理を終了する。   In step S46, the CPU 31 specifies the position and orientation of the marker 71 based on the result of pattern matching in step S44. That is, the CPU 31 calculates the positions of the four vertices from the outline of the third graphic 72 extracted in step S41, and based on the orientation of the pattern image when matched with the captured image, the third in the four directions, up, down, left, and right. The direction of the figure 72 is calculated. Further, the above-described vectors V1 and V2 are calculated for the third graphic 72 from the calculated positions of the four vertices and the orientation of the third graphic 72 in the four directions. As a result, the position and orientation of the marker 71 can be specified. After step S46, the CPU 31 ends the marker detection process.

一方、ステップS47において、CPU31は、今回のマーカ検出処理の処理対象である対象領域にはマーカが無いと判断する。ステップS47の処理は、上記ステップS40と同じである。ステップS47の後、CPU31はマーカ検出処理を終了する。   On the other hand, in step S47, the CPU 31 determines that there is no marker in the target area that is the target of the current marker detection process. The process in step S47 is the same as that in step S40. After step S47, the CPU 31 ends the marker detection process.

以上のように、本変形例によれば、図21に示すマーカ検出処理において、ステップS41およびS46の処理によって高精度でマーカ71(第3図形72)の位置を算出することができる。また、上記実施形態と同様、領域検出処理(ステップS11)は低精度で行われ、また、マーカ検出処理は対象領域のみを処理対象として行われる。そのため、上記実施形態と同様、認識処理を短時間で行うことができる。したがって、本変形例によっても上記実施形態と同様、認識処理を高速かつ精度良く行うことができる。   As described above, according to the present modification, in the marker detection process shown in FIG. 21, the position of the marker 71 (third graphic 72) can be calculated with high accuracy by the processes of steps S41 and S46. Similarly to the above embodiment, the area detection process (step S11) is performed with low accuracy, and the marker detection process is performed only on the target area. Therefore, as in the above embodiment, the recognition process can be performed in a short time. Therefore, also in this modification, the recognition process can be performed at high speed and with high accuracy as in the above embodiment.

また、上記認識処理は、低精度の領域検出処理と高精度のマーカ検出処理とによって対象(第1図形55)を検出するものであればよく、これら2種類の処理における具体的な検出方法はどのような方法であってもよい。例えば、ゲーム装置1は、上記2種類の処理の両方において、パターンマッチングの手法を用いて検出を行ってもよい。すなわち、ゲーム装置1は、領域検出処理においては画素3つ分の間隔で得られる画素値に基づいてパターンマッチングを行うことによって、パターン画像に一致(類似)する対象領域を撮像画像から検出する。そして、マーカ検出処理においては、検出された対象領域内において、画素1つ分の間隔で得られる画素値に基づいてパターンマッチングを行うことによって、対象領域内に第1画像55が存在するか否かを判定する。これによっても、上記実施形態と同様、ゲーム装置1は認識処理を高速かつ精度良く行うことができる。   In addition, the recognition process only needs to detect the target (first graphic 55) by the low-precision area detection process and the high-precision marker detection process. Specific detection methods in these two types of processes are as follows. Any method may be used. For example, the game apparatus 1 may perform detection using a pattern matching technique in both of the two types of processes. That is, the game device 1 detects a target region that matches (similar) the pattern image from the captured image by performing pattern matching based on the pixel values obtained at intervals of three pixels in the region detection process. Then, in the marker detection process, whether or not the first image 55 exists in the target area by performing pattern matching based on the pixel value obtained at intervals of one pixel in the detected target area. Determine whether. Also by this, the game apparatus 1 can perform a recognition process at high speed and with high precision similarly to the said embodiment.

(中心位置から4つの頂点を算出する方法に関する変形例)
また、上記ステップS24においては、CPU31は、ステップS23で検出された内部図形56の領域の個数が所定個数であるか否かを判定した。ここで、本実施形態では、8個の内部図形56の中心位置から4本の直線を算出することで4つの頂点を特定しているので、8個全ての内部図形56が検出されなくても4つの頂点を算出することは可能である。例えば、図17における中心点P1〜P8のいずれか1つがなくても、4本の直線L1〜L4を算出することは可能である。したがって、他の実施形態においては、ステップS24において、CPU31は、ステップS23で検出された内部図形56の領域の個数が所定範囲の個数であるか否かを判定するようにしてもよい。ここで、所定範囲は、内部図形の個数(8個)を含む範囲であり、例えば、7個から8個の範囲である。
(Modification regarding the method of calculating four vertices from the center position)
In step S24, the CPU 31 determines whether the number of areas of the internal graphic 56 detected in step S23 is a predetermined number. Here, in the present embodiment, four vertices are specified by calculating four straight lines from the center positions of the eight internal figures 56, so even if all eight internal figures 56 are not detected. It is possible to calculate four vertices. For example, four straight lines L1 to L4 can be calculated without any one of the center points P1 to P8 in FIG. Therefore, in another embodiment, in step S24, the CPU 31 may determine whether or not the number of areas of the internal graphic 56 detected in step S23 is a predetermined range. Here, the predetermined range is a range including the number of internal figures (eight), for example, a range of 7 to 8.

なお、上記実施形態において、7個の中心位置から4本の直線を算出する場合には、2個の中心位置から1本の直線を特定する必要がある。この場合、誤った組み合わせの2個の中心位置から誤った直線が算出される(例えば、中心点P3と中心点P4を通る直線が算出される)ことを防止する必要がある。そのため、例えば、CPU31は、以下の条件を満たすように、7個の中心位置から4本の直線を算出するようにしてもよい。
(条件1)7個の中心位置のうち2つまたは3つの中心位置を通る。
(条件2)第1図形55の輪郭を表す4本の直線のいずれかと略平行である。
(条件3)第1図形55の輪郭を表す4本の直線のいずれかから所定距離内にある(第1図形55の中心付近を通らない)。
なお、上記(条件2)および(条件3)において、第1図形55の輪郭を表す4本の直線は、上記ステップS22で算出されるものを用いてもよい。上記条件1〜3を満たす直線を算出することで、7個の中心位置から4本の直線を算出することができる。
In the above embodiment, when four straight lines are calculated from the seven central positions, it is necessary to specify one straight line from the two central positions. In this case, it is necessary to prevent an incorrect straight line from being calculated from two center positions of an incorrect combination (for example, a straight line passing through the central point P3 and the central point P4). Therefore, for example, the CPU 31 may calculate four straight lines from the seven center positions so as to satisfy the following condition.
(Condition 1) Two or three center positions out of the seven center positions are passed.
(Condition 2) It is substantially parallel to any of the four straight lines representing the contour of the first graphic 55.
(Condition 3) It is within a predetermined distance from any of the four straight lines representing the outline of the first graphic 55 (does not pass near the center of the first graphic 55).
In the above (Condition 2) and (Condition 3), the four straight lines representing the outline of the first graphic 55 may be those calculated in Step S22. By calculating straight lines that satisfy the above conditions 1 to 3, it is possible to calculate four straight lines from the seven central positions.

以上のように、一直線上に配置される3つ以上の内部図形が描かれた第1図形55を撮像対象とする一方、2つ以上の内部図形の中心位置から近似直線を算出し、この近似直線によってマーカ51の位置(4つの頂点の位置)を算出するようにしてもよい。これによれば、内部図形の数に冗長性を持たせることによって、全ての内部図形を検出できない場合でも4つの頂点の位置を算出することができる。   As described above, while the first graphic 55 on which three or more internal figures arranged on a straight line are drawn is taken as an imaging target, an approximate straight line is calculated from the center positions of the two or more internal figures, and this approximation is performed. You may make it calculate the position (position of four vertices) of the marker 51 with a straight line. According to this, by providing redundancy to the number of internal figures, the positions of the four vertices can be calculated even when all the internal figures cannot be detected.

(マーカに関する変形例)
上記実施形態においては、8個の内部図形56が描かれた第1図形55を含むマーカ51を用いる場合を例として説明したが、本発明において用いることができるマーカはこれに限らない。例えば、他の実施形態においては、内部図形56の数は8個に限らない。図22は、本実施形態の変形例におけるマーカを示す図である。図22に示すマーカ73は、12個の内部図形56を有する第1図形74と、図6と同様の第2図形57とを含む。また、第1図形74内の12個の内部図形56は、四角形(正方形)の4頂点と4辺の位置に配置されている。他の実施形態においては、図6に示すマーカ51に代えて、図22に示すマーカ73を用いるようにしてもよい。マーカ73を用いる場合、上述のステップS26では、CPU31は、3つまたは4つの中心位置から上記直線L1〜L4を算出するようにしてもよい。これによれば、内部図形の数に冗長性を持たせることができるので、CPU31は、全ての内部図形を検出できない場合でも4つの頂点の位置を算出することができる。
(Modifications related to markers)
In the above embodiment, the case where the marker 51 including the first graphic 55 in which the eight internal graphics 56 are drawn is described as an example. However, the marker that can be used in the present invention is not limited thereto. For example, in other embodiments, the number of internal figures 56 is not limited to eight. FIG. 22 is a diagram illustrating a marker in a modified example of the present embodiment. The marker 73 shown in FIG. 22 includes a first graphic 74 having 12 internal graphics 56 and a second graphic 57 similar to FIG. Further, the twelve internal figures 56 in the first figure 74 are arranged at the positions of four vertices and four sides of a square (square). In another embodiment, a marker 73 shown in FIG. 22 may be used instead of the marker 51 shown in FIG. When the marker 73 is used, in step S26 described above, the CPU 31 may calculate the straight lines L1 to L4 from three or four center positions. According to this, since the number of internal figures can be made redundant, the CPU 31 can calculate the positions of the four vertices even when all the internal figures cannot be detected.

また、上記実施形態においては、内部図形56は全て同じ色(白色)としたが、他の実施形態においては、第1図形55内における位置に応じて内部図形56の色を異ならせるようにしてもよい。図23は、本実施形態の他の変形例におけるマーカを示す図である。図23に示すマーカ75は、図22に示す第1図形74と同様、12個の内部図形56が描かれた第1図形76を含む。ここで、第1図形76においては、四角形(正方形)の4辺の位置に配置される各内部図形56の色は、辺毎に異なっている(図23では、色の違いを斜線の方向および間隔で表す)。他の実施形態においては、図6に示すマーカ51に代えて、図23に示すマーカ75を用いるようにしてもよい。この場合、CPU31は、第2図形を用いずにマーカ75の向き(上下左右の4方向に関する向き)を算出することができる。すなわち、CPU31は、内部図形56の色を検知することによって、マーカ75の上下左右の4方向に関する向きを特定することができる。   In the above embodiment, all the internal figures 56 have the same color (white). However, in other embodiments, the color of the internal figure 56 is made different depending on the position in the first figure 55. Also good. FIG. 23 is a diagram illustrating a marker in another modification example of the present embodiment. The marker 75 shown in FIG. 23 includes a first graphic 76 on which 12 internal figures 56 are drawn, similarly to the first graphic 74 shown in FIG. Here, in the first graphic 76, the colors of the internal figures 56 arranged at the positions of the four sides of the quadrangle (square) are different for each side (in FIG. Expressed in intervals). In another embodiment, a marker 75 shown in FIG. 23 may be used instead of the marker 51 shown in FIG. In this case, the CPU 31 can calculate the orientation of the marker 75 (orientation in the four directions, up, down, left, and right) without using the second graphic. That is, the CPU 31 can identify the orientation of the marker 75 in the four directions, up, down, left, and right, by detecting the color of the internal graphic 56.

また、上記実施形態においては、第1図形55を検出しやすくする目的で、マーカ51には黒色の第1図形55の周囲に白色の枠が設けられた。そのため、認識処理による検出対象はマーカ51内の第1図形55であった。ここで、他の実施形態においては、白色の枠はなくてもよく、マーカ51全体が認識処理による検出対象とされてもよい。   In the above embodiment, the marker 51 is provided with a white frame around the black first graphic 55 for the purpose of easily detecting the first graphic 55. Therefore, the detection target by the recognition process is the first graphic 55 in the marker 51. Here, in other embodiments, there may be no white frame, and the entire marker 51 may be a detection target by the recognition process.

また、上記実施形態では、マーカ51は、第1図形55と異なる位置に第2図形57を含んでいた。CPU31は、第1図形55に対して第2図形57が配置される方向に基づいて第1図形55の向き(上下左右の4方向に関する向き)を特定した(S29)。ここで、他の実施形態においては、第1図形の内部に第2図形が描かれたマーカを用いてもよい。例えば、図6に示すマーカ51において、第1図形55の内部の8個の内部図形56によって表される四角形の内側に、第2図形57が形成されてもよい。なお、第2図形は、上記実施形態の矢印の図形のように、向きを特定することができる形状であればどのような図形であってもよい。このとき、CPU31は、ステップS26で4つの頂点を算出した後、4つの頂点によって形成される四角形の内側の領域から第2図形を検出する。そして、検出された第2図形の向きから、上下左右の4方向に関する第1図形の向きを特定する。以上によっても上記実施形態と同様、上下左右の4方向に関する第1図形の向きを特定することができる。ただし、第1図形の内部に第2図形が描かれたマーカを用いる場合には、第1図形の内部に内側図形と第2図形との両方が含まれることになる。そのため、内側図形を検出する際に誤検出が生じる可能性が高くなり、(上記実施形態と比べて)認識処理の精度が落ちる可能性がある。換言すれば、上記実施形態では、第1図形内に内側図形のみが形成されたマーカを用いるので、内側図形をより正確に検出することができ、認識処理の精度を向上することができる。   In the above embodiment, the marker 51 includes the second graphic 57 at a position different from the first graphic 55. The CPU 31 specifies the orientation of the first graphic 55 (orientation in the four directions, up, down, left, and right) based on the direction in which the second graphic 57 is arranged with respect to the first graphic 55 (S29). Here, in another embodiment, a marker in which a second graphic is drawn inside the first graphic may be used. For example, in the marker 51 shown in FIG. 6, the second graphic 57 may be formed inside a square represented by eight internal graphics 56 inside the first graphic 55. The second graphic may be any graphic as long as the direction can be specified, such as the arrow graphic in the above embodiment. At this time, after calculating four vertices in step S26, the CPU 31 detects the second graphic from the area inside the quadrangle formed by the four vertices. And the direction of the 1st figure about four directions of up and down, right and left is specified from the direction of the detected 2nd figure. As described above, as in the above embodiment, the orientation of the first graphic in the four directions, top, bottom, left, and right can be specified. However, when a marker in which the second graphic is drawn inside the first graphic is used, both the inner graphic and the second graphic are included in the first graphic. Therefore, there is a high possibility of erroneous detection when detecting the inner figure, and the accuracy of the recognition process may be reduced (compared to the above embodiment). In other words, in the above embodiment, since the marker in which only the inner graphic is formed in the first graphic is used, the inner graphic can be detected more accurately, and the accuracy of the recognition process can be improved.

また、上記実施形態では、マーカ51は、所定の図形が描かれた薄板状の部材であったが、他の実施形態においては、マーカ51は、表示装置によって所定の図形を表示することによって実現されてもよい。例えば、他の実施形態においては、画面にマーカ51が表示された他の携帯ゲーム装置がマーカ51として用いられてもよい。   In the above embodiment, the marker 51 is a thin plate-like member on which a predetermined graphic is drawn. In other embodiments, the marker 51 is realized by displaying the predetermined graphic on a display device. May be. For example, in another embodiment, another portable game device in which the marker 51 is displayed on the screen may be used as the marker 51.

(認識処理に用いる撮像画像に関する変形例)
上記実施形態においては、低精度で行う領域検出処理(ステップS11)と、高精度で行うマーカ検出処理(ステップS15)とにおいて、同じ撮像画像が用いられた。ここで、他の実施形態においては、上記2つの処理で解像度が異なる画像を用いてもよい。具体的には、領域検出処理においては、マーカ検出処理において用いられる撮像画像よりも解像度が低い画像が用いられてもよい。例えば、認識処理以外の他の処理において必要となる等の理由で、ゲーム装置1がカメラによる撮像画像から解像度の低い画像を生成する場合には、当該解像度の低い画像を領域検出処理において用いるようにしてもよい。
(Modified example of captured image used for recognition processing)
In the above-described embodiment, the same captured image is used in the region detection process (step S11) performed with low accuracy and the marker detection process (step S15) performed with high accuracy. Here, in other embodiments, images having different resolutions may be used in the above two processes. Specifically, in the region detection process, an image having a lower resolution than the captured image used in the marker detection process may be used. For example, when the game apparatus 1 generates an image with a low resolution from an image captured by the camera because it is necessary for a process other than the recognition process, the image with the low resolution is used in the area detection process. It may be.

(マーカ位置の算出に関する変形例)
上記実施形態においては、CPU31は、内部図形56の中心位置を算出し、中心位置に基づいて、撮像画像内におけるマーカ51の位置(4つの頂点P11〜P14の位置)を算出した。ここで、他の実施形態においては、CPU31は、内部図形56の中心位置をそのままマーカ51の位置として用いてもよい。例えば、CPU31は、図9および図17に示す点P1,P3,P6および点P8をマーカ51の位置として用いてもよい。また、上記実施形態においては、マーカ51の位置および向きを表す情報として、4つの点の位置(4つの頂点P11〜P14の位置)を用いたが、マーカ51の3つ以上の点の位置がわかればマーカ51の位置および向きを特定することができる。したがって、他の実施形態においては、マーカ51の位置および向きを表す情報として3つまたは5つ以上の点の位置を用いてもよい。したがって、CPU31は、3つ以上の内部図形の中心位置に基づいてマーカ51の位置および向きを検出することができる。
(Modification regarding marker position calculation)
In the above embodiment, the CPU 31 calculates the center position of the internal graphic 56, and calculates the positions of the markers 51 in the captured image (positions of the four vertices P11 to P14) based on the center position. Here, in another embodiment, the CPU 31 may use the center position of the internal graphic 56 as the position of the marker 51 as it is. For example, the CPU 31 may use the points P1, P3, P6 and the point P8 shown in FIG. 9 and FIG. Moreover, in the said embodiment, although the position of four points (position of the four vertexes P11-P14) was used as information showing the position and direction of the marker 51, the position of the three or more points of the marker 51 is used. If it is known, the position and orientation of the marker 51 can be specified. Therefore, in other embodiments, the position of three or five or more points may be used as information indicating the position and orientation of the marker 51. Therefore, the CPU 31 can detect the position and orientation of the marker 51 based on the center position of three or more internal figures.

(その他の変形例)
上記実施形態では、ゲーム装置1は、ゲーム装置1が備える外側カメラ25によってリアルタイムに取得される撮像画像に対して認識処理を実行した。ここで、他の実施形態においては、認識処理の対象となる撮像画像は、過去に撮像されたものであってもよいし、ゲーム装置1が外部の機器から取得した撮像画像であってもよい。また、上記実施形態では、外側カメラ25がゲーム装置1に予め搭載されているが、他の実施形態では、ゲーム装置1に着脱可能な外付け型のカメラが外側カメラ25に代えて利用されてもよい。
(Other variations)
In the embodiment described above, the game apparatus 1 performs the recognition process on the captured image acquired in real time by the outer camera 25 included in the game apparatus 1. Here, in other embodiments, the captured image that is the target of the recognition process may be a captured image in the past, or may be a captured image acquired by the game apparatus 1 from an external device. . In the above embodiment, the outer camera 25 is mounted on the game apparatus 1 in advance. However, in another embodiment, an external camera that can be attached to and detached from the game apparatus 1 is used instead of the outer camera 25. Also good.

また、上記実施形態では、拡張現実感技術において認識処理が用いられる場合を例として説明した。また、認識処理の認識対象となる物体は、拡張現実感技術において用いられるマーカであった。ここで、本発明は、撮像画像から任意の撮像対象を認識する任意の画像認識処理に適用することが可能である。例えば、他の実施形態においては、認識処理は、撮像画像からユーザの顔を認識し、認識した顔に対して所定の処理(例えば、落書き等の画像を追加する処理)を行う技術に用いられてもよい。   In the above embodiment, the case where the recognition process is used in the augmented reality technology has been described as an example. In addition, the object to be recognized in the recognition process is a marker used in augmented reality technology. Here, the present invention can be applied to arbitrary image recognition processing for recognizing an arbitrary imaging target from a captured image. For example, in another embodiment, the recognition process is used for a technique for recognizing a user's face from a captured image and performing a predetermined process (for example, a process of adding an image such as a graffiti) on the recognized face. May be.

また、上記実施形態では、一台の情報処理装置(ゲーム装置1)のみによって認識処理を実行しているが、他の実施形態では、互いに通信可能な複数の情報処理装置を有する画像認識システムにおいて、当該複数の情報処理装置が認識処理を分担して実行するようにしてもよい。   In the above embodiment, the recognition process is executed by only one information processing device (game device 1). In other embodiments, the image recognition system includes a plurality of information processing devices that can communicate with each other. The plurality of information processing apparatuses may share and execute the recognition process.

以上のように、本発明は、対象の検出精度を維持しつつ、検出に要する時間を短縮すること等を目的として、例えばゲームプログラムやゲーム装置に利用することが可能である。   As described above, the present invention can be used for, for example, a game program or a game device for the purpose of shortening the time required for detection while maintaining the detection accuracy of an object.

1 ゲーム装置
13 タッチパネル
22 上側LCD
25 外側カメラ
31 CPU
32 メインメモリ
51 マーカ
54 対象領域
55 第1図形
56 内部図形
57 第2図形
1 Game device 13 Touch panel 22 Upper LCD
25 Outside camera 31 CPU
32 Main memory 51 Marker 54 Target area 55 First figure 56 Internal figure 57 Second figure

Claims (17)

撮像手段によって撮像された撮像画像に含まれる所定の撮像対象を検出する情報処理装置のコンピュータにおいて実行される画像認識プログラムであって、
前記撮像手段によって撮像された撮像画像を取得する画像取得手段と、
前記撮像画像において第1の間隔で得られる画素値に基づいて、当該撮像画像のうちで前記所定の撮像対象を含む対象領域を検出する領域検出手段と、
前記対象領域内の撮像画像において前記第1の間隔よりも小さい第2の間隔で得られる画素値に基づいて、当該対象領域の画像から前記所定の撮像対象を検出する対象検出手段として前記コンピュータを機能させる、画像認識プログラム。
An image recognition program executed in a computer of an information processing apparatus for detecting a predetermined imaging target included in a captured image captured by an imaging unit,
Image acquisition means for acquiring a captured image captured by the imaging means;
Based on pixel values obtained at first intervals in the captured image, area detection means for detecting a target area including the predetermined imaging target in the captured image;
Based on pixel values obtained at a second interval smaller than the first interval in a captured image in the target region, the computer is used as target detection means for detecting the predetermined imaging target from the image of the target region. An image recognition program that works.
前記対象検出手段は、前記撮像画像内における前記所定の撮像対象の位置を前記第2の間隔で得られる画素値に基づいて算出することによって当該撮像対象を検出する、請求項1に記載の画像認識プログラム。   The image according to claim 1, wherein the target detection unit detects the imaging target by calculating a position of the predetermined imaging target in the captured image based on a pixel value obtained at the second interval. Recognition program. 前記所定の撮像対象は、複数の内部図形が描かれた図形を含み、
前記対象検出手段は、前記対象領域の画像から前記複数の内部図形をそれぞれ検出し、前記第2の間隔で得られる画素値に基づいて各内部図形の中心位置をそれぞれ算出することによって前記所定の撮像対象の位置を検出する、請求項1または請求項2に記載の画像認識プログラム。
The predetermined imaging target includes a figure in which a plurality of internal figures are drawn,
The target detection unit detects the plurality of internal figures from the image of the target area, and calculates the center position of each internal figure based on the pixel values obtained at the second interval. The image recognition program according to claim 1, wherein the image recognition program detects a position of an imaging target.
前記画像認識プログラムは、前記領域検出手段によって検出された前記対象領域において、前記所定の撮像対象の輪郭を抽出する輪郭抽出手段として前記コンピュータをさらに機能させ、
前記対象検出手段は、前記輪郭抽出手段によって抽出された輪郭内の領域から前記複数の内部図形をそれぞれ検出する、請求項3に記載の画像認識プログラム。
The image recognition program further causes the computer to function as a contour extracting unit that extracts a contour of the predetermined imaging target in the target region detected by the region detecting unit,
The image recognition program according to claim 3, wherein the target detection unit detects each of the plurality of internal figures from a region in the contour extracted by the contour extraction unit.
前記輪郭抽出手段は、前記撮像画像において前記第1の間隔よりも小さく前記第2の間隔よりも大きい第3の間隔で得られる画素値に基づいて前記所定の撮像対象の輪郭を抽出する、請求項4に記載の画像認識プログラム。   The contour extracting unit extracts a contour of the predetermined imaging target based on pixel values obtained at a third interval that is smaller than the first interval and larger than the second interval in the captured image. Item 5. The image recognition program according to Item 4. 前記画像認識プログラムは、前記輪郭抽出手段によって抽出された輪郭が前記所定の撮像対象を表すか否かを判定する対象判定手段として前記コンピュータを機能させ、
前記対象検出手段は、前記対象判定手段によって前記所定の撮像対象を表すと判定される輪郭に対応する領域内から前記複数の内部図形をそれぞれ検出する、請求項4または請求項5に記載の画像認識プログラム。
The image recognition program causes the computer to function as an object determination unit that determines whether the contour extracted by the contour extraction unit represents the predetermined imaging target,
6. The image according to claim 4, wherein the target detection unit detects the plurality of internal figures from within an area corresponding to an outline determined to represent the predetermined imaging target by the target determination unit. 7. Recognition program.
前記対象検出手段は、
前記対象領域において複数の内部図形の領域をそれぞれ検出する内部領域検出手段と、
前記内部領域検出手段によって検出された各領域の中心位置をそれぞれ算出する位置算出手段とを有する、請求項3から請求項6のいずれか1項に記載の画像認識プログラム。
The object detection means includes
An internal area detecting means for detecting areas of a plurality of internal figures in the target area,
The image recognition program according to any one of claims 3 to 6, further comprising a position calculation unit that calculates a center position of each region detected by the internal region detection unit.
前記内部領域検出手段は、前記撮像画像において前記第1の間隔よりも小さく前記第2の間隔よりも大きい第4の間隔で得られる画素値に基づいて前記複数の内部図形の領域をそれぞれ検出する、請求項7に記載の画像認識プログラム。   The internal area detection means detects the areas of the plurality of internal figures based on pixel values obtained at a fourth interval that is smaller than the first interval and larger than the second interval in the captured image. The image recognition program according to claim 7. 前記対象検出手段は、前記内部領域検出手段によって検出された領域の個数が、所定範囲内の個数であるか否かを判定する個数判定手段をさらに有し、
前記位置算出手段は、前記所定範囲内の個数の領域が検出された前記対象領域について、前記内部領域検出手段によって検出された各領域の中心位置を算出する、請求項7または請求項8に記載の画像認識プログラム。
The target detection means further includes a number determination means for determining whether or not the number of areas detected by the internal area detection means is a number within a predetermined range,
The said position calculation means calculates the center position of each area | region detected by the said internal area | region detection means about the said object area | region where the number of area | regions within the said predetermined range were detected. Image recognition program.
前記領域検出手段は、前記第1の間隔で隣接する画素間における画素値に基づいて前記所定の撮像対象の輪郭を抽出することによって対象領域を検出する、請求項1から請求項5のいずれか1項に記載の画像認識プログラム。   The said area | region detection means detects an object area | region by extracting the outline of the said predetermined imaging target based on the pixel value between the adjacent pixels in the said 1st space | interval. The image recognition program according to item 1. 前記領域検出手段は、前記画像取得手段によって取得された撮像画像の各画素のうち前記第1の間隔で配置される画素に関する画素値に基づいて前記対象領域を検出し、
前記対象検出手段は、前記画像取得手段によって取得された撮像画像の各画素のうち前記第2の間隔で配置される画素に関する画素値に基づいて前記所定の撮像対象を検出する、請求項1から請求項10のいずれか1項に記載の画像認識プログラム。
The region detection unit detects the target region based on pixel values related to pixels arranged at the first interval among the pixels of the captured image acquired by the image acquisition unit,
The said object detection means detects the said predetermined imaging target based on the pixel value regarding the pixel arrange | positioned by the said 2nd space | interval among each pixel of the captured image acquired by the said image acquisition means. The image recognition program according to claim 10.
前記情報処理装置がアクセス可能な記憶手段から、前記所定の撮像対象を表すパターン画像を取得するパターン取得手段として前記コンピュータをさらに機能させ、
前記対象検出手段は、前記対象領域の画像と前記パターン画像とを比較することによって前記対象領域内に前記所定の撮像対象が含まれるか否かを判断する、請求項1または請求項2に記載の画像認識プログラム。
Causing the computer to further function as pattern acquisition means for acquiring a pattern image representing the predetermined imaging target from storage means accessible by the information processing apparatus;
The target detection unit determines whether or not the predetermined imaging target is included in the target region by comparing the image of the target region with the pattern image. Image recognition program.
前記対象検出手段は、前記第2の間隔で得られる画素値に基づいて前記対象領域の画像から前記所定の撮像対象の輪郭を抽出し、抽出された輪郭に基づいて、前記撮像画像内における前記所定の撮像対象の位置を算出する、請求項1または請求項12に記載の画像認識プログラム。   The target detection means extracts a contour of the predetermined imaging target from the image of the target region based on the pixel value obtained at the second interval, and based on the extracted contour, the target image in the captured image The image recognition program according to claim 1 or 12, wherein a position of a predetermined imaging target is calculated. 前記対象検出手段によって前記所定の撮像対象が検出された場合、当該所定の撮像対象と前記撮像手段との位置関係を前記対象検出手段による検出結果に基づいて算出する位置関係算出手段と、
仮想空間に配置される仮想オブジェクトを表す仮想画像を前記位置関係に基づいて生成し、前記撮像画像に対して前記仮想画像を合成した画像を表示手段に表示させる表示制御手段として前記コンピュータをさらに機能させる、請求項1から請求項13のいずれか1項に記載の画像認識プログラム。
A positional relationship calculation unit that calculates a positional relationship between the predetermined imaging target and the imaging unit based on a detection result of the target detection unit when the predetermined imaging target is detected by the target detection unit;
The computer further functions as a display control unit that generates a virtual image representing a virtual object arranged in the virtual space based on the positional relationship, and causes the display unit to display an image obtained by synthesizing the virtual image with the captured image. The image recognition program according to claim 1, wherein the image recognition program is executed.
撮像手段によって撮像された撮像画像に含まれる所定の撮像対象を検出する画像認識装置であって、
前記撮像手段によって撮像された撮像画像を取得する画像取得手段と、
前記撮像画像において第1の間隔で得られる画素値に基づいて、当該撮像画像のうちで前記所定の撮像対象を含む対象領域を検出する領域検出手段と、
前記対象領域内の撮像画像において前記第1の間隔よりも小さい第2の間隔で得られる画素値に基づいて、当該対象領域の画像から前記所定の撮像対象を検出する対象検出手段とを備える、画像認識装置。
An image recognition device for detecting a predetermined imaging target included in a captured image captured by an imaging means,
Image acquisition means for acquiring a captured image captured by the imaging means;
Based on pixel values obtained at first intervals in the captured image, area detection means for detecting a target area including the predetermined imaging target in the captured image;
Object detection means for detecting the predetermined imaging object from the image of the target area based on pixel values obtained at a second interval smaller than the first interval in the captured image in the target area; Image recognition device.
撮像手段によって撮像された撮像画像に含まれる所定の撮像対象を検出する画像認識システムであって、
前記撮像手段によって撮像された撮像画像を取得する画像取得手段と、
前記撮像画像において第1の間隔で得られる画素値に基づいて、当該撮像画像のうちで前記所定の撮像対象を含む対象領域を検出する領域検出手段と、
前記対象領域内の撮像画像において前記第1の間隔よりも小さい第2の間隔で得られる画素値に基づいて、当該対象領域の画像から前記所定の撮像対象を検出する対象検出手段とを備える、画像認識システム。
An image recognition system for detecting a predetermined imaging target included in a captured image captured by an imaging means,
Image acquisition means for acquiring a captured image captured by the imaging means;
Based on pixel values obtained at first intervals in the captured image, area detection means for detecting a target area including the predetermined imaging target in the captured image;
Object detection means for detecting the predetermined imaging object from the image of the target area based on pixel values obtained at a second interval smaller than the first interval in the captured image in the target area; Image recognition system.
撮像手段によって撮像された撮像画像に含まれる所定の撮像対象を検出するための画像認識方法であって、
前記撮像手段によって撮像された撮像画像を取得する画像取得ステップと、
前記撮像画像において第1の間隔で得られる画素値に基づいて、当該撮像画像のうちで前記所定の撮像対象を含む対象領域を検出する領域検出ステップと、
前記対象領域内の撮像画像において前記第1の間隔よりも小さい第2の間隔で得られる画素値に基づいて、当該対象領域の画像から前記所定の撮像対象を検出する対象検出ステップとを含む、画像認識方法。
An image recognition method for detecting a predetermined imaging target included in a captured image captured by an imaging means,
An image acquisition step of acquiring a captured image captured by the imaging means;
An area detecting step of detecting a target area including the predetermined imaging target in the captured image based on pixel values obtained at first intervals in the captured image;
A target detection step of detecting the predetermined imaging target from the image of the target region based on pixel values obtained at a second interval smaller than the first interval in the captured image in the target region, Image recognition method.
JP2010133510A 2010-06-11 2010-06-11 Image recognition program, image recognition apparatus, image recognition system, and image recognition method Active JP4878396B2 (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP2010133510A JP4878396B2 (en) 2010-06-11 2010-06-11 Image recognition program, image recognition apparatus, image recognition system, and image recognition method
EP10188871.7A EP2395474A3 (en) 2010-06-11 2010-10-26 Storage medium having image recognition program stored therein, image recognition apparatus, image recognition system, and image recognition method
US12/914,037 US9256797B2 (en) 2010-06-11 2010-10-28 Storage medium having image recognition program stored therein, image recognition apparatus, image recognition system, and image recognition method
US12/915,696 US8731332B2 (en) 2010-06-11 2010-10-29 Storage medium having image recognition program stored therein, image recognition apparatus, image recognition system, and image recognition method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010133510A JP4878396B2 (en) 2010-06-11 2010-06-11 Image recognition program, image recognition apparatus, image recognition system, and image recognition method

Publications (2)

Publication Number Publication Date
JP2011096227A true JP2011096227A (en) 2011-05-12
JP4878396B2 JP4878396B2 (en) 2012-02-15

Family

ID=44113019

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010133510A Active JP4878396B2 (en) 2010-06-11 2010-06-11 Image recognition program, image recognition apparatus, image recognition system, and image recognition method

Country Status (1)

Country Link
JP (1) JP4878396B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014069248A1 (en) * 2012-11-02 2014-05-08 ソニー株式会社 Image processing device, image processing method, and program
JPWO2014069247A1 (en) * 2012-11-02 2016-09-08 ソニー株式会社 Image processing apparatus, image processing method, and program

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01289696A (en) * 1988-05-18 1989-11-21 Fanuc Ltd Image processing method for visual sensor system
JPH07212584A (en) * 1994-01-20 1995-08-11 Omron Corp Image processor and copying machine using the same
JPH0935058A (en) * 1995-07-17 1997-02-07 Nec Corp Image recognizing method
JPH11110545A (en) * 1997-09-29 1999-04-23 Ricoh Co Ltd Image recognition device
JP2010033397A (en) * 2008-07-30 2010-02-12 Dainippon Printing Co Ltd Image composition device and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01289696A (en) * 1988-05-18 1989-11-21 Fanuc Ltd Image processing method for visual sensor system
JPH07212584A (en) * 1994-01-20 1995-08-11 Omron Corp Image processor and copying machine using the same
JPH0935058A (en) * 1995-07-17 1997-02-07 Nec Corp Image recognizing method
JPH11110545A (en) * 1997-09-29 1999-04-23 Ricoh Co Ltd Image recognition device
JP2010033397A (en) * 2008-07-30 2010-02-12 Dainippon Printing Co Ltd Image composition device and method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014069248A1 (en) * 2012-11-02 2014-05-08 ソニー株式会社 Image processing device, image processing method, and program
JPWO2014069247A1 (en) * 2012-11-02 2016-09-08 ソニー株式会社 Image processing apparatus, image processing method, and program
US9785839B2 (en) 2012-11-02 2017-10-10 Sony Corporation Technique for combining an image and marker without incongruity
US10378877B2 (en) 2012-11-02 2019-08-13 Sony Corporation Image processing device, image processing method, and program

Also Published As

Publication number Publication date
JP4878396B2 (en) 2012-02-15

Similar Documents

Publication Publication Date Title
US8731332B2 (en) Storage medium having image recognition program stored therein, image recognition apparatus, image recognition system, and image recognition method
CN110544280B (en) AR system and method
US9495800B2 (en) Storage medium having stored thereon image processing program, image processing apparatus, image processing system, and image processing method
US8970623B2 (en) Information processing system, information processing method, information processing device and tangible recoding medium recording information processing program
JP5591281B2 (en) Information processing system, information processing apparatus, information processing program, and moving image reproduction control method
US9058790B2 (en) Image processing system, storage medium storing image processing program, image processing apparatus and image processing method
US8882591B2 (en) Storage medium having image display program stored therein, image display apparatus, image display system, and image display method
US9196093B2 (en) Information presentation device, digital camera, head mount display, projector, information presentation method and non-transitory computer readable medium
US8764563B2 (en) Video game superimposing virtual characters on user supplied photo used as game screen background
US9064335B2 (en) System, method, device and computer-readable medium recording information processing program for superimposing information
JP5791433B2 (en) Information processing program, information processing system, information processing apparatus, and information processing method
JP5791434B2 (en) Information processing program, information processing system, information processing apparatus, and information processing method
JP5213500B2 (en) Image conversion program and image conversion apparatus
JP5478205B2 (en) GAME DEVICE, GAME PROGRAM, GAME SYSTEM, AND GAME CONTROL METHOD
JP2013050883A (en) Information processing program, information processing system, information processor, and information processing method
JP5437726B2 (en) Information processing program, information processing apparatus, information processing system, and coordinate calculation method
WO2019123509A1 (en) Terminal device, system, program and method
JP2012217677A (en) Game system, game device, game program, and image creation method
JP2016127377A (en) Image processing apparatus and image processing method, image reproducer and image reproducing method and program
JP5373744B2 (en) GAME DEVICE, GAME DEVICE CONTROL METHOD, AND PROGRAM
JP4878396B2 (en) Image recognition program, image recognition apparatus, image recognition system, and image recognition method
JP5496991B2 (en) Image display program, image display apparatus, image display system, and image display method
JP5647443B2 (en) Image recognition program, image recognition apparatus, image recognition system, and image recognition method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110325

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20110909

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110921

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20111025

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20111031

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20111104

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20111122

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20111125

R150 Certificate of patent or registration of utility model

Ref document number: 4878396

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20141209

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250