A method for automatic calibration of a ball table

Through the combination of semantic segmentation network model and loss function, the table tennis table's vertex and center position are automatically calculated, which solves the problem of complex and difficult to automate the table tennis table calibration in the existing technology, and realizes the convenience of automated calibration and data analysis.

CN114612576BActive Publication Date: 2024-10-29新华智云科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210292376.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-23
Publication Date
2024-10-29
Estimated Expiration
2042-03-23

AI Technical Summary

Technical Problem

The existing table tennis table calibration process is complex and difficult to automate, requiring a complex camera system and multiple sets of pictures to calculate the calibration parameters.

Method used

Use the semantic segmentation network model to obtain real-time video streams, calculate the table mask to determine the four predicted vertices and the position of the middle net, establish the mapping relationship between the picture coordinate system and the standard table coordinate system, and use loss functions such as dice loss and binary cross entropy loss and boundary loss perform model training and verification.

Benefits of technology

It realizes automatic calibration without manual participation, simplifies table tennis data analysis, automatically identifies the top of the table, the position of the middle net and the distance between the camera and the boundary of the table, and improves the automation and convenience of the calibration process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114612576B_ABST
    Figure CN114612576B_ABST
Patent Text Reader

Abstract

The present application discloses a table tennis automatic calibration method, which relates to the field of automatic calibration technology. The table tennis automatic calibration method comprises the following steps: based on the table tennis mask, the four predicted vertices and the center net position of the table tennis in the video frame to be identified are calculated, the four corresponding standard vertices on the standard table tennis plane are obtained, and the mapping relationship between the picture coordinate system and the standard table tennis coordinate system is established based on the four predicted vertices and the four standard vertices. The beneficial effect is that there is no need for manual participation, and there is no need to use a chessboard to take multiple groups of pictures for a complex camera system. The four vertices of the table tennis table, the center net position, the distance between the camera and the table tennis boundary, and the mapping relationship between the picture coordinate system and the standard table tennis coordinate system are automatically identified. The technical solution of the present application is more convenient and simple to use, and provides a basis for table tennis data analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of automatic calibration, and more specifically, relates to an automatic calibration method for a pool table. Background Art

[0002] Most of the existing table tennis table calibration processes are for complex camera systems, which require taking multiple sets of pictures using a checkerboard to deduce the calibration parameters. They are complex to use and difficult to automate. For example, the document "Research on Modeling of Table Tennis Motion Trajectory Based on Binocular Vision" is a table tennis recognition and tracking system based on binocular vision. By calibrating the camera, the internal and external parameters of the camera are obtained, and the three-dimensional positioning of the table tennis ball is achieved by combining the camera imaging model. The color segmentation, background subtraction and ellipse fitting are integrated to detect the shadow range of the flying ball and obtain the center position of the ball, and establish a table tennis motion trajectory model. Summary of the invention

[0003] The purpose of the present application is to provide a method for automatic calibration of a pool table, so as to solve the technical problem that the existing pool table calibration process in the above-mentioned prior art is complicated to use and difficult to automate.

[0004] In order to achieve the above technical objectives, the technical solutions adopted in this application are as follows:

[0005] A method for automatic calibration of a table, characterized in that it comprises the following steps:

[0006] Acquire a real-time video stream, decode the video stream into video frames to be identified, and input each video frame to be identified in the video stream into a semantic segmentation network model to calculate a ball table mask;

[0007] Calculate four predicted vertices and a center net position of the table in the video frame to be identified based on the table mask;

[0008] Four corresponding standard vertices on the standard table plane are obtained, and a mapping relationship between the screen coordinate system and the standard table coordinate system is established based on the four predicted vertices and the four standard vertices.

[0009] Preferably, the training of the semantic segmentation network model comprises the following steps:

[0010] Collecting table tennis table photos in different scenes, marking table tennis table masks of the table tennis table photos, and inputting the table tennis table photos into a segmentation network model to train the segmentation network model to obtain the semantic segmentation network model;

[0011] Using a loss function to verify the trained semantic segmentation network model to determine whether it is the semantic segmentation network model within the error range;

[0012] If it exceeds the error range, the semantic segmentation network model continues to be trained based on the table tennis table photo. If it does not exceed the error range, the training is terminated to obtain an accurate semantic segmentation network model.

