Vehicle inspection method and vehicle inspection system based on vision

Through visual inspection and robotic arm assistance, the automatic opening of vehicle windows and the precise movement of inspection equipment are realized, which solves the problem of low efficiency of existing vehicle inspection methods and improves the convenience and efficiency of inspection.

CN118429871BActive Publication Date: 2024-10-11SHENZHEN MAXVISION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410897786.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-11
Estimated Expiration
2044-07-05

AI Technical Summary

Technical Problem

Existing vehicle inspection methods are inefficient and inconvenient. They require manual waiting and operation for a long time, and cannot realize intelligent inspection.

Method used

A vision-based vehicle inspection method is adopted to collect vehicle images through cameras and depth cameras, detect the opening and closing of the windows and calculate three-dimensional world coordinates. The robot arm is used to drive the inspection equipment for in-car inspection, and voice prompts are combined to realize automated operations.

Benefits of technology

It improves the efficiency of vehicle inspection, realizes the automatic opening of vehicle windows and the precise movement of inspection equipment, and improves the convenience and efficiency of inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118429871B_ABST
    Figure CN118429871B_ABST
Patent Text Reader

Abstract

The present application discloses a method for inspecting a vehicle based on vision, which includes: judging the positional relationship between the vehicle and a preset frame based on a first image J captured by a first camera; if the vehicle is parked in the preset frame, then giving a voice prompt to the driver to open all windows; detecting all window targets of a second image F captured by a depth camera and calculating the degree of opening of each window target; if the degree of opening of any window target is less than a window opening threshold, then continuing the voice prompting window opening operation, reacquiring the second image F, and continuously detecting all window targets of the second image F and calculating the degree of opening of each window target until the degree of opening of all window targets is greater than the window opening threshold; calculating the first three-dimensional world coordinates of the center point of the window opening area of ​​each window target to the depth camera; and converting the first three-dimensional world coordinate value into the second three-dimensional world coordinates of the mechanical arm on the lane. The present application also provides a vehicle inspection system for implementing the aforementioned vehicle inspection method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of digital image processing, and more specifically, to a vision-based vehicle inspection method and a vehicle inspection system. Background Art

[0002] At the security inspection site, vehicles on the channel need to be inspected for safety, including the number of passengers including the driver and whether there are any dangerous items in the cabin. If it is a manual inspection, security personnel need to wait for a long time in the lane for passing vehicles, and after opening the door, the inspector needs to manually operate on site with handheld cameras, infrared detectors, etc. The inspector needs to wait in the lane for a long time to inspect the vehicle, which is inefficient and inconvenient. Summary of the invention

[0003] With respect to the prior art, the technical problem to be solved by the present application is to provide a vision-based vehicle inspection method and a vehicle inspection system that improve inspection efficiency, facilitate inspection, and facilitate intelligent inspection.

[0004] To solve the above technical problems, in a first aspect, the present application provides a vehicle inspection method based on vision, which comprises:

[0005] Acquire a first image J captured by a first camera whose sensing surface faces the preset frame, and determine a positional relationship between the vehicle and the preset frame based on the first image J;

[0006] If the vehicle is parked within the preset frame, the driver will be prompted by voice to open all windows;

[0007] A side image of a vehicle parked in a preset frame is captured by a depth camera on the lane to obtain a second image F, and all window objects in the second image F are detected and the opening and closing degree of each window object is calculated;

[0008] If the opening degree of any window target is less than the window opening threshold, continue to perform the voice prompt window opening operation, reacquire the second image F, and continue to detect all the window targets in the second image F and calculate the opening degree of each window target until the opening degree of all the window targets is greater than the window opening threshold;

[0009] Calculate the first three-dimensional world coordinates of the center point of the window area of ​​each vehicle window target to the depth camera; and,

[0010] The first three-dimensional world coordinate value is converted into a second three-dimensional world coordinate of the robot arm on the lane.

[0011] In a possible implementation, determining whether the vehicle is parked in a preset frame based on the first image J includes:

[0012] Obtain a preset frame area of ​​the preset frame in the field of view of the first camera image;

[0013] Perform vehicle target detection on the first image J using the first target detection model to obtain a vehicle target frame;

[0014] Determine whether the four corner points of the vehicle target frame are within the preset frame area;

[0015] If so, the vehicle is parked in the preset frame;

[0016] Otherwise, determine the offset between the vehicle target and the preset frame in the travel direction and perpendicular to the travel direction.

[0017] In a possible implementation, the origin of the image coordinate system of the first image J is located at the upper left corner of the image, the horizontal axis of the image coordinate system is parallel to the vehicle travel direction, and the vertical axis of the image coordinate system is perpendicular to the vehicle travel direction; wherein, determining the offset between the vehicle target and the preset frame in the travel direction and perpendicular to the travel direction includes:

[0018] Get the center point O of the preset frame area fra (x fra ,y fra ) and the center point O of the vehicle target box car (x car ,y car );

[0019] Determine whether there is a deviation in the direction of travel: If x fra With x car The absolute value of the difference is greater than the horizontal threshold and x fra With x car If the difference is greater than 0, the vehicle target is behind the preset frame in the parallel direction; if x fra With x car The absolute value of the difference is greater than the horizontal threshold and x fra With x car If the difference is less than 0, the vehicle target exceeds the preset box in the parallel passage direction;

