Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the art described above. Therefore, the invention aims to provide a billiard ball hitting auxiliary method which provides accurate hitting information for a player, facilitates hitting billiards into a specified position, improves hitting hit rate and facilitates improving hitting level of the player.
In order to achieve the above object, an embodiment of the present invention provides a billiards hitting assisting method, including:
determining first coordinate information of the cue ball and second coordinate information of other billiards except the cue ball;
acquiring third coordinate information of a bag opening on the billiard table;
determining a first billiard set according to the second coordinate information and the third coordinate information;
respectively generating a cue ball and a first auxiliary line set of billiards in the first billiard ball set, respectively judging whether foreign matters exist on the first auxiliary lines included in the first auxiliary line set, and removing corresponding billiards from the first billiard ball set when the foreign matters exist on at least one first auxiliary line to obtain a second billiard ball set;
determining target billiards according to the first coordinate information of the cue balls and the second coordinate information of the billiards in the second billiard ball set;
generating a second auxiliary line set between the target billiards and the corresponding target pocket openings;
determining batting information according to the first auxiliary line set, the second auxiliary line set and a preset billiard collision model of the target billiards.
According to some embodiments of the invention, the determining the first coordinate information of the cue ball and the second coordinate information of the billiard ball other than the cue ball comprises:
acquiring an image shot from the position right above the billiard table as an image to be identified;
extracting the characteristics of the image to be identified, and determining a plurality of circular areas;
acquiring color information of the circular area, and determining cue balls and other billiards according to the color information;
and acquiring center information of the plurality of circular areas, and determining first coordinate information of the cue ball and second coordinate information of other billiards except the cue ball according to a preset coordinate system.
According to some embodiments of the invention, obtaining third coordinate information of a pocket on the billiard table comprises:
and acquiring the center information of the bag opening, and determining the third coordinate information of the bag opening on the billiard table according to a preset coordinate system.
According to some embodiments of the invention, determining a first pool set from the second coordinate information and the third coordinate information comprises:
calculating first distance values between the billiards and each bag opening according to second coordinate information of the billiards and third coordinate information of the bag opening on the billiard table, screening out the smallest first distance value, judging whether the smallest first distance value is smaller than or equal to a preset distance value, and determining that the billiards are valid when the smallest first distance value is smaller than or equal to the preset distance value;
and respectively executing the steps on the billiards, and determining a first billiard set according to the determined effective billiards.
According to some embodiments of the invention, the determining whether there is a foreign object on the first auxiliary line included in the first auxiliary line set comprises:
graying the first auxiliary line set to obtain the gray values of the pixels on the first auxiliary line, calculating the gray difference value of the adjacent pixels, judging whether the gray difference value is greater than a preset gray difference value, counting the number of gray difference values greater than the preset gray difference value, and determining that foreign matters exist on the first auxiliary line when the number is greater than the preset number.
According to some embodiments of the invention, determining the target billiard ball according to the first coordinate information of the cue ball and the second coordinate information of the billiard balls in the second billiard ball set comprises:
and respectively calculating second distance values of the cue balls and each billiard ball in the second billiard ball set according to the first coordinate information of the cue balls and the second coordinate information of the billiard balls in the second billiard ball set, and determining the billiard ball corresponding to the smallest second distance value as the target billiard ball.
According to some embodiments of the invention, determining hitting information according to the first auxiliary line set, the second auxiliary line set and a preset billiard collision model of the target billiard comprises:
selecting a second auxiliary line positioned in the middle from the second auxiliary line set as a target second auxiliary line;
generating a simulated cue ball at the collision point of the target cue ball according to the target second auxiliary line and a preset cue ball collision model, and acquiring parameter information of the simulated cue ball;
according to the parameter information and a plurality of first auxiliary lines included in the first auxiliary line set, carrying out derivation calculation, and determining hitting parameters of the cue ball based on each first auxiliary line; and evaluating each hitting parameter, and determining hitting information according to an evaluation result.
According to some embodiments of the invention, the striking parameters comprise a striking power and a striking angle.
According to some embodiments of the invention, obtaining color information for a circular area from which cue balls and other billiard balls are determined comprises:
respectively obtaining a first color value of each pixel point in an RGB color space, wherein the first color value comprises an R channel value, a G channel value and a B channel value;
classifying pixels in a circular area, wherein a pixel point with the minimum R channel value in the first color value is taken as a first type pixel point, a pixel point with the minimum G channel value in the first color value is taken as a second type pixel point, and a pixel point with the minimum B channel value in the first color value is taken as a third type pixel point;
respectively counting the number of first-class pixels, second-class pixels and third-class pixels in the circular region, and determining the color types included in the circular region based on a preset rule according to the counted number; determining a circular region including one color type as a first type circular region, determining a circular region including two color types as a second type circular region, and determining a circular region including three color types as a third type circular region;
presetting color types included by the cue ball, determining a first circular area when the color types included by the cue ball are determined to be one, converting the first circular area from RGB color space to HIS color space, and obtaining a second color value; comparing the second color value with a first preset color value, and determining a first target circular area in the first circular area corresponding to the cue ball according to a comparison result; when the color types of the cue ball are determined to be two or three, determining a second circular area or a third circular area, and converting the second circular area or the third circular area from an RGB color space to an LAB color space to obtain a third color value; and comparing the third color value with a second preset color value, and determining a second circular area of the second type or a second target circular area in the third type corresponding to the cue ball according to the comparison result.
According to some embodiments of the invention, the individual impact parameters are evaluated, including based on a pre-constructed evaluation index system;
the method for constructing the evaluation index system comprises the following steps:
determining an evaluation index according to a preset evaluation purpose and an evaluation object;
acquiring an incidence relation between evaluation indexes, and constructing an evaluation index system according to the incidence relation;
obtaining an evaluation index sample, and calculating and determining the weight coefficient of each evaluation index in an evaluation index system based on a least square method;
evaluating the striking parameters based on the evaluation index system with the weight coefficient set to obtain an evaluation mean value, and respectively calculating the offset coefficient between the evaluation value obtained by each evaluation index in the evaluation index system and the evaluation mean value;
and correcting the weight coefficient according to the offset coefficient to obtain a new weight coefficient.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and drawings.
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
Detailed Description
The preferred embodiments of the present invention will be described in conjunction with the accompanying drawings, and it will be understood that they are described herein for the purpose of illustration and explanation and not limitation.
As shown in fig. 1, an embodiment of the present invention provides a billiard ball hitting assisting method, including steps S1-S7:
s1, determining first coordinate information of the cue ball and second coordinate information of other billiards except the cue ball;
s2, acquiring third coordinate information of a pocket opening on the billiard table;
s3, determining a first billiard set according to the second coordinate information and the third coordinate information;
s4, generating a first auxiliary line set of cue balls and cue balls in the first cue ball set respectively, judging whether foreign matters exist on the first auxiliary lines in the first auxiliary line set respectively, and removing corresponding cue balls from the first cue ball set when the foreign matters exist on at least one first auxiliary line to obtain a second cue ball set;
s5, determining target billiards according to the first coordinate information of the cue balls and the second coordinate information of the billiards in the second billiard set;
s6, generating a second auxiliary line set between the target billiards and the corresponding target pocket mouth;
and S7, determining batting information according to the first auxiliary line set, the second auxiliary line set and a preset billiard collision model of the target billiards.
The working principle of the technical scheme is as follows: establishing a coordinate system on a table top of the billiards, and determining first coordinate information of the cue balls and second coordinate information of other billiards except the cue balls; acquiring third coordinate information of a bag opening on the billiard table; determining a first billiard set according to the second coordinate information and the third coordinate information; the first billiard set represents billiards with the distance less than or equal to the preset distance from the bag opening, and popular billiards are billiards close to the bag opening, and the success rate of the billiards entering the bag opening is high. Respectively generating a cue ball and a first auxiliary line set of billiards in the first billiard ball set, respectively judging whether foreign matters exist on the first auxiliary lines included in the first auxiliary line set, and removing corresponding billiards from the first billiard ball set when the foreign matters exist on at least one first auxiliary line to obtain a second billiard ball set; when the billiards are hit, the billiards need to be collided with the target ball through collision of other billiards, namely, the situation that the target ball is indirectly collided is avoided. The second pool of billiards may all be cue balls that may hit the target ball directly. Determining target billiards according to the first coordinate information of the cue balls and the second coordinate information of the billiards in the second billiard ball set; generating a second auxiliary line set between the target billiards and the corresponding target pocket openings; determining batting information according to the first auxiliary line set, the second auxiliary line set and a preset billiard collision model of the target billiards. The second auxiliary lines are grouped to show that the billiard ball enters the bag opening to have a plurality of tracks, and each track is shown by one second auxiliary line. The first auxiliary line is the path from the cue ball to the target billiard ball for collision, and there are a plurality of paths, each of which is indicated by one first auxiliary line.
The beneficial effects of the above technical scheme are that: the cue ball, other billiards and the bag opening are coordinated, so that the calculation precision is improved conveniently, and the relationship among the cue ball, other billiards and the bag opening is displayed more accurately. In order to simplify the calculation process and improve the hit rate, the first billiard set is determined firstly, the second billiard set is determined secondly, and the target billiards are determined finally. According to the first auxiliary line set, the second auxiliary line set and the preset billiard collision model of the target billiards, the batting information is accurately determined, so that a batting person can accurately master batting strength and angle, the billiards can be conveniently hit into a designated position, batting hit rate is improved, and batting level of the batting person is conveniently improved.
As shown in fig. 2, according to some embodiments of the present invention, the determining the first coordinate information of the cue ball and the second coordinate information of the billiards other than the cue ball includes steps S11 to S14:
s11, acquiring an image shot from the position right above the billiard table as an image to be identified;
s12, extracting the features of the image to be recognized, and determining a plurality of circular areas;
s13, acquiring color information of the circular area, and determining cue balls and other billiards according to the color information;
and S14, acquiring center information of the plurality of circular areas, and determining first coordinate information of the cue ball and second coordinate information of other billiards except the cue ball according to a preset coordinate system.
The working principle of the technical scheme is as follows: acquiring an image shot from the position right above the billiard table as an image to be identified; extracting the characteristics of the image to be identified, and determining a plurality of circular areas; acquiring color information of the circular area, and determining cue balls and other billiards according to the color information; and acquiring center information of the plurality of circular areas, and determining first coordinate information of the cue ball and second coordinate information of other billiards except the cue ball according to a preset coordinate system.
The beneficial effects of the above technical scheme are that: the accuracy of determining the first coordinate information of the cue ball and the second coordinate information of other billiards except the cue ball is improved.
According to some embodiments of the invention, obtaining third coordinate information of a pocket on the billiard table comprises:
and acquiring the center information of the bag opening, and determining the third coordinate information of the bag opening on the billiard table according to a preset coordinate system.
The beneficial effects of the above technical scheme are that: and accurately determining the third coordinate information of the pocket opening on the billiard table.
According to some embodiments of the invention, determining a first pool set from the second coordinate information and the third coordinate information comprises:
calculating first distance values between the billiards and each bag opening according to second coordinate information of the billiards and third coordinate information of the bag opening on the billiard table, screening out the smallest first distance value, judging whether the smallest first distance value is smaller than or equal to a preset distance value, and determining that the billiards are valid when the smallest first distance value is smaller than or equal to the preset distance value;
and respectively executing the steps on the billiards, and determining a first billiard set according to the determined effective billiards.
The working principle of the technical scheme is as follows: calculating first distance values between the billiards and each bag opening according to second coordinate information of the billiards and third coordinate information of the bag opening on the billiard table, screening out the smallest first distance value, judging whether the smallest first distance value is smaller than or equal to a preset distance value, and determining that the billiards are valid when the smallest first distance value is smaller than or equal to the preset distance value; and respectively executing the steps on the billiards, and determining a first billiard set according to the determined effective billiards.
The beneficial effects of the above technical scheme are that: the billiards with higher billiard-entering success rate are preliminarily determined, the complexity and the calculation amount of subsequent calculation are reduced, and the calculation efficiency is improved.
According to some embodiments of the invention, the determining whether there is a foreign object on the first auxiliary line included in the first auxiliary line set comprises:
graying the first auxiliary line set to obtain the gray values of the pixels on the first auxiliary line, calculating the gray difference value of the adjacent pixels, judging whether the gray difference value is greater than a preset gray difference value, counting the number of gray difference values greater than the preset gray difference value, and determining that foreign matters exist on the first auxiliary line when the number is greater than the preset number.
The working principle of the technical scheme is as follows: graying the first auxiliary line set to obtain the gray values of the pixels on the first auxiliary line, calculating the gray difference value of the adjacent pixels, judging whether the gray difference value is greater than a preset gray difference value, counting the number of gray difference values greater than the preset gray difference value, and determining that foreign matters exist on the first auxiliary line when the number is greater than the preset number.
The beneficial effects of the above technical scheme are that: and when the number of the gray difference values larger than the preset gray difference value is determined to be larger than the preset number, the first auxiliary line is determined to have the foreign matters. The accuracy of determining whether there is a foreign object on the first auxiliary wire is improved.
According to some embodiments of the invention, determining the target billiard ball according to the first coordinate information of the cue ball and the second coordinate information of the billiard balls in the second billiard ball set comprises:
and respectively calculating second distance values of the cue balls and each billiard ball in the second billiard ball set according to the first coordinate information of the cue balls and the second coordinate information of the billiard balls in the second billiard ball set, and determining the billiard ball corresponding to the smallest second distance value as the target billiard ball.
The working principle of the technical scheme is as follows: and respectively calculating second distance values of the cue balls and each billiard ball in the second billiard ball set according to the first coordinate information of the cue balls and the second coordinate information of the billiard balls in the second billiard ball set, and determining the billiard ball corresponding to the smallest second distance value as the target billiard ball.
The beneficial effects of the above technical scheme are that: further reducing the hitting range, reducing the calculation amount and simultaneously improving the hitting rate of the cue ball billiards.
As shown in fig. 3, according to some embodiments of the present invention, determining hitting information according to the first auxiliary line set, the second auxiliary line set and a preset billiard collision model of the target billiard includes steps S71-S73:
s71, selecting a second auxiliary line positioned in the middle from the second auxiliary line set as a target second auxiliary line;
s72, generating a simulated cue ball at the collision point of the target billiard according to the target second auxiliary line and a preset billiard collision model, and acquiring parameter information of the simulated cue ball;
s73, carrying out derivation calculation according to the parameter information and a plurality of first auxiliary lines included in the first auxiliary line set, and determining the hitting parameters of the cue ball based on each first auxiliary line; and evaluating each hitting parameter, and determining hitting information according to an evaluation result.
The working principle of the technical scheme is as follows: selecting a second auxiliary line positioned in the middle from the second auxiliary line set as a target second auxiliary line; and selecting the second auxiliary line positioned in the middle, wherein the second auxiliary line is determined to be the optimal track through multiple experiments, and the success rate of bag opening entering is highest. Generating a simulated cue ball at the collision point of the target cue ball according to the target second auxiliary line and a preset cue ball collision model, and acquiring parameter information of the simulated cue ball; according to the parameter information and a plurality of first auxiliary lines included in the first auxiliary line set, carrying out derivation calculation, and determining hitting parameters of the cue ball based on each first auxiliary line; and evaluating each hitting parameter, and determining hitting information according to an evaluation result.
The beneficial effects of the above technical scheme are that: and reversely deducing the hitting parameters during hitting based on the bagging result of the target billiards, evaluating the hitting parameters, and determining hitting information according to the optimal hitting parameters. The evaluation is made taking into consideration the realism, comfort and the like of the player in terms of the power, angle and the like of the shot. The optimal batting information convenient to determine improves the hit rate of batting, has improved batting person's batting experience simultaneously, is convenient for improve batting level.
According to some embodiments of the invention, the striking parameters comprise a striking power and a striking angle.
In one embodiment, the method further comprises:
striking the target billiards according to the striking information to obtain continuous frame images of the target billiards after collision;
analyzing the continuous frame images, determining track points of a target billiard ball on each frame image, connecting a plurality of track points, and determining the moving track of the target billiard ball;
and calculating the difference degree between the moving track and the target second auxiliary line, judging whether the difference degree is greater than the preset difference degree, and sending an alarm prompt when the difference degree is determined to be greater than the preset difference degree.
The calculating the difference degree H between the moving track and the target second auxiliary line comprises the following steps:
wherein N is the number of track points; f is the collision force of the cue ball and the target billiard ball; diThe coordinate of the ith track point in the moving track is shown; di' is the coordinate of the trace point at the corresponding instant on the target second auxiliary line.
The working principle and the beneficial effects of the technical scheme are as follows: striking the target billiards according to the striking information to obtain continuous frame images of the target billiards after collision; analyzing the continuous frame images, determining track points of a target billiard ball on each frame image, connecting a plurality of track points, and determining the moving track of the target billiard ball; and calculating the difference degree between the moving track and the target second auxiliary line, judging whether the difference degree is greater than the preset difference degree, and when the difference degree is determined to be greater than the preset difference degree, indicating that the model parameters of the billiard collision model are abnormal and needing to be corrected, so that the coincidence degree between the moving track of the billiard and the target second auxiliary line is high, and the accuracy of the determined batting information is improved.
According to some embodiments of the invention, obtaining color information for a circular area from which cue balls and other billiard balls are determined comprises:
respectively obtaining a first color value of each pixel point in an RGB color space, wherein the first color value comprises an R channel value, a G channel value and a B channel value;
classifying pixels in a circular area, wherein a pixel point with the minimum R channel value in the first color value is taken as a first type pixel point, a pixel point with the minimum G channel value in the first color value is taken as a second type pixel point, and a pixel point with the minimum B channel value in the first color value is taken as a third type pixel point;
respectively counting the number of first-class pixels, second-class pixels and third-class pixels in the circular region, and determining the color types included in the circular region based on a preset rule according to the counted number; determining a circular region including one color type as a first type circular region, determining a circular region including two color types as a second type circular region, and determining a circular region including three color types as a third type circular region;
presetting color types included by the cue ball, determining a first circular area when the color types included by the cue ball are determined to be one, converting the first circular area from RGB color space to HIS color space, and obtaining a second color value; comparing the second color value with a first preset color value, and determining a first target circular area in the first circular area corresponding to the cue ball according to a comparison result; when the color types of the cue ball are determined to be two or three, determining a second circular area or a third circular area, and converting the second circular area or the third circular area from an RGB color space to an LAB color space to obtain a third color value; and comparing the third color value with a second preset color value, and determining a second circular area of the second type or a second target circular area in the third type corresponding to the cue ball according to the comparison result.
The working principle of the technical scheme is as follows: respectively obtaining a first color value of each pixel point in an RGB color space, wherein the first color value comprises an R channel value, a G channel value and a B channel value; classifying pixels in a circular area, wherein a pixel point with the minimum R channel value in the first color value is taken as a first type pixel point, a pixel point with the minimum G channel value in the first color value is taken as a second type pixel point, and a pixel point with the minimum B channel value in the first color value is taken as a third type pixel point; respectively counting the number of first-class pixels, second-class pixels and third-class pixels in the circular region, and determining the color types included in the circular region based on a preset rule according to the counted number; each type of pixel point represents a color, and when the number of the type of pixel point is 0, the circular area is represented to lack the color represented by the type. Determining a circular region including one color type as a first type circular region, determining a circular region including two color types as a second type circular region, and determining a circular region including three color types as a third type circular region; presetting color types included by the cue ball, determining a first circular area when the color types included by the cue ball are determined to be one, converting the first circular area from RGB color space to HIS color space, and obtaining a second color value; comparing the second color value with a first preset color value, and determining a first target circular area in the first circular area corresponding to the cue ball according to a comparison result; the HIS color space can be described by a cone space model, and the change situations of the hue, the brightness and the saturation of the first type of circular area are clearly shown. The color gamut of the LAB color space is large, more pixel data can be displayed, the defined colors are the most, and when the LAB color space comprises at least two color types, the color weight value of each pixel point can be accurately determined, so that a better color effect is realized. The first predetermined color value is a color value in the HIS color space determined from the cue ball. The second preset color value is a color value in the LAB color space determined from the cue ball.
The beneficial effects of the above technical scheme are that: the color type information included in the circular area is accurately determined and classified, and the circular area is converted into different color spaces according to the number of the color types of the cue balls, so that the color of the cue balls can be accurately determined, and the cue balls and other billiards can be further determined.
According to some embodiments of the invention, the individual impact parameters are evaluated, including based on a pre-constructed evaluation index system;
the method for constructing the evaluation index system comprises the following steps:
determining an evaluation index according to a preset evaluation purpose and an evaluation object;
acquiring an incidence relation between evaluation indexes, and constructing an evaluation index system according to the incidence relation;
obtaining an evaluation index sample, and calculating and determining the weight coefficient of each evaluation index in an evaluation index system based on a least square method;
evaluating the striking parameters based on the evaluation index system with the weight coefficient set to obtain an evaluation mean value, and respectively calculating the offset coefficient between the evaluation value obtained by each evaluation index in the evaluation index system and the evaluation mean value;
and correcting the weight coefficient according to the offset coefficient to obtain a new weight coefficient.
The working principle of the technical scheme is as follows: evaluating each striking parameter, including evaluating based on a pre-established evaluation index system; the method for constructing the evaluation index system comprises the following steps: determining an evaluation index according to a preset evaluation purpose and an evaluation object; acquiring an incidence relation between evaluation indexes, and constructing an evaluation index system according to the incidence relation; obtaining an evaluation index sample, and calculating and determining the weight coefficient of each evaluation index in an evaluation index system based on a least square method; evaluating the striking parameters based on the evaluation index system with the weight coefficient set to obtain an evaluation mean value, and respectively calculating the offset coefficient between the evaluation value obtained by each evaluation index in the evaluation index system and the evaluation mean value; and correcting the weight coefficient according to the offset coefficient to obtain a new weight coefficient. And calculating the offset coefficient between the evaluation value obtained by each evaluation index in the evaluation index system and the evaluation mean value based on the Euclidean distance.
The beneficial effects of the above technical scheme are that: and evaluating based on an evaluation index system to determine the accuracy of evaluation, so that the optimal striking parameters can be determined conveniently. The reasonability of each evaluation index system in the set evaluation index system is improved, subjective and objective errors are reduced, the balance of each evaluation index is guaranteed, the accuracy of an evaluation result is further improved, the dependence on historical data is eliminated, and the method is simple, convenient and practical.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.