[0013] Preferably, the method further comprises the steps of:

[0014] The loss function consists of a dice loss function, a binary cross entropy loss function and a boundaryloss function;

[0015] The formula of the loss function is: L = ω1L Dice +ω2L BCE +ω3L Boundary ;

[0016] Among them, L represents the loss function, L Dice Expressed as dice loss function, L BCE Expressed as a binary crossentropy loss function, L Boundary It is represented as the boundary loss function, ω1 is represented as the weight of the dice loss function, ω2 is represented as the weight of the binary cross entropy loss function, and ω3 is represented as the weight of the boundary loss function.

[0017] Preferably, calculating the four predicted vertices and the center net position of the table in the video frame to be identified based on the table mask specifically includes the following steps:

[0018] Counting the connected domains of the ball table mask, sorting the areas of the connected domains from large to small, so as to calculate the diameter of each connected domain;

[0019] Performing an opening operation on the ball table mask based on a connected domain diameter of a preset size to obtain a first ball table mask, and extracting the largest closed edge of the first ball table mask;

[0020] Polygon fitting is performed on the closed edge to obtain four predicted vertices and the center net position of the table in the video frame to be identified.

[0021] Preferably, extracting the largest closed edge of the first table mask specifically includes the following steps:

[0022] Traversing the first table mask from top to bottom and from left to right to obtain an edge starting point, and creating a closed edge according to the edge starting point;

[0023] Taking any pixel point in the first table mask as the starting point, traverse the four neighborhoods of the pixel point in a clockwise direction until the closed edge traversal is completed;

[0024] The above steps are repeated until the first table mask traversal is completed, and the closed edges are sorted according to the number of elements contained, and the closed edge with the largest number of elements is the largest closed edge.

[0025] Preferably, polygon fitting is performed on the closed edge to obtain four predicted vertices of the table in the video frame to be identified, which specifically includes the following steps:

[0026] Obtain any two points on the closed edge, calculate the first straight line distance between the two points, and calculate the maximum distance from the edge point between the two points to the first straight line;

[0027] If the maximum distance is greater than the preset distance threshold, the first straight line distance between the two points is split to obtain the second straight line and the third straight line, and the above steps are repeated until the maximum distance is lower than the preset distance threshold;

[0028] Traversing all points on the closed edge to obtain a number of predicted vertices, the number of predicted vertices forming a predicted vertex set;

[0029] The predicted vertices in the predicted vertex set are sorted in ascending order to obtain a lower left predicted vertex, an upper left predicted vertex, a lower right predicted vertex and an upper right predicted vertex of the table.

[0030] Preferably, polygon fitting is performed on the closed edge to obtain the center net position of the table in the video frame to be identified, which specifically includes the following steps:

[0031] The center grid position includes two end points of the center grid line, and the two end points are defined as the center grid upper end point and the center grid lower end point respectively;

[0032] The middle grid line endpoint is obtained based on the upper left predicted vertex and the upper right predicted vertex, and the middle grid line lower endpoint is obtained based on the lower left predicted vertex and the lower right predicted vertex.

[0033] Preferably, the method further comprises the steps of:

[0034] The focal length and pixel size of the camera are obtained, and the distance between the camera and the boundary of the table is calculated based on the focal length and pixel size of the camera. The calculation formula is as follows:

[0035]

[0036] Among them, d c It is represented by the distance between the camera and the table boundary, L is the length of the table tennis table, f is the focal length of the camera, RB x Represented as the x-coordinate of the lower right predicted vertex, LB x It is represented as the x-coordinate of the lower left predicted vertex, and σ is represented as the pixel size of the camera.

[0037] An electronic device comprises a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement a method for automatic calibration of a pool table as described above.

[0038] A computer-readable storage medium stores computer instructions, which implement the steps of the above method when executed by a processor.

[0039] The beneficial effects provided by this application are:

[0040] 1. This application calculates the four predicted vertices and the center net position of the table in the video frame to be identified through the table mask, obtains the corresponding four standard vertices on the standard table plane, and establishes the mapping relationship between the screen coordinate system and the standard table coordinate system based on the four predicted vertices and the four standard vertices. No manual participation is required, and there is no need to use a checkerboard to take multiple sets of pictures for a complex camera system. The four vertices of the table tennis table, the center net position, the distance between the camera and the table boundary, and the mapping relationship between the screen coordinate system and the standard table coordinate system are automatically identified. The technical solution of this application is more convenient and simple to use, providing a basis for table tennis data analysis.