[0020] Determine whether there is a deviation in the direction perpendicular to the travel direction: If y fra With y car The absolute value of the difference is greater than the vertical threshold and y fra With y car If the difference between y and y is greater than 0, the vehicle target is to the left of the preset frame in the direction perpendicular to the passage direction; fra With y car The absolute value of the difference is greater than the vertical threshold and y fra With y car If the difference is less than 0, the vehicle target is to the right of the preset frame in the direction perpendicular to the travel direction.

[0021] In one possible implementation, before determining the positional relationship between the vehicle and the preset frame based on the first image J, the vision-based vehicle inspection method further includes: determining whether the vehicle is stopped using a plurality of ranging elements disposed on the lane; the plurality of ranging elements form a row and are distributed along the side length of the preset frame parallel to the direction of travel.

[0022] In a possible implementation, the second image F includes a color image F1 and a depth image F2, wherein detecting all vehicle window objects in the second image F and calculating the opening and closing degree of each vehicle window object includes:

[0023] Detect all window targets in the color image F1 based on the first target detection model to obtain a window target set Window;

[0024] Perform histogram statistics of the depth information of the depth image F2 to obtain the distance D from the vehicle body to the depth camera;

[0025] The depth image F2 is binarized with the distance D as the second threshold to obtain a binarized image;

[0026] Using the first structure element and the second structure element in sequence to perform an erosion operation on the binary image to obtain an eroded image, wherein the size of the first structure element is larger than the second structure element;

[0027] Performing a connected domain solving operation on the eroded image, calculating the minimum bounding rectangles of all connected domains, and selecting the minimum bounding rectangle whose width meets the first preset condition from all the minimum bounding rectangles to form a minimum bounding rectangle set Openw representing the window opening area;

[0028] Match the minimum bounding rectangle belonging to each window target in the minimum bounding rectangle set Openw;

[0029] If it is a car window target Window i If the minimum bounding rectangle in the minimum bounding rectangle set Openw is not matched, the window target Window is determined i No window;

[0030] If it is a car window target Window i Match the minimum bounding rectangle Openw in the minimum bounding rectangle set Openw j , Window target i Degree of opening i =H Openwj / H Windowi , where H Windowi A car window target Window i Height, HOpenwj The minimum bounding rectangle that matches the window target Openw j height.

[0031] In a possible implementation, for any minimum bounding rectangle Openw in the minimum bounding rectangle set Openw j With any window target Window i The matching conditions must be met: The value of is greater than the set threshold;

[0032] in, Represents the minimum enclosing rectangle Openw j The coordinate range in the horizontal direction is: Window target i The coordinate range in the horizontal direction is: Represents an intersection operation.

[0033] In a possible implementation, the first three-dimensional world coordinates from the center point of the window opening area of ​​each vehicle window target to the depth camera are calculated as:

[0034] ;

[0035] ;

[0036] in, , , and The intrinsic parameter matrix K from the depth camera; , are the horizontal and vertical coordinates of the origin of the image physical coordinate system in the image pixel coordinate system respectively; , The horizontal and vertical coordinates of the center point of the window opening area of ​​the vehicle window target in the image; and are the focal length of the depth camera in the horizontal and vertical directions respectively; It is the first 3D world coordinate value from the center point of the windowing area to the depth camera.

[0037] In a possible implementation, the first three-dimensional world coordinate value is converted into a second three-dimensional world coordinate of the robot arm on the lane, which is:

[0038] A× + ;

[0039] A= ;

[0040] Where A is a matrix, is the first three-dimensional world coordinate value Converted into the second 3D world coordinate value in the robot arm coordinate system, three angles , and are the roll angle, pitch angle and yaw angle respectively, , , are the coordinate values ​​of the origin of the depth camera coordinate system on the X-axis, Y-axis, and Z-axis in the robotic arm coordinate system, respectively.

[0041] The present application also provides a vehicle inspection system, which includes:

[0042] A first camera located on a safety island on one side of the lane, with its sensing surface facing a preset frame planned within the lane;

[0043] A depth camera disposed on the same side of the lane as the first camera on the safety island and located on one side of the preset frame, the first camera and the depth camera being sequentially distributed along the direction of vehicle travel, the depth camera being used to capture a side view of a vehicle parked within the preset frame of the lane;

[0044] A slide rail is arranged on the lane safety island on the same side as the depth camera, the slide rail extends along the vehicle travel direction and is arranged side by side with the depth camera perpendicular to the vehicle travel direction;

[0045] A mechanical arm slidably connected to the slide rail, the mechanical arm being capable of moving up and down relative to the lane and being capable of telescopic movement relative to a vehicle within a preset frame of the lane;

[0046] An inspection device disposed on the mechanical arm;

[0047] Voice announcers installed on the lanes; and,

[0048] An image processing module is used to execute the steps of the vision-based vehicle inspection method.

[0049] The beneficial effects of the vision-based vehicle inspection method and vehicle inspection system provided by the present application are: analyzing whether the vehicle is parked within a preset frame and analyzing whether all the windows of the vehicle are open to the window opening threshold through image vision methods; for vehicles with fully open windows, calculating the first three-dimensional world coordinates of the center point of the window opening area of ​​each window target to the depth camera, and converting the first three-dimensional world coordinates into second three-dimensional world coordinates in the robotic arm coordinate system to provide a target position for the movement of the robotic arm, thereby facilitating the subsequent robotic arm to drive the inspection equipment to the window position of the second three-dimensional world coordinates to inspect the situation inside the vehicle. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0051] Figure 1 A schematic diagram of a vehicle inspection system according to an embodiment of the present application;

