Automobile safety belt detection method based on vehicle-mounted near-infrared image
Through the detection method based on vehicle-mounted near-infrared image, combined with technologies such as slight smoothing, gradient vector map and Hough line transformation, the problems of high misjudgment rate and high hardware cost of existing car seat belt detection methods are solved, and accurate driving identification is achieved The function of wearing seat belts for the staff reduces hardware and training costs.
Patent Information
- Application Number
- CN202310840028.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-10
- Publication Date
- 2025-01-10
AI Technical Summary
The existing automotive seat belt detection methods have problems such as high misjudgment rate, high hardware cost and high training time cost. Especially based on image processing methods, multiple straight lines can be detected in areas such as collars and garment folds, resulting in misjudgment. The seat belt sensor approach increases hardware costs.
Using a detection method based on vehicle-mounted near-infrared image, image data is collected through a near-infrared camera to detect the area of interest in the position of the seat belt on the human body, combining slight smoothing, gradient vector map, gradient amplitude map with specified angle directions, and binarization , Hough line transformation and screening strategies reduce misjudgment and improve detection accuracy without increasing hardware and time costs.
It improves the accuracy of seat belt detection, reduces misjudgment, and does not increase additional hardware costs and deep learning training time costs, achieving accurate identification of whether the driver is wearing seat belts.
Smart Images