[0041] 2. The loss function of this application consists of a dice loss function, a binary cross entropy loss function, and a boundary loss function. The dice loss function and the binary cross entropy loss function are used to ensure that the shape of the predicted table mask is close to the shape of the real label, and the boundary loss function is used to ensure that the predicted edge is as close to the edge of the real label as possible. Parameters ω1 and ω2 decrease with the increase in the number of training rounds, and parameter ω3 increases with the increase in the number of training rounds, so that the model focuses on the overall shape of the predicted table mask in the early stage of training, and focuses on edge details in the later stage of training. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0043] Figure 1 It is a flow chart of the automatic calibration method of the table in Example 1. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0045] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0046] Embodiment 1:

[0047] like Figure 1 As shown, this embodiment includes a method for automatic calibration of a pool table, comprising the following steps: acquiring a real-time video stream, decoding the video stream into video frames to be identified, and inputting each video frame to be identified in the video stream into a semantic segmentation network model to calculate a pool table mask.

[0048] The four predicted vertices and the center net position of the table in the video frame to be identified are calculated based on the table mask, the corresponding four standard vertices on the standard table plane are obtained, and the mapping relationship between the picture coordinate system and the standard table coordinate system is established based on the four predicted vertices and the four standard vertices.

[0049] The training of the semantic segmentation network model includes the following steps: collecting photos of table tennis tables in different scenes, annotating the table masks of the table tennis table photos, and inputting the table tennis table photos into the segmentation network model to train the segmentation network model to obtain the semantic segmentation network model.

[0050] The loss function is used to verify the trained semantic segmentation network model to determine whether it is within the error range. If it is beyond the error range, the semantic segmentation network model is continued to be trained based on the table tennis table photo. If it is within the error range, the training is terminated to obtain an accurate semantic segmentation network model.

[0051] In this embodiment, the real-time video stream is obtained by shooting a camera, the table tennis table photos in different scenes include table tennis table photos under different viewing angles, table tennis table photos under different light and table tennis table photos under different backgrounds, and the segmentation network model includes but is not limited to commonly used semantic segmentation models such as Unet, deeplabv3 and FCN, etc. In this embodiment, the table is a table tennis table.

[0052] The loss function is composed of a dice loss function, a binary cross entropy loss function and a boundary loss function. The formula of the loss function is: L = ω1L Dice +ω2L BCE +ω3L Boundary .

[0053] Among them, L represents the loss function, L Dice Expressed as dice loss function, L BCE Expressed as a binary crossentropy loss function, L Boundary It is represented as the boundary loss function, ω1 is represented as the weight of the dice loss function, ω2 is represented as the weight of the binary cross entropy loss function, and ω3 is represented as the weight of the boundary loss function.

[0054] Specifically, in the technical solution of the present application, the edge is the key information for locating and predicting the vertex. In order to highlight the edge, the loss function adopts a combination of dice loss function + binary cross entropy loss function + boundary loss function.

[0055] The formula used by the dice loss function is as follows:

[0056]

[0057] Among them, L Dice It is represented as the dice loss function, y represents the real table mask, Represented as the predicted ball table mask. The formula used by the binary cross entropy loss function is as follows:

[0058]

[0059] Among them, L BCE It is represented as a binary cross entropy loss function, y represents the real table mask, Denoted as the predicted table mask.

[0060] The formula used by the boundary loss function is as follows:

[0061] L Boundary =∫ Ω Φ G (q)s(q)dq

[0062] Among them, L Boundary It is represented as the boundary loss function, y represents the real ball table mask, is represented by the predicted table mask, Ω is represented by y and The union of G represents the edge of y, q represents any point in Ω, Φ G (q) represents the shortest distance from point q to any point on G. When , s(q) = 1, otherwise s(q) = 0.

[0063] Specifically, the dice loss function and the binary cross entropy loss function are used to ensure that the shape of the predicted table mask is close to the shape of the real label, and the boundary loss function is used to ensure that the predicted edge is as close to the edge of the real label as possible. Parameters ω1 and ω2 decrease with the increase of the number of training rounds, and parameter ω3 increases with the increase of the number of training rounds, so that the model focuses on the overall shape of the predicted table mask in the early stage of training, and focuses on the edge details in the later stage of training.