[0052] Figure 2 A schematic diagram of a scene of a depth camera, a robotic arm, and a vehicle in a parking lane of a vehicle inspection system according to an embodiment of the present application.

[0053] Figure 3 This is a flowchart of the steps of the vision-based vehicle inspection method according to an embodiment of the present application.

[0054] Figure 4 Schematic diagram of the positional relationship of the vehicle target frame in the first image J of the embodiment of the present application, which is located behind the preset frame in the vehicle travel direction.

[0055] Figure 5 Schematic diagram of the positional relationship of the vehicle target frame in the first image J of an embodiment of the present application, which is to the left of the preset frame perpendicular to the vehicle's travel direction.

[0056] Figure 6 This is a flowchart of the steps of detecting all vehicle window objects in the second image F and calculating the opening degree of each vehicle window object in an embodiment of the present application.

[0057] Figure 7 This is a result diagram of a color image F1 of the side of a vehicle captured by the depth camera of an embodiment of the present application.

[0058] Figure 8 Schematic diagram of the horizontal distance h1 from the depth camera to the edge of the lane and the width h2 of the lane according to an embodiment of the present application.

[0059] Fig. 9 This is a histogram statistical result diagram of the depth information of a depth image when the value range of [H1, H2] is [0.5, 2.5] and the statistical interval of the histogram is 5 cm in the embodiment of the present application.

[0060] Fig.10 For the embodiment of this application Figure 7 The result of binarizing the depth image corresponding to the color image.

[0061] Fig.11 For the embodiment of this application Fig.10 The resulting image after the corrosion operation.

[0062] Fig.12 A schematic diagram of a robotic arm coordinate system and a depth camera coordinate system established in an embodiment of the present application. DETAILED DESCRIPTION

[0063] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0064] It should be noted that when an element is referred to as being "fixed to" or "disposed on" another element, it can be directly on the other element or indirectly on the other element. When an element is referred to as being "connected to" another element, it can be directly connected to the other element or indirectly connected to the other element.

[0065] It should be understood that the terms "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.

[0066] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0067] The vision-based vehicle inspection method and vehicle inspection system of the present application will now be described in detail with reference to the accompanying drawings.

[0068] Please refer to Figure 1 and Figure 2 The vehicle inspection system provided in the embodiment of the present application is communicatively connected to the background monitoring system, and the vehicle inspection system includes a first camera located on a safety island on one side of the lane, a depth camera arranged on the same side of the lane as the first camera and located on one side of a preset frame, a slide rail arranged on the lane safety island on the same side as the depth camera, a robotic arm slidably connected to the slide rail, an inspection device arranged on the robotic arm, a voice announcer arranged on the lane, and an image processing module.

[0069] Specifically, the preset frame is planned in advance in the lane, which can generally be a rectangular frame. The preset frame defines the preset position where the vehicle is parked in the lane to wait for inspection. The first camera's sensing surface faces the preset frame planned in the lane, and the first camera can collect images entering the lane. The depth camera is set on one side of the preset frame, and the depth camera is used to photograph the vehicle parked in the preset frame. It can be understood that the vehicle directly enters the preset frame in the direction of traffic in the lane. The depth camera is located on the side of the vehicle, and the depth camera collects the side view of the vehicle with the window. The slide rail extends along the direction of vehicle travel and is arranged side by side with the depth camera at right angles to the direction of vehicle travel. The robotic arm can slide along the slide rail to achieve a forward and backward displacement change in a first direction along the direction of vehicle travel, and the robotic arm is a standard part. The robotic arm can move up and down in a second direction relative to the ground lane and can move left and right in a third direction relative to the vehicle in the lane, so that the robotic arm drives the inspection device to move toward the vehicle; the first direction, the second direction and the third direction are perpendicular to each other, so the robotic arm cooperates with the slide rail and realizes three-axis movement, wherein the movement of the robotic arm along the slide rail can be achieved by a motor connected thereto.

[0070] Specifically, the image processing module cooperates with other devices of the vehicle inspection system to perform the steps of the vehicle inspection method based on vision. The image processing module can accept the first image J collected by the first camera, determine whether there is a vehicle entering the lane by identifying the first image J, and analyze the first image J to determine the positional relationship between the vehicle entering the lane and the preset frame; and the image processing module can accept the second image F collected by the depth camera, analyze the second image F to determine whether all the windows of the vehicle are opened to the window opening threshold, and analyze the center position of the window opening area of ​​the window; further, the image processing module calculates the first three-dimensional world coordinates of the center point of the window opening area of ​​each window target to the depth camera, and converts the first three-dimensional world coordinate value into the second three-dimensional world coordinate of the mechanical arm on the lane. In this way, the background monitoring system can feed back the second three-dimensional world coordinate to the mechanical arm, so that the mechanical arm can obtain the coordinate value relative to the target position of the center of the window opening area of ​​the window. Among them, the inspection device can be a device including but not limited to a surveillance camera and / or an infrared detector, and the mechanical arm performs three-axis motion to drive the inspection device to move to each window position, and the inspection device can inspect the situation inside the vehicle.

[0071] Among them, when the image processing module analyzes that the vehicle entering the lane has not stopped within the preset frame or the vehicle is offset from the preset frame, a voice prompt for re-docking can be issued through the voice announcer; when the image processing module determines that the vehicle has stopped within the preset frame, a voice prompt for opening the window can be issued through the voice announcer; when the image processing module analyzes that there is any window target that has not been opened to the window opening threshold, a voice prompt for opening the window can continue to be issued through the voice announcer.

