Disclosure of Invention
The present invention aims to solve, at least to some extent, one of the technical problems in the above-described technology. Therefore, the invention aims to provide a billiard ball hitting auxiliary method which provides accurate hitting information for a hitter, is convenient for driving billiards into a designated position, improves hitting hit rate and is convenient for improving hitting level of the hitter.
In order to achieve the above object, an embodiment of the present invention provides a billiard ball striking assisting method, including:
determining first coordinate information of a cue ball and second coordinate information of other billiards except the cue ball;
acquiring third coordinate information of a pocket on the billiard table;
determining a first billiard ball set according to the second coordinate information and the third coordinate information;
generating a first auxiliary line set of the billiards in the first billiard ball set and a first auxiliary line set of the billiards in the first billiard ball set respectively, judging whether the first auxiliary lines included in the first auxiliary line set contain foreign matters or not respectively, and removing the corresponding billiards from the first billiard ball set when determining that at least one first auxiliary line contains the foreign matters, so as to obtain a second billiard ball set;
determining a target billiard ball according to the first coordinate information of the cue ball and the second coordinate information of billiards in the second billiard ball set;
generating a second auxiliary line set between the target billiard ball and the corresponding target pocket;
and determining batting information according to the first auxiliary line set, the second auxiliary line set and a preset billiard collision model of the target billiard.
According to some embodiments of the 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:
acquiring an image shot from the right above a billiard table as an image to be identified;
extracting features of the image to be identified, and determining a plurality of circular areas;
acquiring color information of a circular area, and determining a cue ball and other billiards according to the color information;
and acquiring center information of a plurality of circular areas, and determining first coordinate information of the cue ball and second coordinate information of other cue balls except the cue ball according to a preset coordinate system.
According to some embodiments of the invention, obtaining third coordinate information of a billiard table pocket includes:
and acquiring center information of the pocket opening, and determining third coordinate information of the pocket opening on the billiard table according to a preset coordinate system.
According to some embodiments of the invention, determining the first pool cue set according to the second coordinate information and the third coordinate information includes:
according to the second coordinate information of the billiard ball and the third coordinate information of the pocket openings on the billiard ball table, calculating first distance values of the billiard ball and each pocket opening, 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 billiard ball is effective when the smallest first distance value is smaller than or equal to the preset distance value;
and respectively executing the steps on each billiard ball, and determining a first billiard ball set according to each determined effective billiard ball.
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 includes:
and carrying out graying treatment on the first auxiliary line set, obtaining the gray values of the pixel points on the first auxiliary line, calculating the gray difference values of the adjacent pixel points, judging whether the gray difference values are larger than the preset gray difference values, counting the number of the gray difference values larger than the preset gray difference values, and determining that foreign matters exist on the first auxiliary line when the number is determined to be larger than the preset number.
According to some embodiments of the present invention, determining a target billiard ball according to first coordinate information of a cue ball and second coordinate information of billiards in the second billiard ball set includes:
and respectively calculating second distance values of the billiards in the second billiard ball set and the billiards in the second billiard ball set according to the first coordinate information of the billiards and the second coordinate information of the billiards in the second billiard ball set, and determining the billiards corresponding to the smallest second distance values as target billiards.
According to some embodiments of the present invention, determining shot information according to the first auxiliary line set, the second auxiliary line set, and a preset billiard ball collision model of a target billiard ball includes:
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 a collision point of a target billiard ball according to the target second auxiliary line and a preset billiard 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, deducing and calculating are carried out, and the hitting parameters of the first auxiliary lines on the cue ball are determined; and evaluating each hitting parameter, and determining hitting information according to an evaluation result.
According to some embodiments of the invention, the impact parameters include impact strength and impact angle.
According to some embodiments of the present invention, color information of a circular area is acquired, and a cue ball and other billiards are determined according to the color information, including:
respectively acquiring a first color value of each pixel point included in the circular area 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 used as a first type pixel point, a pixel point with the minimum G channel value in the first color value is used as a second type pixel point, and a pixel point with the minimum B channel value in the first color value is used as a third type pixel point;
respectively counting the number of first class pixel points, second class pixel points and third class pixel points in the circular area, and determining the color types included in the circular area based on a preset rule according to the counted number; determining a circular area including one color category as a first type circular area, determining a circular area including two color categories as a second type circular area, and determining a circular area including three color categories as a third type circular area;
presetting color types included in a cue ball, determining a first circular area when the color types included in the cue ball are determined to be one, and converting the first circular area from an RGB color space to a HIS color space to obtain a second color value; comparing the second color value with a first preset color value, and determining a first target circular area in a first circular area corresponding to the cue ball according to a comparison result; when the color types included in the cue ball are 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 RGB color space to 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 round-shaped area corresponding to the cue ball or a second target round-shaped area in the third round-shaped area according to the comparison result.
According to some embodiments of the invention, the evaluation of the individual impact parameters includes evaluating based on a pre-constructed evaluation index system;
the construction method of the evaluation index system comprises the following steps:
determining an evaluation index according to a preset evaluation purpose and an evaluation object;
acquiring an association relation between evaluation indexes, and constructing an evaluation index system according to the association relation;
acquiring an evaluation index sample, and determining weight coefficients of all evaluation indexes in an evaluation index system based on least square calculation;
evaluating the hit parameters based on the evaluation index system with the weight coefficients set to obtain an evaluation average value, and respectively calculating offset coefficients between the evaluation values obtained by all the evaluation indexes in the evaluation index system and the evaluation average 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 may be realized and attained by the structure particularly pointed out in the written description and drawings.
The technical scheme of the invention is further described in detail through the drawings and the embodiments.
Detailed Description
The preferred embodiments of the present invention will be described below with reference to the accompanying drawings, it being understood that the preferred embodiments described herein are for illustration and explanation of the present invention only, and are not intended to limit the present invention.
As shown in fig. 1, an embodiment of the present invention provides a billiard ball striking assisting method, which includes steps S1 to S7:
s1, determining first coordinate information of a cue ball and second coordinate information of other billiards except the cue ball;
s2, obtaining third coordinate information of a pocket on the billiard table;
s3, determining a first billiard ball set according to the second coordinate information and the third coordinate information;
s4, respectively generating a first auxiliary line set of the billiards in the first billiard ball set and the billiards in the first billiard ball set, respectively judging whether the first auxiliary lines included in the first auxiliary line set contain foreign matters or not, and removing the corresponding billiards from the first billiard ball set when determining that at least one first auxiliary line contains foreign matters, so as to obtain a second billiard ball set;
s5, determining a target billiard ball according to the first coordinate information of the cue ball and the second coordinate information of billiards in the second billiard ball set;
s6, generating a second auxiliary line set between the target billiard ball and the corresponding target pocket;
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 billiard.
The working principle of the technical scheme is as follows: establishing a coordinate system on a tabletop of the billiard ball, and determining first coordinate information of the billiard ball and second coordinate information of other billiards except the billiard ball; acquiring third coordinate information of a pocket on the billiard table; determining a first billiard ball set according to the second coordinate information and the third coordinate information; the first billiard ball set represents billiards with the distance from the pocket opening being smaller than or equal to the preset distance, popular billiards which are close to the pocket opening are determined, and the success rate of the billiards entering the pocket opening is high. Generating a first auxiliary line set of the billiards in the first billiard ball set and a first auxiliary line set of the billiards in the first billiard ball set respectively, judging whether the first auxiliary lines included in the first auxiliary line set contain foreign matters or not respectively, and removing the corresponding billiards from the first billiard ball set when determining that at least one first auxiliary line contains the foreign matters, so as to obtain a second billiard ball set; avoiding that the target ball can be hit only by other billiards when the billiards are hit, namely avoiding the situation of considering indirect collision with the target ball. The second billiard ball set is all that the cue ball can directly collide with the target ball. Determining a target billiard ball according to the first coordinate information of the cue ball and the second coordinate information of billiards in the second billiard ball set; generating a second auxiliary line set between the target billiard ball and the corresponding target pocket; and determining batting information according to the first auxiliary line set, the second auxiliary line set and a preset billiard collision model of the target billiard. The second auxiliary line sets to indicate that the billiard ball enters the pocket and has a plurality of tracks, each track being indicated by a second auxiliary line. The first auxiliary line is that the cue ball goes to the target billiard ball to collide, and a plurality of tracks exist, and each track is represented by one first auxiliary line.
The beneficial effects of the technical scheme are that: and the coordinates of the cue ball, other cue balls and the pocket mouth are realized, so that the calculation accuracy is improved, and the relationship among the cue ball, other cue balls and the pocket mouth is displayed more accurately. In order to simplify the calculation flow and improve the hit rate, the first billiard ball set is determined firstly, the second billiard ball set is determined secondly, and the target billiard ball is determined finally. According to the first auxiliary line set, the second auxiliary line set and a preset billiard ball collision model of the target billiards, the ball hitting information is accurately determined, so that a player can accurately grasp the force and angle of hitting balls, the billiards can be conveniently hit into a designated position, the hit rate of the balls is improved, and the hit level of the player 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-S14:
s11, acquiring an image shot from the right upper side of the billiard table as an image to be identified;
s12, extracting features of the image to be identified, and determining a plurality of circular areas;
s13, acquiring color information of a circular area, and determining a cue ball and other billiards according to the color information;
s14, acquiring center information of a plurality of circular areas, and determining first coordinate information of the cue ball and second coordinate information of other cue balls 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 right above a billiard table as an image to be identified; extracting features of the image to be identified, and determining a plurality of circular areas; acquiring color information of a circular area, and determining a cue ball and other billiards according to the color information; and acquiring center information of a plurality of circular areas, and determining first coordinate information of the cue ball and second coordinate information of other cue balls except the cue ball according to a preset coordinate system.
The beneficial effects of the technical scheme are that: the accuracy of determining the first coordinate information of the cue ball and the second coordinate information of other cue balls except the cue ball is improved.
According to some embodiments of the invention, obtaining third coordinate information of a billiard table pocket includes:
and acquiring center information of the pocket opening, and determining third coordinate information of the pocket opening on the billiard table according to a preset coordinate system.
The beneficial effects of the technical scheme are that: and accurately determining third coordinate information of the pocket mouth on the billiard table.
According to some embodiments of the invention, determining the first pool cue set according to the second coordinate information and the third coordinate information includes:
according to the second coordinate information of the billiard ball and the third coordinate information of the pocket openings on the billiard ball table, calculating first distance values of the billiard ball and each pocket opening, 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 billiard ball is effective when the smallest first distance value is smaller than or equal to the preset distance value;
and respectively executing the steps on each billiard ball, and determining a first billiard ball set according to each determined effective billiard ball.
The working principle of the technical scheme is as follows: according to the second coordinate information of the billiard ball and the third coordinate information of the pocket openings on the billiard ball table, calculating first distance values of the billiard ball and each pocket opening, 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 billiard ball is effective when the smallest first distance value is smaller than or equal to the preset distance value; and respectively executing the steps on each billiard ball, and determining a first billiard ball set according to each determined effective billiard ball.
The beneficial effects of the technical scheme are that: and the billiards with higher success rate of billiards can be primarily determined, the complexity and the calculated 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 includes:
and carrying out graying treatment on the first auxiliary line set, obtaining the gray values of the pixel points on the first auxiliary line, calculating the gray difference values of the adjacent pixel points, judging whether the gray difference values are larger than the preset gray difference values, counting the number of the gray difference values larger than the preset gray difference values, and determining that foreign matters exist on the first auxiliary line when the number is determined to be larger than the preset number.
The working principle of the technical scheme is as follows: and carrying out graying treatment on the first auxiliary line set, obtaining the gray values of the pixel points on the first auxiliary line, calculating the gray difference values of the adjacent pixel points, judging whether the gray difference values are larger than the preset gray difference values, counting the number of the gray difference values larger than the preset gray difference values, and determining that foreign matters exist on the first auxiliary line when the number is determined to be larger than the preset number.
The beneficial effects of the technical scheme are that: when the gray difference value of the adjacent pixel points is larger than the preset gray difference value, which indicates that the adjacent pixel points possibly belong to two different objects, and when the gray difference value is larger than the preset gray difference value by more than the preset number, foreign matters are determined to exist on the first auxiliary line. The accuracy of determining whether a foreign object is present on the first auxiliary line is improved.
According to some embodiments of the present invention, determining a target billiard ball according to first coordinate information of a cue ball and second coordinate information of billiards in the second billiard ball set includes:
and respectively calculating second distance values of the billiards in the second billiard ball set and the billiards in the second billiard ball set according to the first coordinate information of the billiards and the second coordinate information of the billiards in the second billiard ball set, and determining the billiards corresponding to the smallest second distance values as target billiards.
The working principle of the technical scheme is as follows: and respectively calculating second distance values of the billiards in the second billiard ball set and the billiards in the second billiard ball set according to the first coordinate information of the billiards and the second coordinate information of the billiards in the second billiard ball set, and determining the billiards corresponding to the smallest second distance values as target billiards.
The beneficial effects of the technical scheme are that: further reduces the batting range, reduces the calculated amount and improves the hit rate of the billiards.
As shown in fig. 3, according to some embodiments of the present invention, the hitting information is determined according to the first auxiliary line set, the second auxiliary line set, and a preset billiard ball collision model of a target billiard ball, including 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 a collision point of the target billiard ball according to the target second auxiliary line and a preset billiard ball collision model, and acquiring parameter information of the simulated cue ball;
s73, performing deduction calculation according to the parameter information and a plurality of first auxiliary lines included in the first auxiliary line set, 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 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 a second auxiliary line positioned in the middle, determining the optimal track through multiple experiments, and ensuring that the success rate of the bag inlet is highest. Generating a simulated cue ball at a collision point of a target billiard ball according to the target second auxiliary line and a preset billiard 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, deducing and calculating are carried out, and the hitting parameters of the first auxiliary lines on the cue ball are determined; and evaluating each hitting parameter, and determining hitting information according to an evaluation result.
The beneficial effects of the technical scheme are that: and reversely deducing the hitting parameters during hitting based on the result of the target billiards in the pocket, evaluating the hitting parameters, and determining hitting information according to the optimal hitting parameters. The achievement, comfort and the like of the batters are comprehensively considered according to the batting force, angle and the like when the evaluation is carried out. The optimal batting information is convenient to determine, the hit rate of batting is improved, meanwhile, the batting experience of a batter is improved, and the batting level is convenient to improve.
According to some embodiments of the invention, the impact parameters include impact strength and impact angle.
In an embodiment, further comprising:
striking the target billiards according to the striking information to acquire continuous frame images of the target billiards after collision;
analyzing the continuous frame images, determining a track point of a target billiard on each frame image, connecting a plurality of track points, and determining a moving track of the target billiard;
and calculating the difference between the moving track and the target second auxiliary line, judging whether the difference is larger than a preset difference, and sending out an alarm prompt when the difference is determined to be larger than the preset difference.
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; d (D) i Coordinates of the ith track point in the moving track; d (D) i ' is the coordinates of the trajectory point at the corresponding moment on the second auxiliary line of the target.
The technical scheme has the working principle and beneficial effects that: striking the target billiards according to the striking information to acquire continuous frame images of the target billiards after collision; analyzing the continuous frame images, determining a track point of a target billiard on each frame image, connecting a plurality of track points, and determining a moving track of the target billiard; and calculating the difference between the moving track and the target second auxiliary line, judging whether the difference is larger than the preset difference, and when the difference is larger than the preset difference, indicating that the model parameters of the billiard collision model are abnormal, and correcting the model parameters to ensure that the overlapping ratio of the moving track of the billiard and the target second auxiliary line is high, thereby improving the accuracy of the determined batting information.
According to some embodiments of the present invention, color information of a circular area is acquired, and a cue ball and other billiards are determined according to the color information, including:
respectively acquiring a first color value of each pixel point included in the circular area 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 used as a first type pixel point, a pixel point with the minimum G channel value in the first color value is used as a second type pixel point, and a pixel point with the minimum B channel value in the first color value is used as a third type pixel point;
respectively counting the number of first class pixel points, second class pixel points and third class pixel points in the circular area, and determining the color types included in the circular area based on a preset rule according to the counted number; determining a circular area including one color category as a first type circular area, determining a circular area including two color categories as a second type circular area, and determining a circular area including three color categories as a third type circular area;
presetting color types included in a cue ball, determining a first circular area when the color types included in the cue ball are determined to be one, and converting the first circular area from an RGB color space to a HIS color space to obtain a second color value; comparing the second color value with a first preset color value, and determining a first target circular area in a first circular area corresponding to the cue ball according to a comparison result; when the color types included in the cue ball are 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 RGB color space to 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 round-shaped area corresponding to the cue ball or a second target round-shaped area in the third round-shaped area according to the comparison result.
The working principle of the technical scheme is as follows: respectively acquiring a first color value of each pixel point included in the circular area 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 used as a first type pixel point, a pixel point with the minimum G channel value in the first color value is used as a second type pixel point, and a pixel point with the minimum B channel value in the first color value is used as a third type pixel point; respectively counting the number of first class pixel points, second class pixel points and third class pixel points in the circular area, and determining the color types included in the circular area based on a preset rule according to the counted number; each type of pixel point represents a color, and when the number of the pixel points of a certain type is 0, the color represented by the type is absent in the circular area. Determining a circular area including one color category as a first type circular area, determining a circular area including two color categories as a second type circular area, and determining a circular area including three color categories as a third type circular area; presetting color types included in a cue ball, determining a first circular area when the color types included in the cue ball are determined to be one, and converting the first circular area from an RGB color space to a HIS color space to obtain a second color value; comparing the second color value with a first preset color value, and determining a first target circular area in a first circular area corresponding to the cue ball according to a comparison result; the HIS color space can be described by a conical space model, which clearly shows the variation of hue, brightness and color saturation of the first circular region. The color gamut of the LAB color space is larger, more pixel data can be displayed, meanwhile, the defined colors are the most, and when at least two color types are included, the color weight value of each pixel point can be accurately determined, so that a better color effect is realized. The first preset 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 LAB color space determined from the cue ball.
The beneficial effects of the technical scheme are that: the color type information included in the circular area is accurately determined and classified, and the color type information is converted into different color spaces according to the number of color types of the cue ball, so that the color of the cue ball is accurately determined, and further the cue ball and other billiards are determined.
According to some embodiments of the invention, the evaluation of the individual impact parameters includes evaluating based on a pre-constructed evaluation index system;
the construction method of the evaluation index system comprises the following steps:
determining an evaluation index according to a preset evaluation purpose and an evaluation object;
acquiring an association relation between evaluation indexes, and constructing an evaluation index system according to the association relation;
acquiring an evaluation index sample, and determining weight coefficients of all evaluation indexes in an evaluation index system based on least square calculation;
evaluating the hit parameters based on the evaluation index system with the weight coefficients set to obtain an evaluation average value, and respectively calculating offset coefficients between the evaluation values obtained by all the evaluation indexes in the evaluation index system and the evaluation average 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-constructed evaluation index system; the construction method of the evaluation index system comprises the following steps: determining an evaluation index according to a preset evaluation purpose and an evaluation object; acquiring an association relation between evaluation indexes, and constructing an evaluation index system according to the association relation; acquiring an evaluation index sample, and determining weight coefficients of all evaluation indexes in an evaluation index system based on least square calculation; evaluating the hit parameters based on the evaluation index system with the weight coefficients set to obtain an evaluation average value, and respectively calculating offset coefficients between the evaluation values obtained by all the evaluation indexes in the evaluation index system and the evaluation average value; and correcting the weight coefficient according to the offset coefficient to obtain a new weight coefficient. And calculating an offset coefficient between an evaluation value and an evaluation mean value obtained by each evaluation index in the evaluation index system based on the Euclidean distance.
The beneficial effects of the technical scheme are that: based on the evaluation index system, the accuracy of evaluation is determined, so that the optimal striking parameters can be conveniently determined. The rationality 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 ensured, the accuracy of an evaluation result is further improved, dependence on historical data is eliminated, and the method is simpler, more convenient and more practical.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.