Figure CN119296080A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a vehicle safety belt detection method, in particular to a vehicle safety belt detection method based on vehicle-mounted near-infrared images. Background Art
[0002] In recent years, with the growth of national income and the support of national policies, the number of cars has also increased dramatically. However, traffic accidents are also rising. The correct use of car seat belts can help drivers improve their chances of survival in accidents and effectively protect their lives. Intelligent identification of whether the driver is wearing a seat belt and reporting it will help improve the safety and intelligence of the car cabin. The existing seat belt detection methods are mainly divided into deep learning-based methods, image processing-based methods, and seat belt sensor-based methods. The deep learning-based method requires a lot of time and energy to collect materials for training, and also requires the support of hardware acceleration devices. The image processing-based method performs straight line detection on the seat belt area and detects the seat belt through the specific directionality of the edge of the seat belt. This method easily detects multiple straight lines in areas such as collars and clothing wrinkles, thereby determining that the driver is wearing a seat belt, resulting in misjudgment. The seat belt sensor-based method is purely a stacking of hardware that increases costs. Summary of the invention
[0003] The purpose of the present invention is to solve the problem of whether the driver is wearing a seat belt in a near-infrared image by using an image processing method in a driver monitoring system without increasing the hardware cost and time cost of existing automobile seat belt detection equipment or devices, and to provide a car seat belt detection method based on vehicle-mounted near-infrared images.
[0004] A vehicle seat belt detection method based on vehicle-mounted near-infrared images, the method is as follows: A. Data Collection: Collect a frame of real-time image data Img0 through a near-infrared camera; B. Obtain the grayscale image of the possible area of interest of the seat belt position on the human body: The specific operations are as follows: According to the face detection on the real-time image, the coordinates of the rectangular frame of the face in the image are obtained; the bottom center point A of the rectangular frame is calculated, and point A is used as the reference point. Horizontally, a certain number of pixels are respectively expanded to the left and right at a ratio of 1:5. Vertically, point A is used as the vertex and expanded downward to the bottom of the original image to generate an image of the region of interest where the car seat belt exists on the human body, and converted into a target grayscale image Img1; C. Slightly smooth the grayscale image: Traverse the target grayscale image Img1, select the central pixel and the 8 pixels around the central pixel to form a 3x3 matrix, calculate the average value of all pixels in the matrix, and use it to replace the original central pixel to generate a new target grayscale image Img2; D. Generate the gradient vector map of the target grayscale image: Traverse the target grayscale image GrayB, select the central pixel, and use the adjacent left and right 2 pixels and the adjacent upper and lower 2 pixels of the central pixel to form a vector by subtracting the value of the left pixel from the right pixel and the value of the upper pixel from the lower pixel to replace the original central pixel, thereby generating a gradient vector map GradV; E. Generate a gradient magnitude map at a specified angle direction based on the gradient vector map: Traverse the gradient vector graph GradV, select the center pixel vector, whose members are Gx and Gy, calculate the L2 norm value M of the center pixel vector, and use the inverse cosine theorem to find the gradient direction angle Theta based on Gx and M. Assuming the specified angle is Beta, the closer the gradient direction angle is to Beta, the closer the weight coefficient k is to 1. Conversely, the farther away from Beta, the closer k is to 0. Based on the multiplication of the weight coefficient k and M, a new value is calculated to replace the original center pixel vector, thereby generating a new gradient amplitude graph Grad in the direction of the specified angle Beta; F. Binarize the gradient magnitude map: The gradient image Grad itself is a single-channel image, that is, a grayscale image. The image Grad is divided into several small areas. The size of each small area can be adjusted according to the actual situation. Each small area is traversed, and the average value of its pixel value is calculated and used as the segmentation threshold of the area. For each pixel, it is compared with the segmentation threshold. If the pixel value is greater than the segmentation threshold, the original pixel value is replaced by 255, otherwise, the original pixel value is replaced by 0. The binarization results of all small areas are combined into a new binary image BinA. G. Traverse the binary image and clear small connected areas: Traverse the binary image BinA, search for contours in the binary image, and calculate the width, height and area of the contours to generate a contour tree of the binary image BinA. Traverse the contour tree. When the width of the contour is less than the preset threshold T1, the height is less than the preset threshold T2, and the area is less than the preset threshold T3, the contour is determined to be a scattered point. All values of the contour are replaced with 0, and finally a new binary image BinB is generated. H. Perform Hough line transform on the binary image: Input binary image BinB, set distance accuracy threshold Rho in pixels, angle accuracy Gamma in radians, and threshold parameter Threshold of weight accumulation plane. Using the principle of Hough line transform, queue Q1 can be calculated. Each member of queue Q1 records the straight line vector information, which are the pixel distance and rotation angle of the upper left corner of the image. I. Screening and judging whether there are safety belts: Traverse the queue Q1, when the rotation angle of a queue member is less than the preset threshold T4, or greater than the preset threshold T5, then delete the member from the queue Q1 to obtain a new queue Q2. The queue Q2 is sorted from small to large according to the pixel distance of the upper left corner of the image of the members to obtain a new queue Q3; the queue Q3 is traversed, and the absolute value of the pixel distance difference and the absolute value of the rotation angle difference are calculated for each two adjacent members. If the absolute value of the pixel distance difference is less than the preset threshold value T6, and the absolute value of the rotation angle difference is less than the preset threshold value T7, then the two members are considered to be equal, and the two members are merged to obtain a new queue Q4; the queue Q4 is traversed, and the absolute value of the pixel distance difference and the absolute value of the rotation angle difference are calculated for each two adjacent members. If the absolute value of the pixel distance difference is greater than the preset threshold value T8 and less than the preset threshold value T9, and the absolute value of the rotation angle difference is less than the preset threshold value T10, the total number of pixels N0 and the number of pixels with a pixel value of 0 N1 between the two members are counted. If the ratio of N1 to N0 is greater than or equal to the preset threshold value T11, then it is considered that the seat belt is detected; J. Count the number of image detections and the number of seat belts recognized and report: Within the preset time, the number of image detections K1 is counted, and the number of seat belts recognized K2 is counted. When the ratio of K2 to K1 is greater than or equal to the preset threshold T12, it is reported that the seat belt is detected. Otherwise, it is reported that the seat belt is not detected.
[0005] The beneficial effects of adopting the above technical solution are: 1. No additional hardware costs and deep learning training time costs are required; 2. The detection method adds filtering of specified gradient direction angles and filtering of small connected domains after binarization, as well as screening and reporting strategies, which greatly improves the detection accuracy of seat belts and reduces misjudgments. BRIEF DESCRIPTION OF THE DRAWINGS
[0006] Figure 1 This is a flowchart of the detection method described in this scheme. DETAILED DESCRIPTION
[0007] The following further describes the content of the present invention in conjunction with the accompanying drawings and preferred specific embodiments of the present invention. The examples are only used to explain the present invention and are not used to limit the scope of the present invention.
[0008] like Figure 1 As shown in , a method for detecting a car seat belt based on a vehicle-mounted near-infrared image is described as follows: A. Data Collection: Collect a frame of real-time image data Img0 through a near-infrared camera; B. Obtaining a grayscale image of a possible area of interest where the seat belt is located on the human body; C. Slightly smooth the grayscale image; D. Generate a gradient vector map of the target grayscale image; E. Generate a gradient magnitude map of a specified angle direction according to the gradient vector map; F. Binarize the gradient amplitude map; G. Traverse the binary image and remove small connected domains; H. Perform Hough line transform on the binary image; I. Screen and determine whether there is a safety belt; J. Count the number of image detections and the number of seat belts recognized and report them.
[0009] Furthermore, the specific operation of obtaining the grayscale image of the possible area of interest of the seat belt position on the human body in step B is as follows: Based on face detection on real-time images, the coordinates of the rectangular frame of the face in the image are obtained; the bottom center point A of the rectangular frame is calculated, and point A is used as the reference point. Horizontally, a certain number of pixels are expanded to the left and right at a ratio of 1:5. Vertically, with point A as the vertex, it is expanded downward to the bottom of the original image to generate an image of the region of interest where the car seat belt exists on the human body, which is converted into a target grayscale image Img1.
[0010] Furthermore, in step C, the target grayscale image is slightly smoothed: Traverse the target grayscale image Img1, select the central pixel and the 8 pixels around the central pixel to form a 3x3 matrix, calculate the average value of all pixels in the matrix, and use it to replace the original central pixel to generate a new target grayscale image Img2.
[0011] Furthermore, the gradient vector map of the target grayscale image is generated in step D: Traverse the target grayscale image GrayB, select the central pixel, and use the adjacent left and right 2 pixels and the adjacent upper and lower 2 pixels of the central pixel to form a vector by subtracting the value of the left pixel from the right pixel and the value of the upper pixel from the lower pixel to replace the original central pixel, thereby generating a gradient vector map GradV.
[0012] Furthermore, in step E, a gradient magnitude map of a specified angle direction is generated according to the gradient vector map: Traverse the gradient vector graph GradV, select the center pixel vector, whose members are Gx and Gy, calculate the L2 norm value M of the center pixel vector, and use the inverse cosine theorem to find the gradient direction angle Theta based on Gx and M. Assuming the specified angle is Beta, the closer the gradient direction angle is to Beta, the closer the weight coefficient k is to 1. Conversely, the farther away from Beta, the closer k is to 0. Based on the multiplication of the weight coefficient k and M, a new value is calculated to replace the original center pixel vector, thereby generating a new gradient magnitude graph Grad in the direction of the specified angle Beta.
[0013] Furthermore, in the step F, the gradient magnitude map is binarized: The gradient image Grad itself is a single-channel image, that is, a grayscale image. The image Grad is divided into several small areas, and the size of each small area can be adjusted according to the actual situation; each small area is traversed, and the average value of its pixel value is calculated, and it is used as the segmentation threshold of the area. For each pixel, it is compared with the segmentation threshold. If the pixel value is greater than the segmentation threshold, the original pixel value is replaced by 255, otherwise, the original pixel value is replaced by 0; the binarization results of all small areas are merged into a new binary image BinA; it should be noted that if the selected small area is too small, noise is likely to appear, and if the selected small area is too large, it will lead to the loss of image details; Furthermore, in the G step, the binary image is traversed to remove small connected domains: Traverse the binary image BinA, search for contours in the binary image, and calculate the width, height and area of the contours to generate a contour tree of the binary image BinA. Traverse the contour tree. When the width of the contour is less than the preset threshold T1, the height is less than the preset threshold T2, and the area is less than the preset threshold T3, the contour is judged as a scatter point, and all values of the contour are replaced with 0. Finally, a new binary image BinB is generated.
[0014] Furthermore, in the H step, the binary image is subjected to Hough line transformation: Input the binary image BinB, set the distance accuracy threshold Rho in pixels, the angle accuracy Gamma in radians, and the threshold parameter Threshold of the weighted accumulation plane. Using the principle of Hough line transform, queue Q1 can be calculated. Each member of queue Q1 records the straight line vector information, which are the pixel distance and rotation angle of the upper left corner of the image.
[0015] Furthermore, the screening and determination of whether the safety belt is used in step I: Traverse the queue Q1, when the rotation angle of a queue member is less than the preset threshold T4, or greater than the preset threshold T5, then delete the member from the queue Q1 to obtain a new queue Q2. Queue Q2 is sorted from small to large according to the pixel distance of the upper left corner of the image of the members to obtain a new queue Q3; queue Q3 is traversed, and the absolute value of the pixel distance difference and the absolute value of the rotation angle difference are calculated for each two adjacent members. If the absolute value of the pixel distance difference is less than the preset threshold value T6, and the absolute value of the rotation angle difference is less than the preset threshold value T7, then the two members are considered to be equal, and the two members are merged to obtain a new queue Q4; queue Q4 is traversed, and the absolute value of the pixel distance difference and the absolute value of the rotation angle difference are calculated for each two adjacent members. If the absolute value of the pixel distance difference is greater than the preset threshold value T8 and less than the preset threshold value T9, and the absolute value of the rotation angle difference is less than the preset threshold value T10, the total number of pixels N0 between the two members and the number of pixels with a pixel value of 0 N1 are counted. If the ratio of N1 to N0 is greater than or equal to the preset threshold value T11, then it is considered that the seat belt is detected.
[0016] Furthermore, in the J step, the number of image detections and the number of seat belts recognized are counted and reported: Within the preset time, the number of image detections K1 is counted, and the number of seat belts recognized K2 is counted. When the ratio of K2 to K1 is greater than or equal to the preset threshold T12, it is reported that the seat belt is detected. Otherwise, it is reported that the seat belt is not detected.
[0017] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A vehicle seat belt detection method based on vehicle-mounted near-infrared images, characterized in that: The method is as follows: A. Data Collection: Collect a frame of real-time image data Img0 through a near-infrared camera; B. Obtaining a grayscale image of a possible area of interest where the seat belt is located on the human body; C. Slightly smooth the grayscale image; D. Generate a gradient vector map of the target grayscale image; E. Generate a gradient magnitude map of a specified angle direction according to the gradient vector map; F. Binarize the gradient amplitude map; G. Traverse the binary image and remove small connected domains; H. Perform Hough line transform on the binary image; I. Screen and determine whether there is a safety belt; J. Count the number of image detections and the number of seat belts recognized and report them.
2. The vehicle seat belt detection method based on vehicle-mounted near-infrared images according to claim 1 is characterized in that: The specific operation of obtaining the grayscale image of the possible area of interest of the seat belt position on the human body in step B is as follows: Based on face detection on real-time images, the coordinates of the rectangular frame of the face in the image are obtained; the bottom center point A of the rectangular frame is calculated, and point A is used as the reference point. Horizontally, a certain number of pixels are expanded to the left and right at a ratio of 1:
5. Vertically, with point A as the vertex, it is expanded downward to the bottom of the original image to generate an image of the region of interest where the car seat belt exists on the human body, which is converted into a target grayscale image Img1.
3. The vehicle seat belt detection method based on vehicle-mounted near-infrared images according to claim 1 is characterized in that: In step C, the target grayscale image is slightly smoothed: Traverse the target grayscale image Img1, select the central pixel and the 8 pixels around the central pixel to form a 3x3 matrix, calculate the average value of all pixels in the matrix, and use it to replace the original central pixel to generate a new target grayscale image Img2.
4. The vehicle seat belt detection method based on vehicle-mounted near-infrared images according to claim 1 is characterized in that: The gradient vector map of the target grayscale image is generated in the D step: Traverse the target grayscale image GrayB, select the central pixel, and use the adjacent left and right 2 pixels and the adjacent upper and lower 2 pixels of the central pixel to form a vector by subtracting the value of the left pixel from the right pixel and the value of the upper pixel from the lower pixel to replace the original central pixel, thereby generating a gradient vector map GradV.
5. The vehicle seat belt detection method based on vehicle-mounted near-infrared images according to claim 1 is characterized in that: In the step E, a gradient magnitude map of a specified angle direction is generated according to the gradient vector map: Traverse the gradient vector graph GradV, select the center pixel vector, whose members are Gx and Gy, calculate the L2 norm value M of the vector of the center pixel, and use the inverse cosine theorem to find the gradient direction angle Theta based on Gx and M; Assuming that the specified angle is Beta, the closer the gradient direction angle is to Beta, the closer the weight coefficient k is to 1. Conversely, the farther away from Beta, the closer k is to 0. According to the multiplication of the weight coefficient k and M, a new value is calculated to replace the original center pixel vector, thereby generating a new gradient amplitude map Grad in the specified angle Beta direction.
6. The vehicle seat belt detection method based on vehicle-mounted near-infrared images according to claim 1 is characterized in that: In the F step, the gradient magnitude map is binarized: The gradient image Grad itself is a single-channel image, that is, a grayscale image. The image Grad is divided into several small areas, and the size of each small area can be adjusted according to the actual situation. Each small area is traversed, and the average value of its pixel value is calculated, and it is used as the segmentation threshold of the area. For each pixel, it is compared with the segmentation threshold. If the pixel value is greater than the segmentation threshold, the original pixel value is replaced by 255, otherwise, the original pixel value is replaced by 0. The binarization results of all small areas are merged into a new binary image BinA.
7. The vehicle seat belt detection method based on vehicle-mounted near-infrared images according to claim 1 is characterized in that: In the G step, the binary image is traversed to remove small connected domains: Traverse the binary image BinA, search for contours in the binary image, and calculate the width, height and area of the contours to generate a contour tree of the binary image BinA. Traverse the contour tree. When the width of the contour is less than the preset threshold T1, the height is less than the preset threshold T2, and the area is less than the preset threshold T3, the contour is judged as a scatter point, and all values of the contour are replaced with 0. Finally, a new binary image BinB is generated.
8. The vehicle seat belt detection method based on vehicle-mounted near-infrared images according to claim 1 is characterized in that: In the H step, the binary image is subjected to Hough line transformation: Input the binary image BinB, set the distance accuracy threshold Rho in pixels, the angle accuracy Gamma in radians, and the threshold parameter Threshold of the weighted accumulation plane. Using the principle of Hough line transform, queue Q1 can be calculated. Each member of queue Q1 records the straight line vector information, which are the pixel distance and rotation angle of the upper left corner of the image.
9. The vehicle seat belt detection method based on vehicle-mounted near-infrared images according to claim 1 is characterized in that: Screening and determining whether the safety belt is used in step I: Traverse the queue Q1. When the rotation angle of a queue member is less than the preset threshold T4, or greater than the preset threshold T5, delete the member from the queue Q1 to obtain a new queue Q2. Queue Q2 is sorted from small to large according to the pixel distance of the upper left corner of the image of the members to obtain a new queue Q3; queue Q3 is traversed, and the absolute value of the pixel distance difference and the absolute value of the rotation angle difference are calculated for each two adjacent members. If the absolute value of the pixel distance difference is less than the preset threshold value T6, and the absolute value of the rotation angle difference is less than the preset threshold value T7, then the two members are considered to be equal, and the two members are merged to obtain a new queue Q4; queue Q4 is traversed, and the absolute value of the pixel distance difference and the absolute value of the rotation angle difference are calculated for each two adjacent members. If the absolute value of the pixel distance difference is greater than the preset threshold value T8 and less than the preset threshold value T9, and the absolute value of the rotation angle difference is less than the preset threshold value T10, the total number of pixels N0 between the two members and the number of pixels with a pixel value of 0 N1 are counted. If the ratio of N1 to N0 is greater than or equal to the preset threshold value T11, then it is considered that the seat belt is detected.
10. The vehicle seat belt detection method based on vehicle-mounted near-infrared images according to claim 1 is characterized in that: In the J step, the number of image detections and the number of seat belt recognitions are counted and reported: Within the preset time, the number of image detections K1 is counted, and the number of seat belts recognized K2 is counted. When the ratio of K2 to K1 is greater than or equal to the preset threshold T12, it is reported that the seat belt is detected. Otherwise, it is reported that the seat belt is not detected.