[0072] Please refer to Figure 3 The embodiment of the present application provides a vision-based vehicle inspection method applied to the above vehicle inspection system, the method comprising the following steps S100 to S500:

[0073] Step S100: acquiring a first image J captured by a first camera with a sensing surface facing a preset frame, and determining a positional relationship between the vehicle and the preset frame based on the first image J;

[0074] Step S200: If the vehicle is parked in the preset frame, the driver is prompted by voice to open all windows;

[0075] Step S300: using a depth camera on the lane to capture a side image of a vehicle parked within a preset frame to obtain a second image F, detecting all vehicle window objects in the second image F and calculating the opening and closing degree of each vehicle window object;

[0076] Step S400: If the opening degree of any window target is less than the window opening threshold, continue to perform the voice prompt window opening operation, reacquire the second image F, and continue to detect all the window targets in the second image F and calculate the opening degree of each window target until the opening degree of all the window targets is greater than the window opening threshold;

[0077] Step S500: Calculate the first three-dimensional world coordinates from the center point of the window opening area of ​​each vehicle window target to the depth camera;

[0078] Step S600: converting the first three-dimensional world coordinate value into the second three-dimensional world coordinate of the robot arm on the lane.

[0079] It is worth noting that in the above step S100, the above first camera collects the first image J about the vehicle entering, and uses the target detection network model to detect the target of the first image J. When the vehicle target is detected, it means that a vehicle has entered at this time; the target detection network model can be but not limited to the yolox learning network model. When a vehicle target enters, the positional relationship between the vehicle in the first image J and the preset frame is determined. When it is determined that the vehicle is parked in the preset frame, the background monitoring system can control the voice announcer to issue a voice of "please open all windows" to remind the driver to open the window. Since in the vehicle inspection process, it is necessary to extend the mechanical arm to drive the inspection equipment to each window so as to inspect the situation in the vehicle at different positions, each window of the vehicle should be opened, and the opening and closing degree of each window is calculated by step S300 to determine whether the window is opened to the set window opening threshold. Since the mechanical arm and the inspection equipment have a certain size, the window needs to be opened to a certain extent to ensure safety, and the window opening area can be set to 0.8.

[0080] It is worth noting that the aforementioned vehicle inspection system is also provided with a plurality of distance measuring elements located on the lane, and the plurality of distance measuring elements form a row and are distributed along the length of the side of the preset frame parallel to the direction of travel, for sensing whether there is an object entering the preset frame. When there is a sudden change in the feedback distance of the distance measuring element among the plurality of distance measuring elements and it is less than the set threshold, it indicates that a foreign object has entered the preset frame, and it can be known that a vehicle has entered in combination with the recognition result of the first camera, and then it appears that: within a certain period of time, the distance feedback by the plurality of distance measuring elements remains unchanged, indicating that the vehicle has stopped steadily at this time, and at this time, the step of determining the positional relationship between the vehicle and the preset frame based on the first image J can be executed, so that the vehicle has not stopped steadily, and the step of determining the positional relationship between the vehicle and the preset frame based on the first image J is always executed. The measurement results of the plurality of distance measuring elements will be fed back to the background monitoring system, and the distance measuring element may be a laser radar, but is not limited thereto.

[0081] In one embodiment of the application, for step S100, judging whether the vehicle is parked in a preset frame based on the first image J includes:

[0082] Step S110: obtaining a preset frame area of ​​the preset frame in the field of view of the first camera image;

[0083] Step S120: using the first target detection model to perform vehicle target detection on the first image J to obtain a vehicle target frame;

[0084] Step S130: Determine whether the four corner points of the vehicle target frame are within the preset frame area; if so, execute step S140; otherwise, execute step S150;

[0085] Step S140: the vehicle stops within a preset frame;

[0086] Step S150: Determine the offset between the vehicle target and the preset frame in the travel direction and perpendicular to the travel direction.

[0087] It is worth noting that the mechanical arm and the depth camera are arranged on one side of the preset frame. Since the movement range of the mechanical arm is limited, the preset frame for parking is planned in advance. In order to successfully complete the intelligent inspection later, it is necessary to first determine whether the vehicle is parked in the preset position. The first camera is fixedly arranged on the lane and the sensing surface is facing the preset frame, so the position of the preset frame in the image imaged by the first camera is fixed, so the position of the preset frame in the first image J remains unchanged. The preset frame is planned in advance on the lane, so the position of the preset frame in the first image and the coordinates of the four corner points of the preset frame in the first image J can be known in advance and fixed. The first target detection module is the aforementioned yolox learning network model. The vehicle target in the first image J is detected by the first target detection network, and the vehicle target frame, the center coordinates of the target frame, and the height and width of the target frame can be obtained. Understandably, the coordinates of the four corner points of the target frame can be known according to the center point of the vehicle target frame, the height and width of the target frame. If the coordinates of the four corner points are located in the preset frame area, the vehicle can be identified as parked in the preset frame. If the four corner points are not all located in the preset box, it is necessary to analyze the offset of the vehicle target relative to the preset box again. Figure 1 , Figure 4 and Figure 5 Specifically describe the offset of the vehicle target relative to the preset frame.

[0088] In one embodiment of the application, the origin of the image coordinate system of the first image J is located at the upper left corner of the image, the horizontal axis of the image coordinate system is parallel to the vehicle travel direction, and the vertical axis of the image coordinate system is perpendicular to the vehicle travel direction; wherein step S150: determining the offset between the vehicle target and the preset frame in the travel direction and perpendicular to the travel direction includes:

