WO2019128504A1 - Method and apparatus for image processing in billiards game, and terminal device - Google Patents

Method and apparatus for image processing in billiards game, and terminal device Download PDF

Info

Publication number
WO2019128504A1
WO2019128504A1 PCT/CN2018/115386 CN2018115386W WO2019128504A1 WO 2019128504 A1 WO2019128504 A1 WO 2019128504A1 CN 2018115386 W CN2018115386 W CN 2018115386W WO 2019128504 A1 WO2019128504 A1 WO 2019128504A1
Authority
WO
WIPO (PCT)
Prior art keywords
billiard
information
elliptical
area
position information
Prior art date
Application number
PCT/CN2018/115386
Other languages
French (fr)
Chinese (zh)
Inventor
梁栋
Original Assignee
深圳市超级视觉科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市超级视觉科技有限公司 filed Critical 深圳市超级视觉科技有限公司
Publication of WO2019128504A1 publication Critical patent/WO2019128504A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/24Aligning, centring, orientation detection or correction of the image
    • G06V10/245Aligning, centring, orientation detection or correction of the image by locating a pattern; Special marks for positioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/07Target detection

Definitions

  • the invention relates to the field of machine vision recognition technology, in particular to an image processing method, device and terminal device in a billiard game.
  • the billiards are regarded as a circle, and then the billiards are positioned to obtain the position information of the billiards.
  • the ball is seen as a visual source, and the shape of the ball (unless located at the center of the center) is not circular, so the billiard is regarded as a circle. Inevitably, there is a large error or even an error in the obtained billiard position information.
  • an embodiment of the present invention provides an image processing method and apparatus in a billiard game to solve the problem of the image processing method in the billiard game in the prior art.
  • a first aspect of the embodiments of the present invention provides an image processing method in a billiard game, which is applied to a system including a photographing apparatus, and the image processing method includes:
  • the video information is analyzed based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
  • the video information includes distribution information of an elliptical area corresponding to each billiard on a table surface;
  • the video information is analyzed based on the constructed projection model including the shooting device and the billiard position, and the position information of the billiard is obtained:
  • An elliptical region conforming to the projection model is detected from the distribution information
  • analyzing, according to the constructed projection model including the shooting device and the billiard position, the position information of the billiards from the video information includes:
  • the location information of the connected area is obtained, and the location information of each of the plurality of connected areas is used as the location information of the billiard corresponding to each of the elliptical areas.
  • the location information of the connected area is obtained, and the location information of each of the plurality of connected areas is used as the location information of the billiard corresponding to each of the elliptical areas.
  • a second aspect of the present invention provides an image processing apparatus in a billiard game, including:
  • An acquisition module configured to collect video information of a billboard including a billiard table and a billiard on the counter by a photographing device;
  • the analysis module is configured to analyze the video information based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
  • the video information includes distribution information of an elliptical area corresponding to each billiard on a table surface;
  • the analysis module includes:
  • a detecting unit configured to detect, from the distribution information, an elliptical region that conforms to the projection model
  • a calculating unit configured to calculate, according to the spatial geometric position relationship of the elliptical region corresponding to the billiard in the shooting device, the billiard, and the distribution information in the projection model, based on the position information of the elliptical region that conforms to the projection model The location information of the billiard to which the ellipse area belongs is obtained.
  • the analyzing module includes:
  • a first dividing unit configured to divide the video information into multiple frames
  • a segmentation unit configured to segment an elliptical region and a mesa region corresponding to billiards in each of the plurality of frames based on the projection model
  • a second dividing unit configured to divide the set of the elliptical regions into a plurality of connected regions
  • an acquiring unit configured to acquire location information of the connected area, and use location information of each of the plurality of connected areas as position information of billiards corresponding to the respective elliptical areas.
  • the obtaining unit includes:
  • the sub-unit is configured to divide the connected area into independent areas, obtain location information of each of the independent areas, and use location information of the independent area as location information of billiards corresponding to the independent area.
  • the obtaining unit includes:
  • a matching subunit configured to match the area size with a preset threshold to obtain a matching result
  • Extracting a subunit configured to extract, from the connected region, a plurality of circles that do not overlap each other based on the matching result, each circle corresponding to a circumscribed ellipse that conforms to the projection model and is circumscribed to the circle, the outer
  • the merged area of the cut ellipse occupying area is the connected area; the position information of the plurality of circles not overlapping each other is converted into position information of the billiard.
  • a third aspect of an embodiment of the present invention provides a terminal device including a memory, a processor, and a computer program stored in the memory and operable on the processor, wherein the processor executes the The steps of the method of the first aspect are implemented when the computer program is described.
  • a fourth aspect of the embodiments of the present invention provides a computer readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the method of the first aspect step.
  • the video information of the billiard table and the billiard on the countertop is collected by the photographing device; the video information is analyzed based on the constructed projection model including the photographing device and the billiard position, and the billiard is obtained.
  • Position information wherein the video information includes an image in which the billiard shape is an ellipse.
  • the billiard shape is an ellipse, and the position information of the billiard in the image of the video information is obtained based on the projection model, thereby improving the accuracy of the position information.
  • the implementation process of the embodiment of the present invention is simple, and has strong practicability and ease of use.
  • FIG. 1 is a schematic flow chart showing an implementation of an image processing method in a billiard game in an embodiment
  • FIG. 2 is a schematic diagram of a projection model of an image processing method in a billiard game in an embodiment
  • FIG. 3 is a schematic diagram of a specific implementation process of step S102 in an embodiment
  • step S102 is a schematic diagram of another specific implementation process of step S102 in an embodiment
  • Figure 5-A is a schematic view of a connected region formed by overlapping three elliptical regions in one embodiment
  • Figure 5-B is a schematic view of a connected region formed by an elliptical region in an embodiment
  • FIG. 5-C is a schematic diagram showing an extraction result of a connected region formed by overlapping three elliptical regions in one embodiment
  • Figure 5-D is a schematic diagram showing an intermediate process of extracting a connected region formed by overlapping three elliptical regions in one embodiment
  • step S304 is a schematic diagram of a specific implementation process of step S304 in an embodiment
  • FIG. 7 is a structural block diagram of a terminal device in an embodiment
  • Figure 8 is a schematic illustration of an image processing apparatus in a billiard game in one embodiment.
  • the term “if” can be interpreted as “when” or “on” or “in response to determining” or “in response to detecting” depending on the context.
  • the phrase “if determined” or “if detected [condition or event described]” may be interpreted in context to mean “once determined” or “in response to determining” or “once detected [condition or event described] ] or “in response to detecting [conditions or events described]”.
  • FIG. 1 is a schematic flow chart showing an implementation of an image processing method in a billiard game provided by Embodiment 1 of the present invention. As shown in FIG. 1 , the image processing method in the billiard game may specifically include the following steps:
  • Step S101 Collecting video information of the billiard table including the billiard table and the billiard on the countertop by the photographing device.
  • the camera device may be a camera, and the camera refers to a device that can collect video or image sequences, and may be an industrial camera, a web camera, a surveillance camera, a camera equipped with the computer itself, and the like.
  • Step S102 analyzing the video information based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
  • the projection model is shown in Fig. 2.
  • the cone with the camera's optical center as the apex and tangent to the ball is constructed.
  • the section cut by the plane of the table (the projection of the billiard on the plane) is an ellipse, which is the image of the ball.
  • the shape presented in is that the physical size of the billiards is fixed, and since the ball is always tangent to the plane of the table, the position of the billiards and the vertical projection point of the center of the sphere are mutually determined.
  • the elliptical position ie, the elliptical center position
  • the elliptical shape including the long axis length, the short axis length, and the long axis direction
  • the position information and ellipse shape of the billiards can be derived.
  • the above position and length may be based on the physical coordinates of the table, or may be based on image coordinates, or normalized coordinates, and the like. It should be noted that the ideal situation in which the main optical axis of the camera is perpendicular to the mesa is shown in FIG. 2. In fact, even if the main optical axis is not perpendicular to the mesa, the ball is still elliptical in the image, and the above parameters can still be derived from each other.
  • the elliptical position i.e., the position of the elliptical center point
  • the billiard position and the elliptical shape can be derived.
  • One implementation is:
  • the long side of the mesa is the X-axis direction
  • the wide side of the mesa is the Y-axis. If the optical center of the camera is located directly above the center of the table and the distance from the table h, the coordinates are (0, 0, h).
  • the forward process of billiard projection is: know h, x, y, r, find x', y', a, b, ⁇ .
  • This is easily done by establishing a cone equation and solving the joint equation of the cone and the plane.
  • the actual need is to know h, x', y', r, find x, y, a, b, ⁇ .
  • This requires x, y as the quantity to be quantified, and also establishes the cone equation and solves the joint equation of the cone and the plane, which can be used to find x, y.
  • the above is an implementation of comparative specifications, there are actually many alternatives, not enumerated.
  • the video information includes distribution information of an elliptical area corresponding to each billiard on a table surface
  • analyzing the video information based on the constructed projection model including the shooting device and the billiard position, and obtaining the position information of the billiard includes the following steps:
  • Step S201 detecting an elliptical region that conforms to the projection model from the distribution information.
  • the distribution information may be a distribution of elliptical regions on the mesa, and may be: there is no overlapping region between all elliptical regions, that is, all elliptical regions are independent; or: at least one elliptical region is independent There are overlaps between two or more elliptical regions; it may also be that all elliptical regions are not independent, that is, for any ellipse, at least overlap with its adjacent elliptical region.
  • the overlapping regions generally refer to partial overlap.
  • Detecting an elliptical region conforming to the projection model from the distribution information, and also detecting an elliptical contour conforming to the projection model for example, directly applying a Hough transform (Hough) Transform) or the random sample consensus (RANSAC) method, which directly detects all ellipse that conforms to the (x', y', a, b, ⁇ ) constraint from the distribution information.
  • Hough transform Hough transform
  • RBSAC random sample consensus
  • the elliptical region is solid (the region surrounded by the curve), the elliptical contour is hollow (closed curve), and if the "ellipse" is mentioned, the elliptical region or the elliptical contour is included, which can be understood according to the context. . It can be understood that the elliptical region includes an elliptical contour of the elliptical region. Therefore, the detection may be performed by first detecting an elliptical region and further detecting an elliptical contour conforming to the projection model; or, first detecting an ellipse of the elliptical region.
  • the contour which further detects the elliptical region that conforms to the projection model, does not limit the scope of protection of the embodiments of the present invention.
  • Step S202 Calculate the spatial geometric position relationship of the elliptical region corresponding to the billiard in the shooting model according to the shooting device, the billiards, and the position information of the ellipse region that matches the projection model.
  • analyzing the video information based on the constructed projection model including the photographing device and the billiard position, and obtaining the position information of the billiard includes the following steps:
  • Step S301 dividing the video information into a plurality of frames.
  • a frame is a single image frame of the smallest unit of video information.
  • One frame is a still picture, and successive frames form an animation.
  • the video information is divided into a plurality of frames, that is, divided into a plurality of pictures, each of which constitutes one picture.
  • Step S302 Segment the elliptical area and the mesa area corresponding to the billiard in each of the plurality of frames based on the projection model.
  • the elliptical area corresponding to the billiard is projected on the plane where the table top is located, wherein since the mesa is substantially unchanged, the frame may be used in each of the plurality of frames based on the projection model.
  • the ellipse area and the mesa area corresponding to the billiards are divided to obtain all the elliptical areas.
  • Step S303 Divide the set of the elliptical regions into a plurality of connected regions.
  • the area shown in FIG. 5-A is a connected area formed by overlapping three elliptical areas. It can be understood that the area shown in FIG. 5-B is a connected area formed by an elliptical area.
  • Step S304 Acquire location information of the connected area, and use position information of each of the plurality of connected areas as position information of billiards corresponding to the respective elliptical areas.
  • Step S304 includes two situations:
  • the first case can be implemented as follows.
  • Obtaining the location information of the connected area, and the location information of each of the plurality of connected areas as the location information of the billiard corresponding to each of the elliptical areas respectively includes:
  • the elliptical area is divided into non-overlapping areas.
  • the result of extracting the connected area shown in FIG. 5-A is as shown in FIG. 5-C.
  • the following implementation manner converting the image in the video information into a grayscale image to fix a threshold (such as 200) or an adaptive threshold (such as using the previous tracking result to know that there are n balls on the mesa, then the gray level of all pixels is high
  • the image is binarized to the lower 20th nth gray value as a threshold value, and is divided into an elliptical region and a mesa region, and each connected region of the elliptical region corresponds to one billiard.
  • the billiards of whatever color are used have the characteristics of a highlight area at the center position, and the highlight areas of adjacent billiards do not overlap.
  • each connected area is either an elliptical area of a single billiard or an adjoining number of elliptical areas.
  • the shape parameter of the elliptical region is related to the elliptical position, but is approximately unchanged in a connected region.
  • the projection model is established by taking the central position of the connected region as the elliptical position, and the elliptical shape thus obtained is pixelated, and the morphological corrosion is performed on the connected region by using it as a template. After etching, several small connected regions are obtained, and each small connected region corresponds to one. Billiards, the position information of each small connected area is used as the position information of the corresponding billiards. It should be noted that, therefore, the present embodiment can implement the blurring processing on the connected area, that is, it is not necessary to divide and connect the connected areas in which the elliptical areas overlap, and the processing efficiency is high.
  • acquiring location information of the connected area, and using location information of each of the plurality of connected areas as The location information of the billiard corresponding to each ellipse area may include:
  • Step S401 Acquire an area size of the connected area.
  • Step S402 Matching the area size with a preset threshold to obtain a matching result.
  • the elliptical model is established as the elliptical position of the connected region, that is, the shape parameter is determined.
  • the number of ellipse in the connected region is calculated, and then m elliptical center positions are calculated for the connected region, thereby determining m ellipse of the shape parameter, the union of the m elliptical coverage areas is required to be the entire connected area, and the inscribed circles of the m ellipse do not overlap each other. If the number m and m center positions above cannot be calculated, all the possibilities can be exhausted, and then the matching result that meets the requirements can be selected.
  • Step S403 extracting, from the connected region, a plurality of circles that do not overlap each other based on the matching result, and each circle corresponds to a circumscribed ellipse that conforms to the projection model and is circumscribed to the circle, and the circumscribed ellipse occupies The union of the regions is the connected region; the position information of the plurality of circles that do not overlap each other is converted into position information of the billiards.
  • FIG. 5-D the result of extracting the connected regions shown in FIG. 5-A is as shown in FIG. 5-D.
  • the positional information of each of the independent regions is obtained by dividing the connected region in which the overlapping region exists into a plurality of circles that do not overlap each other, that is, the coordinates obtained by performing coordinate transformation on the center of the inscribed circle The coordinates of the vertical projection point of the billiard.
  • the relative position before the billiards is not the absolute position of each billiard, so the approximation process does not affect the accuracy of the billiard position information, but improves the processing efficiency. The algorithm was optimized.
  • the video information of the billiard table and the billiard on the countertop is collected by the photographing device; the video information is analyzed based on the constructed projection model including the photographing device and the billiard position, and the billiard is obtained.
  • Position information wherein the video information includes an image in which the billiard shape is an ellipse.
  • the billiard shape is an ellipse, and the position information of the billiard in the image of the video information is obtained based on the projection model, thereby improving the accuracy of the position information.
  • the implementation process of the embodiment of the present invention is simple, and has strong practicability and ease of use.
  • FIG. 7 is a structural block diagram of an image processing apparatus in a billiard game provided by Embodiment 2 of the present invention.
  • the image processing device 70 in the billiard game includes an acquisition module 71 and an analysis module 72. Among them, the specific functions of each module are as follows:
  • the collecting module 71 is configured to collect video information of a billboard including a billiard table and a billiard on the counter by the photographing device;
  • the analysis module 72 is configured to analyze the video information based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
  • the video information includes distribution information of an elliptical area corresponding to each billiard on a table surface;
  • the analysis module 72 includes:
  • a detecting unit configured to detect, from the distribution information, an elliptical region that conforms to the projection model
  • a calculating unit configured to calculate, according to the spatial geometric position relationship of the elliptical region corresponding to the billiard in the shooting device, the billiard, and the distribution information in the projection model, based on the position information of the elliptical region that conforms to the projection model The location information of the billiard to which the ellipse area belongs is obtained.
  • the analyzing module 72 includes:
  • a first dividing unit configured to divide the video information into multiple frames
  • a segmentation unit configured to segment an elliptical region and a mesa region corresponding to billiards in each of the plurality of frames based on the projection model
  • a second dividing unit configured to divide the set of the elliptical regions into a plurality of connected regions
  • an acquiring unit configured to acquire location information of the connected area, and use location information of each of the plurality of connected areas as position information of billiards corresponding to the respective elliptical areas.
  • the obtaining unit includes:
  • the sub-unit is configured to divide the connected area into independent areas, obtain location information of each of the independent areas, and use location information of the independent area as location information of billiards corresponding to the independent area.
  • the dividing subunit includes:
  • a matching subunit configured to match the area size with a preset threshold to obtain a matching result
  • Extracting a subunit configured to extract, from the connected region, a plurality of circles that do not overlap each other based on the matching result, each circle corresponding to a circumscribed ellipse that conforms to the projection model and is circumscribed to the circle, the outer
  • the merged area of the cut ellipse occupying area is the connected area; the position information of the plurality of circles not overlapping each other is converted into position information of the billiard.
  • the video information of the billiard table and the billiard on the countertop is collected by the photographing device; the video information is analyzed based on the constructed projection model including the photographing device and the billiard position, and the billiard is obtained.
  • Position information wherein the video information includes an image in which the billiard shape is an ellipse.
  • the billiard shape is an ellipse, and the position information of the billiard in the image of the video information is obtained based on the projection model, thereby improving the accuracy of the position information.
  • the implementation process of the embodiment of the present invention is simple, and has strong practicability and ease of use.
  • FIG. 8 is a schematic diagram of a terminal device according to Embodiment 3 of the present invention.
  • the terminal device 8 of this embodiment includes a processor 80, a memory 81, and a computer program 82 stored in the memory 81 and operable on the processor 80, such as an image in a billiard game. Processing method.
  • the processor 80 executes the computer program 82, the steps in the embodiment of the image processing method in each of the above billiard games are implemented, for example, steps S101 to S102 shown in FIG.
  • the processor 80 executes the computer program 82, the functions of the modules in the above various device embodiments are implemented, such as the functions of the modules 81 to 82 shown in FIG.
  • the computer program 82 can be partitioned into one or more modules/units that are stored in the memory 81 and executed by the processor 80 to complete this invention.
  • the one or more modules/units may be a series of computer program instruction segments capable of performing a particular function, the instruction segments being used to describe the execution of the computer program 82 in the terminal device 8.
  • the computer program 82 can be divided into an acquisition module and an analysis module, and the specific functions of each module are as follows:
  • An acquisition module configured to collect video information of a billboard including a billiard table and a billiard on the counter by a photographing device;
  • the analysis module is configured to analyze the video information based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
  • the terminal device 8 may be a computing device such as a desktop computer, a notebook, a palmtop computer, or a cloud server.
  • the terminal device may include, but is not limited to, a processor 80 and a memory 81. It will be understood by those skilled in the art that FIG. 8 is merely an example of a terminal device, and does not constitute a limitation of the terminal device, and may include more or less components than those illustrated, or combine some components, or different components, such as
  • the terminal device may further include an input/output device, a network access device, a bus, and the like.
  • the so-called processor 80 can be a central processing unit (Central Processing Unit, CPU), can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the memory 81 may be an internal storage unit of the terminal device 8, such as a hard disk or a memory of the terminal device 8.
  • the memory 81 may also be an external storage device of the terminal device 8, for example, a plug-in hard disk provided on the terminal device 8, a smart memory card (SMC), and a secure digital (SD). Card, flash card (Flash Card) and so on.
  • the memory 81 may also include both an internal storage unit of the terminal device 8 and an external storage device.
  • the memory 81 is used to store the computer program and other programs and data required by the terminal device.
  • the memory 81 can also be used to temporarily store data that has been output or is about to be output.
  • each functional unit and module described above is exemplified. In practical applications, the above functions may be assigned to different functional units as needed.
  • the module is completed by dividing the internal structure of the device into different functional units or modules to perform all or part of the functions described above.
  • Each functional unit and module in the embodiment may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the integrated unit may be hardware.
  • Formal implementation can also be implemented in the form of software functional units.
  • the specific names of the respective functional units and modules are only for the purpose of facilitating mutual differentiation, and are not intended to limit the scope of protection of the present application.
  • For the specific working process of the unit and the module in the foregoing system reference may be made to the corresponding process in the foregoing method embodiment, and details are not described herein again.
  • the disclosed apparatus/terminal device and method may be implemented in other manners.
  • the device/terminal device embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division.
  • there may be another division manner for example, multiple units.
  • components may be combined or integrated into another system, or some features may be omitted or not performed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in electrical, mechanical or other form.
  • the units described as being separated into separate components may or may not be physically separated, and the components converted to the unit display may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. on. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated modules/units if implemented in the form of software functional units and converted to separate products for sale or use, may be stored in a computer readable storage medium.
  • the present invention implements all or part of the processes in the foregoing embodiments, and may also be completed by a computer program to instruct related hardware.
  • the computer program may be stored in a computer readable storage medium.
  • the steps of the various method embodiments described above may be implemented when the program is executed by the processor.
  • the computer program comprises computer program code, which may be in the form of source code, object code form, executable file or some intermediate form.
  • the computer readable medium can include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard drive, a magnetic disk, an optical disk, a computer memory, a read only memory (ROM, Read-Only) Memory), random access memory (RAM, Random) Access Memory), electrical carrier signals, telecommunications signals, and software distribution media.
  • ROM Read Only memory
  • RAM Random Access Memory

