Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a method, a device and equipment for testing the rise and fall time of an electric railing for charging, which are used for solving the technical problems of large error, high labor and time cost in the measurement and calculation of the rise and fall time of the electric railing in the prior art.
A method for testing rising and falling time of an electric railing for charging comprises the steps of S1, carrying out framing treatment on an acquired rising and falling video according to a preset frame rate to obtain a total frame number Num, setting a variable C frame to represent the number of current image frames, enabling an initial value of the variable C frame to be 1, S2, starting from a first frame image, sequentially taking a rectangular area covering the maximum motion range of the electric railing in each frame image as an ROI area, S3, preprocessing an image of the ROI area to obtain a gray image, S4, extracting edges of the gray image according to an edge detection algorithm, carrying out binarization treatment to obtain a binary edge image, S5, carrying out differential operation on the binary edge image of a C frame frame and the binary edge image of a C frame -1 frame to obtain a differential image, S6 counting whether the number of non-zero pixels in the differential image is smaller than a preset threshold, if yes, taking the included angle solved by the previous frame as the current included angle, and entering a step S9, S7, carrying out binarization treatment on the binary edge image according to an edge detection algorithm to obtain a binary edge image, carrying out differential operation on the binary edge image and carrying out linear conversion on the obtained candidate image according to the C frame -1 frame, and setting a candidate straight line to meet the requirement of the linear conversion in the linear direction of the candidate frame according to the requirement of the S34S9, judging whether the C frame frame image is the last frame image, if so, entering a step S10, otherwise, acquiring the next frame image of the current image as a new C frame frame image, repeating the steps S3 to S9, and S10 according to the included angleS11 calculates a unit frame time interval according to the preset frame rate, and calculates the electric rail rise/fall time according to the unit frame time interval, the start frame number C frame_start and the stop frame number C frame_end and the start frame number C frame_start and the stop frame number C frame_end.
In one embodiment, the method further comprises the steps of installing an electric railing landing time testing device at the place where the electric railing to be tested is located, starting video acquisition in the electric railing landing time testing device, continuously acquiring real-time images of the electric railing, controlling the electric railing to start lifting rod movement/landing rod movement, identifying the lifting/landing movement state of the electric railing, and stopping video acquisition when the electric railing stops lifting/landing movement, so that a landing video is obtained.
In one embodiment, the preprocessing in step S3 includes graying processing and filtering denoising processing.
In one embodiment, the step S7 comprises taking m discrete values l 1、l2、…、lm of the length l of the electric railing at equal intervals within a set range [ l min,lmax ], taking n discrete values theta 1、θ2、…、θn of the horizontal included angle theta at equal intervals within the set range [ theta min,θmax ], defining a two-dimensional array S [ m ] [ n ], initializing all elements of the two-dimensional array S [ m ] [ n ] to be 0, traversing all non-zero pixels (i, j) of an ROI binary edge image, voting on all combinations of (l p,θq) satisfying the following, and storing the results in the elements S [ p ] [ q ] of the two-dimensional array S [ m ] [ n ]:
lp=i×cosθq+j×sinθq
And sequencing all elements of the two-dimensional array Sm [ n ] from large to small, and taking (L p,θq) combinations corresponding to k elements in the front sequence to represent k candidate straight lines in the C frame frame image, wherein the k candidate straight lines are marked as L 1、L2、…、Lk.
In one embodiment, the step S8 includes the steps of defining S81 that the movement of the lifting rod is θ (0) =0°, defining the falling movement as θ (0) =90°, defining the variable a=1, determining S82 that the combination of (L p,θq) of the straight line L a satisfies the following formula condition, if yes, determining θ q corresponding to the straight line L a as an included angle θ (C frame) between the electric railing and the horizontal direction, and proceeding to step S9, if no, increasing the variable a by 1:
The method comprises the steps of S83, S82 repeatedly executing the step S82 until the included angle theta (C frame) between the electric railing and the horizontal direction is solved or a=k+1 is established, S84, when the included angle theta (C frame) is not solved in the steps S81-S83, the included angle theta (C frame) is solved by adopting the previous frame image, namely the included angle theta (C frame)=θ(Cframe -1).
In one embodiment, the step S10 comprises forming a C frame -theta sequence from the frame numbers of the image frames and the included angles between the corresponding electric railings and the horizontal direction, moving the starting rod from the second frame image to the Num-1 frame image, searching the first frame image meeting the constraint condition of the following formula frame by frame, and taking the frame numbers as C frame_start:
Starting from the C frame_start frame image to the Num-1 frame image, searching the first frame image which meets the constraint adjustment of the following formula frame by frame for the starting rod motion, and taking the frame number as C frame_end:
And θ (C frame +1) is the included angle between the electric railing and the horizontal direction, which is obtained in the later frame of image.
In one embodiment, the frame numbers of the image frames and the included angles between the corresponding electric railings and the horizontal direction form a C frame -theta sequence, and for the falling rod motion, the first frame image meeting the constraint conditions of the following formula is searched for from the second frame image to the Num-1 frame image frame by frame, and the frame numbers are taken as C frame_start:
Starting from the C frame_start frame image to the Num-1 frame image, for the falling rod motion, searching the first frame image meeting the constraint condition of the following formula frame by frame, and taking the frame number as C frame_end:
And θ (C frame +1) is the included angle between the electric railing and the horizontal direction, which is obtained in the later frame of image.
In one embodiment, the formula for calculating the electric balustrade up/down time T in step S11 is as follows:
T=(Cframe_end-Cframe_start)×Δt
Where Δt is the unit frame time interval.
The electric railing rise and fall time testing device for the toll is characterized by comprising a high-speed video acquisition sensor, a main control unit and a special bracket, wherein the frame rate of the high-speed video acquisition sensor is at least 100 frames/second.
An apparatus comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the computer program, performs the steps of a method for testing rise and fall time of a powered toll rail as described in the various embodiments above.
According to the technical scheme, the beneficial technical effects of the invention are as follows:
1. The whole process adopts the device to collect videos, and the rise and fall time of the electric railing is tested by the provided method for testing the rise and fall time of the electric railing for charging, so that the manual participation is reduced, the precision of time calculation is improved, and meanwhile, the labor and time cost are saved.
2. And the two adjacent frames of binarized edge images are subjected to differential processing, so that whether the railing is still moving or not can be rapidly judged, the testing efficiency is improved, and the time cost is further saved.
Detailed Description
Embodiments of the technical scheme of the present invention will be described in detail below with reference to the accompanying drawings. The following examples are only for more clearly illustrating the technical aspects of the present invention, and thus are merely examples, and are not intended to limit the scope of the present invention.
It is noted that unless otherwise indicated, technical or scientific terms used herein should be given the ordinary meaning as understood by one of ordinary skill in the art to which this application belongs.
In one embodiment, as shown in fig. 1, there is provided a device for testing rise and fall time of an electric balustrade for charging, which comprises a high-speed video acquisition sensor, a main control unit and a special bracket, wherein the frame rate of the high-speed video acquisition sensor is at least 100 frames/second. Specifically, the main control unit comprises a man-machine interaction part, is arranged on one side of the electric railing through a special bracket, and the central optical axis of the sensor is perpendicular to the vertical surface where the railing is located. In practical application, an industrial camera with a frame rate of 200 frames/second and a resolution of 2592×1944 can be used as a high-speed video acquisition sensor and is arranged on an A-frame support with a distance of 10 meters and a height of 1.1 meters from an electric railing, and a main control unit adopts a portable computer. Meanwhile, a charging computer sends a rod lifting/falling instruction to the electric railing in the toll booth to start the electric railing to move, so that video collection is performed.
In one embodiment, as shown in fig. 2, a method for acquiring the lifting video of the electric railing is provided, which comprises the steps of installing an electric railing lifting time testing device at the place of the electric railing with lifting time to be tested, starting video acquisition in the electric railing lifting time testing device, continuously acquiring real-time images of the electric railing, controlling the electric railing to start lifting motion/lifting motion, identifying the lifting/lifting motion state of the electric railing, and stopping video acquisition when the electric railing stops lifting/lifting motion, so as to acquire the lifting video.
Specifically, the video acquisition method needs to be combined with an electric rail lifting time testing device (hereinafter referred to as a testing device) for charging in fig. 1, wherein when the testing device is arranged, if the rail image background acquired by the high-speed video acquisition sensor is complex, a pure color curtain is erected on the other side of the electric rail to simplify the acquired rail image background, the time interval between the acquired video image frames and the image frames should be kept constant, and the single on-site acquisition is only aimed at one lifting motion or one dropping motion, and in the video acquisition process, the high-speed video acquisition sensor should be kept in a static state.
In one embodiment, as shown in fig. 3, there is provided a method for testing rise and fall time of an electric balustrade for charging, comprising the steps of:
S1, carrying out framing treatment on the acquired landing video according to a preset frame rate to obtain a total frame number Num, and setting a variable C frame to represent the current image frame number, wherein the initial value of the variable C frame is 1.
Specifically, the current site video is opened, the total frame number Num of the video image is acquired, the variable C frame =1 is initialized, and the 0 th frame binary edge image with the pixel value of all 0 is constructed.
S2, starting from the first frame image, taking a rectangular area covering the maximum movement range of the electric railing in each frame image as an ROI area.
Specifically, the 1 st frame image is read, a rectangular region covering the maximum motion range of the electric railing is defined as a region of interest (ROI region) through man-machine interaction, as shown in fig. 4, and once the region is defined, the pixel coordinates of the ROI region are the same as those of the 1 st frame image in the subsequent image frames.
S3, preprocessing the image of the ROI area to obtain a gray level image.
Specifically, the preprocessing in step S3 includes graying processing and filtering denoising processing. During image preprocessing, a color ROI area image is converted into a Gray image through a calculation formula Gray=0.30R+0.59G+0.11B, wherein Gray is a pixel Gray value, R, G, B is a three-primary-color component, and the Gray image is processed through a mean value filtering algorithm to reduce interference of image noise points on a subsequent analysis process.
S4, extracting the edges of the gray level image according to an edge detection algorithm, and performing binarization processing to obtain a binary edge image;
specifically, a Laplacian second order differential operator is used for edge detection.
S5, carrying out differential operation on the binary edge image of the C frame frame and the binary edge image of the C frame -1 frame to obtain a differential image;
S6, counting the number of non-zero pixels in the differential image, judging whether the number of the non-zero pixels is smaller than a preset threshold value, if not, entering a step S7, if yes, taking the included angle solved by the previous frame as the current included angle, and entering a step S9;
s7, carrying out Hough transformation on the binary edge image to obtain a candidate straight line meeting the set requirement in the C frame frame image;
In one embodiment, step S7 includes equally spacing the electric rail length l within a set range [ l min,lmax ] by m discrete values l 1、l2、…、lm, equally spacing the horizontal included angle θ within a set range [ θ min,θmax ] by n discrete values θ 1、θ2、…、θn, defining a two-dimensional array S [ m ] [ n ], initializing all elements of the two-dimensional array S [ m ] [ n ] to 0, traversing all non-zero pixels (i, j) of the ROI binary edge image, voting on all combinations of (l p,θq) that satisfy equation (1), and saving the result in elements S [ p ] [ q ] of the two-dimensional array S [ m ] [ n ]:
lp=i×cosθq+j×sinθq (1)
Wherein, p is more than or equal to 1 and less than or equal to m, q is more than or equal to 1 and less than or equal to n, all elements of the two-dimensional array S [ m ] [ n ] are ordered from large to small, and k candidate straight lines in the C frame frame image are expressed by (L p,θq) combination corresponding to k elements which are ordered at the front, and are marked as L 1、L2、…、Lk.
S8, calculating the included angle between the electric railing and the horizontal direction according to the candidate straight line
In one embodiment, the step S8 includes S81 defining the rising stem motion as θ (0) =0°, defining the falling stem motion as θ (0) =90°, defining the variable a=1, S82 determining whether the combination of (L p,θq) of the straight line L a satisfies the condition of the formula (2), wherein "0+.θ q-θ(Cframe-1)≤θthed" in the combination formula (2) is to determine the rising stem motion, and "0+.θ (C frame-1)-θq≤θthed" is to determine the falling stem motion, if yes, θ q corresponding to the straight line L a is the angle θ (C frame) between the electric rail and the horizontal direction, and proceeding to the step S9, if no, increasing the variable a by 1:
Wherein θ (C frame -1) is the included angle between the electric railing and the horizontal direction obtained in the previous frame image, and θ thed is the preset threshold value of the angle change between the adjacent frame images;
S83 repeatedly executes step S82 until the included angle theta (C frame) between the electric railing and the horizontal direction is solved, or a=k+1 is established, wherein k is k candidate straight lines in the step S7, and when the included angle theta (C frame) is not solved in the steps S81-S83, theta (C frame) is the included angle theta (C frame)=θ(Cframe -1) solved by adopting the previous frame image.
S9, judging whether the C frame frame image is the last frame image, if so, entering a step S10, otherwise, acquiring the next frame image of the current image as a new C frame frame image, and repeating the steps S3 to S9.
Specifically, whether the image of the C frame th frame is the last frame is determined, if yes, whether C frame is less than or equal to Num is determined, if yes, the process proceeds to step S10 directly, if not, the variable C frame=Cframe +1 is made, and the processes of steps S3 to S9 are repeated iteratively until C frame is less than or equal to Num is determined.
S10 according to the included angleA start frame number C frame_start and a stop frame number C frame_end are acquired.
In one embodiment, for the rod lifting motion, the step S10 comprises the steps of forming a C frame -theta sequence by the frame numbers of the image frames and the corresponding included angles between the electric railings and the horizontal direction, starting from the second frame image to the Num-1 frame image, searching the first frame image meeting the constraint condition of the formula (3) from frame to frame for the rod lifting motion, and taking the frame numbers of the first frame image as C frame_start:
Starting from the C frame_start frame image to the Num-1 frame image, searching the first frame image meeting the constraint adjustment of the formula (4) frame by frame for the starting rod motion, and taking the frame number as C frame_end:
And θ (C frame +1) is the included angle between the electric railing and the horizontal direction, which is obtained in the later frame of image.
In one embodiment, for the falling pole motion, the step S10 comprises the steps of forming a C frame -theta sequence by the frame numbers of the image frames and the corresponding included angles between the electric railings and the horizontal direction, and searching the first frame image meeting the constraint condition of the following formula (5) from the second frame image to the Num-1 frame image frame to frame by frame for the falling pole motion, wherein the frame numbers are taken as C frame_start:
Starting from the C frame_start frame image to the Num-1 frame image, for the falling rod motion, searching the first frame image meeting the constraint condition of the following formula (6) frame by frame, and taking the frame number as C frame_end:
And θ (C frame +1) is the included angle between the electric railing and the horizontal direction, which is obtained in the later frame of image.
S11, calculating a unit frame time interval according to a preset frame rate, and calculating the electric rail rising/falling time according to the unit frame time interval, the starting frame number C frame_start and the stopping frame number C frame_end.
In one embodiment, equation (7) for calculating the motorized balustrade up/down time T in step S11 is:
T=(Cframe_end-Cframe_start)×Δt (7)
Where Δt is the unit frame time interval.
Specifically, the unit frame time interval is the image frame time interval Δt=1 second/frame rate.
In one embodiment, an apparatus is provided, which may be a server, the internal structure of which may be as shown in fig. 5. The device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the device is configured to provide computing and control capabilities. The memory of the device includes a non-volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the device is used for storing configuration templates and can also be used for storing target webpage data. The network interface of the device is used for communicating with an external terminal through a network connection. The computer program when executed by the processor is used for realizing a method for testing the rise and fall time of the electric railing for charging.
It will be appreciated by persons skilled in the art that the structure shown in fig. 5 is merely a block diagram of a portion of the structure associated with the present inventive arrangements and does not constitute a limitation of the apparatus to which the present inventive arrangements are applied, and that a particular apparatus may include more or less components than those shown in the drawings, or may combine certain components, or have a different arrangement of components.
It will be appreciated by those skilled in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be centralized on a single computing device, or distributed across a network of computing devices, or they may alternatively be implemented in program code executable by computing devices, such that they may be stored on a computer storage medium (ROM/RAM, magnetic or optical disk) for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than what is shown or described herein, or they may be individually manufactured as individual integrated circuit modules, or a plurality of modules or steps in them may be manufactured as a single integrated circuit module. Therefore, the present invention is not limited to any specific combination of hardware and software.
It should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention, and not for limiting the same, and although the present invention has been described in detail with reference to the above-mentioned embodiments, it should be understood by those skilled in the art that the technical solution described in the above-mentioned embodiments may be modified or some or all of the technical features may be replaced, and these modifications or substitutions do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiments of the present invention, and all the modifications or substitutions are included in the scope of the claims and the specification of the present invention.