[0089] Step S151: Obtain the center point O of the preset frame area fra (x fra ,y fra ) and the center point O of the vehicle target box car (x car ,y car ), where x fra ,y fra The center point O fra The horizontal and vertical coordinates, x car ,y car The center point O car The horizontal and vertical coordinates of

[0090] Step S152: Determine whether a deviation occurs in the direction of travel: If x fra With x car The absolute value of the difference is greater than the horizontal threshold and x fra With xcar If the difference is greater than 0, the vehicle target is behind the preset frame in the parallel direction; if x fra With x car The absolute value of the difference is greater than the horizontal threshold and x fra With x car If the difference is less than 0, the vehicle target exceeds the preset frame in the parallel passage direction, that is, the vehicle target is ahead of the preset frame;

[0091] Step S153: Determine whether a deviation occurs perpendicular to the direction of travel: If y fra With y car The absolute value of the difference is greater than the vertical threshold and y fra With y car If the difference between y and y is greater than 0, the vehicle target is to the left of the preset frame in the direction perpendicular to the passage direction; fra With y car The absolute value of the difference is greater than the vertical threshold and y fra With y car If the difference is less than 0, the vehicle target is to the right of the preset frame in the direction perpendicular to the travel direction.

[0092] It is worth noting that the above steps S152 and S153 are performed simultaneously. The horizontal threshold and the vertical threshold can be set according to the actual situation. fra With x car The absolute value of the difference is less than or equal to the horizontal threshold and y fra With y car If the absolute value of the difference is less than or equal to the longitudinal threshold, it can be determined that the vehicle target does not deviate from the preset frame, that is, at this time, it can be determined that the vehicle target is equivalent to being located in the preset frame. For example, two corner points of the vehicle target frame are located in the preset frame, but the other two corner points are slightly beyond the preset frame. At this time, it can also be determined that the vehicle target is located in the preset frame, that is, the vehicle target slightly exceeds the preset frame area, which has little impact.

[0093] Furthermore, when the vehicle target deviates from the preset frame, the vision-based vehicle inspection method further includes:

[0094] Step S154: Prompt the vehicle to dock at the preset frame again by voice;

[0095] Step S155: Use two distance measuring elements arranged on the same side of the lane to determine whether the vehicle is in place during the re-docking process: when the distances of the vehicles detected by the two distance measuring elements in the preset frame are both within the set threshold range, it indicates that the vehicle target is re-docking.

[0096] Among them, in step S154, the offset of the vehicle target and the preset frame in the direction of travel and perpendicular to the direction of travel can be fed back to the background monitoring system, and the background monitoring system controls the voice announcer to make voice announcements according to the offset situation to remind the driver to re-park the vehicle in the preset frame. For example, when the vehicle target is behind the preset frame in the parallel travel direction, the voice announcer is controlled to broadcast "The vehicle is not parked in the preset frame, it is behind the preset frame, please move forward slowly and re-park"; for example, when the vehicle target is to the left of the preset frame perpendicular to the travel direction, the voice announcer is controlled to broadcast "The vehicle is not parked in the preset frame, it is to the left of the preset frame, please re-park slowly to the right", and so on, according to the offset situation, voice reminders are made to re-park. The aforementioned vehicle inspection system can also set a display screen on the safety island on one side of the lane, wherein the positional relationship between the vehicle and the preset frame analyzed by the image processing module can be displayed in the form of a picture on the display screen, for example, as Figure 4 and Figure 5 The positional relationship between the preset frame and the vehicle target frame is also displayed, so that the driver can visually check the situation of the vehicle parked at the inspection location. In order to facilitate the driver to view, the display screen is set on the safety island and in front of the preset frame in the direction of travel. The driver can directly view the picture on the display screen in the car.

[0097] Among them, after the voice prompt of step S154, the driver will control the movement of the vehicle, and the image processing module will continuously execute the step of determining the positional relationship between the vehicle and the preset frame, and continuously update the picture on the display screen according to the processing result of the image processing module. In this way, the driver can visually check the re-docking process; until it is determined that the vehicle is parked in the preset frame, the voice announcer will issue a voice prompt of "Please open all windows when parking".

[0098] In one embodiment of the application, Figure 6 As shown, step S300: detecting all vehicle window objects in the second image F and calculating the opening and closing degree of each vehicle window object specifically includes the following steps S310 to S317.

[0099] Step S310: Detect all vehicle window targets in the color image F1 based on the first target detection model to obtain a vehicle window target set Window.

[0100] in, Figure 7The figure shows a color image F1 of the side of a vehicle captured by a depth camera. When the embodiment of the present application deals with a private car parked in a lane, the first target detection model may be but is not limited to a YOLOX or YOLOX5 deep learning network model. When training the first target detection model, the window data of private vehicles is collected, and the YOLOX network model is trained using any existing training method to obtain a first target detection model for detecting window targets. Among them, target detection is performed on the color image F1 using the first target detection network, and all window targets in the color image F1 can be obtained. During target detection, the target frame information of each window target will be fed back. Assume that any detected window is a Window j , then the vehicle target Window j The target frame information is (C Winxj ,C Winyj ,W Winj ,H Winj ), where C Winxj ,C Winyj ,W Winj ,H Winj They are the window targets Window j The horizontal coordinate of the center point of the target frame, the vertical coordinate of the center point of the target frame, the width of the target frame and the height of the target frame. The width of the image involved in all embodiments of the present application is the length in the horizontal direction, and the height of the image involved is the length in the vertical direction.