[0064] When training the semantic segmentation network model, data augmentation operations are performed to enhance the generalization ability of the semantic segmentation network model to various complex environments. Data augmentation operations include rotation, flipping, translation, scaling, and random occlusion strategies.

[0065] The four predicted vertices and the center net position of the table in the video frame to be identified are calculated based on the table mask, which specifically includes the following steps: counting the connected domains of the table mask, sorting the areas of the connected domains from large to small, and calculating the diameters of each connected domain. The table mask is opened based on the connected domain diameter of a preset size to obtain the first table mask, and the largest closed edge of the first table mask is extracted. The closed edge is polygonally fitted to obtain the four predicted vertices and the center net position of the table in the video frame to be identified.

[0066] Specifically, the table mask is defined as MT, the connected domains of MT are counted, and the areas of the connected domains are sorted from large to small to obtain {T1, T2, …, T N}, {T1,T2,…,T N The diameter of {r1,r2,…,r N}, an opening operation is performed on MT with a preset kernel size of r2 to obtain the first table mask.

[0067] Extract the largest closed edge of the first table mask, specifically including the following steps: traverse the first table mask from top to bottom and from left to right to obtain the edge starting point, and create a closed edge based on the edge starting point. Take any pixel point in the first table mask as the starting point, and traverse the 4 neighborhoods of the pixel point in a clockwise direction until the closed edge traversal is completed. Repeat the above steps until the first table mask traversal is completed, sort the closed edges according to the number of elements contained, and the closed edge with the largest number of elements is the largest closed edge.

[0068] Specifically, step 1: define the first table mask as MT o , define MT o The width is W, and MT is defined o The height is H, and MT is defined o Any pixel in x i,j , where 0≤i≤W-1, 0≤j≤H-1. Traverse the MT from top to bottom and from left to right. o , if i1, j1 are found, the condition is met and but It is called the edge starting point, and a new closed edge Bl is created based on the edge starting point k =[(i1, j1)].

[0069] Step 2: As a starting point, from Start traversing in clockwise direction If we find i2, j2 in the 4-neighborhood, we can satisfy the condition If i1≠i2 or j1≠j2 is satisfied, then let i1=i2, j1=j2, and add (i2, j2) to the closed edge Bl k middle.

[0070] Step 3: Repeat step 2 until i1=i2 and j1=j2, then close edge Bl k Traversal completed.

[0071] Step 4: Repeat steps 1 to 3 until the traversal is complete. o Finally, we get the closed edge set Bl = {Bl1, Bl2, ..., Bl K}, sort Bl by the number of elements it contains, and the closed edge with the largest number of elements is the largest closed edge Bl max .

[0072] Polygon fitting is performed on the closed edge to obtain four predicted vertices of the table in the video frame to be identified, which specifically includes the following steps: obtaining any two points on the closed edge, calculating the first straight line distance between the two points, and calculating the maximum distance from the edge point to the first straight line between the two points.

[0073] If the maximum distance is greater than the preset distance threshold, the first straight line distance between the two points is split to obtain the second and third straight lines, and the above steps are repeated until the maximum distance is lower than the preset distance threshold. After traversing all points on the closed edge, several predicted vertices are obtained, and several predicted vertices form a predicted vertex set.

[0074] The predicted vertices in the predicted vertex set are sorted in ascending order to obtain a lower left predicted vertex, an upper left predicted vertex, a lower right predicted vertex, and an upper right predicted vertex of the table.

[0075] Specifically, get the maximum closed edge Bl max Take any two points on the graph, define them as point A and point B, and calculate the first straight line distance between point A and point B, that is, straight line AB. Calculate the maximum distance d from the edge point between the two points to straight line AB, and let the point with the maximum distance be point C. In this embodiment, the edge points are all edge points traversed between point A and point B when traversing the edge clockwise or counterclockwise.

[0076] If the maximum distance d is greater than the preset distance threshold dt, the line AB is divided into two segments AC and CB, and the above steps are repeated until the maximum distance is lower than the preset distance threshold. Otherwise, the line AB is used as an approximation of the edge between point A and point B. max All points on the traversal are traversed according to the above steps to obtain a number of predicted vertices, and a number of predicted vertices constitute a predicted vertex set {p1, p2, ..., p K}.

[0077] For {p1,p2,…,p K} Sort in ascending order along the x-axis to obtain {p′1,p′2,…,p′ K-1 ,p′ K}, the lower left predicted vertex LB, upper left predicted vertex LT, lower right predicted vertex RB and upper right predicted vertex RT of the table are:

[0078] (LB,LT,RB,RT)=(p′1,p′2,p′ K-1 ,p′ K )

[0079] The closed edge is polygonally fitted to obtain the center net position of the table in the video frame to be identified, specifically including the following steps: the center net position includes the two end points of the center net line, and the two end points are defined as the center net line end point and the center net line end point. The center net line end point is obtained based on the upper left predicted vertex and the upper right predicted vertex, and the center net line end point is obtained based on the lower left predicted vertex and the lower right predicted vertex.

[0080] The formula used for the endpoints on the network line is as follows:

[0081]

[0082] Among them, NT represents the upper endpoint of the middle network line, LT represents the upper left predicted vertex, and RT represents the upper right predicted vertex.

[0083] The formula used by the offline endpoint of the ChinaNet is as follows:

[0084]

[0085] Among them, NB represents the lower endpoint of the middle network line, LB represents the lower left predicted vertex, and RB represents the lower right predicted vertex.

[0086] Specifically, the homography matrix is ​​calculated based on the four predicted vertices and the four standard vertices, and the mapping relationship between the screen coordinate system and the standard table coordinate system is established based on the homography matrix. The specific formula is as follows:

[0087]

[0088] Among them, (x′, y′) is a point on the standard table plane, (x, y) is a point on the screen coordinates, It is the homography matrix from the screen coordinate system to the standard table coordinate system.

[0089] The method further includes the steps of obtaining the focal length and pixel size of the camera, and calculating the distance between the camera and the boundary of the table based on the focal length and pixel size of the camera, wherein the calculation formula is as follows:

[0090]

[0091] Among them, d c It is represented by the distance between the camera and the table boundary, L is the length of the table tennis table, f is the focal length of the camera, RB x Represented as the x-coordinate of the lower right predicted vertex, LB x It is represented as the x-coordinate of the lower left predicted vertex, and σ is represented as the pixel size of the camera.

[0092] Embodiment 2:

[0093] An electronic device includes a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the above-mentioned automatic calibration method for a pool table.

[0094] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the electronic device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0095] A computer-readable storage medium stores computer instructions, which implement the steps of the method in Example 1 when executed by a processor.