Abstract

Provided are a method and apparatus for image processing in a billiards game, and a terminal device. The method is applied to a system including a photographing apparatus, and comprises: collecting video information including a table top of a billiards table and billiards balls on the table top by means of a photographing apparatus (101); and analyzing the video information based on a constructed projection model including the photographing apparatus and billiards ball positions to obtain position information of the billiards balls, wherein the billiards balls in an image included in the video information are elliptical in shape (102). In the method, billiards balls in an image included in video information are elliptical in shape, and position information of the billiards balls in the image in the video information is obtained based on a projection model, so that the accuracy of position information is improved. In addition, the method is simple to implement and has greater practicability and usability.

Description

一种台球比赛中的图像处理方法、装置及终端设备Image processing method, device and terminal device in billiard game 技术领域Technical field
本发明涉及机器视觉识别技术领域,特别是涉及一种台球比赛中的图像处理方法、装置及终端设备。The invention relates to the field of machine vision recognition technology, in particular to an image processing method, device and terminal device in a billiard game.
背景技术Background technique
近年机器视觉开始应用在台球比赛的电子计分上。现有的实现方式如下:通过拍摄装置对台球比赛的视频进行采集,然后通过建立的模型获取台球桌台面上台球的位置信息,再进行后续操作实现电子计分。因此,获取台球桌台面上台球的位置信息是关键的一个步骤。In recent years, machine vision has begun to be applied to electronic scoring of billiard games. The existing implementation manner is as follows: the video of the billiard game is collected by the photographing device, and then the position information of the billiards on the billiard table surface is obtained through the established model, and then the subsequent operation is performed to realize electronic scoring. Therefore, obtaining the location information of billiards on the billiard table is a key step.
技术问题technical problem
然而,现有的模型中将台球视为圆形,再对台球进行定位以获取台球的位置信息。并且,由于拍摄装置距离台球桌的台面的高度是有限的,因此以拍摄装置为视觉源,看到的球(除非位于正对中心的位置)的形状并非圆形,因此将台球视为圆形必然造成获取到的台球位置信息存在较大误差甚至错误。However, in the existing model, the billiards are regarded as a circle, and then the billiards are positioned to obtain the position information of the billiards. Moreover, since the height of the camera from the table of the billiard table is limited, the ball is seen as a visual source, and the shape of the ball (unless located at the center of the center) is not circular, so the billiard is regarded as a circle. Inevitably, there is a large error or even an error in the obtained billiard position information.
技术解决方案Technical solution
有鉴于此,本发明实施例提供了一种台球比赛中的图像处理方法及装置,以解决现有技术中台球比赛中的图像处理方法存在的问题。In view of this, an embodiment of the present invention provides an image processing method and apparatus in a billiard game to solve the problem of the image processing method in the billiard game in the prior art.
本发明实施例的第一方面提供了一种台球比赛中的图像处理方法,应用于包含拍摄装置的系统,所述图像处理方法包括:A first aspect of the embodiments of the present invention provides an image processing method in a billiard game, which is applied to a system including a photographing apparatus, and the image processing method includes:
通过所述拍摄装置采集包含台球桌的台面及台面上的台球的视频信息;Collecting, by the photographing device, video information of a billboard including a billiard table and a billiard on the countertop;
基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息;所述视频信息包含的图像中台球形状为椭圆。The video information is analyzed based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
可选地,所述视频信息包括各个台球对应的椭圆区域在台面上的分布信息;Optionally, the video information includes distribution information of an elliptical area corresponding to each billiard on a table surface;
基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息包括:The video information is analyzed based on the constructed projection model including the shooting device and the billiard position, and the position information of the billiard is obtained:
从所述分布信息中检测出符合所述投射模型的椭圆区域;An elliptical region conforming to the projection model is detected from the distribution information;
根据所述投射模型中所述拍摄装置、台球以及所述分布信息中台球对应的椭圆区域的空间几何位置关系,基于所述符合所述投射模型的椭圆区域的位置信息,计算得到该椭圆区域所属的台球的位置信息。Determining, according to the spatial geometric position relationship of the elliptical region corresponding to the billiard in the shooting model, the positional information of the elliptical region conforming to the projection model, and calculating the elliptical region The location information of the billiards.
可选地,基于构建的包括所述拍摄装置、台球位置的投射模型对从所述视频信息进行分析,得到台球的位置信息包括:Optionally, analyzing, according to the constructed projection model including the shooting device and the billiard position, the position information of the billiards from the video information includes:
将所述视频信息划分为多个帧;Dividing the video information into a plurality of frames;
基于所述投射模型,将所述多个帧中每个帧中的台球对应的椭圆区域和台面区域进行分割;And dividing, according to the projection model, an elliptical area and a mesa area corresponding to billiards in each of the plurality of frames;
将所述椭圆区域的集合划分为多个连通区域;Dividing the set of elliptical regions into a plurality of connected regions;
获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息。Obtaining location information of the connected area, and using position information of each of the plurality of connected areas as position information of billiards corresponding to the respective elliptical areas.
可选地,获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息包括:Optionally, the location information of the connected area is obtained, and the location information of each of the plurality of connected areas is used as the location information of the billiard corresponding to each of the elliptical areas.
将所述连通区域划分为独立区域,获取所述每个独立区域的位置信息,并将所述独立区域的位置信息分别作为与所述独立区域对应的台球的位置信息。Dividing the connected area into independent areas, acquiring location information of each of the independent areas, and using the location information of the independent area as location information of billiards corresponding to the independent area.
可选地,获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息包括:Optionally, the location information of the connected area is obtained, and the location information of each of the plurality of connected areas is used as the location information of the billiard corresponding to each of the elliptical areas.
获取连通区域的面积大小;Obtain the area size of the connected area;
将所述面积大小与预设的阈值进行匹配获得匹配结果;Matching the area size with a preset threshold to obtain a matching result;
基于所述匹配结果从连通区域中提取出多个彼此不重叠的圆,每个圆都对应一个符合所述投射模型且外切于该圆的外切椭圆,所述外切椭圆占据区域的并集为所述连通区域。Extracting, from the connected region, a plurality of circles that do not overlap each other based on the matching result, each circle corresponding to a circumscribed ellipse conforming to the projection model and circumscribed to the circle, the circumscribed ellipse occupying the region The set is the connected area.
本发明实施例的第二方面提供了一种台球比赛中的图像处理装置,包括:A second aspect of the present invention provides an image processing apparatus in a billiard game, including:
采集模块,用于通过拍摄装置采集包含台球桌的台面及台面上的台球的视频信息;An acquisition module, configured to collect video information of a billboard including a billiard table and a billiard on the counter by a photographing device;
分析模块,用于基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息;所述视频信息包含的图像中台球形状为椭圆。The analysis module is configured to analyze the video information based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
可选地,所述视频信息包括各个台球对应的椭圆区域在台面上的分布信息;Optionally, the video information includes distribution information of an elliptical area corresponding to each billiard on a table surface;
所述分析模块包括:The analysis module includes:
检测单元,用于从所述分布信息中检测出符合所述投射模型的椭圆区域;a detecting unit, configured to detect, from the distribution information, an elliptical region that conforms to the projection model;
计算单元,用于根据所述投射模型中所述拍摄装置、台球以及所述分布信息中台球对应的椭圆区域的空间几何位置关系,基于所述符合所述投射模型的椭圆区域的位置信息,计算得到该椭圆区域所属的台球的位置信息。a calculating unit, configured to calculate, according to the spatial geometric position relationship of the elliptical region corresponding to the billiard in the shooting device, the billiard, and the distribution information in the projection model, based on the position information of the elliptical region that conforms to the projection model The location information of the billiard to which the ellipse area belongs is obtained.
可选地,所述分析模块包括:Optionally, the analyzing module includes:
第一划分单元,用于将所述视频信息划分为多个帧;a first dividing unit, configured to divide the video information into multiple frames;
分割单元,用于基于所述投射模型,将所述多个帧中每个帧中的台球对应的椭圆区域和台面区域进行分割;a segmentation unit, configured to segment an elliptical region and a mesa region corresponding to billiards in each of the plurality of frames based on the projection model;
第二划分单元,用于将所述椭圆区域的集合划分为多个连通区域;a second dividing unit, configured to divide the set of the elliptical regions into a plurality of connected regions;
获取单元,用于获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息。And an acquiring unit, configured to acquire location information of the connected area, and use location information of each of the plurality of connected areas as position information of billiards corresponding to the respective elliptical areas.
可选地,所述获取单元包括:Optionally, the obtaining unit includes:
划分子单元,用于将所述连通区域划分为独立区域,获取所述每个独立区域的位置信息,并将所述独立区域的位置信息分别作为与所述独立区域对应的台球的位置信息。The sub-unit is configured to divide the connected area into independent areas, obtain location information of each of the independent areas, and use location information of the independent area as location information of billiards corresponding to the independent area.
可选地,所述获取单元包括:Optionally, the obtaining unit includes:
获取子单元,用于获取连通区域的面积大小;Obtaining a subunit for obtaining an area size of the connected area;
匹配子单元,用于将所述面积大小与预设的阈值进行匹配获得匹配结果;a matching subunit, configured to match the area size with a preset threshold to obtain a matching result;
提取子单元,用于基于所述匹配结果从连通区域中提取出多个彼此不重叠的圆,每个圆都对应一个符合所述投射模型且外切于该圆的外切椭圆,所述外切椭圆占据区域的并集为所述连通区域;将所述多个彼此不重叠的圆的位置信息转化为台球的位置信息。Extracting a subunit, configured to extract, from the connected region, a plurality of circles that do not overlap each other based on the matching result, each circle corresponding to a circumscribed ellipse that conforms to the projection model and is circumscribed to the circle, the outer The merged area of the cut ellipse occupying area is the connected area; the position information of the plurality of circles not overlapping each other is converted into position information of the billiard.
本发明实施例的第三方面提供了一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现第一方面中方法的步骤。A third aspect of an embodiment of the present invention provides a terminal device including a memory, a processor, and a computer program stored in the memory and operable on the processor, wherein the processor executes the The steps of the method of the first aspect are implemented when the computer program is described.
本发明实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现第一方面中方法的步骤。A fourth aspect of the embodiments of the present invention provides a computer readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the method of the first aspect step.
有益效果Beneficial effect
实施本发明实施例,将具有如下有益效果:Implementation of the embodiments of the present invention will have the following beneficial effects:
在本发明实施例中,通过拍摄装置采集包含台球桌的台面及台面上的台球的视频信息;基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息,所述视频信息包含的图像中台球形状为椭圆。本发明实施例视频信息包含的图像中台球形状为椭圆,基于投射模型得到视频信息的图像中台球的位置信息,提高了位置信息的准确度。另外,本发明实施例的实现过程简单,具有较强的实用性和易用性。In the embodiment of the present invention, the video information of the billiard table and the billiard on the countertop is collected by the photographing device; the video information is analyzed based on the constructed projection model including the photographing device and the billiard position, and the billiard is obtained. Position information, wherein the video information includes an image in which the billiard shape is an ellipse. In the image included in the video information of the embodiment of the present invention, the billiard shape is an ellipse, and the position information of the billiard in the image of the video information is obtained based on the projection model, thereby improving the accuracy of the position information. In addition, the implementation process of the embodiment of the present invention is simple, and has strong practicability and ease of use.
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any creative work.
其中:among them:
图1是一个实施例中台球比赛中的图像处理方法的实现流程示意图;1 is a schematic flow chart showing an implementation of an image processing method in a billiard game in an embodiment;
图2是一个实施例中台球比赛中的图像处理方法的投射模型的示意图;2 is a schematic diagram of a projection model of an image processing method in a billiard game in an embodiment;
图3是一个实施例中步骤S102的具体实现流程示意图;FIG. 3 is a schematic diagram of a specific implementation process of step S102 in an embodiment;
图4是一个实施例中步骤S102的另一具体实现流程示意图;4 is a schematic diagram of another specific implementation process of step S102 in an embodiment;
图5-A是一个实施例中三个椭圆区域重叠后构成的连通区域的示意图;Figure 5-A is a schematic view of a connected region formed by overlapping three elliptical regions in one embodiment;
图5-B是一个实施例中一个椭圆区域构成的连通区域的示意图;Figure 5-B is a schematic view of a connected region formed by an elliptical region in an embodiment;
图5-C是一个实施例中对三个椭圆区域重叠后构成的连通区域的提取结果的示意图;FIG. 5-C is a schematic diagram showing an extraction result of a connected region formed by overlapping three elliptical regions in one embodiment; FIG.
图5-D是一个实施例中对三个椭圆区域重叠后构成的连通区域的提取的中间过程的示意图;Figure 5-D is a schematic diagram showing an intermediate process of extracting a connected region formed by overlapping three elliptical regions in one embodiment;
图6是一个实施例中步骤S304的具体实现流程示意图;6 is a schematic diagram of a specific implementation process of step S304 in an embodiment;
图7是一个实施例中终端设备的结构框图;7 is a structural block diagram of a terminal device in an embodiment;
图8是一个实施例中台球比赛中的图像处理装置的示意图。Figure 8 is a schematic illustration of an image processing apparatus in a billiard game in one embodiment.
本发明的实施方式Embodiments of the invention
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本发明实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本发明。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本发明的描述。In the following description, for purposes of illustration and description However, it will be apparent to those skilled in the art that the present invention may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the invention.
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。The term "comprising", when used in the specification and the claims of the claims The existence or addition of , whole, steps, operations, elements, components, and/or collections thereof.
还应当理解,在此本发明说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本发明。如在本发明说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It is also to be understood that the terminology of the present invention is to be construed as a The singular forms "", ",",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
还应当进一步理解,在本发明说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It is further understood that the term "and/or" used in the description of the invention and the appended claims means any combination and all possible combinations of one or more of the associated listed items, .
如在本说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当……时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "on" or "in response to determining" or "in response to detecting" depending on the context. Similarly, the phrase "if determined" or "if detected [condition or event described]" may be interpreted in context to mean "once determined" or "in response to determining" or "once detected [condition or event described] ] or "in response to detecting [conditions or events described]".
为了说明本发明所述的技术方案,下面通过具体实施例来进行说明。需要说明的是,以下实施例应用于包含拍摄装置的系统。In order to explain the technical solution described in the present invention, the following description will be made by way of specific embodiments. It should be noted that the following embodiments are applied to a system including a photographing device.
实施例一Embodiment 1
图1示出了本发明实施例一提供的台球比赛中的图像处理方法的实现流程示意图。如图1所示,该台球比赛中的图像处理方法具体可以包括如下步骤:1 is a schematic flow chart showing an implementation of an image processing method in a billiard game provided by Embodiment 1 of the present invention. As shown in FIG. 1 , the image processing method in the billiard game may specifically include the following steps:
步骤S101:通过所述拍摄装置采集包含台球桌的台面及台面上的台球的视频信息。Step S101: Collecting video information of the billiard table including the billiard table and the billiard on the countertop by the photographing device.
其中,拍摄装置可以是摄像头,摄像头泛指可以采集视频或者图像序列的设备,可以是工业相机、网络摄像头、监控摄像头、计算机自身配备的摄像头等。The camera device may be a camera, and the camera refers to a device that can collect video or image sequences, and may be an industrial camera, a web camera, a surveillance camera, a camera equipped with the computer itself, and the like.
步骤S102:基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息;所述视频信息包含的图像中台球形状为椭圆。Step S102: analyzing the video information based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
投射模型如图2所示,构造以摄像头光心为顶点并与球相切的圆锥,它被台面所在平面所截的截面(即台球在该平面的投影)为椭圆,这正是球在图像中呈现的形状。显而易见的前提是,台球的物理尺寸是固定的,而且由于正常情况下球总是与台面所在平面相切,因此台球位置与球心在台面的竖直投影点相互决定。这时,在已知台球位置的情况下,可以计算出椭圆位置(即椭圆中心位置)和椭圆形状(包括长轴长度、短轴长度、长轴方向);反过来,在已知椭圆位置的情况下,可以推导出台球的位置信息和椭圆形状。上述位置和长度可以是基于台面物理坐标,也可以基于图像坐标,或者归一化坐标等。需要说明的是,图2中展示的是摄像头主光轴与台面垂直的理想情况,事实上即使主光轴与台面不垂直,球在图像中仍然呈椭圆,且上述参数仍然可以相互推导。The projection model is shown in Fig. 2. The cone with the camera's optical center as the apex and tangent to the ball is constructed. The section cut by the plane of the table (the projection of the billiard on the plane) is an ellipse, which is the image of the ball. The shape presented in . The obvious premise is that the physical size of the billiards is fixed, and since the ball is always tangent to the plane of the table, the position of the billiards and the vertical projection point of the center of the sphere are mutually determined. At this time, in the case where the billiard position is known, the elliptical position (ie, the elliptical center position) and the elliptical shape (including the long axis length, the short axis length, and the long axis direction) can be calculated; conversely, at the known elliptical position In this case, the position information and ellipse shape of the billiards can be derived. The above position and length may be based on the physical coordinates of the table, or may be based on image coordinates, or normalized coordinates, and the like. It should be noted that the ideal situation in which the main optical axis of the camera is perpendicular to the mesa is shown in FIG. 2. In fact, even if the main optical axis is not perpendicular to the mesa, the ball is still elliptical in the image, and the above parameters can still be derived from each other.
前面提到,已知椭圆位置(即椭圆中心点位置),可以推导出台球位置和椭圆形状(包括长轴长度、短轴长度、长轴方向)。一种实施方式是:As mentioned above, the elliptical position (i.e., the position of the elliptical center point) is known, and the billiard position and the elliptical shape (including the long axis length, the short axis length, and the long axis direction) can be derived. One implementation is:
以台面中心为原点,台面为Z=0平面,台面长边方向为X轴方向,台面宽边方向为Y轴方向建立坐标系。设摄像头光心位于台面中心正上方且距离台面h,则其坐标为(0,0,h)。设台球位置为(x,y),其半径已知为r,且默认放置于台面上,则其球心坐标为(x,y,r)。以顶点为(0,0,h),做一个与球心为(x,y,r)半径为r的球相切的圆锥,与Z=0平面相交,得到的椭圆即为投影椭圆,设其中心为(x',y'),长轴长度为a,短轴长度为b,长轴方向为θ。Taking the center of the mesa as the origin, the mesa is the Z=0 plane, the long side of the mesa is the X-axis direction, and the wide side of the mesa is the Y-axis. If the optical center of the camera is located directly above the center of the table and the distance from the table h, the coordinates are (0, 0, h). Set the billiard position to (x, y), its radius is known as r, and by default placed on the table, its spherical coordinates are (x, y, r). Let the vertices be (0,0,h) and make a cone tangent to the sphere whose sphere is (x,y,r) radius r, intersect with the Z=0 plane, and the obtained ellipse is the projection ellipse. Its center is (x', y'), the length of the major axis is a, the length of the minor axis is b, and the direction of the major axis is θ.
台球投影的正向过程是:已知h, x, y, r,求x',y',a,b,θ。这通过建立圆锥方程并求解圆锥与平面的联合方程是很容易做到的。反过来,实际需要是已知h, x', y', r,求x,y,a,b,θ。这需要将x,y作为待定量,同样建立圆锥方程并求解圆锥与平面的联合方程,可以反过来求出x,y。以上是比较规范的一种实现方式,实际还有很多替代方式,不一一列举。The forward process of billiard projection is: know h, x, y, r, find x', y', a, b, θ. This is easily done by establishing a cone equation and solving the joint equation of the cone and the plane. In turn, the actual need is to know h, x', y', r, find x, y, a, b, θ. This requires x, y as the quantity to be quantified, and also establishes the cone equation and solves the joint equation of the cone and the plane, which can be used to find x, y. The above is an implementation of comparative specifications, there are actually many alternatives, not enumerated.
作为本实施例的一个优选实施例,所述视频信息包括各个台球对应的椭圆区域在台面上的分布信息;As a preferred embodiment of the present embodiment, the video information includes distribution information of an elliptical area corresponding to each billiard on a table surface;
如图3所示,基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息包括如下步骤:As shown in FIG. 3, analyzing the video information based on the constructed projection model including the shooting device and the billiard position, and obtaining the position information of the billiard includes the following steps:
步骤S201:从所述分布信息中检测出符合所述投射模型的椭圆区域。Step S201: detecting an elliptical region that conforms to the projection model from the distribution information.
其中,分布信息可以是椭圆区域在台面上的分布情况,可以是:所有的椭圆区域之间都不存在重叠区域,即所有的椭圆区域是独立的;也可以是:至少一个椭圆区域是独立的,两个或者两个以上的椭圆区域存在重叠;还可以是:所有的椭圆区域都不是独立的,即对于任何一个椭圆,至少与其相邻的椭圆区域重叠。其中,上述重叠区域一般指部分重叠。从分布信息中检测出符合所述投射模型的椭圆区域,还可以是检测符合所述投射模型的椭圆轮廓,例如,直接应用霍夫变换(Hough Transform)或者随机抽样一致算法(random sample consensus,RANSAC)方法,直接从分布信息中检测出所有符合(x',y',a,b,θ)约束的椭圆。Wherein, the distribution information may be a distribution of elliptical regions on the mesa, and may be: there is no overlapping region between all elliptical regions, that is, all elliptical regions are independent; or: at least one elliptical region is independent There are overlaps between two or more elliptical regions; it may also be that all elliptical regions are not independent, that is, for any ellipse, at least overlap with its adjacent elliptical region. Wherein, the overlapping regions generally refer to partial overlap. Detecting an elliptical region conforming to the projection model from the distribution information, and also detecting an elliptical contour conforming to the projection model, for example, directly applying a Hough transform (Hough) Transform) or the random sample consensus (RANSAC) method, which directly detects all ellipse that conforms to the (x', y', a, b, θ) constraint from the distribution information.
需要说明的是,椭圆区域是实心的(曲线包围的区域),椭圆轮廓是空心的(封闭曲线),如果提到“椭圆”则包括椭圆区域或者椭圆轮廓这两种情况,可根据上下文进行理解。可以理解的是,椭圆区域包括该椭圆区域的椭圆轮廓,因此上述检测的实现方法还可以是先检测椭圆区域,再进一步检测出符合所述投射模型的椭圆轮廓;或者,先检测椭圆区域的椭圆轮廓,再进一步检测符合所述投射模型的椭圆区域,在此并不限制本发明实施例的保护范围。It should be noted that the elliptical region is solid (the region surrounded by the curve), the elliptical contour is hollow (closed curve), and if the "ellipse" is mentioned, the elliptical region or the elliptical contour is included, which can be understood according to the context. . It can be understood that the elliptical region includes an elliptical contour of the elliptical region. Therefore, the detection may be performed by first detecting an elliptical region and further detecting an elliptical contour conforming to the projection model; or, first detecting an ellipse of the elliptical region. The contour, which further detects the elliptical region that conforms to the projection model, does not limit the scope of protection of the embodiments of the present invention.
步骤S202:根据所述投射模型中所述拍摄装置、台球以及所述分布信息中台球对应的椭圆区域的空间几何位置关系,基于所述符合所述投射模型的椭圆区域的位置信息,计算得到该椭圆区域所属的台球的位置信息。Step S202: Calculate the spatial geometric position relationship of the elliptical region corresponding to the billiard in the shooting model according to the shooting device, the billiards, and the position information of the ellipse region that matches the projection model. The location information of the billiards to which the ellipse area belongs.
作为本实施例的另一个优选实施例,如图4所示,基于构建的包括所述拍摄装置、台球位置的投射模型对从所述视频信息进行分析,得到台球的位置信息包括如下步骤:As another preferred embodiment of the present embodiment, as shown in FIG. 4, analyzing the video information based on the constructed projection model including the photographing device and the billiard position, and obtaining the position information of the billiard includes the following steps:
步骤S301:将所述视频信息划分为多个帧。Step S301: dividing the video information into a plurality of frames.
帧,就是视频信息中最小单位的单幅影像画面,一帧就是一副静止的画面,连续的帧就形成动画。将视频信息划分为多个帧,即分为多个画面,每个画面构成一张图像。A frame is a single image frame of the smallest unit of video information. One frame is a still picture, and successive frames form an animation. The video information is divided into a plurality of frames, that is, divided into a plurality of pictures, each of which constitutes one picture.
步骤S302:基于所述投射模型,将所述多个帧中每个帧中的台球对应的椭圆区域和台面区域进行分割。Step S302: Segment the elliptical area and the mesa area corresponding to the billiard in each of the plurality of frames based on the projection model.
可以理解的是,台球对应的椭圆区域是投影在台面所在的平面上的,其中,由于台面基本保持不变,因此,可以基于所述投射模型,将所述多个帧中每个帧中的台球对应的椭圆区域和台面区域进行分割,得到所有的椭圆区域。It can be understood that the elliptical area corresponding to the billiard is projected on the plane where the table top is located, wherein since the mesa is substantially unchanged, the frame may be used in each of the plurality of frames based on the projection model. The ellipse area and the mesa area corresponding to the billiards are divided to obtain all the elliptical areas.
步骤S303:将所述椭圆区域的集合划分为多个连通区域。Step S303: Divide the set of the elliptical regions into a plurality of connected regions.
其中,如图5-A所示的区域即为三个椭圆区域重叠后构成的连通区域。可以理解的是,图5-B所示的区域即为一个椭圆区域构成的连通区域。The area shown in FIG. 5-A is a connected area formed by overlapping three elliptical areas. It can be understood that the area shown in FIG. 5-B is a connected area formed by an elliptical area.
步骤S304:获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息。Step S304: Acquire location information of the connected area, and use position information of each of the plurality of connected areas as position information of billiards corresponding to the respective elliptical areas.
步骤S304包括两种情形:Step S304 includes two situations:
第一种情形,需要将连通区域中重叠的区域进行划分,使之成为一个个独立的区域;In the first case, it is necessary to divide the overlapping areas in the connected area to make them separate areas;
第二种情形,不需要将连通区域中重叠的区域进行划分,可以进行模糊处理。In the second case, it is not necessary to divide the overlapping areas in the connected area, and the blurring process can be performed.
其中,第一种情形可以是按照如下方法实现。获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息包括:Among them, the first case can be implemented as follows. Obtaining the location information of the connected area, and the location information of each of the plurality of connected areas as the location information of the billiard corresponding to each of the elliptical areas respectively includes:
将所述连通区域划分为独立区域,获取所述每个独立区域的位置信息,并将所述独立区域的位置信息分别作为与所述独立区域对应的台球的位置信息。Dividing the connected area into independent areas, acquiring location information of each of the independent areas, and using the location information of the independent area as location information of billiards corresponding to the independent area.
将椭圆区域分成一个个不重叠区域,示例性地,对图5-A所示的连通区域进行提取的结果如图5-C所示。例如以下实现方式:将视频信息中的图像转为灰度图,以固定阈值(如200)或自适应阈值(如利用以往跟踪结果知道台面上有n个球,则以所有像素灰度从高向低排在第20n位的灰度值作为阈值)将图像二值化,从而分割为椭圆区域和台面区域,椭圆区域的每个连通区域对应一个台球。这里利用了无论什么颜色的台球都在中心位置有高光区域的特性,而相邻台球的高光区域不会发生重叠。The elliptical area is divided into non-overlapping areas. Illustratively, the result of extracting the connected area shown in FIG. 5-A is as shown in FIG. 5-C. For example, the following implementation manner: converting the image in the video information into a grayscale image to fix a threshold (such as 200) or an adaptive threshold (such as using the previous tracking result to know that there are n balls on the mesa, then the gray level of all pixels is high The image is binarized to the lower 20th nth gray value as a threshold value, and is divided into an elliptical region and a mesa region, and each connected region of the elliptical region corresponds to one billiard. Here, the billiards of whatever color are used have the characteristics of a highlight area at the center position, and the highlight areas of adjacent billiards do not overlap.
在第二种情形中,基于上述的连通区域,其中可能存在两个椭圆区域重叠后构成的连通区域,或者三个椭圆区域重叠后构成的连通区域甚至三个以上椭圆区域重叠后构成的连通区域。换句话说,每个连通区域要么是单个台球的椭圆区域,要么是相邻的若干椭圆区域粘连而成。椭圆区域的形状参数与椭圆位置有关,但在一个连通区域内近似认为不变。将连通区域中心位置作为椭圆位置建立投射模型,将由此得到的椭圆形状像素化,以它作为模板对连通区域进行形态学腐蚀,腐蚀后得到若干个小连通区域,每个小连通区域即对应一个台球,将每个小连通区域的位置信息作为对应的台球的位置信息。需要说明的是,因此,本实施例可以实现对连通区域的模糊处理,即不需要对椭圆区域存在重叠的连通区域进行分割再进行处理,处理效率高。In the second case, based on the above-mentioned connected area, there may be a connected area formed by overlapping two elliptical areas, or a connected area formed by overlapping three elliptical areas or even a connected area formed by overlapping three or more elliptical areas. . In other words, each connected area is either an elliptical area of a single billiard or an adjoining number of elliptical areas. The shape parameter of the elliptical region is related to the elliptical position, but is approximately unchanged in a connected region. The projection model is established by taking the central position of the connected region as the elliptical position, and the elliptical shape thus obtained is pixelated, and the morphological corrosion is performed on the connected region by using it as a template. After etching, several small connected regions are obtained, and each small connected region corresponds to one. Billiards, the position information of each small connected area is used as the position information of the corresponding billiards. It should be noted that, therefore, the present embodiment can implement the blurring processing on the connected area, that is, it is not necessary to divide and connect the connected areas in which the elliptical areas overlap, and the processing efficiency is high.
作为第二种情形的另一个实施例,进一步地,如图6所示,获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息可以包括:As another embodiment of the second scenario, further, as shown in FIG. 6, acquiring location information of the connected area, and using location information of each of the plurality of connected areas as The location information of the billiard corresponding to each ellipse area may include:
步骤S401:获取连通区域的面积大小。Step S401: Acquire an area size of the connected area.
步骤S402:将所述面积大小与预设的阈值进行匹配获得匹配结果。Step S402: Matching the area size with a preset threshold to obtain a matching result.
示例性地,将连通区域的中心位置作为椭圆位置建立椭圆模型即确定形状参数,先计算出该连通区域内的椭圆个数m,再对该连通区域计算出m个椭圆中心位置,由此确定m个该形状参数的椭圆,要求这m个椭圆覆盖区域的并集恰好是整个连通区域,且这m个椭圆的内切圆相互不重叠。上面的个数m及m个中心位置若无法计算,也可以穷举出所有可能,再从中选取出符合要求的匹配结果。For example, the elliptical model is established as the elliptical position of the connected region, that is, the shape parameter is determined. First, the number of ellipse in the connected region is calculated, and then m elliptical center positions are calculated for the connected region, thereby determining m ellipse of the shape parameter, the union of the m elliptical coverage areas is required to be the entire connected area, and the inscribed circles of the m ellipse do not overlap each other. If the number m and m center positions above cannot be calculated, all the possibilities can be exhausted, and then the matching result that meets the requirements can be selected.
步骤S403:基于所述匹配结果从连通区域中提取出多个彼此不重叠的圆,每个圆都对应一个符合所述投射模型且外切于该圆的外切椭圆,所述外切椭圆占据区域的并集为所述连通区域;将所述多个彼此不重叠的圆的位置信息转化为台球的位置信息。Step S403: extracting, from the connected region, a plurality of circles that do not overlap each other based on the matching result, and each circle corresponds to a circumscribed ellipse that conforms to the projection model and is circumscribed to the circle, and the circumscribed ellipse occupies The union of the regions is the connected region; the position information of the plurality of circles that do not overlap each other is converted into position information of the billiards.
示例性地,对图5-A所示的连通区域进行提取的结果如图5-D所示。Illustratively, the result of extracting the connected regions shown in FIG. 5-A is as shown in FIG. 5-D.
本优选实施例中,通过将存在重叠区域的连通区域分割成为多个彼此不重叠的圆,获取所述每个独立区域的位置信息,即把内切圆的圆心位置进行坐标转换后获得的坐标作为台球竖直投影点的坐标。需要说明的是,本实施例中,关注的是台球之前的相对位置而非每一个台球的绝对位置,因此这种近似处理并不会影响台球位置信息的准确度,反而提高了处理的效率,优化了算法。In the preferred embodiment, the positional information of each of the independent regions is obtained by dividing the connected region in which the overlapping region exists into a plurality of circles that do not overlap each other, that is, the coordinates obtained by performing coordinate transformation on the center of the inscribed circle The coordinates of the vertical projection point of the billiard. It should be noted that, in this embodiment, the relative position before the billiards is not the absolute position of each billiard, so the approximation process does not affect the accuracy of the billiard position information, but improves the processing efficiency. The algorithm was optimized.
在本发明实施例中,通过拍摄装置采集包含台球桌的台面及台面上的台球的视频信息;基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息,所述视频信息包含的图像中台球形状为椭圆。本发明实施例视频信息包含的图像中台球形状为椭圆,基于投射模型得到视频信息的图像中台球的位置信息,提高了位置信息的准确度。另外,本发明实施例的实现过程简单,具有较强的实用性和易用性。In the embodiment of the present invention, the video information of the billiard table and the billiard on the countertop is collected by the photographing device; the video information is analyzed based on the constructed projection model including the photographing device and the billiard position, and the billiard is obtained. Position information, wherein the video information includes an image in which the billiard shape is an ellipse. In the image included in the video information of the embodiment of the present invention, the billiard shape is an ellipse, and the position information of the billiard in the image of the video information is obtained based on the projection model, thereby improving the accuracy of the position information. In addition, the implementation process of the embodiment of the present invention is simple, and has strong practicability and ease of use.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。It should be understood that the size of the sequence of the steps in the above embodiments does not imply a sequence of executions, and the order of execution of the processes should be determined by its function and internal logic, and should not be construed as limiting the implementation of the embodiments of the present invention.
实施例二Embodiment 2
请参考图7,其示出了本发明实施例二提供的台球比赛中的图像处理装置的结构框图。台球比赛中的图像处理装置70包括:采集模块71和分析模块72。其中,各模块的具体功能如下:Please refer to FIG. 7, which is a structural block diagram of an image processing apparatus in a billiard game provided by Embodiment 2 of the present invention. The image processing device 70 in the billiard game includes an acquisition module 71 and an analysis module 72. Among them, the specific functions of each module are as follows:
采集模块71,用于通过拍摄装置采集包含台球桌的台面及台面上的台球的视频信息;The collecting module 71 is configured to collect video information of a billboard including a billiard table and a billiard on the counter by the photographing device;
分析模块72,用于基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息;所述视频信息包含的图像中台球形状为椭圆。The analysis module 72 is configured to analyze the video information based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
可选地,所述视频信息包括各个台球对应的椭圆区域在台面上的分布信息;Optionally, the video information includes distribution information of an elliptical area corresponding to each billiard on a table surface;
所述分析模块72包括:The analysis module 72 includes:
检测单元,用于从所述分布信息中检测出符合所述投射模型的椭圆区域;a detecting unit, configured to detect, from the distribution information, an elliptical region that conforms to the projection model;
计算单元,用于根据所述投射模型中所述拍摄装置、台球以及所述分布信息中台球对应的椭圆区域的空间几何位置关系,基于所述符合所述投射模型的椭圆区域的位置信息,计算得到该椭圆区域所属的台球的位置信息。a calculating unit, configured to calculate, according to the spatial geometric position relationship of the elliptical region corresponding to the billiard in the shooting device, the billiard, and the distribution information in the projection model, based on the position information of the elliptical region that conforms to the projection model The location information of the billiard to which the ellipse area belongs is obtained.
可选地,所述分析模块72包括:Optionally, the analyzing module 72 includes:
第一划分单元,用于将所述视频信息划分为多个帧;a first dividing unit, configured to divide the video information into multiple frames;
分割单元,用于基于所述投射模型,将所述多个帧中每个帧中的台球对应的椭圆区域和台面区域进行分割;a segmentation unit, configured to segment an elliptical region and a mesa region corresponding to billiards in each of the plurality of frames based on the projection model;
第二划分单元,用于将所述椭圆区域的集合划分为多个连通区域;a second dividing unit, configured to divide the set of the elliptical regions into a plurality of connected regions;
获取单元,用于获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息。And an acquiring unit, configured to acquire location information of the connected area, and use location information of each of the plurality of connected areas as position information of billiards corresponding to the respective elliptical areas.
可选地,所述获取单元包括:Optionally, the obtaining unit includes:
划分子单元,用于将所述连通区域划分为独立区域,获取所述每个独立区域的位置信息,并将所述独立区域的位置信息分别作为与所述独立区域对应的台球的位置信息。The sub-unit is configured to divide the connected area into independent areas, obtain location information of each of the independent areas, and use location information of the independent area as location information of billiards corresponding to the independent area.
可选地,将所述划分子单元包括:Optionally, the dividing subunit includes:
获取子单元,用于获取连通区域的面积大小;Obtaining a subunit for obtaining an area size of the connected area;
匹配子单元,用于将所述面积大小与预设的阈值进行匹配获得匹配结果;a matching subunit, configured to match the area size with a preset threshold to obtain a matching result;
提取子单元,用于基于所述匹配结果从连通区域中提取出多个彼此不重叠的圆,每个圆都对应一个符合所述投射模型且外切于该圆的外切椭圆,所述外切椭圆占据区域的并集为所述连通区域;将所述多个彼此不重叠的圆的位置信息转化为台球的位置信息。Extracting a subunit, configured to extract, from the connected region, a plurality of circles that do not overlap each other based on the matching result, each circle corresponding to a circumscribed ellipse that conforms to the projection model and is circumscribed to the circle, the outer The merged area of the cut ellipse occupying area is the connected area; the position information of the plurality of circles not overlapping each other is converted into position information of the billiard.
在本发明实施例中,通过拍摄装置采集包含台球桌的台面及台面上的台球的视频信息;基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息,所述视频信息包含的图像中台球形状为椭圆。本发明实施例视频信息包含的图像中台球形状为椭圆,基于投射模型得到视频信息的图像中台球的位置信息,提高了位置信息的准确度。另外,本发明实施例的实现过程简单,具有较强的实用性和易用性。In the embodiment of the present invention, the video information of the billiard table and the billiard on the countertop is collected by the photographing device; the video information is analyzed based on the constructed projection model including the photographing device and the billiard position, and the billiard is obtained. Position information, wherein the video information includes an image in which the billiard shape is an ellipse. In the image included in the video information of the embodiment of the present invention, the billiard shape is an ellipse, and the position information of the billiard in the image of the video information is obtained based on the projection model, thereby improving the accuracy of the position information. In addition, the implementation process of the embodiment of the present invention is simple, and has strong practicability and ease of use.
实施例三Embodiment 3
图8是本发明实施例三提供的终端设备的示意图。如图8所示,该实施例的终端设备8包括:处理器80、存储器81以及存储在所述存储器81中并可在所述处理器80上运行的计算机程序82,例如台球比赛中的图像处理方法程序。所述处理器80执行所述计算机程序82时实现上述各个台球比赛中的图像处理方法实施例中的步骤,例如图1所示的步骤S101至S102。或者,所述处理器80执行所述计算机程序82时实现上述各装置实施例中各模块的功能,例如图8所示模块81至82的功能。FIG. 8 is a schematic diagram of a terminal device according to Embodiment 3 of the present invention. As shown in FIG. 8, the terminal device 8 of this embodiment includes a processor 80, a memory 81, and a computer program 82 stored in the memory 81 and operable on the processor 80, such as an image in a billiard game. Processing method. When the processor 80 executes the computer program 82, the steps in the embodiment of the image processing method in each of the above billiard games are implemented, for example, steps S101 to S102 shown in FIG. Alternatively, when the processor 80 executes the computer program 82, the functions of the modules in the above various device embodiments are implemented, such as the functions of the modules 81 to 82 shown in FIG.
示例性的,所述计算机程序82可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器81中,并由所述处理器80执行,以完成本发明。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序82在所述终端设备8中的执行过程。例如,所述计算机程序82可以被分割成采集模块和分析模块,各模块的具体功能如下:Illustratively, the computer program 82 can be partitioned into one or more modules/units that are stored in the memory 81 and executed by the processor 80 to complete this invention. The one or more modules/units may be a series of computer program instruction segments capable of performing a particular function, the instruction segments being used to describe the execution of the computer program 82 in the terminal device 8. For example, the computer program 82 can be divided into an acquisition module and an analysis module, and the specific functions of each module are as follows:
采集模块,用于通过拍摄装置采集包含台球桌的台面及台面上的台球的视频信息;An acquisition module, configured to collect video information of a billboard including a billiard table and a billiard on the counter by a photographing device;
分析模块,用于基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息;所述视频信息包含的图像中台球形状为椭圆。The analysis module is configured to analyze the video information based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
所述终端设备8可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端设备可包括,但不仅限于,处理器80、存储器81。本领域技术人员可以理解,图8仅仅是终端设备的示例,并不构成对终端设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端设备还可以包括输入输出设备、网络接入设备、总线等。The terminal device 8 may be a computing device such as a desktop computer, a notebook, a palmtop computer, or a cloud server. The terminal device may include, but is not limited to, a processor 80 and a memory 81. It will be understood by those skilled in the art that FIG. 8 is merely an example of a terminal device, and does not constitute a limitation of the terminal device, and may include more or less components than those illustrated, or combine some components, or different components, such as The terminal device may further include an input/output device, a network access device, a bus, and the like.
所称处理器80可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器 (Digital Signal Processor,DSP)、专用集成电路 (Application Specific Integrated Circuit,ASIC)、现成可编程门阵列 (Field-Programmable Gate Array,FPGA) 或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-called processor 80 can be a central processing unit (Central Processing Unit, CPU), can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
所述存储器81可以是所述终端设备8的内部存储单元,例如终端设备8的硬盘或内存。所述存储器81也可以是所述终端设备8的外部存储设备,例如所述终端设备8上配备的插接式硬盘,智能存储卡(Smart Media Card, SMC),安全数字(Secure Digital, SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器81还可以既包括所述终端设备8的内部存储单元也包括外部存储设备。所述存储器81用于存储所述计算机程序以及所述终端设备所需的其他程序和数据。所述存储器81还可以用于暂时地存储已经输出或者将要输出的数据。The memory 81 may be an internal storage unit of the terminal device 8, such as a hard disk or a memory of the terminal device 8. The memory 81 may also be an external storage device of the terminal device 8, for example, a plug-in hard disk provided on the terminal device 8, a smart memory card (SMC), and a secure digital (SD). Card, flash card (Flash Card) and so on. Further, the memory 81 may also include both an internal storage unit of the terminal device 8 and an external storage device. The memory 81 is used to store the computer program and other programs and data required by the terminal device. The memory 81 can also be used to temporarily store data that has been output or is about to be output.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。It will be apparent to those skilled in the art that, for convenience and brevity of description, only the division of each functional unit and module described above is exemplified. In practical applications, the above functions may be assigned to different functional units as needed. The module is completed by dividing the internal structure of the device into different functional units or modules to perform all or part of the functions described above. Each functional unit and module in the embodiment may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the integrated unit may be hardware. Formal implementation can also be implemented in the form of software functional units. In addition, the specific names of the respective functional units and modules are only for the purpose of facilitating mutual differentiation, and are not intended to limit the scope of protection of the present application. For the specific working process of the unit and the module in the foregoing system, reference may be made to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above embodiments, the descriptions of the various embodiments are different, and the parts that are not detailed or described in a certain embodiment can be referred to the related descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods for implementing the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present invention.
在本发明所提供的实施例中,应该理解到,所揭露的装置/终端设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/终端设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided by the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the device/terminal device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units. Or components may be combined or integrated into another system, or some features may be omitted or not performed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in electrical, mechanical or other form.
所述转换为分离部件说明的单元可以是或者也可以不是物理上分开的,转换为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as being separated into separate components may or may not be physically separated, and the components converted to the unit display may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. on. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的模块/单元如果以软件功能单元的形式实现并转换为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。The integrated modules/units, if implemented in the form of software functional units and converted to separate products for sale or use, may be stored in a computer readable storage medium. Based on such understanding, the present invention implements all or part of the processes in the foregoing embodiments, and may also be completed by a computer program to instruct related hardware. The computer program may be stored in a computer readable storage medium. The steps of the various method embodiments described above may be implemented when the program is executed by the processor. Wherein, the computer program comprises computer program code, which may be in the form of source code, object code form, executable file or some intermediate form. The computer readable medium can include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard drive, a magnetic disk, an optical disk, a computer memory, a read only memory (ROM, Read-Only) Memory), random access memory (RAM, Random) Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in a jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, computer readable media Does not include electrical carrier signals and telecommunication signals.
以上所述实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围,均应包含在本发明的保护范围之内。The embodiments described above are only for explaining the technical solutions of the present invention, and are not intended to be limiting; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art will understand that The technical solutions described in the examples are modified, or some of the technical features are equivalently replaced; and the modifications or substitutions do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in Within the scope of protection of the present invention.

Claims (10)

  1. 一种台球比赛中的图像处理方法,其特征在于,应用于包含拍摄装置的系统,所述图像处理方法包括:An image processing method in a billiard game, which is characterized in that it is applied to a system including a photographing device, and the image processing method includes:
    通过所述拍摄装置采集包含台球桌的台面及台面上的台球的视频信息;Collecting, by the photographing device, video information of a billboard including a billiard table and a billiard on the countertop;
    基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息;所述视频信息包含的图像中台球形状为椭圆。The video information is analyzed based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
  2. 根据权利要求1所述的台球比赛中的图像处理方法,其特征在于,所述视频信息包括各个台球对应的椭圆区域在台面上的分布信息;The image processing method of the billiard game according to claim 1, wherein the video information comprises distribution information of an elliptical area corresponding to each billiard on the table surface;
    基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息包括:The video information is analyzed based on the constructed projection model including the shooting device and the billiard position, and the position information of the billiard is obtained:
    从所述分布信息中检测出符合所述投射模型的椭圆区域;An elliptical region conforming to the projection model is detected from the distribution information;
    根据所述投射模型中所述拍摄装置、台球以及所述分布信息中台球对应的椭圆区域的空间几何位置关系,基于所述符合所述投射模型的椭圆区域的位置信息,计算得到该椭圆区域所属的台球的位置信息。Determining, according to the spatial geometric position relationship of the elliptical region corresponding to the billiard in the shooting model, the positional information of the elliptical region conforming to the projection model, and calculating the elliptical region The location information of the billiards.
  3. 根据权利要求1所述的台球比赛中的图像处理方法,其特征在于,基于构建的包括所述拍摄装置、台球位置的投射模型对从所述视频信息进行分析,得到台球的位置信息包括:The image processing method in a billiard game according to claim 1, wherein the position information of the billiards is obtained based on the constructed projection model including the shooting device and the billiard position, and the position information of the billiards is:
    将所述视频信息划分为多个帧;Dividing the video information into a plurality of frames;
    基于所述投射模型,将所述多个帧中每个帧中的台球对应的椭圆区域和台面区域进行分割;And dividing, according to the projection model, an elliptical area and a mesa area corresponding to billiards in each of the plurality of frames;
    将所述椭圆区域的集合划分为多个连通区域;Dividing the set of elliptical regions into a plurality of connected regions;
    获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息。Obtaining location information of the connected area, and using position information of each of the plurality of connected areas as position information of billiards corresponding to the respective elliptical areas.
  4. 根据权利要求3所述的台球比赛中的图像处理方法,其特征在于,获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息包括:The image processing method in a billiard game according to claim 3, wherein position information of the connected area is acquired, and position information of each of the plurality of connected areas is respectively used as the The position information of the billiard corresponding to the ellipse area includes:
    将所述连通区域划分为独立区域,获取所述每个独立区域的位置信息,并将所述独立区域的位置信息分别作为与所述独立区域对应的台球的位置信息。Dividing the connected area into independent areas, acquiring location information of each of the independent areas, and using the location information of the independent area as location information of billiards corresponding to the independent area.
  5. 如权利要求3所述的台球比赛中的图像处理方法,其特征在于,获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息包括:The image processing method in a billiard game according to claim 3, wherein position information of the connected area is acquired, and position information of each of the plurality of connected areas is respectively used as the The position information of the billiard corresponding to the ellipse area includes:
    获取连通区域的面积大小;Obtain the area size of the connected area;
    将所述面积大小与预设的阈值进行匹配获得匹配结果;Matching the area size with a preset threshold to obtain a matching result;
    基于所述匹配结果从连通区域中提取出多个彼此不重叠的圆,每个圆都对应一个符合所述投射模型且外切于该圆的外切椭圆,所述外切椭圆占据区域的并集为所述连通区域;将所述多个彼此不重叠的圆的位置信息转化为台球的位置信息。Extracting, from the connected region, a plurality of circles that do not overlap each other based on the matching result, each circle corresponding to a circumscribed ellipse conforming to the projection model and circumscribed to the circle, the circumscribed ellipse occupying the region The set is the connected area; the position information of the plurality of circles that do not overlap each other is converted into position information of the billiard.
  6. 一种台球比赛中的图像处理装置,其特征在于,包括:An image processing device in a billiard game, comprising:
    采集模块,用于通过拍摄装置采集包含台球桌的台面及台面上的台球的视频信息;An acquisition module, configured to collect video information of a billboard including a billiard table and a billiard on the counter by a photographing device;
    分析模块,用于基于构建的包括所述拍摄装置、台球位置的投射模型对所述视频信息进行分析,得到台球的位置信息;所述视频信息包含的图像中台球形状为椭圆。The analysis module is configured to analyze the video information based on the constructed projection model including the photographing device and the billiard position to obtain position information of the billiard; the video information includes an image in which the billiard shape is an ellipse.
  7. 根据权利要求6所述的台球比赛中的图像处理装置,其特征在于,所述视频信息包括各个台球对应的椭圆区域在台面上的分布信息;The image processing device of the billiard game according to claim 6, wherein the video information comprises distribution information of an elliptical area corresponding to each billiard on the table surface;
    所述分析模块包括:The analysis module includes:
    检测单元,用于从所述分布信息中检测出符合所述投射模型的椭圆区域;a detecting unit, configured to detect, from the distribution information, an elliptical region that conforms to the projection model;
    计算单元,用于根据所述投射模型中所述拍摄装置、台球以及所述分布信息中台球对应的椭圆区域的空间几何位置关系,基于所述符合所述投射模型的椭圆区域的位置信息,计算得到该椭圆区域所属的台球的位置信息。a calculating unit, configured to calculate, according to the spatial geometric position relationship of the elliptical region corresponding to the billiard in the shooting device, the billiard, and the distribution information in the projection model, based on the position information of the elliptical region that conforms to the projection model The location information of the billiard to which the ellipse area belongs is obtained.
  8. 根据权利要求6所述的台球比赛中的图像处理装置,其特征在于,所述分析模块包括:The image processing apparatus of the billiard game according to claim 6, wherein the analysis module comprises:
    第一划分单元,用于将所述视频信息划分为多个帧;a first dividing unit, configured to divide the video information into multiple frames;
    分割单元,用于基于所述投射模型,将所述多个帧中每个帧中的台球对应的椭圆区域和台面区域进行分割;a segmentation unit, configured to segment an elliptical region and a mesa region corresponding to billiards in each of the plurality of frames based on the projection model;
    第二划分单元,用于将所述椭圆区域的集合划分为多个连通区域;a second dividing unit, configured to divide the set of the elliptical regions into a plurality of connected regions;
    获取单元,用于获取所述连通区域的位置信息,并将所述多个连通区域中的各个椭圆区域的位置信息分别作为与所述各个椭圆区域对应的台球的位置信息。And an acquiring unit, configured to acquire location information of the connected area, and use location information of each of the plurality of connected areas as position information of billiards corresponding to the respective elliptical areas.
  9. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至5任一项所述方法的步骤。A terminal device comprising a memory, a processor, and a computer program stored in the memory and operable on the processor, wherein the processor executes the computer program as claimed in claim 1 5 The steps of any of the methods described.
  10. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至5任一项所述方法的步骤。A computer readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the method of any one of claims 1 to 5.
PCT/CN2018/115386 2017-12-28 2018-11-14 Method and apparatus for image processing in billiards game, and terminal device WO2019128504A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711464888.4 2017-12-28
CN201711464888.4A CN108090486B (en) 2017-12-28 2017-12-28 Image processing method and device in billiard game

Publications (1)

Publication Number Publication Date
WO2019128504A1 true WO2019128504A1 (en) 2019-07-04

Family

ID=62180422

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/115386 WO2019128504A1 (en) 2017-12-28 2018-11-14 Method and apparatus for image processing in billiards game, and terminal device

Country Status (2)

Country Link
CN (1) CN108090486B (en)
WO (1) WO2019128504A1 (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108090486B (en) * 2017-12-28 2020-06-09 深圳市超级视觉科技有限公司 Image processing method and device in billiard game
CN108960098B (en) * 2018-06-22 2022-04-01 梁栋 Billiard collision relation recognition method and billiard game scoring system
CN109011534B (en) * 2018-08-08 2020-08-04 Oppo广东移动通信有限公司 Billiard ball hitting assisting method and device, storage medium and electronic equipment
WO2020105973A1 (en) * 2018-11-23 2020-05-28 김현철 Billiard hall auxiliary system and server thereof
CN110334617B (en) * 2019-06-20 2021-04-27 梁栋 Method for judging collision of billiards with pool edges and billiard game scoring system
CN110443859B (en) * 2019-07-30 2023-05-30 佛山科学技术学院 Computer vision-based billiard foul judging method and system
CN112891909A (en) * 2019-11-19 2021-06-04 杨清平 Snooker scoring device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103955693A (en) * 2013-05-06 2014-07-30 北京瑞盖科技有限公司 Nine-ball computer-assisted detection identification method
CN104740866A (en) * 2013-12-27 2015-07-01 唐方旭 Precise positioning device for resetting balls in snooker
CN105261048A (en) * 2015-09-11 2016-01-20 中国人民解放军信息工程大学 Accurate positioning method for central cone-beam projection position of small sphere
CN107270812A (en) * 2017-06-26 2017-10-20 江苏密斯欧智能科技有限公司 Target ball recognition methods in a kind of automatic assembling
CN108090486A (en) * 2017-12-28 2018-05-29 深圳市超级视觉科技有限公司 Image processing method and device in a kind of game of billiards
CN108079565A (en) * 2017-12-28 2018-05-29 深圳市超级视觉科技有限公司 A kind of game of billiards scoring system

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8992315B2 (en) * 2009-07-27 2015-03-31 Obscura Digital, Inc. Automated enhancements for billiards and the like
CN102252661B (en) * 2011-04-02 2013-04-10 华南理工大学 Globoid three-dimensional positioning method for machine vision
CN104954750A (en) * 2015-06-18 2015-09-30 北京共创普惠科技有限公司 Data processing method and device for billiard system
CN105107190A (en) * 2015-09-15 2015-12-02 清华大学 Image collecting and processing system applied to Chinese billiards and image processing method
KR101757788B1 (en) * 2015-12-17 2017-07-14 연세대학교 산학협력단 Method and Apparatus of Scoring Pool
CN106952307B (en) * 2017-03-22 2020-01-07 广东工业大学 Method and system for positioning sphere in image

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103955693A (en) * 2013-05-06 2014-07-30 北京瑞盖科技有限公司 Nine-ball computer-assisted detection identification method
CN104740866A (en) * 2013-12-27 2015-07-01 唐方旭 Precise positioning device for resetting balls in snooker
CN105261048A (en) * 2015-09-11 2016-01-20 中国人民解放军信息工程大学 Accurate positioning method for central cone-beam projection position of small sphere
CN107270812A (en) * 2017-06-26 2017-10-20 江苏密斯欧智能科技有限公司 Target ball recognition methods in a kind of automatic assembling
CN108090486A (en) * 2017-12-28 2018-05-29 深圳市超级视觉科技有限公司 Image processing method and device in a kind of game of billiards
CN108079565A (en) * 2017-12-28 2018-05-29 深圳市超级视觉科技有限公司 A kind of game of billiards scoring system

Also Published As

Publication number Publication date
CN108090486A (en) 2018-05-29
CN108090486B (en) 2020-06-09

Similar Documents

Publication Publication Date Title
WO2019128504A1 (en) Method and apparatus for image processing in billiards game, and terminal device
WO2020207191A1 (en) Method and apparatus for determining occluded area of virtual object, and terminal device
US10373380B2 (en) 3-dimensional scene analysis for augmented reality operations
WO2018120038A1 (en) Method and device for target detection
JP5822322B2 (en) Network capture and 3D display of localized and segmented images
CN110363817B (en) Target pose estimation method, electronic device, and medium
CN112528831B (en) Multi-target attitude estimation method, multi-target attitude estimation device and terminal equipment
US20180018499A1 (en) Method for calculating area of fingerprint overlapping region and electronic device thereof
US20150098645A1 (en) Method, apparatus and system for selecting a frame
US20170154204A1 (en) Method and system of curved object recognition using image matching for image processing
CN112581629A (en) Augmented reality display method and device, electronic equipment and storage medium
CN109784250B (en) Positioning method and device of automatic guide trolley
CN107610151B (en) Pedestrian trajectory processing method/system, computer-readable storage medium and device
CN111079772A (en) Image edge extraction processing method, device and storage medium
CN106709500B (en) Image feature matching method
CN110930411B (en) Human body segmentation method and system based on depth camera
CN111325798B (en) Camera model correction method, device, AR implementation equipment and readable storage medium
US11354883B2 (en) Image processing method and apparatus, and electronic device
CN112149583A (en) Smoke detection method, terminal device and storage medium
CN108492284B (en) Method and apparatus for determining perspective shape of image
CN107480673B (en) Method and device for determining interest region in medical image and image editing system
CN113902932A (en) Feature extraction method, visual positioning method and device, medium and electronic equipment
JP7121132B2 (en) Image processing method, apparatus and electronic equipment
CN114897999B (en) Object pose recognition method, electronic device, storage medium, and program product
WO2023109086A1 (en) Character recognition method, apparatus and device, and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18894741

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18894741

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 10/11/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18894741

Country of ref document: EP

Kind code of ref document: A1