[0101] Among them, any window target Window j The area of ​​its target box is W Winj ×H Winj The vehicle to be inspected is parked at a preset position in the lane, which is planned in advance. The depth camera is also set around the preset position. When the vehicle is parked at the preset position, most of the depth camera screen will be occupied by the vehicle target to be inspected. In addition, the driver's window and the rear of the vehicle are generally on both sides of the color image collected by the depth camera. Compared with other windows, the rear passenger window will be concentrated in the middle of the color image.

[0102] Step S320: Perform a histogram of depth information statistics on the depth image F2 to obtain the distance D from the vehicle body to the depth camera, specifically:

[0103] The threshold range of depth information for histogram statistics is set according to the position of the depth camera installed on the lane and the width of the lane, where H1<H2;

[0104] Step S321: performing histogram statistics on the number of pixels corresponding to each depth information value within the threshold range [H1, H2] in the depth image F2;

[0105] Step S322: selecting the depth information corresponding to the maximum value of the vertical axis of the histogram as the distance D from the vehicle body to the depth camera.

[0106] Among them, H1 and H2 are two set thresholds, H1=h1+t, H2=0.5·h2+ H1; Figure 8 As shown in the figure, h2 is the width of the lane. Since the depth camera is installed on the safety island on one side of the lane, h1 is the horizontal distance from the depth camera to the edge of the lane. The aforementioned t is a set threshold, which represents the distance between the vehicle body and the edge of the lane where the depth camera is installed. That is, after the vehicle stops in the preset frame, the vehicle body is set to a parking distance from the edge of the lane. The value of t can be 0.2 meters. The units of H1 and H2 are both meters.

[0107] Understandably, the depth information of the depth image is subjected to histogram statistics, that is, a histogram is established with the depth information representing the distance information as the horizontal axis and the total number of pixels of each depth information value as the vertical axis. Fig. 9 It shows the histogram statistics of the depth information of a depth image when the value range of [H1, H2] is [0.5, 2.5] and the statistical interval of the histogram is 5 cm. Since the depth camera collects images of vehicles parked in the channel on the safety island on one side of the lane, and what is collected is the side view of the vehicle, and most of the depth information within the threshold range [H1, H2] in the histogram is the depth information of the vehicle body, then defining the threshold range [H1, H2] can exclude some depth information that is not very relevant to the vehicle target. Since the depth camera collects the side view of the vehicle and the threshold range [H1, H2] is set, then in the histogram statistics, the depth information corresponding to the maximum value of the vertical axis is the distance D from the vehicle body to the depth camera. For Fig. 9 The statistical results of the histogram are as follows: distance D = 1.65 meters.

[0108] Step S330: binarizing the depth image F2 with the distance D as a second threshold to obtain a binarized image.

[0109] It is worth noting that each pixel in the depth image F2 represents the distance information of a certain position in the real scene from the depth camera. The acquisition target of the depth camera is the vehicle, and most of the field of view of the depth camera is the vehicle target. Then, using the distance information as the threshold of the binarization operation, the window area or the area outside the vehicle body can be segmented. Specifically, when the binarization operation is performed with the distance D as the second threshold, the pixel value of the depth image F2 is less than the distance D. The pixel value is assigned to 0, otherwise the pixel value is assigned to 255. Fig.10 For Figure 7 The result of binarizing the depth image corresponding to the color image.

[0110] Step S340: performing an erosion operation on the binary image using the first structuring element and the second structuring element in sequence to obtain an eroded image, wherein the size of the first structuring element is larger than that of the second structuring element.

[0111] The first structural element Can be 15×7, the second structural element It can be 3×3. The larger corrosion structure element is recorded as , used to remove noise from depth image data; smaller erosion structural elements It is used to connect the regions that may be divided into multiple close regions and merge them into a large region. Apply the structural elements one by one , , perform corrosion operation: ,in, Represents an image erosion operation. Fig.11 For Fig.10 The resulting image after the corrosion operation.

[0112] Step S350: performing a connected domain solving operation on the eroded image, calculating the minimum bounding rectangles of all connected domains, and selecting the minimum bounding rectangle whose width meets the first preset condition from all the minimum bounding rectangles to form a minimum bounding rectangle set Openw representing the window area.

[0113] The connected domain solution operation can adopt the existing method. ecti The first precondition that needs to be met when belonging to the set Openw is: openwj >T W And W openwj <0.8·W F2 ;

[0114] Among them, W openwj Openw for the minimum external target frame j Width, W F2 is the width of the depth image F2, T W The fourth threshold value of width is set to 150. openwj <0.8·W F2 , we can exclude the relatively large connected areas representing the area outside the vehicle body in the binarization results, such as Fig.11 The connected area with the largest pixel value at the top being 255. openwj >T W , too small connected areas can be excluded, because as long as the car window is opened, no matter how large the open area is, its width has a certain length.

[0115] Step S360: Match the minimum bounding rectangle belonging to each vehicle window object in the minimum bounding rectangle set Openw.

[0116] Among them, for any minimum bounding rectangle Openw in the minimum bounding rectangle set Openw j With any window target Window i The matching conditions must be met: The value of is greater than the set threshold;

[0117] in, Represents the minimum enclosing rectangle Openw j The coordinate area in the horizontal direction, Window target i The coordinate range in the horizontal direction is: It represents the intersection operation, and the threshold can be set to 0.7.

[0118] Step S370: If it is a window target Window i If the minimum bounding rectangle in the minimum bounding rectangle set Openw is not matched, the window target Window is determined i The window is not open.

