Disclosure of Invention
Based on the above, in order to solve or improve the problems in the prior art, the application provides a method and a system for identifying the opening and closing states of a rolling gate of a parking garage, which can improve the monitoring efficiency of the parking garage.
In a first aspect, a method for identifying a state of opening and closing a rolling shutter door of a parking garage is provided, comprising the steps of:
acquiring an image of a camera arranged in a parking garage, which is shot by the camera and faces to a shutter of the parking garage;
identifying straight lines in the image along a first direction or a second direction, and counting the number of the straight lines;
and identifying the opening and closing states of the rolling gate according to the number of the straight lines along the first direction or the second direction, wherein an included angle formed by the first direction and the horizontal direction is smaller than a first preset angle, and an included angle formed by the second direction and the vertical direction is smaller than a second preset angle.
In one embodiment, a plurality of strip structures are arranged on the shutter along the horizontal direction;
the step of identifying the open/close state of the shutter according to the number of straight lines in the first direction includes: if the number of the straight lines in the first direction is larger than a first preset number threshold, judging that the shutter is in a closed state, otherwise, judging that the shutter is in an open state;
the step of identifying the open/close state of the shutter according to the number of straight lines in the second direction includes: and if the number of the straight lines in the second direction is larger than a second preset number threshold, judging that the shutter is in an open state, otherwise, judging that the shutter is in a closed state.
In one embodiment, the step of acquiring images of a position, which is opposite to a rolling gate of the parking garage, taken by a camera installed in the parking garage is to acquire a plurality of continuous images; the shooting direction of a camera installed in the parking garage is fixed;
if the number of the straight lines in the first direction is greater than a first preset number threshold, the step of determining that the shutter is in a closed state includes: if the number of the straight lines in the first direction in the continuous multiple images is larger than a first preset number threshold value, and the positions of the straight lines in the first direction in each image are the same, the shutter is judged to be in a closed state, and if the number of the straight lines in the first direction in the continuous multiple images is larger than the first preset number threshold value, but the positions of the straight lines in the first direction in more than two images are different, the shutter is judged to be in an open state.
In one embodiment, if the number of straight lines in the first direction is greater than a first preset number threshold, the step of determining that the shutter door is in a closed state includes: and if the number of the straight lines in the first direction is greater than a first preset number threshold, and the adjacent straight lines in the first direction are parallel and equidistant, and/or the width of the straight lines in the first direction is in a preset width range, judging that the shutter door is in a closed state.
In one embodiment, if the number of the straight lines in the first direction detected in the preset time period gradually decreases from being greater than a first preset number threshold value to being less than the first preset number threshold value and being maintained for more than the preset time period, the shutter door is judged to be in an open state.
In one embodiment, in the step of identifying the open/close state of the shutter according to the number of the straight lines along the first direction or the second direction, if the shutter is determined to be in the open state, an image of the shutter in the open state is obtained, and the image of the shutter in the open state is uploaded to a terminal for login of the user authority of the parking garage;
and when the terminal receives the image at the shutter door, popping up an alarm interface, generating an alarm button on the alarm interface, and if the alarm button is triggered, sending alarm information to the terminal of the public security department by the terminal.
In one embodiment, the step of identifying a straight line in the image comprises:
performing binarization processing on the image;
and detecting a straight line in the binarized image by using Hough line transformation.
In one embodiment, the step of detecting the straight line in the binarized image by using hough line transform includes:
acquiring all pixel points of straight lines along a first direction or a second direction, mapping each pixel point into a two-dimensional coordinate system, acquiring straight line equations of each straight line along the first direction and each straight line along the second direction, and defining the straight line equations as y=kx+b, wherein y represents a value of each pixel point on an ordinate, x represents a value of each pixel point on an abscissa, b represents a value of each pixel point on an ordinate when the value of each pixel point on an abscissa is zero, k=tan alpha, alpha is the first preset angle for the straight line along the first direction, k=tan (90 ° +beta) for the straight line along the second direction, and beta is the second preset angle;
each linear equation y=kx+b is converted into b= -xk+y, thereby obtaining a straight line passing through the coordinate point (k, b).
In a second aspect, the application provides a system for identifying the opening and closing states of a parking garage rolling gate, which comprises a processor, a memory and a camera arranged in a parking garage, wherein the shooting direction of the camera is opposite to the parking garage rolling gate; the camera is connected with the processor;
the camera is used for shooting images of the parking garage shutter;
the memory has stored therein a computer program which, when executed by the processor, causes the processor to perform the steps of the method of identifying a parking garage door opening and closing status as described in any of the embodiments above.
In one embodiment, the parking garage further comprises a communication module and a terminal for login of the parking garage user permission, and the camera is in communication connection with the terminal through the communication module;
the processor is used for triggering the camera to upload the acquired image of the shutter in the open state to a terminal of the parking garage user permission login through the communication module when the shutter is judged to be in the open state;
the terminal is used for popping up an alarm interface when receiving the image at the shutter door, generating an alarm button on the alarm interface, and sending alarm information to a terminal of a public security department when the alarm button is triggered.
According to the method and the system for identifying the opening and closing states of the rolling gate of the parking garage, the image identification method is adopted, and the opening and closing states of the rolling gate are identified through identifying the number of straight lines in the image at the rolling gate of the parking garage, so that the monitoring efficiency of the parking garage is improved.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
As described in the background art, the parking garage is currently judged to be in a safe state or to be intruded illegally mainly by manually observing the video uploaded by the camera, and the efficiency is low.
The embodiment of the application provides a method for identifying the opening and closing states of a rolling gate of a parking garage, which can improve the monitoring efficiency of the parking garage.
Referring to fig. 2, a flowchart of a method for identifying a door opening/closing state of a parking garage according to an embodiment includes the following steps:
step 202, acquiring an image of a shutter door of a parking garage, which is shot by a camera installed in the parking garage and is opposite to the parking garage;
step 204, identifying straight lines in the image along the first direction or along the second direction, and counting the number of the straight lines;
step 206, identifying the opening and closing state of the shutter according to the number of straight lines along the first direction or along the second direction, wherein the included angle formed by the first direction and the horizontal direction is smaller than a first preset angle, and the included angle formed by the second direction and the vertical direction is smaller than a second preset angle.
Since a typical characteristic of a typical roll-up door is to arrange a plurality of bar-like structures in a horizontal direction (as shown in fig. 3), the ground outside the roll-up door has lines in a vertical direction due to the possible presence of plants, utility poles, etc. Therefore, the method for identifying the opening and closing states of the rolling gate of the parking garage in the embodiment can adopt an image identification method, and the opening and closing states of the rolling gate are identified by identifying the number of straight lines in the image at the rolling gate of the parking garage, so that the monitoring efficiency of the parking garage is improved.
The rolling gate in the real scene has a strip-shaped structure along the horizontal direction possibly with working errors, and plants, telegraph poles and the like outside the rolling gate in the real scene are close to the vertical direction, but have deviation inevitably. In addition, when the camera performs image processing or shooting, straight lines belonging to the horizontal direction and the vertical direction in the real scene are wrongly processed into oblique lines. Therefore, when image recognition is adopted in the embodiment, the straight line forming the preset angle with the horizontal direction and the straight line forming the preset angle with the vertical direction are also recognized, so that the influence caused by the reasons can be reduced.
In this embodiment, the direction in which the flat ground is located may be regarded as a horizontal direction. The direction perpendicular to the flat ground can be regarded as the vertical direction.
The camera can be installed at the ceiling of the parking garage, and in particular, the camera is installed to enable the shooting direction to be opposite to the shutter door.
The first preset angle may be within ±20°, that is, straight lines in the image forming an angle smaller than 20 ° with the horizontal direction are identified. The second preset angle can be within + -10 degrees, namely, straight lines, which form included angles smaller than 10 degrees with the vertical direction, in the image are identified.
In some embodiments, referring to fig. 4 or 5, the step of identifying a straight line in the image along the first direction or along the second direction includes:
2042, performing binarization processing on the image;
in step 2044, a straight line in the first direction or in the second direction in the binarized image is detected by hough line transform.
In the embodiments, the Hough line transformation is adopted to detect the straight line, so that the calculation amount is small, and the method can be realized by using a low-cost processor, so that the hardware cost is saved.
In specific implementation, the HoughLines function of the OpenCV library can be directly called to finish the line detection of the Houghline transformation.
In some embodiments, the step of detecting a straight line in the first direction or in the second direction in the binarized image using hough line transform comprises:
acquiring all pixel points of straight lines along a first direction or a second direction, mapping each pixel point into a two-dimensional coordinate system, acquiring straight line equations of straight lines along the first direction and straight lines along the second direction, and defining the straight line equations as y=kx+b, wherein y represents a value of each pixel point on an ordinate, x represents a value of each pixel point on an abscissa, b represents a value of each pixel point on an ordinate when the value of each pixel point on an abscissa is zero, and k=tan α, α is the first preset angle for the straight lines along the first direction. For a straight line in the second direction, k=tan (90 ° +β), β being the second preset angle.
Each linear equation y=kx+b is converted into b= -xk+y, thereby obtaining a straight line passing through the coordinate point (k, b).
It will be appreciated by those skilled in the art that in implementing the present embodiment, the first preset angle and the second preset angle may be negative, for example, α equals-15 °, and β equals-8 °.
In some embodiments, a plurality of strip structures are arranged on the rolling gate along the horizontal direction. It is thus possible to determine whether the roll-up door is closed by identifying the number of straight lines in the image in the first direction (the first direction forming an angle with the horizontal direction smaller than a first preset angle). Specifically, referring to fig. 4, the steps of identifying the open/close state of the shutter according to the number of straight lines along the first direction include:
step 2046, identifying the open/close state of the shutter door according to whether the number of straight lines in the first direction is greater than a first preset number threshold. If the number of the straight lines in the first direction is greater than the first preset number threshold, step 208 is executed to determine that the shutter is in a closed state. Otherwise, step 210 is executed to determine that the shutter door is in an open state. The first preset number threshold may be dependent on the number of bar structures of the shutter door in the real scene, for example 20.
Specifically, if the number of the straight lines in the first direction detected in the preset time is gradually reduced from being larger than a first preset number threshold value to be smaller than the first preset number threshold value and maintained for more than the preset time, the shutter door is judged to be in an open state.
In other embodiments, the shutter door may have a vertical line scene at the outside, so whether the shutter door is closed can be identified by the number of straight lines in the second direction. Specifically, referring to fig. 5, the steps of identifying the open/close state of the shutter according to the number of straight lines along the second direction include: step 2047, identifying the open/close state of the shutter according to whether the number of straight lines along the second direction is greater than a second preset number threshold. If the number of the straight lines in the second direction is greater than the second preset number threshold, step 208 is executed to determine that the shutter is in the open state, otherwise step 210 is executed to determine that the shutter is in the closed state. The second preset number threshold may be based on the actual situation, e.g. 5.
To further improve recognition accuracy, in some embodiments, the step of acquiring images taken by cameras mounted within the parking garage at the location facing the parking garage shutter door is to acquire a succession of images; the shooting direction of the camera installed in the parking garage is fixed, namely the shooting area of the camera is always unchanged; if the number of straight lines in the first direction is greater than the first preset number threshold, the step of determining that the shutter is in the closed state includes: if the number of straight lines in the first direction in the continuous multiple images is greater than a first preset number threshold, and the positions of the straight lines in the first direction in each image are the same, which means that the straight lines in the first direction in the images are static and greater than the preset number, then the shutter is likely to be in a closed state when the images of the shutter are shot, and if the number of straight lines in the first direction in the continuous multiple images is greater than the first preset number threshold, but the positions of the straight lines in the first direction in more than two images are different, which means that the straight lines in the first direction are dithered or moved, then the shot images of a moving object are likely to be static rather than the shutter image in the closed state, then the shutter is judged to be in an open state.
In addition, in some embodiments, if the number of straight lines in the first direction is greater than the first preset number threshold, the step of determining that the shutter door is in the closed state may further include: if the number of the straight lines in the first direction is greater than a first preset number threshold, and the adjacent straight lines in the first direction are parallel and equidistant, the probability that the straight lines belong to the rolling gate is higher, and/or the width of the straight lines in the first direction is within the preset width range of the strip-shaped structure of the rolling gate, and the rolling gate can be judged to be in a closed state under the conditions.
In the rolling gate in the real scene, the strip structures are parallel and equidistant and have a certain width, so in the embodiments, the rolling gate can be judged to be in a closed state by further identifying that the straight lines in the first direction are parallel and equidistant and/or the width of the straight lines is within the preset width range of the strip structure of the rolling gate. In this way, the recognition accuracy when the shutter is in the closed state is improved.
In some embodiments, in the step of identifying the open/close state of the shutter according to the number of straight lines along the first direction or the second direction, if the shutter is determined to be in the open state, an image of the shutter in the open state is acquired, and the image of the shutter in the open state is uploaded to a terminal to which the parking garage user rights are logged in; when the terminal receives the image at the shutter door, the terminal pops up an alarm interface, generates an alarm button on the alarm interface, and if the alarm button is triggered, the terminal sends alarm information to the terminal of the public security department. In this way, the property safety of the parking garage is improved.
The embodiment of the application also provides a system for identifying the opening and closing states of the rolling gate of the parking garage, referring to fig. 6, which comprises a processor 630, a memory and a camera 610 installed in the parking garage, wherein the shooting direction of the camera is opposite to the rolling gate 620 of the parking garage; the camera 610 is connected with the processor 630;
the camera 610 is used for shooting an image of the parking garage shutter 620;
the memory stores a computer program which, when executed by the processor 630, causes the processor 630 to perform the steps of the method of identifying a status of a shutter door of a parking garage as in any of the embodiments above.
In one embodiment, the system for identifying the opening and closing states of the rolling gate of the parking garage further comprises a communication module and a terminal 640 for logging in the user authority of the parking garage, wherein the camera 610 is in communication connection with the terminal 640 through the communication module; the processor 630 is configured to trigger the camera 610 to upload the acquired image of the shutter door in the open state to the terminal 640 for login of the user permission of the parking garage through the communication module when the shutter door is determined to be in the open state; when the terminal 640 receives the image at the shutter door, the alarm interface is popped up, an alarm button is generated on the alarm interface, and if the alarm button is triggered, the terminal sends alarm information to the terminal of the public security department.
The terminal 640 may be implemented in various forms. For example, the terminals 640 described in the present application may include mobile terminals such as cell phones, tablet computers, notebook computers, palm computers, personal digital assistants (Personal Digital Assistant, PDA), portable media players (Portable Media Player, PMP), navigation devices, wearable devices, smart bracelets, pedometers, and fixed terminals such as digital TVs, desktop computers, and the like.
The specific definition of the system for identifying the opening and closing state of the rolling gate of the parking garage is referred to in the previous embodiment, and is not repeated here in particular.
Fig. 7 is a block diagram showing the construction of an apparatus for recognizing the open/close state of a roller shutter of a parking garage according to one embodiment. As shown in fig. 7, the apparatus for recognizing a state of opening and closing a shutter of a parking garage includes:
the image acquisition module 710 is used for acquiring an image of a position, which is opposite to a rolling gate of the parking garage, and is shot by a camera arranged in the parking garage;
a straight line identifying module 720, configured to identify straight lines in the image along the first direction or along the second direction, and count the number of the straight lines;
the shutter door opening and closing state identification module 730 is configured to identify the shutter door opening and closing state according to the number of straight lines along the first direction or along the second direction, where an included angle formed by the first direction and the horizontal direction is smaller than a first preset angle, and an included angle formed by the second direction and the vertical direction is smaller than a second preset angle.
According to the embodiment of the application, the method of image recognition is adopted, the opening and closing states of the rolling gate are recognized by recognizing the number of straight lines in the images at the rolling gate of the parking garage, and the monitoring efficiency of the parking garage is improved.
The above-mentioned division of each module in the device for identifying the opening and closing state of the rolling gate of the parking garage is only used for illustration, and in other embodiments, the device for identifying the opening and closing state of the rolling gate of the parking garage can be divided into different sub-modules according to the need, so as to complete all or part of the functions of the device for identifying the opening and closing state of the rolling gate of the parking garage.
For specific limitations on the means for identifying the opening and closing state of the parking garage door, reference is made to the above limitations on the method for identifying the opening and closing state of the parking garage door, and no further description is given here. The above-mentioned means for identifying the opening and closing state of the rolling gate of the parking garage may be implemented in whole or in part by software, hardware and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
The implementation of each module in the device for identifying the opening and closing states of the garage rolling gate provided in the embodiment of the application can be in the form of a computer program. The computer program may run on a terminal or a server. Program modules of the computer program may be stored in the memory of the terminal or server. Which when executed by a processor, performs the steps of the methods described in the embodiments of the present application.
The application also proposes an electronic device comprising a processor and a memory, in which a computer program is stored which, when executed by the processor, causes the processor to carry out the steps of the method of identifying the status of a shutter door of a parking garage as in any of the embodiments above.
The electronic device may be implemented in various forms. For example, the electronic devices described in the present application may include mobile terminals such as cell phones, tablet computers, notebook computers, palm computers, personal digital assistants (Personal Digital Assistant, PDA), portable media players (Portable Media Player, PMP), navigation devices, wearable devices, smart bracelets, pedometers, and stationary terminals such as digital TVs, desktop computers, and the like.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.