[0096] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0097] The present invention is described with reference to the flowcharts and / or block diagrams of the method, terminal device (system), and computer program product according to the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0098] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0099] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0100] It should be noted that:

[0101] The phrases "one embodiment" or "embodiment" mentioned in the specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present application. Therefore, the phrases "one embodiment" or "embodiment" appearing in various places throughout the specification do not necessarily refer to the same embodiment.

[0102] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0103] In addition, it should be noted that the shapes and names of the parts and components of the specific embodiments described in this specification may be different. Any equivalent or simple changes made based on the structure, features and principles described in the patent concept of this application are included in the protection scope of the patent of this application. The technicians in the technical field of this application can make various modifications or supplements to the specific embodiments described or replace them in a similar way, as long as they do not deviate from the structure of this application or exceed the scope defined by the claims, they should all fall within the protection scope of this application.

Claims

1. A method for automatic calibration of a table, characterized in that: The following steps are involved: Acquire a real-time video stream, decode the video stream into video frames to be identified, and input each video frame to be identified in the video stream into a semantic segmentation network model to calculate a ball table mask; Calculate four predicted vertices and the center net position of the table in the video frame to be identified based on the table mask, wherein the center net position includes two end points of the center net line, and the two end points are defined as the upper end point of the center net line and the lower end point of the center net line, respectively; Acquire four corresponding standard vertices on the standard table plane, and establish a mapping relationship between the screen coordinate system and the standard table coordinate system based on the four predicted vertices and the four standard vertices; The calculation of the four predicted vertices and the center net position of the table in the video frame to be identified based on the table mask specifically includes the following steps: Counting the connected domains of the ball table mask, sorting the areas of the connected domains from large to small, so as to calculate the diameter of each connected domain; Performing an opening operation on the ball table mask based on a connected domain diameter of a preset size to obtain a first ball table mask, and extracting the largest closed edge of the first ball table mask; Performing polygon fitting on the closed edge to obtain four predicted vertices and a center net position of the table in the video frame to be identified; Performing polygon fitting on the closed edge to obtain four predicted vertices of the table in the video frame to be identified specifically includes the following steps: Obtain any two points on the closed edge, calculate the first straight line distance between the two points, and calculate the maximum distance from the edge point between the two points to the first straight line; If the maximum distance is greater than the preset distance threshold, the first straight line distance between the two points is split to obtain the second straight line and the third straight line, and the above steps are repeated until the maximum distance is lower than the preset distance threshold; Traversing all points on the closed edge to obtain a number of predicted vertices, the number of predicted vertices forming a predicted vertex set; The predicted vertices in the predicted vertex set are sorted in ascending order to obtain a lower left predicted vertex, an upper left predicted vertex, a lower right predicted vertex and an upper right predicted vertex of the table.