[0119] Step S380: If it is a window target Window i Match the minimum bounding rectangle Openw in the minimum bounding rectangle set Openw j , Window target i Degree of opening i =H Openwj / H Windowi , where H Windowi A car window target Window i Height, H Openwj The minimum bounding rectangle that matches the window target Openw j height.

[0120] like Fig.12As shown, the establishment of the mechanical coordinate system: the center of the end of the robot arm installed on the safety island is the origin of the robot arm coordinate system, the X-axis x_robot_arm is perpendicular to the lane passing direction, the Y-axis y_robot_arm is parallel to the lane passing direction, and the Z-axis z_robot_arm is perpendicular to the ground. The robot arm can move with the slide rail, and the robot arm will return to the initial position after each movement. The origin of the robot arm coordinate system refers to the robot arm being at the initial position. The establishment of the depth camera coordinate system: the center point of the depth camera is the origin of the depth camera coordinate system, the optical axis of the depth camera is the Z-axis z_camera of the depth camera, the line perpendicular to the z_camera axis and pointing to the ground is the Y-axis y_camera of the depth camera coordinate system, and the line perpendicular to the z_camera axis and the y_camera axis is the X-axis of the depth camera coordinate system; the optical axis of the depth camera is the camera centerline.

[0121] For the above step S500, the first three-dimensional world coordinates from the center point of the window opening area of ​​each vehicle window target to the depth camera are calculated as:

[0122] ; ;

[0123] Among them, the above formula is based on the three-dimensional vision foundation. It can be understood that it involves the relationship between the image physical coordinate system, the image pixel coordinate system, the camera coordinate system and the three-dimensional world coordinate system. , , and The intrinsic parameter matrix K from the depth camera; the intrinsic parameter matrix K can be obtained by calibrating the depth camera; , are the horizontal and vertical coordinates of the origin of the image physical coordinate system in the image pixel coordinate system respectively; , The horizontal coordinate and the vertical coordinate of the center point of the window opening area of ​​the vehicle window in the image data F, that is, the center point of the window opening area is the horizontal coordinate and the vertical coordinate of the center point of the minimum circumscribed rectangle obtained by matching in step S360. and They are the focal lengths of the depth camera in the horizontal and vertical directions, respectively. The image physical coordinate system is the CCD image plane of the depth camera, and the image pixel coordinate system is a coordinate system established with the upper left corner of the image generated by the depth camera as the origin. It is the 3D world coordinate value from the center point of the windowing area to the depth camera. They are respectively the X-axis coordinate, Y-axis coordinate, and Z-axis coordinate in the depth camera coordinate system.

[0124] For the above step S600, the first three-dimensional world coordinate value is converted into the second three-dimensional world coordinate of the robot arm on the lane:

[0125] A× + ;

[0126] A=

[0127] Where A is a matrix, is the first three-dimensional world coordinate value Converted into the second three-dimensional world coordinate value in the robot coordinate system, They are the coordinate values ​​of the X-axis x_robot_arm, the Y-axis y_robot_arm, and the Z-axis z_robot_arm in the robot arm coordinate system, three angles , and They are roll angle, pitch angle and yaw angle, three angles , and It is used to describe the position relationship between the depth camera coordinate system and the robotic arm coordinate system. For example, the robotic arm coordinate system is rotated along the X axis. Angle, then rotate along the Y axis Angle, then rotate along the Z axis Angle, you can get the attitude of the camera coordinate system. Vector ( , , ) represents the position offset of the origin of the depth camera in the robotic arm coordinate system, that is, , , They are the coordinate values ​​of the origin of the depth camera coordinate system in the X-axis x_robot_arm, Y-axis y_robot_arm and Z-axis z_robot_arm of the robot arm coordinate system. After the depth camera is installed and the initial position of the robot arm on the safety island is determined, , and Three angles can be determined, and , , It is also certain and can be measured.

[0128] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A vehicle inspection method based on vision, characterized in that: include: Acquire a first image J captured by a first camera whose sensing surface faces the preset frame, and determine a positional relationship between the vehicle and the preset frame based on the first image J; If the vehicle is parked within the preset frame, the driver will be prompted by voice to open all windows; Using a depth camera on the lane to collect a side image of a vehicle parked in a preset frame to obtain a second image F, detecting all window objects in the second image F and calculating the opening and closing degree of each window object; If the opening degree of any window target is less than the window opening threshold, continue to perform the voice prompt window opening operation, reacquire the second image F, and continue to detect all the window targets in the second image F and calculate the opening degree of each window target until the opening degree of all the window targets is greater than the window opening threshold; Calculate the first three-dimensional world coordinates of the center point of the window area of ​​each window target to the depth camera; as well as Convert the first three-dimensional world coordinate value into a second three-dimensional world coordinate of the robot arm on the lane; The second image F includes a color image F1 and a depth image F2. Detecting all vehicle window objects in the second image F and calculating the opening and closing degree of each vehicle window object include: Detect all window targets in the color image F1 based on the first target detection model to obtain a window target set Window; Perform histogram statistics of the depth information of the depth image F2 to obtain the distance D from the vehicle body to the depth camera; The depth image F2 is binarized with the distance D as the second threshold to obtain a binarized image; Using the first structure element and the second structure element in sequence to perform an erosion operation on the binary image to obtain an eroded image, wherein the size of the first structure element is larger than the second structure element; Performing a connected domain solving operation on the eroded image, calculating the minimum bounding rectangles of all connected domains, and selecting the minimum bounding rectangle whose width meets the first preset condition from all the minimum bounding rectangles to form a minimum bounding rectangle set Openw representing the window opening area; Match the minimum bounding rectangle belonging to each window target in the minimum bounding rectangle set Openw; If it is a car window target Window i If the minimum bounding rectangle in the minimum bounding rectangle set Openw is not matched, the window target Window is determined i No window; If it is a car window target Window i Match the minimum bounding rectangle Openw in the minimum bounding rectangle set Openw j , Window target i Degree of opening i = H Openwj / H Windowi , where H Windowi A car window target Window i Height, H Openwj The minimum bounding rectangle that matches the window target Openw j height.

