A gate opening detection method, device and electronic equipment
By setting multiple markers on the gate and using image detection technology, the problem of not being able to detect the gate opening when the marker is blocked is solved, and higher accuracy and stability are achieved.
Patent Information
- Application Number
- CN202411354887.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-09-26
AI Technical Summary
The prior art cannot detect the gate opening when a mark on the gate is blocked, resulting in low accuracy and stability of controlling the gate opening.
By setting multiple markers with non-repetitive positions on the gate, the current position of at least one marker is determined using image detection technology, and the moving distance of the gate is determined based on the predetermined calibration information of the marker, thereby calculating the opening of the gate. Spend.
When a marker is blocked, the gate opening can still be accurately detected, which improves the accuracy and stability of the gate opening.
Smart Images

Figure CN118882502B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image intelligent detection technology, and in particular to a gate opening detection method, device, and electronic equipment. Background Art
[0002] The gate is a control facility used to close and open the drainage channel. It can be used to intercept water flow, control water level, adjust flow, discharge sediment and floating objects, etc. It is one of the important water conservancy facilities. The flow and speed of the water flow can be adjusted by controlling the gate opening. The height of the gate opening is crucial to the accuracy and stability of water flow management.
[0003] The current method for detecting the gate opening is to set a marker on the gate and calculate the gate opening based on the correspondence between the actual position of the marker and the position in the gate image. However, when the marker is blocked, the gate opening cannot be calculated. It can be seen that the application scenarios of the above-mentioned gate opening detection method are very limited. It is impossible to detect the gate opening when a marker is blocked, resulting in low accuracy and stability in controlling the gate opening. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a gate opening detection method, device, and electronic device to solve the problem that the gate opening cannot be detected when a marker on the gate is blocked. The specific technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for detecting a gate opening, the method comprising:
[0006] Acquire an image to be detected, wherein the image to be detected includes a gate, and a plurality of markers with non-repeated positions are arranged on the gate;
[0007] Performing image detection on the image to be detected to determine a current position of at least one marker in the image to be detected;
[0008] Determine the moving distance of the gate according to the current position and the predetermined calibration information of the multiple markers, wherein the calibration information at least includes the calibration position and the physical distance of the multiple markers in the opening direction of the gate, the calibration position is the position of each marker in the calibration image, and the calibration image is an image of the gate captured when the gate is opened to a preset height;
[0009] The opening of the gate is determined based on the preset height and the moving distance.
[0010] In a second aspect, an embodiment of the present application provides a device for detecting a gate opening, the device comprising:
[0011] An image detection module, used for acquiring an image to be detected, wherein the image to be detected includes a gate, and a plurality of markers with non-repeated positions are arranged on the gate;
[0012] A position determination module, used to perform image detection on the image to be detected, and determine the current position of at least one marker in the image to be detected;
[0013] a distance determination module, configured to determine the moving distance of the gate according to the current position and the calibration information of the plurality of predetermined markers, wherein the calibration information at least includes a calibration position and a physical distance of the plurality of markers in the opening direction of the gate, the calibration position is the position of each marker in a calibration image, and the calibration image is an image of the gate captured when the gate is opened to a preset height;
[0014] The opening determination module is used to determine the opening of the gate based on the preset height and the moving distance.
[0015] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0016] Memory, used to store computer programs;
[0017] The processor is used to implement any method step described in the first aspect when executing the program stored in the memory.
[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of the first aspects are implemented.
[0019] Beneficial effects of the embodiments of the present application:
[0020] In the scheme provided by the embodiment of the present application, the electronic device can obtain an image to be detected, wherein the image to be detected includes a gate, and a plurality of markers with non-repeating positions are arranged on the gate, and then image detection is performed on the image to be detected, and the current position of at least one marker in the image to be detected is determined, and then the moving distance of the gate is determined according to the current position and the calibration information of the predetermined plurality of markers, wherein the calibration information at least includes the calibration position and the physical distance of the plurality of markers in the opening direction of the gate, the calibration position is the position of each marker in the calibration image, and the calibration image is the image of the gate collected when the gate is opened to a preset height, so as to determine the opening of the gate based on the preset height and the moving distance. In this way, since a plurality of markers with non-repeating positions are arranged on the gate, when one marker is blocked, the gate opening can be detected by using other markers on the gate that are not blocked, and as long as the current position of at least one marker can be determined from the image to be detected, the gate opening can be determined based on the predetermined calibration position of the marker and the physical distance of the marker in the opening direction of the gate, thereby improving the accuracy and stability of the gate opening. Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0022] Figure 1 A flow chart of a gate opening detection method provided in an embodiment of the present application;
[0023] Figure 2 Based on Figure 1 A schematic diagram of a shooting point display interface of the illustrated embodiment;
[0024] Figure 3 Based on Figure 1 A schematic diagram of a shooting point information query interface of the illustrated embodiment;
[0025] Figure 4 Based on Figure 1 A schematic diagram of a marker information setting interface of the illustrated embodiment;
[0026] Figure 5 Based on Figure 1 A schematic diagram of a marker rectangular detection frame drawing interface of the illustrated embodiment;
[0027] Figure 6 for Figure 1 A flow chart of step S103 in the illustrated embodiment;
[0028] Figure 7 Based on Figure 1 A schematic diagram of a marker information configuration interface of the illustrated embodiment;
[0029] Figure 8 Based on Figure 1 A schematic flow chart of a gate opening detection method according to the illustrated embodiment;
[0030] Fig. 9 A schematic diagram of the structure of a gate opening detection device provided in an embodiment of the present application;
[0031] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0033] In order to avoid the inability to detect the gate opening when a marker on the gate is blocked, and to improve the accuracy and stability of controlling the gate opening, the embodiments of the present application provide a gate opening detection method, device, electronic device, computer-readable storage medium and computer program product. The following first introduces a gate opening detection method provided by the embodiments of the present application.
[0034] A gate opening detection method provided in an embodiment of the present application can be applied to any electronic device that needs to detect the gate opening, for example, it can be a processing device, a management device, a server, etc., without specific limitation here, and for the sake of clear description, it is referred to as an electronic device hereinafter.
[0035] like Figure 1 As shown, a method for detecting gate opening, the method comprising:
[0036] S101, obtaining an image to be detected;
[0037] Wherein, the image to be detected includes a gate, and a plurality of markers with non-repeated positions are arranged on the gate;
[0038] S102, performing image detection on the image to be detected, and determining a current position of at least one marker in the image to be detected;
[0039] S103, determining a moving distance of the gate according to the current position and the predetermined calibration information of the plurality of markers;
[0040] The calibration information at least includes a calibration position and a physical distance between the multiple markers in the opening direction of the gate, the calibration position is the position of each marker in the calibration image, and the calibration image is an image of the gate captured when the gate is opened to a preset height;
[0041] S104: Determine the opening of the gate based on the preset height and the moving distance.
[0042] It can be seen that in the solution provided in the embodiment of the present application, the electronic device can obtain an image to be detected, wherein the image to be detected includes a gate, and a plurality of markers with non-repeating positions are arranged on the gate. Then, image detection is performed on the image to be detected to determine the current position of at least one marker in the image to be detected, and then the moving distance of the gate is determined based on the current position and the calibration information of the plurality of markers determined in advance, wherein the calibration information includes at least the calibration position and the physical distance of the plurality of markers in the opening direction of the gate, the calibration position is the position of each marker in the calibration image, and the calibration image is an image of the gate captured when the gate is opened to a preset height, thereby determining the opening of the gate based on the preset height and the moving distance. In this way, since there are multiple markers with non-overlapping positions on the gate, when one marker is blocked, other unblocked markers on the gate can be used to detect the gate opening. As long as the current position of at least one marker can be determined from the image to be detected, the gate opening can be determined based on the predetermined calibrated position of the marker and the physical distance of the marker in the opening direction of the gate, thereby improving the accuracy and stability of the gate opening.
[0043] Since the flow rate and speed of water flow can be adjusted by controlling the gate opening, the gate opening is crucial to the accuracy and stability of water flow management. Water conservancy workers need to know the gate opening in a timely manner. In order to reduce labor costs and improve the accuracy of detecting the gate opening, the gate opening can be detected by an electronic device based on. In the above step S101, the electronic device can obtain the image to be detected.
[0044] Image acquisition devices may be arranged around the gate to capture images of the gate and the conditions around the gate. In one embodiment, in order to facilitate the acquisition of images to be detected for a specific gate, the image acquisition devices around the gate may be grouped according to the gates captured.
[0045] For example, Figure 2As shown in the figure, click the point rule configuration button on the algorithm strategy platform to get the point grouping of image acquisition devices. For example, the image acquisition devices used to shoot gate 1 are divided into reservoir group 1, the image acquisition devices used to shoot gate 2 are divided into reservoir group 2, and the image acquisition devices used to shoot gate 3 are divided into reservoir group 3, etc. Enter the group or label in the query box under the point grouping to query the grouping of image acquisition devices for a specific gate or the grouping of image acquisition devices and the corresponding labels, such as Figure 2 As shown, the query is for reservoir 1.
[0046] In addition, you can also make further condition settings in the category of Reservoir Group 1 by selecting the Select Point box, Point External Code column, Rule Configuration Status column, and Attribute Configuration Status column under the Point column, click the Query button to query the image acquisition devices that meet the conditions and the corresponding information, and click the Reset button to reset the above setting columns. The display interface can display a maximum of 20 pieces of information per page. When the number of pieces of information queried is greater than 20, the queried information will be displayed on multiple pages. You can enter a number in the Page Number box and click the Jump button to jump directly to the corresponding page.
[0047] If you want to query all image acquisition devices under the category of Reservoir Group 1, you can set the rule configuration status bar and the attribute configuration status bar to All, and you can also add or remove image acquisition devices under this category by clicking the Add Point button and the Delete button.
[0048] After setting the above settings, Figure 2 As shown, a page of 10 pieces of information corresponding to all image acquisition devices under the classification of reservoir group 1 can be queried. Each piece of information includes: shooting point name, shooting point number, shooting point type, region, IP (Internet Protocol) address and port number, longitude, latitude, point external code, rule configuration status, attribute configuration status, and operation options.
[0049] For example, shooting point names include Camera 01, etc., shooting point numbers include 1ead02b40e7e4316916ac9c2544e7e60, etc., shooting point types include gun cameras and ball cameras, etc., belonging areas include root nodes, etc., IP addresses and port numbers include 10.16.70.115:8000, etc., longitude includes 0, etc., latitude includes 0, etc., point external codes include 330000000.., etc., rule configuration status includes configured and unconfigured, attribute configuration status includes configured and unconfigured, and operation options include drawing rules, attribute configuration, and deletion.
[0050] In this way, when the electronic device needs to obtain the image to be detected, Figure 3 As shown in the figure, the point information query component includes a component description button, an input parameter button, and an output parameter button. You can switch the corresponding page by clicking different buttons. Click the input parameter button, select the shooting point number (cameraIndexCode) as the shooting point to be captured in the shooting point number column of the input parameter page, select the preset point of the shooting point to be captured in the preset point number column, select the rule group to be queried in the group selection column, select the rule group label to be queried in the group label column, and select the event picture url (Universal Resource Locator) field in the event picture url (Universal Resource Locator) column, that is, the storage location of the picture to be detected.
[0051] Click the Edit button under the Condition Configuration column and enter the expression: The light band label (brandTag) string is in the input value range of red light band, blue light band, that is, the markers set on the gate are red light band and blue light band; click the Clear button under the Condition Configuration column to clear the entered expression; click the switch button under the Grouping Rule Query to choose whether to query other shooting point rules in the same group. In this way, in the input parameter interface of the point information query component, enter the above information to obtain the image to be detected corresponding to the gate.
[0052] The image acquisition device around the gate can upload the captured video or image to the electronic device that detects the gate opening according to a preset period, or the above electronic device can send a video or image acquisition request to the image acquisition device around the gate according to a preset period, and the above image acquisition device will send the captured video or image to the electronic device after receiving the acquisition request. If the electronic device acquires an image captured by the image acquisition device, the image including the gate can be directly used as the image to be detected; if the electronic device acquires a video, it is necessary to further extract image frames from the video, and use the image frames including the gate as the image to be detected, which is reasonable.
[0053] For different geographical locations and seasons, the precipitation conditions and the water level rise of the reservoir are different. For example, for towns in the rainy season or flood season, the local precipitation is relatively large and the water level of the reservoir rises relatively quickly. Therefore, it is necessary to always pay attention to the gate opening and adjust the flow rate and speed of the water flow by controlling the gate opening to avoid floods. In this case, the preset period for the electronic device to obtain the image to be detected can be set shorter, for example, the above preset period can be set to 2 seconds, 10 seconds or 1 minute.
[0054] For towns with a relatively dry climate, the local precipitation is small, the water level of the reservoir rises slowly, and the possibility of flooding is low, so there is no need to always pay attention to the gate opening. In this case, the preset period for the electronic device to obtain the image to be detected can be set to be relatively long, for example, the preset period can be set to 3 days, 7 days or 15 days, which is reasonable.
[0055] The image to be detected includes a gate, and a plurality of markers with non-repeating positions are set on the gate. Since a fence is usually set around the gate to protect the gate, when the marker on the gate is used to detect the gate opening, the marker may be blocked by the fence or other objects. By setting a plurality of markers with non-repeating positions on the gate, it can be avoided that the gate opening cannot be detected when one marker is blocked.
[0056] In one embodiment, the gate may be provided with two non-repeating markers or three non-repeating markers. When there are many obstructions around the gate, five non-repeating markers may be provided on the gate. The physical distance between every two non-repeating markers may be the same or different according to actual conditions, which is reasonable.
[0057] In order to facilitate the distinction of multiple non-repeating markers set on the gate, the color, shape, pattern or digital label of the marker can be set to different categories. For example, if there are two non-repeating markers on the gate, the two markers can be red reflective tape and blue reflective tape respectively; if there are three non-repeating markers on the gate, the three markers can be red reflective tape, blue reflective tape and yellow reflective tape respectively, or square reflective tape, triangular reflective tape and rectangular reflective tape respectively; if there are five non-repeating markers on the gate, the five markers can be reflective tape No. 1, reflective tape No. 2, reflective tape No. 3, reflective tape No. 4 and reflective tape No. 5 respectively.
[0058] The reflective tape and the digital number can be set on the gate by pasting, printing or spraying, and the digital number is set near the corresponding reflective tape to identify the corresponding reflective tape. The above methods are all reasonable and are not specifically limited here. Of course, the marker can also be other markers besides the reflective tape, as long as it can be detected by the electronic device from the image.
[0059] After acquiring the image to be detected including the gate, in the above step S102, the electronic device can perform image detection on the image to be detected to determine the current position of at least one marker in the image to be detected.
[0060] Since a plurality of markers with non-overlapping positions are arranged on the gate, if the plurality of markers in the image to be detected are not blocked, the current positions of all the markers in the image to be detected can be determined.
[0061] For example, two markers with non-overlapping positions are set on the gate, namely red reflective tape and blue reflective tape. If the red reflective tape and the blue reflective tape are not blocked in the acquired image to be monitored, the electronic device can determine the position coordinates of the corner points of the red reflective tape and the blue reflective tape in the image to be detected, and use them as the current positions of the red reflective tape and the blue reflective tape in the image to be detected.
[0062] If one of the red reflective tape or the blue reflective tape in the image to be monitored is blocked, the electronic device can determine the current position of the blue reflective tape or the red reflective tape that is not blocked in the image to be detected.
[0063] For another example, five markers with non-repeated positions are set on the gate, namely reflective tape No. 1, reflective tape No. 2, reflective tape No. 3, reflective tape No. 4 and reflective tape No. 5. If none of the five reflective tapes in the acquired image to be monitored is blocked, the electronic device can determine the position coordinates of the center points of the five reflective tapes in the image to be detected, and use them as the current positions of the five reflective tapes in the image to be detected.
[0064] If none of the three reflective tapes in the acquired image to be monitored is blocked, the electronic device can determine the position coordinates of the center points of the three reflective tapes in the image to be detected, and use them as the current positions of the three reflective tapes in the image to be detected.
[0065] After determining the current position of at least one marker in the image to be detected, the current position information can be used to determine the moving distance of the gate. Then, in the above step S103, the electronic device can determine the moving distance of the gate according to the current position and the calibration information of the predetermined multiple markers. The calibration information at least includes the calibration position and the physical distance of the multiple markers in the opening direction of the gate. The calibration position is the position of each marker in the calibration image. The calibration image is an image of the gate collected when the gate is opened to a preset height.
[0066] Since the calibration image and the image to be detected are taken by the same image acquisition device, the relationship between the position of the target in the image to be detected and the physical position in the real world is the same as the relationship between the position of the target in the calibration image and the physical position in the real world. Therefore, the moving distance of the gate can be determined based on the current position information of at least one marker in the image to be detected, the calibration information, and the proportional relationship between the physical distances of multiple markers in the opening direction of the gate.
[0067] Since the above-mentioned current position and calibrated position are both the positions of the markers in the image, and the physical distance of multiple markers in the direction of gate opening is the actual distance, the gate movement distance can be determined based on the image distance, i.e., the current position and calibrated position of the marker, and the actual distance, i.e., the physical distance between multiple markers and the gate movement distance. The above-mentioned calibration image is an image of the gate captured when the gate is opened to a preset height. The preset height can be the height when the gate is opened to the maximum, or it can be the height of the gate at any opening, which is not specifically limited here.
[0068] For example, there are two non-overlapping light strips on the gate, namely the upper red reflective strip and the lower blue reflective strip. The physical distance between the red reflective strip and the blue reflective strip is 1.2 meters, and the gate is 5.3 meters high when it is open to the maximum. Then, in order to calculate the gate opening in the subsequent detection process, Figure 4 The properties can be configured in the configuration interface shown in the figure. Specifically, the distance between the red and blue light bars can be set to 1.2, and the maximum height can be set to 5.30 in the property configuration interface.
[0069] like Figure 4 As shown, in Figure 2 On the basis of the above, click the property configuration button in the operation option corresponding to the shooting point name Camera 01 and the shooting point number 7f9a2ed18d9e4344b2544f2d72e26246. The algorithm strategy platform will display the property configuration pop-up window. Configure the rule properties in this pop-up window. For example, enter 1.2 in the description box under the red and blue light bar distance column, enter 5.30 in the description box under the maximum height column, and you can also drop down and select the corresponding option in the description box under other configuration columns.
[0070] After opening the property configuration pop-up window, if you need to save the set property configuration, click the OK button in the pop-up window; if you do not need to save the set property configuration, click the Cancel button in the pop-up window.
[0071] like Figure 5 As shown in the figure, after obtaining the calibration image collected when the gate is opened to the preset height, in order to determine the calibration position of the red reflective tape and the blue reflective tape, you can draw the area frame through the point selection under the point rule configuration, and draw a rectangular detection frame around the borders of the red reflective tape and the blue reflective tape in the real-time image, that is, the image to be detected. In addition to selecting rectangular drawing to draw the detection frame, you can also select line drawing and polygon drawing to draw the detection frame. When you need to clear the detection frame drawn in the real-time image, you can click the Clear Canvas button.
[0072] After completing the drawing of the rectangular detection frame, in the interface of the content drawn at the preset point, use the prompt to add relevant fields according to the rule frame through (resource package), add relevant fields to the rule frame, and set the red light band as the target frame in the starting frame setting column; set the blue light band as the target frame in the ending frame setting column.
[0073] After completing the above settings, if you need to save the relevant settings, click the Save button in the area frame drawing interface; if you do not need to save the relevant settings, click the Return button in the area frame drawing interface.
[0074] Since the two rectangular detection frames overlap highly with the borders of the red reflective tape and the blue reflective tape, the position of the rectangular detection frame of the red reflective tape and the position of the rectangular detection frame of the blue reflective tape can be directly used as the calibration positions of the red reflective tape and the blue reflective tape, respectively.
[0075] And the rectangular detection frame of the red reflective tape is used as the starting frame, that is, the position of the highest marker, and the rectangular detection frame of the blue reflective tape is used as the ending frame, that is, the position of the lowest marker, so as to determine the positions of the red reflective tape and the blue reflective tape in the calibration image. Of course, the calibration image can also be detected by an electronic device to obtain the position of the rectangular detection frame of the red reflective tape and the position of the rectangular detection frame of the blue reflective tape, which is reasonable and is not specifically limited here.
[0076] In this way, after determining the moving distance of the gate using the current position and the calibration information of the predetermined multiple markers, in the above step S104, the electronic device can determine the gate opening based on the preset height and the moving distance. In one embodiment, if the above preset height is the height when the gate opening is the largest, the height of the current gate is always less than the preset height, so the difference between the preset height and the moving distance can be directly calculated as the gate opening. For example, if the preset height of the gate is 10 meters, and the calculated moving distance of the gate is 6 meters, it can be determined that the gate opening at this time is 10-6=4 meters.
[0077] In one embodiment, if the above-mentioned preset height is the height when the gate is not at its maximum opening, it is necessary to first determine whether the gate is currently moving upward or downward relative to the gate at the preset height, and then determine the opening of the gate based on the preset height and moving distance.
[0078] For example, when the gate height is 10 meters when the gate opening is maximum, the preset height of the gate is 8 meters, and the calculated moving distance of the gate is 1 meter. If it is determined that the gate moves downward, that is, the gate is in the process of closing, then it can be determined that the gate opening at this time is 8-1=7 meters; if it is determined that the gate moves upward, that is, the gate is in the process of opening, then it can be determined that the gate opening at this time is 8+1=9 meters.
[0079] It can be seen that in the solution provided in the embodiment of the present application, since a plurality of markers with non-overlapping positions are provided on the gate, when one marker is blocked, other unblocked markers on the gate can be used to detect the gate opening. As long as the current position of at least one marker can be determined from the image to be detected, the gate opening can be determined based on the predetermined calibrated position of the marker and the physical distance of the marker in the opening direction of the gate, thereby improving the accuracy and stability of the gate opening.
[0080] Since the multiple markers set on the gate may be blocked in the image to be detected, the number of markers detected by the electronic device from the image to be detected may be multiple or one. In view of this situation, as an implementation of an embodiment of the present application, the above step of determining the moving distance of the gate based on the current position and the predetermined calibration information of the multiple markers may include:
[0081] When there are multiple markers detected from the image to be detected, one of the current positions of the multiple markers is determined as the target position; or, when there is only one marker detected from the image to be detected, the current position of the one marker is determined as the target position. Based on the target position and the calibration information of the multiple markers determined in advance, the moving distance of the gate is determined.
[0082] In one embodiment, when determining the moving distance of the gate, only one of the current positions of the multiple markers needs to be used as the target position, and all the current positions of the multiple markers in the image to be detected do not need to be used. Therefore, if the current positions of the multiple markers included in the image to be detected are determined, the current position of one marker can be randomly selected from the multiple current positions as the target position. For example, the uppermost current position can be selected as the target position from the multiple current positions, or the lowermost current position can be selected as the target position from the multiple current positions, which is reasonable.
[0083] In one implementation, if the image to be detected includes only one unobstructed marker, the current position of the marker is directly determined as the target position.
[0084] After determining the target position of a marker in the image to be detected, the moving distance of the gate is calculated based on the target position, the position of each marker in the calibration image, and the physical distance between multiple markers in the opening direction of the gate.
[0085] For example, two markers at different positions are provided on the gate, namely a red reflective tape and a blue reflective tape. In the acquired image to be detected, if the red reflective tape and the blue reflective tape are not blocked, the electronic device can determine the current positions of the red reflective tape and the blue reflective tape, and then determine the current position of the red reflective tape or the current position of the blue reflective tape as the target position, and then determine the moving distance of the gate based on the target position of the red reflective tape and the calibration information of the red reflective tape and the blue reflective tape; or determine the moving distance of the gate based on the target position of the blue reflective tape and the calibration information of the red reflective tape and the blue reflective tape.
[0086] In the acquired image to be detected, if the blue reflective tape is blocked and the electronic device can only detect the red reflective tape, then the electronic device can determine the current position of the red reflective tape as the target position, and then determine the moving distance of the gate based on the target position of the red reflective tape and the calibration information of the red reflective tape and the blue reflective tape.
[0087] In the acquired image to be detected, if the red reflective tape is blocked and the electronic device can only detect the blue reflective tape, then the electronic device can determine the current position of the blue reflective tape as the target position, and then determine the moving distance of the gate based on the target position of the blue reflective tape and the calibration information of the red reflective tape and the blue reflective tape.
[0088] It can be seen that in this embodiment, when there are multiple markers in the image to be detected, it is not necessary to use the current positions of all the markers to determine the moving distance of the gate. It is only necessary to determine one of the current positions of multiple markers as the target position, and use the target position to determine the moving distance of the gate, thereby reducing the amount of calculation to determine the moving distance of the gate and improving the efficiency of determining the gate opening.
[0089] As an implementation method of the present application, Figure 6 As shown, the step of determining the moving distance of the gate based on the target position and the calibration information of the predetermined plurality of markers may include:
[0090] S601, determining a position change of the first marker in the image according to the target position, the calibrated position of the first marker corresponding thereto, and the calibrated position of the second marker among the multiple markers.
[0091] After determining the current position of a marker in the image to be detected as the target position, further determine the calibration position of the first marker corresponding to the target position in the calibration image, and the calibration position of the second marker other than the first marker in the calibration image. Furthermore, the electronic device can determine the position change of the first marker in the image based on the target position of the first marker in the image to be detected and the calibration position of the first marker in the calibration image.
[0092] In one embodiment, two markers with different positions are provided on the gate, namely a red reflective tape and a blue reflective tape. In the acquired image to be detected, neither the red reflective tape nor the blue reflective tape is blocked. Therefore, the current position of the red reflective tape or the blue reflective tape in the image to be detected can be determined as the target position, and the calibration position of the red reflective tape and the blue reflective tape in the calibration image can be obtained.
[0093] If the current position of the red reflective tape in the image to be detected is determined as the target position, then the position of the red reflective tape in the calibration image is the calibration position of the first marker, and the position of the blue reflective tape is the calibration position of the second marker. Therefore, based on the target position of the red reflective tape in the image to be detected, the calibration position of the first marker in the calibration image, and the calibration position of the second marker, the position change of the red reflective tape in the image to be detected relative to the red reflective tape in the calibration image is determined.
[0094] If the current position of the blue reflective tape in the image to be detected is determined as the target position, then the position of the blue reflective tape in the calibration image is the calibration position of the first marker, and the position of the red reflective tape is the calibration position of the second marker. Therefore, based on the target position of the blue reflective tape in the image to be detected, the calibration position of the first marker in the calibration image, and the calibration position of the second marker, the position change of the blue reflective tape in the image to be detected relative to the blue reflective tape in the calibration image is determined.
[0095] The calibration positions of the red reflective tape and the blue reflective tape in the calibration image may be predetermined and stored in the electronic device, which is not specifically limited here.
[0096] In another embodiment, two markers with different positions are provided on the gate, namely a red reflective tape and a blue reflective tape. In the acquired image to be detected, there is only one red reflective tape, so the current position of the red reflective tape in the image to be detected is directly determined as the target position. Then, the position of the red reflective tape in the calibration image is the calibration position of the first marker, and the position of the blue reflective tape is the calibration position of the second marker.
[0097] Therefore, the position change of the red reflective tape in the image to be detected relative to the red reflective tape in the calibration image is determined according to the target position of the red reflective tape in the image to be detected, the calibration position of the first marker and the calibration position of the second marker in the calibration image.
[0098] In another embodiment, two markers with different positions are provided on the gate, namely a red reflective tape and a blue reflective tape. After the gate moves, there is only one blue reflective tape in the acquired image to be detected. Therefore, the current position of the blue reflective tape in the image to be detected is directly determined as the target position. Then, the position of the blue reflective tape in the calibration image is the calibration position of the first marker, and the position of the red reflective tape is the calibration position of the second marker.
[0099] Therefore, the position change of the blue reflective tape in the image to be detected relative to the blue reflective tape in the calibration image is determined according to the target position of the blue reflective tape in the image to be detected, the calibration position of the first marker and the calibration position of the second marker in the calibration image.
[0100] In another embodiment, three markers at different positions are arranged on the gate, namely, a square reflective tape, a triangular reflective tape, and a rectangular reflective tape. In the acquired image to be detected, the square reflective tape, the triangular reflective tape, and the rectangular reflective tape are not blocked, so the current position of the square reflective tape, the triangular reflective tape, or the rectangular reflective tape in the image to be detected can be determined as the target position. If the current position of the square reflective tape in the image to be detected is determined as the target position, then the position of the square reflective tape in the calibration image is the calibration position of the first marker, and the position of the triangular reflective tape or the position of the rectangular reflective tape is the calibration position of the second marker, so that according to the target position of the square reflective tape in the image to be detected, the calibration position of the first marker in the calibration image, and the calibration position of the second marker, the position change of the square reflective tape in the image to be detected relative to the square reflective tape in the calibration image is determined.
[0101] In another embodiment, three markers in different positions are provided on the gate, namely, a square reflective tape, a triangular reflective tape and a rectangular reflective tape. In the acquired image to be detected, the square reflective tape and the triangular reflective tape can be detected. Similarly, in the case where the red reflective tape and the blue reflective tape in the above image to be detected are not blocked, the corresponding first marker can be a square reflective tape or a triangular reflective tape.
[0102] If the current position of the square reflective tape in the image to be detected is determined as the target position, then the position of the square reflective tape in the calibration image is the calibration position of the first marker, and the position of the triangular reflective tape or the position of the rectangular reflective tape is the calibration position of the second marker.
[0103] If the current position of the triangular reflective tape in the image to be detected is determined as the target position, then the position of the triangular reflective tape in the calibration image is the calibration position of the first marker, and the position of the square reflective tape or the position of the rectangular reflective tape is the calibration position of the second marker.
[0104] Therefore, based on the target position in the image to be detected, the calibrated position of the first marker in the calibration image and the calibrated position of the second marker, the position change of the square reflective tape in the image to be detected relative to the square reflective tape in the calibration image, or the position change of the triangular reflective tape in the image to be detected relative to the triangular reflective tape in the calibration image is determined.
[0105] In another embodiment, three markers with different positions are arranged on the gate, namely, a square reflective tape, a triangular reflective tape, and a rectangular reflective tape. In the acquired image to be detected, only the square reflective tape can be detected. Similarly, in the case where only the red reflective tape or the blue reflective tape can be detected in the above-mentioned image to be detected, the current position of the square reflective tape in the image to be detected is determined as the target position, then the position of the square reflective tape in the calibration image is the calibration position of the first marker, and the position of the triangular reflective tape or the position of the rectangular reflective tape is the calibration position of the second marker. Thus, the position change of the square reflective tape in the image to be detected relative to the square reflective tape in the calibration image is determined.
[0106] When there are multiple markers in different positions in the image to be detected, the current position of a marker can be randomly determined as the target position, and the marker is the first marker in the calibration image. A marker is randomly determined among the other markers in the calibration image except the first marker as the second marker, and no specific limitation is made here.
[0107] S602: Determine a moving distance of the gate according to the position change and a physical distance between the first marker and the second marker in the opening direction of the gate.
[0108] Since the position change determined above is the change of a marker in the image to be detected, after determining the position change of a marker in the image, it is necessary to use the physical distance between the first marker and the second marker in the direction of gate opening, that is, the actual distance between the first marker and the second marker in the direction of gate opening, and determine the actual moving distance of the gate based on the proportional relationship between the image distance and the actual distance.
[0109] In one embodiment, two markers at different positions are provided on the gate, namely a red reflective tape and a blue reflective tape, and what is determined is the position change of the red reflective tape or the blue reflective tape in the image, then the moving distance of the gate is determined according to the physical distance between the red reflective tape and the blue reflective tape in the gate opening direction, and the proportional relationship between the position change and the physical distance. Specifically, the product of the position change and the physical distance is determined as the moving distance of the gate.
[0110] In one embodiment, three markers with different positions are provided on the gate, namely a square reflective tape, a triangular reflective tape and a rectangular reflective tape. If the position change of the square reflective tape in the image is determined, then according to the physical distance between the square reflective tape and the triangular reflective tape in the gate opening direction, or the physical distance between the square reflective tape and the rectangular reflective tape in the gate opening direction, based on the proportional relationship between the position change and the physical distance, the product of the position change and the physical distance is determined as the moving distance of the gate.
[0111] If the position change of the triangular reflective tape in the image is to be determined, the moving distance of the gate is determined based on the physical distance between the triangular reflective tape and the square reflective tape in the opening direction of the gate, or the physical distance between the triangular reflective tape and the rectangular reflective tape in the opening direction of the gate, using the proportional relationship between the position change and the physical distance.
[0112] If the position change of the rectangular reflective tape in the image is determined, the moving distance of the gate is determined based on the physical distance between the rectangular reflective tape and the triangular reflective tape in the gate opening direction, or the physical distance between the rectangular reflective tape and the square reflective tape in the gate opening direction, using the proportional relationship between the position change and the physical distance. This is reasonable and is not specifically limited here.
[0113] It can be seen that in this embodiment, the position change of the first marker in the image is determined according to the calibrated position of the first marker and the corresponding first marker and the calibrated position of the second marker among the multiple markers, and then according to the physical distance between the first marker and the second marker in the gate opening direction, the moving distance of the gate can be accurately determined based on the proportional relationship between the image distance and the actual distance, thereby ensuring the accuracy of the gate opening.
[0114] As an implementation method of an embodiment of the present application, the current position of the above-mentioned marker in the image to be detected can be the target corner point coordinates of the detection box of the marker in the image to be detected, and the above-mentioned calibrated position can be the calibrated corner point coordinates of the detection box of each marker in the calibrated image.
[0115] In this case, the step of determining the position change of the first marker in the image according to the target position, the calibrated position of the first marker corresponding thereto, and the calibrated position of the second marker among the multiple markers may include:
[0116] Calculate the first distance between the target corner point coordinates and the calibrated corner point coordinates of the corresponding first marker; calculate the second distance between the calibrated corner point coordinates of the first marker and the calibrated corner point coordinates of the second marker among the multiple markers; calculate the ratio between the first distance and the second distance as the position change of the first marker in the image.
[0117] Among them, the target corner point coordinates of the detection frame can be the coordinates of the upper left corner point, the coordinates of the upper right corner point, the coordinates of the lower left corner point, or the coordinates of the lower right corner point, which are all reasonable and are not specifically limited here.
[0118] The positions of the target corner point coordinates of the detection frame, the calibrated corner point coordinates of the first marker corresponding thereto, and the calibrated corner point coordinates of the second marker among the above multiple markers are unified. For example, if the target corner point coordinates of the detection frame are the coordinates of the upper left corner point, then the calibrated corner point coordinates of the first marker and the calibrated corner point coordinates of the second marker are also the coordinates of the upper left corner point; if the target corner point coordinates of the detection frame are the coordinates of the lower right corner point, then the calibrated corner point coordinates of the first marker and the calibrated corner point coordinates of the second marker are also the coordinates of the lower right corner point.
[0119] For example, there are two markers at different positions on the gate, namely a red reflective tape and a blue reflective tape. In the calibration image, the coordinates of the calibration corner point of the red reflective tape are (x1, y1), and the coordinates of the calibration corner point of the blue reflective tape are (x2, y2).
[0120] In one embodiment, in the acquired image to be detected, if both the red reflective tape and the blue reflective tape are detectable, and the current position of the red reflective tape in the image to be detected is determined as the target position, and the current position of the red reflective tape is the target corner point coordinates (x3, y3) of the upper left corner of the detection frame of the red reflective tape in the image to be detected, then the first distance between the calculated target corner point coordinates and the upper left calibrated corner point coordinates (x1, y1) is .
[0121] If the current position of the blue reflective tape in the image to be detected is determined as the target position, the current position of the blue reflective tape is the target corner point coordinates (x4, y4) of the upper left corner of the detection frame of the blue reflective tape in the image to be detected, and the first distance between the target corner point coordinates of the blue reflective tape and the upper left corner calibration corner point coordinates (x2, y2) is calculated as .
[0122] In one embodiment, if only the red reflective tape can be detected in the acquired image to be detected, the coordinates of the upper left corner of the detection frame of the red reflective tape in the calibration image are (x1, y1), and the current position of the red reflective tape is the target corner point coordinates (x3, y3) of the upper left corner of the detection frame of the red reflective tape in the image to be detected, then the first distance between the calculated target corner point coordinates and the calibration corner point coordinates (x1, y1) of the first marker corresponding to it is .
[0123] In the acquired image to be detected, if only the blue reflective tape can be detected, the coordinates of the upper left corner of the detection frame of the blue reflective tape in the calibration image are (x2, y2), and the current position of the blue reflective tape is the target corner point coordinates (x4, y4) of the upper left corner of the detection frame of the blue reflective tape in the image to be detected, then the first distance between the calculated target corner point coordinates and the calibration corner point coordinates (x2, y2) of the corresponding first marker is .
[0124] For example, three markers at different positions are set on the gate, namely, a square reflective tape, a triangular reflective tape and a rectangular reflective tape. In the calibration image, the calibrated corner point coordinates of the square reflective tape are (x1, y1), the calibrated corner point coordinates of the triangular reflective tape are (x2, y2), and the calibrated corner point coordinates of the rectangular reflective tape are (x3, y3).
[0125] In one embodiment, in the acquired image to be detected, if the square reflective tape, the triangular reflective tape, and the rectangular reflective tape are all detectable, and the current position of the square reflective tape in the image to be detected is determined as the target position, the current position of the square reflective tape is the target corner point coordinates (x4, y4) of the upper left corner of the detection frame of the square reflective tape in the image to be detected, and the first distance between the calculated target corner point coordinates and the upper left calibrated corner point coordinates (x1, y1) is .
[0126] If the current position of the triangular reflective tape in the image to be detected is determined as the target position, the current position of the triangular reflective tape is the target corner point coordinates (x5, y5) of the upper left corner of the detection frame of the triangular reflective tape in the image to be detected, and the first distance between the calculated target corner point coordinates and the upper left corner calibration corner point coordinates (x2, y2) is .
[0127] If the current position of the rectangular reflective tape in the image to be detected is determined as the target position, the current position of the rectangular reflective tape is the target corner point coordinates (x6, y6) of the upper left corner of the detection frame of the rectangular reflective tape in the image to be detected, and the first distance between the calculated target corner point coordinates and the upper left calibration corner point coordinates (x3, y3) is .
[0128] In one embodiment, in the acquired image to be detected, if any two of the square reflective tapes, the triangular reflective tapes, and the rectangular reflective tapes can be detected, similarly, the first distance between the target corner point coordinates of the square reflective tape and the calibrated corner point coordinates (x1, y1) of the upper left corner is calculated to be ;
[0129] The first distance between the target corner coordinates of the triangular reflective tape and the calibrated corner coordinates (x2, y2) of the upper left corner is ;
[0130] The first distance between the target corner coordinates of the rectangular reflective tape and the calibrated corner coordinates (x3, y3) of the upper left corner is .
[0131] In one embodiment, if only a square reflective tape can be detected in the acquired image to be detected, the coordinates of the upper left corner of the detection frame of the square reflective tape in the calibration image are (x1, y1), and the current position of the square reflective tape is the target corner point coordinates (x4, y4) of the upper left corner of the detection frame of the square reflective tape in the image to be detected, then the first distance between the calculated target corner point coordinates and the calibration corner point coordinates (x1, y1) of the upper left corner is .
[0132] After calculating the first distance, the electronic device may calculate a second distance between the coordinates of the calibrated corner point of the first marker and the coordinates of the calibrated corner point of a second marker among the plurality of markers, wherein the second marker is one of the markers other than the first marker among the plurality of markers in the calibration image.
[0133] For example, there are two markers at different positions on the gate, namely red reflective tape and blue reflective tape. In the calibration image, the coordinates of the upper left corner of the red reflective tape are (x1, y1), and the coordinates of the upper left corner of the blue reflective tape are (x2, y2). If the coordinates of the calibration corner of the first marker are (x1, y1), then the coordinates of the calibration corner of the second marker are (x2, y2). The second distance between the first marker and the second marker is calculated to be ; If the coordinates of the calibrated corner point of the first marker are (x2, y2), then the coordinates of the calibrated corner point of the second marker are (x1, y1), and the second distance between the first marker and the second marker is calculated to be .
[0134] For another example, three markers at different positions are set on the gate, namely, a square reflective tape, a triangular reflective tape, and a rectangular reflective tape. In the calibration image, the coordinates of the upper left corner calibration point of the square reflective tape are (x1, y1), the coordinates of the upper left corner calibration point of the triangular reflective tape are (x2, y2), and the coordinates of the upper left corner calibration point of the rectangular reflective tape are (x3, y3). If the coordinates of the calibration point of the first marker are (x1, y1), then the coordinates of the calibration point of the second marker can be (x2, y2) or (x3, y3).
[0135] Correspondingly, the second distance between the first marker and the second marker is calculated to be or Correspondingly, if the coordinates of the calibrated corner point of the first marker are (x2, y2) or (x3, y3), the second distance between the first marker and the second marker can be calculated in the same way, which is reasonable.
[0136] After calculating the first distance and the second distance, the electronic device calculates the ratio between the first distance and the second distance as the position change of the first marker in the image. Since the first distance and the second distance are both distances of the marker in the image, the electronic device can calculate the position change of the first marker in the image by calculating the ratio between the two.
[0137] Among them, the first distance represents the distance between the target corner point coordinates of the marker in the image to be detected and the calibrated corner point coordinates of the first marker corresponding to it in the calibration image; the second distance represents the distance between the calibrated corner point coordinates of the first marker in the calibration image and the calibrated corner point coordinates of the second marker; the first distance and the second distance represent the position change of the marker whose current position is determined as the target position in the image, which can be used as the position change amount; the larger the ratio of the first distance to the second distance, the greater the position change amount of the first marker in the image.
[0138] For example, there are two markers at different positions on the gate, namely red reflective tape and blue reflective tape. If both the red reflective tape and the blue reflective tape can be detected in the image to be detected, then the position change of the first marker in the image is or .
[0139] Further, according to the position change and the physical distance L between the first marker and the second marker in the opening direction of the gate, the moving distance of the gate is determined to be or .
[0140] If only the red reflective tape can be detected in the image to be detected, then the position change of the first marker in the image is , the further determined moving distance of the gate is If only the blue reflective tape can be detected in the image to be detected, then the position change of the first marker in the image is , the further determined moving distance of the gate is .
[0141] For another example, three markers in different positions are arranged on the gate, namely a square reflective tape, a triangular reflective tape and a rectangular reflective tape, wherein the physical distance between the square reflective tape and the triangular reflective tape is L1, the physical distance between the square reflective tape and the rectangular reflective tape is L2, and the physical distance between the triangular reflective tape and the rectangular reflective tape is L3; wherein, L1, L2, and L3 may be the same or different, which is all reasonable and is not specifically limited here.
[0142] If the square reflective tape, the triangular reflective tape and the rectangular reflective tape are all detectable, then the position change of the first marker in the image can be , or Then we can further determine the moving distances of the gates. , or etc. This is all reasonable.
[0143] It can be seen that in this embodiment, by taking the target corner coordinates of the detection frame of the marker in the to-be-detected figure as the current position in the to-be-detected image, and the calibrated corner coordinates of the detection frame of each marker in the calibrated image as the calibrated position, the first distance between the two is calculated by the above target corner coordinates and the calibrated corner coordinates, and the second distance between the calibrated corner coordinates of the first marker and the calibrated corner coordinates of the second marker is calculated, and then the ratio of the above first distance to the second distance is taken as the position change of the first marker in the image. The position change of the first marker in the image can be quickly and accurately calculated by the distance between the image coordinate points.
[0144] As an implementation of an embodiment of the present application, the step of determining the opening of the gate based on the preset height and the moving distance may include:
[0145] In the case where the preset height is the maximum height of the gate, the difference between the preset height and the moving distance is calculated as the opening of the gate.
[0146] If the above preset height is the height when the gate is at its maximum opening, no matter how the gate moves, the current height of the gate is always less than the preset height. Therefore, the electronic device can directly calculate the difference between the preset height and the moving distance to determine the gate opening.
[0147] For example, if the preset height of the gate is 10 meters and the calculated moving distance of the gate is 6 meters, it can be determined that the opening of the gate at this time is 4 meters; for another example, if the preset height of the gate is 15 meters and the calculated moving distance of the gate is 10 meters, it can be determined that the opening of the gate at this time is 5 meters.
[0148] In one embodiment, two markers at different positions are provided on the gate, namely a red reflective tape and a blue reflective tape. If both the red reflective tape and the blue reflective tape can be detected in the image to be detected, the movement distance of the gate is determined according to the position change of the red reflective tape and the physical distance between the first marker and the second marker in the opening direction of the gate. , then the gate opening is determined by the difference between the preset height and the moving distance. .
[0149] Or according to the position change of the blue reflective tape and the physical distance between the first marker and the second marker in the opening direction of the gate, the moving distance of the gate is determined to be , then the gate opening is determined by the difference between the preset height and the moving distance. .
[0150] If only the red reflective tape can be detected in the image to be detected, the moving distance of the gate is , then the gate opening is determined by the difference between the preset height and the moving distance. .
[0151] If only the blue reflective tape can be detected in the image to be detected, then the determined moving distance of the gate is , then the gate opening is determined by the difference between the preset height and the moving distance. .
[0152] In one embodiment, three markers with different positions are arranged on the gate, namely, a square reflective tape, a triangular reflective tape and a rectangular reflective tape, wherein the physical distance between the square reflective tape and the triangular reflective tape is L1, the physical distance between the square reflective tape and the rectangular reflective tape is L2, and the physical distance between the triangular reflective tape and the rectangular reflective tape is L3; if the square reflective tape, the triangular reflective tape and the rectangular reflective tape are all detectable, then the position change of the first marker in the image can be , or Then the moving distances of the gates are , or The gate opening is determined based on the difference between the preset height and the moving distance. , or .
[0153] In the case that the preset height is not the maximum height of the gate, if the current position of the marker is higher than the calibrated position corresponding to the marker, the electronic device calculates the sum of the preset height and the moving distance as the opening of the gate, or, if the current position of the marker is not higher than the calibrated position corresponding to the marker, the electronic device calculates the difference between the preset height and the moving distance as the opening of the gate.
[0154] If the above-mentioned preset height is not the maximum height of the gate, but the height of the gate at any opening, the relationship between the current gate height and the preset height cannot be determined. Therefore, it is necessary to first determine whether the gate is currently moving up or down, and then determine the gate opening based on the preset height and moving distance.
[0155] If the gate moves upward, the current position of the marker in the image to be detected is higher than the calibration position corresponding to the marker in the calibration image, and it is necessary to calculate the sum of the preset height and the moving distance as the opening of the gate; if the gate moves downward, the current position of the marker in the image to be detected is not higher than the calibration position corresponding to the marker in the calibration image, and it is necessary to calculate the difference between the preset height and the moving distance as the opening of the gate.
[0156] For example, the maximum height of the gate is 10 meters and the preset height is 7 meters. If the current position of the red reflective tape in the image to be detected is (6, 4) and the calibrated position of the red reflective tape in the calibration image is (6, 7), by comparing the vertical coordinate values of the current position and the calibrated position, it can be determined that the gate is moving downward and the current position of the red reflective tape is not higher than the calibrated position corresponding to the marker. The difference between the preset height and the moving distance is calculated as the opening of the gate.
[0157] If the current position of the red reflective tape in the image to be detected is (6, 8), and the calibrated position of the red reflective tape in the calibration image is (6, 7), by comparing the vertical coordinate values of the current position and the calibrated position, it can be determined that the gate is moving upward. The current position of the red reflective tape is higher than the calibrated position corresponding to the marker, then the sum of the preset height and the moving distance is calculated as the gate opening.
[0158] In one embodiment, two markers at different positions are provided on the gate, namely a red reflective tape and a blue reflective tape. If both the red reflective tape and the blue reflective tape can be detected in the image to be detected, the movement distance of the gate is determined according to the position change of the red reflective tape and the physical distance between the first marker and the second marker in the opening direction of the gate. , then the gate opening is determined by the sum of the preset height H and the moving distance. .
[0159] Or according to the position change of the blue reflective tape and the physical distance between the first marker and the second marker in the opening direction of the gate, the moving distance of the gate is determined to be , then the gate opening is determined by the sum of the preset height and the moving distance. .
[0160] If only the red reflective tape can be detected in the image to be detected, the moving distance of the gate is , then the gate opening is determined by the sum of the preset height and the moving distance. .
[0161] If only the blue reflective tape can be detected in the image to be detected, then the determined moving distance of the gate is , then the gate opening is determined by the sum of the preset height and the moving distance. .
[0162] In one embodiment, three markers with different positions are arranged on the gate, namely, a square reflective tape, a triangular reflective tape and a rectangular reflective tape, wherein the physical distance between the square reflective tape and the triangular reflective tape is L1, the physical distance between the square reflective tape and the rectangular reflective tape is L2, and the physical distance between the triangular reflective tape and the rectangular reflective tape is L3; if the square reflective tape, the triangular reflective tape and the rectangular reflective tape are all detectable, then the position change of the first marker in the image can be , or Then the moving distances of the gates are , or The gate opening is determined based on the sum of the preset height and the moving distance. , or .
[0163] If the current position of the red reflective tape in the image to be detected is (6, 8), and the calibrated position of the red reflective tape in the calibration image is (6, 8), by comparing the vertical coordinate values of the current position and the calibrated position, it can be determined that the gate has not moved, and the current position of the red reflective tape is equal to the calibrated position corresponding to the marker, then the gate opening is equal to the preset height of the gate, 7 meters.
[0164] That is to say, Figure 7 As shown in the figure, the river gate opening calculation component includes a component description button, an input parameter button, and an output parameter button. By clicking different buttons, you can switch the corresponding page. After obtaining the target corner coordinates of the red reflective tape in the image to be detected, click the input parameter button in the river gate opening calculation component, select the event occurrence time (dateTime) as the time of the event in the event time box, that is, the acquisition time of the image to be detected; select the shooting point number (cameraindexCode) corresponding to the gate in the shooting point number box.
[0165] In the Current Coordinates column of the light strip, select the rectangular detection frame, enter the x-coordinate value of the target corner point of the red reflective tape in the target frame coordinate X(x) corresponding to the x column, and enter the y-coordinate value of the target corner point of the red reflective tape in the target frame coordinate Y(y) corresponding to the y column; enter the x-coordinate value of the target corner point of the blue reflective tape in the target frame end point coordinate X(x) corresponding to the x column, and enter the y-coordinate value of the target corner point of the blue reflective tape in the target frame end point coordinate Y(y) corresponding to the y column to obtain the target frame coordinates of the current position of the light strip, and select the detection object category in the Current Target Frame Label column of the light strip as the target frame label of the current position of the light strip.
[0166] In the light band initial coordinates (at maximum opening) column, select the rectangular detection frame, enter the x-coordinate value of the calibrated corner point of the red reflective tape in the coordinate X (x) of the starting point of the rectangular rule frame corresponding to the x column, and enter the y-coordinate value of the calibrated corner point of the red reflective tape in the coordinate Y (y) of the starting point of the rectangular rule frame corresponding to the y column; enter the x-coordinate value of the calibrated corner point of the blue reflective tape in the coordinate X (x) of the ending point of the rectangular rule frame corresponding to the x column, and enter the y-coordinate value of the calibrated corner point of the blue reflective tape in the coordinate Y (y) of the ending point of the rectangular rule frame corresponding to the y column, so as to obtain the coordinates of the light band target frame when the river gate is at the maximum opening.
[0167] In the Lightband Initial Target Frame Properties (at Maximum Opening) column, select the lightband label (brandTag) and lightband height (brandHeight) used for gate opening calculation as the label and height of the lightband target frame when the river gate is at the maximum opening; and set the event reporting interval to 2 seconds in the Event Reporting Interval column. In this way, the river gate opening calculation component can calculate the gate opening based on the above information and output it.
[0168] It can be seen that in the solution provided in the embodiment of the present application, the relationship between the preset height of the gate and the maximum height of the gate is determined. When the preset height is the maximum height of the gate, the difference between the preset height and the moving distance can be directly calculated as the gate opening; and when the preset height is not the maximum height of the gate, it is necessary to first determine the relationship between the current position of the marker and the calibrated position corresponding to the marker, so as to determine whether to use the difference or the sum to calculate the gate opening. In this way, whether the preset height of the gate is the maximum height of the gate or not, the gate opening can be accurately calculated.
[0169] As an implementation of an embodiment of the present application, before the step of determining the moving distance of the gate based on the target position and the predetermined calibration information of the plurality of markers, the method further includes:
[0170] The electronic device determines the degree of overlap between the current position of at least one marker and the calibrated position of the marker, and when the above-mentioned overlap is greater than a preset threshold, determines that the opening of the gate is a preset height; when the above-mentioned overlap is not greater than the preset threshold, executes the above-mentioned step of determining the moving distance of the gate based on the target position and the calibration information of the plurality of markers determined in advance.
[0171] When the gate is at a preset height and does not move, the current position of the marker in the gate's image to be detected and the calibrated position of the marker in the calibration image have a high degree of overlap. At this time, the gate's moving distance is zero, and the gate's opening is the preset height of the gate.
[0172] When the gate moves compared to the preset height, the current position of the marker in the gate's image to be detected will change relative to the calibrated position of the marker in the calibration image when the gate is at the preset height. The greater the movement distance of the gate, the lower the degree of overlap between the current position of the marker and the calibrated position of the marker.
[0173] For example, when two markers are set on the gate, the degree of coincidence between the current position of any one of the two markers and the calibrated position of the marker can be determined; the degree of coincidence between the current position of each of the two markers and the calibrated position of the corresponding marker can also be determined.
[0174] For another example, when three markers are set on the gate, the degree of coincidence between the current position of any one of the three markers and the calibrated position of the marker can be determined; the degree of coincidence between the current position of any two of the three markers and the calibrated positions of the corresponding markers can also be determined; the degree of coincidence between the current position of each of the three markers and the calibrated position of the corresponding marker can also be determined. All of these are reasonable and are not specifically limited here.
[0175] When the degree of overlap between the current position of at least one marker in the image to be detected and the calibrated position of the marker is greater than a preset threshold, it means that the current gate has not moved compared to the preset height. At this time, the opening of the gate is the preset height, wherein the above-mentioned preset threshold can be set according to actual conditions.
[0176] In one embodiment, if only the degree of overlap between the current position of one marker and the calibrated position of the marker is determined, then when the degree of overlap is greater than a preset threshold, the opening of the gate is determined to be a preset height.
[0177] For example, when there are two markers on the gate, the degree of overlap between the current position of any one of the two markers and the calibrated position of the marker can be determined. If the degree of overlap is greater than a preset threshold, the opening of the gate is the preset height. The degree of overlap between the current position of each of the two markers and the calibrated position of the corresponding marker can also be determined.
[0178] In one embodiment, if the degree of overlap between the current positions of a plurality of markers and the calibrated positions of the corresponding markers is determined, then when all the degrees of overlap are greater than a preset threshold, the gate opening is determined to be a preset height.
[0179] For example, when two markers are set on the gate, the degree of overlap between the current position of each of the two markers and the calibrated position of the corresponding marker can be determined. If both of these overlaps are greater than the preset threshold, the gate opening is determined to be the preset height; if at least one overlap is not greater than the preset threshold, the current gate opening is not the preset height.
[0180] For another example, when three markers are set on the gate, the overlap between the current position of each of the three markers and the calibrated position of the corresponding marker can be determined. If all three overlaps are greater than a preset threshold, the gate opening is determined to be the preset height; if at least one overlap is not greater than the preset threshold, the current gate opening is not the preset height. Alternatively, the overlap between the current position of any two of the three markers and the calibrated position of the corresponding marker is determined. If both overlaps are greater than the preset threshold, the gate opening is determined to be the preset height; if at least one overlap is not greater than the preset threshold, the current gate opening is not the preset height.
[0181] In one embodiment, if the degree of overlap between the current positions of a plurality of markers and the calibrated positions of the corresponding markers is determined, then when a preset ratio of the overlap is greater than a preset threshold, the gate opening is determined to be a preset height.
[0182] For example, when the above-mentioned preset ratio is 60%, when there are two markers on the gate, the degree of overlap between the current position of each of the two markers and the calibrated position of the corresponding marker can be determined. If both of these overlaps are greater than the preset threshold, the gate opening is determined to be the preset height; if at least one overlap is not greater than the preset threshold, the current gate opening is not the preset height.
[0183] For another example, when three markers are set on the gate, the degree of overlap between the current position of each of the three markers and the calibrated position of the corresponding marker can be determined. If at least two of the overlaps are greater than a preset threshold, the gate opening is determined to be the preset height; if at least two of the overlaps are not greater than the preset threshold, the current gate opening is not the preset height.
[0184] If the above overlap is not greater than the preset threshold, it means that the gate has moved and the current gate opening is not the preset height. It is necessary to further determine the moving distance of the gate based on the target position of the marker in the image to be detected and the calibration information of multiple predetermined markers.
[0185] It can be seen that in this embodiment, before using the target position and the calibration information of multiple predetermined markers to determine the moving distance of the gate, the relationship between the degree of overlap between the current position of at least one marker and the calibrated position of the marker and the preset threshold value can be determined first. When the above-mentioned degree of overlap is greater than the preset threshold value, the opening of the gate can be directly determined as the preset height, and there is no need to calculate the moving distance of the gate, thereby improving the efficiency of determining the gate opening.
[0186] Since a fence is usually set up around the gate to protect it, the fence may block the gate's markers in the image to be detected during the movement of the gate. When all markers in the image to be detected are blocked, the electronic device cannot determine the gate's opening based on the current position of the markers. At this time, it is necessary to obtain an image whose acquisition time is before the acquisition time of the image to be detected and in which the markers can be detected in the image to be detected to calculate the current gate opening. Therefore, the image acquisition device around the gate continuously shoots the gate, and the image to be detected obtained by the electronic device is a frame of the video taken of the gate in real time.
[0187] As an implementation of the embodiment of the present application, when no marker is detected from the image to be detected, the method further includes:
[0188] The electronic device obtains event information of two gate opening detection events determined before the acquisition time of the image to be detected, wherein the event information includes a first detection time and a first gate opening of the first gate opening detection event, and a second detection time and a second gate opening of the second gate opening detection event. Based on the running speed of the gate and the difference between the first detection time and the second detection time, the electronic device determines the distance moved by the gate from the first detection time to the second detection time.
[0189] When no marker is detected in the image to be detected, the electronic device obtains event information of two gate opening detection events determined before the acquisition time of the above-mentioned image to be detected, and the two gate opening detection events are two events in which the gate opening is detected. The above-mentioned event information includes the first detection time and the first gate opening of the first gate opening detection event, and the second detection time and the second gate opening of the second gate opening detection event.
[0190] After obtaining the first detection time of the first gate opening detection event and the second detection time of the second gate opening detection event, the difference between the first detection time and the second detection time can be determined, and then based on the running speed of the gate, the product of the running speed and the difference between the above times can be calculated as the distance of the gate between the first detection time and the second detection time, where the first detection time is later than the second detection time.
[0191] In one embodiment, the operating speed of the above-mentioned gate is unknown, and it is necessary to calculate the operating speed of the gate first. Since the gate runs at a uniform speed during the movement, the operating speed of the gate can be determined first based on the height difference between the first gate opening and the second gate opening, and the difference between the first detection time and the second detection time, and then the product of the operating speed and the difference between the first detection time and the second detection time is calculated as the moving distance of the gate.
[0192] For example, the running speed of the gate is unknown. We can first determine the moving speed of the gate based on the distance difference J and time difference M1 between any two movements of the gate: When no marker is detected in the image to be detected, the acquisition time of the detection image is recorded as M2, and the first detection time M3 of the first gate opening detection event and the second detection time M4 of the second gate opening detection event are obtained, as well as the corresponding first gate opening L2 and second gate opening L3. It can be determined that within the time range of the first detection time and the second detection time, the movement distance of the gate is S×(M2-M3).
[0193] In one embodiment, the running speed of the gate is a known quantity set at the factory, and there is no need to calculate the running speed of the gate. The product of the running speed and the difference between the first detection time and the second detection time can be directly calculated as the moving distance of the gate.
[0194] For example, if the speed of the gate operation is S2 set when the equipment leaves the factory and is known, when no marker is detected in the image to be detected, the acquisition time of the detection image is recorded as M2, and the first detection time M3 of the first gate opening detection event and the second detection time M4 of the second gate opening detection event are obtained, as well as the corresponding first gate opening L2 and second gate opening L3. It can be determined that the moving distance of the gate within the time range of the first detection time and the second detection time is S2×(M2-M3).
[0195] The opening of the gate is determined based on the first gate opening, the second gate opening, and the determined distance.
[0196] After determining the movement distance of the gate within the first detection time and the second detection time, the gate opening can be determined based on the first gate opening, the second gate opening and the determined movement distance of the gate.
[0197] It can be seen that in this embodiment, when no marker is detected in the image to be detected, the distance moved by the gate from the first detection time to the second detection time can be determined based on the event information of two gate opening detection events determined before the acquisition time of the image to be detected, and then the gate opening when the marker is not detected in the image to be detected is determined based on the first gate opening, the second gate opening and the determined distance. This avoids the situation where the gate opening cannot be determined when no marker is detected in the image to be detected, and enriches the application scenarios of gate opening detection.
[0198] As an implementation of an embodiment of the present application, the step of determining the gate opening based on the first gate opening, the second gate opening and the determined distance may include:
[0199] When the first gate opening is greater than the second gate opening, the electronic device calculates the sum of the first gate opening and the determined distance to obtain the gate opening; when the first gate opening is not greater than the second gate opening, the electronic device calculates the difference between the first gate opening and the determined distance to obtain the gate opening.
[0200] When the first gate opening is greater than the second gate opening, it means that the gate is in the process of opening and moving upward, and the gate height in the image to be detected is greater than the first gate opening. Therefore, the sum of the first gate opening and the determined distance is calculated to obtain the gate opening.
[0201] For example, when L2-L3>0, it means that the gate is in the process of opening and moving upward. According to the first gate opening L2 and the gate moving distance S×(M2-M3), the gate opening is calculated to be L2+ S×(M2-M3); or, according to the first gate opening L2 and the gate moving distance S2×(M2-M3), the gate opening is calculated to be L2+ S2×(M2-M3).
[0202] When the first gate opening is not greater than the second gate opening, it indicates that the gate is in the process of closing by moving downward, and the gate height in the image to be detected is less than the first gate opening. Therefore, the difference between the first gate opening and the determined distance is calculated to obtain the gate opening.
[0203] For example, when L2-L3<0, it means that the gate is in the process of closing by moving downward. According to the first gate opening L2 and the gate moving distance S×(M2-M3), the gate opening is calculated to be L2-S×(M2-M3); or, according to the first gate opening L2 and the gate moving distance S2×(M2-M3), the gate opening is calculated to be L2-S2×(M2-M3).
[0204] It can be seen that in this embodiment, whether the gate moves downward or upward is determined by the size of the first opening and the second opening of the gate, and it can be accurately selected whether to use the sum value or the difference value to calculate the gate opening, thereby improving the accuracy of detecting the gate opening.
[0205] As an implementation method of the present application, based on the interface element, the flow chart of determining the gate opening can be as follows: Figure 8 As shown, it may specifically include:
[0206] Gate light band recognition event 801: When the gate opening needs to be detected, the electronic device can obtain the gate light band recognition event, indicating that the gate opening needs to be determined at this time.
[0207] Point information query component 802, based on which a user or electronic device can input the shooting point number where the gate is photographed, thereby querying and obtaining information such as the image to be detected including the gate.
[0208] The river gate opening calculation element 803, based on the river gate opening calculation element, the electronic device can calculate the gate opening according to the detection frame coordinates of the red reflective tape and the blue reflective tape in the image to be detected, the detection frame coordinates of the red reflective tape and the blue reflective tape in the calibration image collected when the gate is at a preset height, and the pre-set physical distance between the red reflective tape and the blue reflective tape.
[0209] The gate light band identification event output 804, the electronic device can output the gate opening output by the river gate opening calculation element, that is, the gate light band identification event output. For example, it can be displayed in the interface of the electronic device.
[0210] It can be seen that the solution provided in the embodiment of the present application is not limited to a specific usage scenario, but can be applied to various scenarios of gate opening. Whether there is an obstruction or an unobstructed scene, the gate opening, that is, the height of the gate, can be calculated using one or more of the red and blue reflective strips, without the need for any water gauge equipment.
[0211] Corresponding to the above-mentioned gate opening detection method, the embodiment of the present application further provides a gate opening detection device. The following is an introduction to a gate opening detection device provided in the embodiment of the present application.
[0212] like Fig. 9 As shown, a gate opening detection device comprises:
[0213] An image detection module 910 is used to obtain an image to be detected;
[0214] Wherein, the image to be detected includes a gate, and a plurality of markers with non-repetitive positions are arranged on the gate.
[0215] The position determination module 920 is used to perform image detection on the image to be detected and determine the current position of at least one marker in the image to be detected.
[0216] A distance determination module 930, for determining a moving distance of the gate according to the current position and the predetermined calibration information of the plurality of markers;
[0217] Among them, the calibration information at least includes the calibration position and the physical distance of the multiple markers in the opening direction of the gate, the calibration position is the position of each marker in the calibration image, and the calibration image is the image of the gate captured when the gate is opened to a preset height.
[0218] The opening determination module 940 is used to determine the opening of the gate based on the preset height and the moving distance.
[0219] It can be seen that in the solution provided in the embodiment of the present application, the electronic device can obtain an image to be detected, wherein the image to be detected includes a gate, and a plurality of markers with non-repeating positions are arranged on the gate. Then, image detection is performed on the image to be detected to determine the current position of at least one marker in the image to be detected, and then the moving distance of the gate is determined based on the current position and the calibration information of the plurality of markers determined in advance, wherein the calibration information includes at least the calibration position and the physical distance of the plurality of markers in the opening direction of the gate, the calibration position is the position of each marker in the calibration image, and the calibration image is an image of the gate captured when the gate is opened to a preset height, thereby determining the opening of the gate based on the preset height and the moving distance. In this way, since there are multiple markers with non-overlapping positions on the gate, when one marker is blocked, other unblocked markers on the gate can be used to detect the gate opening. As long as the current position of at least one marker can be determined from the image to be detected, the gate opening can be determined based on the predetermined calibrated position of the marker and the physical distance of the marker in the opening direction of the gate, thereby improving the accuracy and stability of the gate opening.
[0220] As an implementation of the embodiment of the present application, the distance determination module 930 may include:
[0221] The target position determination submodule is used to determine, when there are multiple markers detected from the image to be detected, one of the current positions of the multiple markers as the target position; or, when there is only one marker detected from the image to be detected, determine the current position of the one marker as the target position.
[0222] The moving distance determination submodule is used to determine the moving distance of the gate based on the target position and the calibration information of the plurality of predetermined markers.
[0223] As an implementation of the embodiment of the present application, the above-mentioned moving distance determination submodule may include:
[0224] The position change determination unit is used to determine the position change of the first marker in the image according to the target position, the calibrated position of the first marker corresponding to it, and the calibrated position of the second marker among the multiple markers.
[0225] A moving distance determination unit is used to determine the moving distance of the gate according to the position change and the physical distance between the first marker and the second marker in the opening direction of the gate.
[0226] As an implementation method of an embodiment of the present application, the current position of the above-mentioned marker in the image to be detected is the target corner point coordinates of the detection box of the marker in the image to be detected, and the above-mentioned calibration position is the calibration corner point coordinates of the detection box of each marker in the calibration image; the above-mentioned position change determination unit may include:
[0227] The first distance determination subunit is used to calculate the first distance between the target corner point coordinates and the calibrated corner point coordinates of the first marker corresponding to it.
[0228] The second distance determination subunit is used to calculate the second distance between the calibrated corner point coordinates of the first marker and the calibrated corner point coordinates of the second marker among the multiple markers.
[0229] The position change determination subunit is used to calculate the ratio between the first distance and the second distance as the position change of the first marker in the image.
[0230] As an implementation of the embodiment of the present application, the above-mentioned opening degree determination module 940 may include:
[0231] The first gate opening determination submodule is used to calculate the difference between the preset height and the moving distance as the gate opening when the preset height is the maximum height of the gate.
[0232] The second submodule for determining the gate opening is used to, when the preset height is not the maximum height of the gate, calculate the sum of the preset height and the moving distance as the opening of the gate if the current position of the marker is higher than the calibrated position corresponding to the marker, or, if the current position of the marker is not higher than the calibrated position corresponding to the marker, calculate the difference between the preset height and the moving distance as the opening of the gate.
[0233] As an implementation of the embodiment of the present application, the distance determination module 930 may further include:
[0234] The coincidence determination submodule is used to determine the coincidence between the current position of the at least one marker and the calibrated position of the marker.
[0235] The preset height determination submodule is used to determine that the opening of the gate is a preset height when the overlap degree is greater than a preset threshold.
[0236] The moving distance execution submodule is used to execute the step of determining the moving distance of the gate based on the target position and the calibration information of the plurality of predetermined markers when the overlap degree is not greater than a preset threshold.
[0237] As an implementation method of the embodiment of the present application, the above-mentioned image to be detected is a frame of a video captured in real time of the gate;
[0238] In the case where no marker is detected from the image to be detected, the device further includes:
[0239] An event information acquisition module is used to obtain event information of two gate opening detection events determined before the acquisition moment of the image to be detected, wherein the event information includes the first detection time and the first gate opening of the first gate opening detection event, and the second detection time and the second gate opening of the second gate opening detection event.
[0240] The second distance determination module is used to determine the distance moved by the gate from the first detection time to the second detection time according to the running speed of the gate and the difference between the first detection time and the second detection time.
[0241] The second gate opening determination module is used to determine the gate opening based on the first gate opening, the second gate opening and the determined distance.
[0242] As an implementation of the embodiment of the present application, the gate opening second determination module may include:
[0243] The first gate opening determination submodule is used to calculate the sum of the first gate opening and the determined distance to obtain the gate opening when the first gate opening is greater than the second gate opening.
[0244] The second gate opening determination submodule is used to calculate the difference between the first gate opening and the determined distance to obtain the gate opening when the first gate opening is not greater than the second gate opening.
[0245] The present application also provides an electronic device, such as Fig.10 As shown, including:
[0246] Memory 1001, used for storing computer programs;
[0247] The processor 1002 is used to implement the gate opening detection method steps described in any of the above embodiments when executing the program stored in the memory 1001.
[0248] It can be seen that in the solution provided in the embodiment of the present application, the electronic device can obtain an image to be detected, wherein the image to be detected includes a gate, and a plurality of markers with non-repeating positions are arranged on the gate. Then, image detection is performed on the image to be detected to determine the current position of at least one marker in the image to be detected, and then the moving distance of the gate is determined based on the current position and the calibration information of the plurality of markers determined in advance, wherein the calibration information includes at least the calibration position and the physical distance of the plurality of markers in the opening direction of the gate, the calibration position is the position of each marker in the calibration image, and the calibration image is an image of the gate captured when the gate is opened to a preset height, thereby determining the opening of the gate based on the preset height and the moving distance. In this way, since there are multiple markers with non-overlapping positions on the gate, when one marker is blocked, other unblocked markers on the gate can be used to detect the gate opening. As long as the current position of at least one marker can be determined from the image to be detected, the gate opening can be determined based on the predetermined calibrated position of the marker and the physical distance of the marker in the opening direction of the gate, thereby improving the accuracy and stability of the gate opening.
[0249] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0250] The communication interface is used for communication between the above electronic device and other devices.
[0251] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0252] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0253] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of the gate opening detection method described in any of the above embodiments are implemented.
[0254] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the gate opening detection method described in any of the above embodiments.
[0255] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.
[0256] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0257] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0258] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A method for detecting gate opening, characterized in that: The method comprises: Acquire an image to be detected, wherein the image to be detected includes a gate, and a plurality of markers with non-repeated positions are arranged on the gate; Performing image detection on the image to be detected to determine a current position of at least one marker in the image to be detected; Determine the moving distance of the gate according to the current position and the predetermined calibration information of the multiple markers, wherein the calibration information at least includes the calibration position and the physical distance of the multiple markers in the opening direction of the gate, the calibration position is the position of each marker in the calibration image, and the calibration image is an image of the gate captured when the gate is opened to a preset height; Determining the opening of the gate based on the preset height and the moving distance; Wherein, the step of determining the moving distance of the gate according to the current position and the predetermined calibration information of the plurality of markers comprises: Determine a position change of the first marker in the image according to a target position, a calibrated position of the first marker corresponding thereto, and a calibrated position of a second marker among the plurality of markers, wherein the target position is one of the current positions of the markers; The moving distance of the gate is determined according to the position change and the physical distance between the first marker and the second marker in the opening direction of the gate.
2. The method according to claim 1, characterized in that The method for determining the target position includes: When there are multiple markers detected from the image to be detected, one of the current positions of the multiple markers is determined as the target position; or, when there is only one marker detected from the image to be detected, the current position of the one marker is determined as the target position.
3. The method according to claim 1, characterized in that The current position of the marker in the image to be detected is the target corner coordinates of the detection frame of the marker in the image to be detected, and the calibrated position is the calibrated corner coordinates of the detection frame of each marker in the calibrated image; The step of determining the position change of the first marker in the image according to the target position, the calibrated position of the first marker corresponding thereto, and the calibrated position of the second marker among the plurality of markers comprises: Calculating a first distance between the target corner point coordinates and the calibrated corner point coordinates of the first marker corresponding thereto; Calculating a second distance between the coordinates of a calibrated corner point of the first marker and the coordinates of a calibrated corner point of a second marker among the plurality of markers; The ratio between the first distance and the second distance is calculated as the position change of the first marker in the image.
4. The method according to any one of claims 1 to 3, characterized in that: The step of determining the opening of the gate based on the preset height and the moving distance comprises: In the case where the preset height is the maximum height of the gate, calculating the difference between the preset height and the moving distance as the opening of the gate; When the preset height is not the maximum height of the gate, if the current position of the marker is higher than the calibrated position corresponding to the marker, the sum of the preset height and the moving distance is calculated as the opening of the gate, or, if the current position of the marker is not higher than the calibrated position corresponding to the marker, the difference between the preset height and the moving distance is calculated as the opening of the gate.
5. The method according to any one of claims 1 to 3, characterized in that: Before the step of determining the moving distance of the gate according to the current position and the predetermined calibration information of the plurality of markers, the method further comprises: Determining a degree of coincidence between a current position of the at least one marker and a calibrated position of the marker; When the overlap degree is greater than a preset threshold, determining the gate opening to be a preset height; When the degree of overlap is not greater than a preset threshold, the step of determining the moving distance of the gate based on the target position and the calibration information of the plurality of predetermined markers is performed.
6. The method according to any one of claims 1 to 3, characterized in that: The image to be detected is a frame of a video shot of the gate in real time; In the case where no marker is detected from the image to be detected, the method further includes: Acquire event information of two gate opening detection events determined before the acquisition time of the image to be detected, wherein the event information includes a first detection time and a first gate opening of the first gate opening detection event, and a second detection time and a second gate opening of the second gate opening detection event; Determine the distance the gate moves from the first detection time to the second detection time according to the running speed of the gate and the difference between the first detection time and the second detection time; The opening of the gate is determined based on the first gate opening, the second gate opening, and the determined distance.
7. The method according to claim 6, characterized in that The step of determining the gate opening based on the first gate opening, the second gate opening and the determined distance comprises: When the first gate opening is greater than the second gate opening, calculating the sum of the first gate opening and the determined distance to obtain the gate opening; When the first gate opening is not greater than the second gate opening, a difference between the first gate opening and the determined distance is calculated to obtain the gate opening.
8. A gate opening detection device, characterized in that: The device comprises: An image detection module, used for acquiring an image to be detected, wherein the image to be detected includes a gate, and a plurality of markers with non-repeated positions are arranged on the gate; A position determination module, used to perform image detection on the image to be detected, and determine the current position of at least one marker in the image to be detected; a distance determination module, configured to determine the moving distance of the gate according to the current position and the calibration information of the plurality of predetermined markers, wherein the calibration information at least includes a calibration position and a physical distance of the plurality of markers in the opening direction of the gate, the calibration position is the position of each marker in a calibration image, and the calibration image is an image of the gate captured when the gate is opened to a preset height; An opening determination module, used to determine the opening of the gate based on the preset height and the moving distance; Wherein, the distance determination module includes: a position change determination unit, configured to determine a position change of the first marker in the image according to a target position, a calibrated position of the first marker corresponding thereto, and a calibrated position of a second marker among the plurality of markers, wherein the target position is one of the current positions of the markers; A moving distance determination unit is used to determine the moving distance of the gate according to the position change and the physical distance between the first marker and the second marker in the opening direction of the gate.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-7 when executing a program stored in a memory.
Citation Information
Patent Citations
Vehicle door opening degree calculation method, vehicle door opening degree calculation device and vehicle
CN116428986A
Mechanical valve stroke analysis system, method and equipment and storage medium
CN116624645A