2. A method for automatic calibration of a table according to claim 1, characterized in that: The training of the semantic segmentation network model includes the following steps: Collecting table tennis table photos in different scenes, marking table tennis table masks of the table tennis table photos, and inputting the table tennis table photos into a segmentation network model to train the segmentation network model to obtain the semantic segmentation network model; Using a loss function to verify the trained semantic segmentation network model to determine whether it is the semantic segmentation network model within the error range; If it exceeds the error range, the semantic segmentation network model continues to be trained based on the table tennis table photo. If it does not exceed the error range, the training is terminated to obtain an accurate semantic segmentation network model.

3. A method for automatic calibration of a table according to claim 2, characterized in that: Also includes the steps: The loss function consists of a dice loss function, a binary cross entropy loss function and a boundary loss function; The formula of the loss function is: L = ω1L Dice +ω2L BCE +ω3L Boundary ; Among them, L represents the loss function, L Dice Expressed as dice loss function, L BCE Expressed as a binary cross entropyloss function, L Boundary It is represented as the boundary loss function, ω1 is represented as the weight of the dice loss function, ω2 is represented as the weight of the binary cross entropy loss function, and ω3 is represented as the weight of the boundary loss function.

4. A method for automatic calibration of a table according to claim 1, characterized in that: Extracting the largest closed edge of the first table mask specifically includes the following steps: Traversing the first table mask from top to bottom and from left to right to obtain an edge starting point, and creating a closed edge according to the edge starting point; Taking any pixel point in the first table mask as the starting point, traverse the 4 neighborhoods of the pixel point in a clockwise direction until the closed edge traversal is completed; The above steps are repeated until the first table mask traversal is completed, and the closed edges are sorted according to the number of elements contained, and the closed edge with the largest number of elements is the largest closed edge.

5. The automatic calibration method for a table according to claim 1, characterized in that: Performing polygon fitting on the closed edge to obtain the center net position of the table in the video frame to be identified specifically includes the following steps: The center grid position includes two end points of the center grid line, and the two end points are defined as the center grid upper end point and the center grid lower end point respectively; The middle grid line endpoint is obtained based on the upper left predicted vertex and the upper right predicted vertex, and the middle grid line lower endpoint is obtained based on the lower left predicted vertex and the lower right predicted vertex.

6. A method for automatic calibration of a table according to claim 1, characterized in that: Also includes the steps: The focal length and pixel size of the camera are obtained, and the distance between the camera and the boundary of the table is calculated based on the focal length and pixel size of the camera. The calculation formula is as follows: Among them, d c It is represented by the distance between the camera and the table boundary, L is the length of the table tennis table, f is the focal length of the camera, RB x Represented as the x-coordinate of the lower right predicted vertex, LB x It is represented as the x-coordinate of the lower left predicted vertex, and σ is represented as the pixel size of the camera.

7. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement a method for automatic calibration of a ball table as described in any one of claims 1 to 6.

8. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Ping-pong ball drop point identification and scoring method and system based on target detection and tracking

    CN110458100A

  • Camera parameter calibration method and device, terminal and storage medium

    CN113781575A