2. The method for vehicle inspection based on vision as claimed in claim 1, characterized in that: Determining whether the vehicle is parked in a preset frame based on the first image J includes: Obtain a preset frame area of ​​the preset frame in the field of view of the first camera image; Perform vehicle target detection on the first image J using the first target detection model to obtain a vehicle target frame; Determine whether the four corner points of the vehicle target frame are within the preset frame area; If so, the vehicle is parked in the preset frame; Otherwise, determine the offset between the vehicle target and the preset frame in the travel direction and perpendicular to the travel direction.

3. The vision-based vehicle inspection method according to claim 2, characterized in that: The origin of the image coordinate system of the first image J is located at the upper left corner of the image, the horizontal axis of the image coordinate system is parallel to the vehicle travel direction, and the vertical axis of the image coordinate system is perpendicular to the vehicle travel direction; wherein, determining the offset between the vehicle target and the preset frame in the travel direction and perpendicular to the travel direction includes: Get the center point O of the preset frame area fra (x fra ,y fra ) and the center point O of the vehicle target box car (x car ,y car ); Determine whether there is a deviation in the direction of travel: If x fra With x car The absolute value of the difference is greater than the horizontal threshold and x fra With x car If the difference is greater than 0, the vehicle target is behind the preset frame in the parallel direction; if x fra With x car The absolute value of the difference is greater than the horizontal threshold and x fra With x car If the difference is less than 0, the vehicle target exceeds the preset box in the parallel passage direction; Determine whether there is a deviation in the direction perpendicular to the travel direction: If y fra With y car The absolute value of the difference is greater than the vertical threshold and y fra With y car If the difference between y and y is greater than 0, the vehicle target is to the left of the preset frame in the direction perpendicular to the passage direction; fra With y car The absolute value of the difference is greater than the vertical threshold and y fra With y car If the difference is less than 0, the vehicle target is to the right of the preset frame in the direction perpendicular to the travel direction.

4. The vision-based vehicle inspection method according to claim 1, characterized in that: Before determining the positional relationship between the vehicle and the preset frame based on the first image J, the vision-based vehicle inspection method further includes: determining whether the vehicle is stopped using a plurality of ranging elements disposed on the lane; the plurality of ranging elements form a row and are distributed along the side length of the preset frame parallel to the direction of travel.

5. The vision-based vehicle inspection method according to claim 1, characterized in that: For any minimum bounding rectangle Openw in the minimum bounding rectangle set Openw j With any window target Window i The matching conditions must be met: The value of is greater than the set threshold; in, Represents the minimum enclosing rectangle Openw j The coordinate range in the horizontal direction is: Window is the window target i The coordinate range in the horizontal direction is: Represents an intersection operation.

6. The method for vehicle inspection based on vision as claimed in claim 5, characterized in that: Calculate the first 3D world coordinates of the center point of the window area of ​​each window target to the depth camera: ; ; in, , , and The intrinsic parameter matrix K from the depth camera; , are the horizontal and vertical coordinates of the origin of the image physical coordinate system in the image pixel coordinate system respectively; , The horizontal and vertical coordinates of the center point of the window opening area of ​​the vehicle window target in the image; and are the focal length of the depth camera in the horizontal and vertical directions respectively; It is the first 3D world coordinate value from the center point of the windowing area to the depth camera.

7. The vision-based vehicle inspection method according to claim 6, characterized in that: The first three-dimensional world coordinate value is converted into the second three-dimensional world coordinate of the robot arm on the lane: A× + ; A= ; Where A is a matrix, is the first three-dimensional world coordinate value Converted into the second 3D world coordinate value in the robot arm coordinate system, three angles , and are the roll angle, pitch angle and yaw angle respectively, , , are the coordinate values ​​of the origin of the depth camera coordinate system on the X-axis, Y-axis, and Z-axis in the robotic arm coordinate system, respectively.

8. A vehicle inspection system, which is connected to a background monitoring system, characterized in that: include: A first camera located on a safety island on one side of the lane, with its sensing surface facing a preset frame planned within the lane; A depth camera disposed on the same side of the lane as the first camera on the safety island and located on one side of the preset frame, the first camera and the depth camera being sequentially distributed along the direction of vehicle travel, the depth camera being used to capture a side view of a vehicle parked within the preset frame of the lane; A slide rail is arranged on the lane safety island on the same side as the depth camera, the slide rail extends along the vehicle travel direction and is arranged side by side with the depth camera perpendicular to the vehicle travel direction; A mechanical arm slidably connected to the slide rail, the mechanical arm being capable of moving up and down relative to the lane and being capable of telescopic movement relative to a vehicle within a preset frame of the lane; An inspection device disposed on the mechanical arm; A voice announcer installed on the lane; as well as An image processing module is used to execute the steps of the vision-based vehicle inspection method as described in any one of claims 1 to 7.