METHOD FOR SIMULATING AND CONTROLLING VIRTUAL SPHERE IN A MOBILE DEVICE

20170315609 · 2017-11-02

    Inventors

    Cpc classification

    International classification

    Abstract

    The present invention discloses a virtual sphere simulation and control method for a mobile device, comprising: acquiring images using an image acquisition component of the mobile device, so as to acquire a sequence of continuous images; analyzing contents of the images; in the sequence of the acquired images, according to a certain rule, carrying out the interaction between a virtual sphere and the contents of the images as well as a user; and displaying a result of interaction on a screen of the mobile device.

    Claims

    1. A method for simulating and controlling virtual sphere in a mobile device, comprising: acquiring images using an image acquisition component of the mobile device, so as to acquire a sequence of continuous images; analyzing contents of the images; in the sequence of the acquired images, according to a certain rule, carrying out the interaction between a virtual sphere and the contents of the images as well as a user; and displaying a result of interaction on a screen of the mobile device.

    2. The method according to claim 1, wherein analyzing contents of the images comprises: calculating image edges in the vicinity of the virtual sphere; calculating velocity and direction of a collision; updating a position of the virtual sphere; and displaying the virtual sphere.

    3. The method according to claim 1, wherein rules for the interaction comprise at least one of the following: rigid collision between a sphere and color borders in the image is occurred; rigid collision between the sphere and the left, right and lower edges of the screen is occurred; in the screen, the sphere suffers from virtual gravity field, and thereby “falls” toward the lower part of the screen, the virtual gravity field being from the upper part of the screen to the lower part of the screen; rigid collision between the sphere and a user's finger is occurred, angle and strength of the collision between the sphere and the finger is considered when the collision occurs; the sphere flies out of the screen upwardly, and falls in free ball merely toward the lower part of the screen after flying out of the screen; only collision between the lower part of the sphere and the image contents as well as the user's finger is taken into consideration.

    4. The method according to claim 1, wherein calculating image edges in the vicinity of the virtual sphere comprises: converting the input image into a grayscale image; calculating a grayscale histogram of the lower part of the virtual sphere; generating a grayscale probability plot using the histogram; and taking the generated probability plot as a basis for the judgment of the edges.

    5. The method according to claim 4, wherein an image edge is a junction of regions having different grayscale probabilities.

    6. The method according to claim 2, wherein the velocities of the collision in the transverse and longitudinal directions are independent from each other, the velocity in the transverse direction is proportional to the distance from a contact point in the transverse direction to the virtual sphere center, and the velocity in the longitudinal direction is inversely proportional to the distance from a contact point in the longitudinal direction to the sphere center.

    Description

    BRIEF DESCRIPTION OF DRAWINGS

    [0013] The drawings illustrate embodiments of the present invention, and are used along with the Description to explain principles of the present invention. In the drawings:

    [0014] FIG. 1 illustrates a virtual sphere simulation and control method according to the embodiment of the present invention.

    [0015] FIG. 2 is a schematic diagram illustrating a scenario for applying the embodiment of the present invention.

    [0016] FIG. 3 is a flow chart illustrating how to implement the step of analyzing contents of the image in FIG. 1.

    [0017] FIG. 4 is a flow chart illustrating how to calculate the image edges in the vicinity of a sphere.

    [0018] FIG. 5 is a grayscale image when no other object enters the scope of the sphere.

    [0019] FIG. 6 is a grayscale image when another object enters the scope of the sphere.

    DETAILED DESCRIPTION

    [0020] Embodiments according to the present invention disclose a virtual sphere simulation and control method of a mobile device. For illustrative purposes, multiple specific details are stated in the following descriptions so as to provide a comprehensive understanding of embodiments of the present invention. However, it is obvious to those skilled in the art that embodiments of the present invention can be implemented without such specific details.

    [0021] In the present invention, ordinary images are captured by using a common consumer-level image acquisition device (such as a cell phone, a tablet computer, and a household camera), and an effect of the interaction between a person and a virtual sphere is achieved by using a result of intelligently analyzing the images. Specifically, the present invention discloses a system which acquires image information by using an image acquisition device (such as a camera), generates a virtual sphere by using a computing device (such as a PC, a cell phone, and a tablet computer, etc), intelligently analyzing the acquired image contents by using an image processing method, interacting with the virtual sphere on the basis of the analysis, and finally displaying the result of the interaction and the image on a display device (such as a cell phone, a display, etc).

    [0022] FIG. 1 illustrates a virtual sphere simulation and control method 100 according to the embodiment of the present invention. The method 100 mainly comprises three steps: acquiring images, analyzing contents of the images, and displaying interaction a result.

    [0023] Specifically, in the course of acquiring images, a sequence of continuous images is acquired by using a common image acquisition device (such as a cell phone and a desktop PC camera). The image acquisition device is movable, which has no influence on the result of interactions with the virtual sphere.

    [0024] In the course of analyzing contents of images, the present invention assumes that the virtual sphere interacts with the image contents and the user in the sequence of acquired images according to a certain rule. In the following, virtual juggling ball will be described by way of example. Note that the virtual juggling ball is merely, without limiting the present invention in terms of embodiments, used for explaining how a virtual sphere interacts with the image contents and the user, and thereby any application including interactions between a virtual sphere and an image as well as a user falls within the scope of the present invention.

    [0025] FIG. 2 is a schematic diagram illustrating a scenario for applying the embodiment of the present invention. As shown in FIG. 2, a user holds device (such as a cell phone) with his/her hands, aims camera of the phone at a certain scenario S and orients the display screen to the user. Then the user places his/her finger into the scenario S to which the image acquisition device (such as a cell phone camera) is oriented, in order to interact with the virtual juggling ball. Rules for interaction are as follows:

    [0026] (1) rigid collision between a sphere and the color borders in the image is occurred;

    [0027] (2) rigid collision between the sphere and the left, right and lower edges of the screen is occurred;

    [0028] (3) in the screen, the sphere suffers from virtual gravity field from the upper part of the screen to the lower part of the screen, and thereby “falls” toward the lower part of the screen;

    [0029] (4) rigid collision between the sphere and the user's finger is occurred, angle and strength of the collision between the sphere and the finger should be considered when the collision occurred;

    [0030] (5) the sphere flies out of the screen upwardly, and falls in free ball merely toward the lower part of the screen after flying out of the screen;

    [0031] (6) only collision between the lower part of the sphere and the image contents as well as the user's finger is taken into consideration, and collision of the upper part of the sphere is not considered;

    [0032] (7) “sphere” is merely orally used to refer to a virtual sphere, and it is in fact displayed as a perfect circle on the screen.

    [0033] Those skilled in the art will understand that any interaction device satisfying the functions and any interaction manner based on image processing are included in the interaction manner of the present invention. For example, the virtual sphere used in the present invention is not limited to a virtual juggling ball, and it may be a virtual ice-curling ball, a virtual ping-pong, a virtual basketball, etc.

    [0034] FIG. 3 is a flow chart illustrating how to implement the step of analyzing contents of the image in FIG. 1. In step 31, next frame of an image is input. In step 32, the image edges in the vicinity of a sphere are calculated. In step 33, velocity and direction of the collision is calculated. In step 34, position of the sphere is update. In step 35, the sphere is displayed. In step 36, determination on whether the image contents are analyzed is performed. If so, the process is terminated. If not, the process returns to step 31.

    [0035] Calculating the Image Edges in the Vicinity of a Sphere

    [0036] FIG. 4 is a flow chart illustrating how to calculate the image edges in the vicinity of a sphere. The principle for calculating the image edges in the vicinity of a sphere is as follows: in the present application, color of the lower part of a sphere is considered as one color. When there are two or more grayscales, it is regarded that some objects enter into the scope of the sphere to interact with the sphere. The specific calculation process involves calculation of a histogram and generation of a probability plot.

    [0037] As shown in FIG. 4, firstly, the input image is converted into a grayscale image. Then, histogram H showing grayscales of the lower part of the sphere is calculated. Then the histogram H showing grayscales is used to generate a probability plot showing grayscales. Lastly, judgment of the edges is performed according to the generated probability plot.

    [0038] A. Calculating a Histogram

    [0039] FIG. 5 is a grayscale image when no other object enters the scope of the sphere. In the image, the gray region is a scope on which the color histogram is calculated. Method for calculating the color histogram:

    [00001] H ( i ) = .Math. j = 0 N .Math. .Math. P ( j ) wherein .Math. .Math. p ( j ) = { 1 , if .Math. .Math. the .Math. .Math. grayscale = i 0 , if .Math. .Math. the .Math. .Math. grayscale i

    [0040] H is an array consisting of 256 elements, each element represents the number of pixels which grayscale value equals to i in the grayscale image. Gray region range on the grayscale image is traversed for each pixel P(j), j represents the j-th pixel, and N is the total number of the pixels in the grayscale region. If the grayscale value P(j)=i, H(i)=H(i)+1.

    [0041] B. Generating a Probability Plot

    [0042] FIG. 6 is a grayscale image when another object enters the scope of the sphere. As stated above, after H is calculated, the present invention regards that the grayscales mostly appeared are regarded as the main background grayscale, and pixels of other grayscales represent an interactive object which enters into the scope of the sphere body.

    [0043] The probability of appearing is:

    [00002] D ( j ) = 255 × ( 1 - H ( grayscale ( j ) ) H Max )

    [0044] D(j) represents the grayscale value of each pixel of a small probability plot, j represents the j-th pixel, H.sub.Max represents a maximum value in the 256 elements of the histogram. In the image D derived, the larger the grayscale value is, the fewer the colors in the scope of the sphere body are, i.e., the greater the probability is that the pixels are an interaction object entering the sphere. Then, the image edges present as a junction of two regions having different appearing probabilities, i.e., a junction of regions having different grayscale probabilities.

    [0045] Calculating the Velocity and Direction of Collisions

    [0046] According to the present invention, in the appearing probability plot D generated in the previous step, the gravity center of the region having a greater probability that the pixels are an interaction object is an interaction point P.sub.Int of the interaction object and the sphere, and the difference of the P.sub.Int relative to the sphere center between the horizontal and vertical coordinates (pixels) represents the strength in the interactive horizontal and vertical directions, the velocities in the horizontal and vertical directions are independent from each other.

    [0047] Method for calculating the interaction point is:

    [00003] P Int ( X C , Y C ) X C = 1 M .Math. .Math. j = 1 N .Math. ( D ( j ) × X i ) Y C = 1 M .Math. .Math. j = 1 N .Math. ( D ( j ) .Math. Y j )

    [0048] X and Y represent the horizontal coordinate and vertical coordinate of the region having a greater probability, D(j) is the probability calculated in the previous step, X.sub.C and Y.sub.C are the coordinates of the gravity center. The transverse velocity is proportional to the distance from the contact point in the X direction to the sphere center, the longer the distance from the contact point to the sphere center is, the faster the contact velocity is. The longitudinal velocity is inversely proportional to the distance from the contact point in the Y direction to the sphere center, the shorter the distance from the contact point to the sphere center is, the faster the contact velocity is.

    [00004] V X = .Math. X C - X 0 .Math. R × V X , Max V Y = ( 1 - .Math. Y C - Y 0 .Math. R ) × V Y , Max

    [0049] The subscript Max represents the maximum velocities in the transverse direction and the longitudinal direction which are predetermined fixed values.

    [0050] Updating the Position of the Sphere

    [0051] According to present invention, the position of the sphere is independently moved in the transverse direction and the longitudinal direction staring from an initial static condition. In the transverse direction, the sphere moves uniformly in a straight line at a collision velocity V.sub.X after each occurrence of interaction (by touching the hand, the image edges, and the boundaries of the screen). In the longitudinal direction, the sphere is thrown upward vertically with an initial velocity of collision velocity V.sub.Y after the occurrence of the interaction in the longitudinal direction (see: http://baike.baidu.com/link?url=tj8e6IfmpCZqSxfLM98X7_qCWeuq2JQBHDCRJfb8GxDqZHhCqxeHuJ_9GokBCSzZ)

    [0052] The current position of the sphere is:


    X=X.sub.t+V.sub.X×T


    Y=Y.sub.t+(V.sub.Y−0.5×g×TT

    [0053] wherein the subscript t represents the t-th collision X.sub.t, and Y.sub.t represents the horizontal and the vertical coordinates of the t-th collision, g is the gravity acceleration, and T represents a time interval between the current time and the time when the t-th collision occurs.

    [0054] Displaying the Sphere

    [0055] The virtual sphere is displayed on the screen at the current position X, Y. Then all the operations are completed.

    [0056] In the present invention, ordinary images are captured by using a common consumer-level image acquisition device (such as a cell phone, a tablet computer, and a household camera), and an effect of the interaction between a person and a virtual sphere is achieved by using a result of intelligently analyzing the images, such that a result of the human-sphere interaction is displayed to the user using the image processing-based augmented reality method. Therefore, the present invention can allow an ordinary user to interact with a virtual sphere generated by the augmented reality technique, using a common image acquisition device and a display device such as a cell phone and a tablet computer, such that the user has a more immersive feeling of real scenes and betters snaps into the augmented reality system, thereby realizing a unique interaction manner that cannot be implement in the prior art.

    [0057] The above embodiment is merely a preferred embodiment of the present invention, and is not used to limit the present invention. It is obvious to those skilled in the art that various amendments and modifications can be made to the embodiment of the present invention without digressing from the sprit and scope of the present invention. Thus, the present invention aims to cover all amendments or transformations which fall within the scope of the present invention defined in the claims.