Camera device occlusion detection method, device, electronic equipment and storage medium
By performing face detection and feature encoding comparison of video data obtained by the camera device in the vehicle, the problem of inability to accurately detect driver behavior when the camera device is blocked, achieving higher detection accuracy and traffic safety guarantees.
Patent Information
- Application Number
- CN202111668662.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-31
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2041-12-31
AI Technical Summary
The camera device may be blocked in the vehicle, resulting in the inability to accurately detect the driver's behavior, which will affect traffic safety.
The video data of the vehicle driving area is obtained by the camera device and face detection is performed. If no face is detected, it is encoded based on the pixel value of the current image frame, feature encoding information is obtained, and compared with the preset feature encoding information to determine whether the camera device is blocked.
When the face is not recognized, it is possible to more accurately determine whether the camera device is blocked by comparison of feature encoding information, thereby improving detection accuracy and ensuring accurate monitoring of driver behavior.
Smart Images

Figure CN114332720B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a camera device occlusion detection method, device, electronic device and storage medium. Background Art
[0002] With the improvement of people's living standards, vehicles have become an indispensable means of transportation in people's lives. The camera device in the car cabin can be used to restrain the driver's driving behavior, thereby reducing the probability of traffic accidents, thereby helping to improve driving safety.
[0003] However, in actual use, the camera device may be blocked. If the camera device is blocked, the driver's behavior cannot be accurately detected. Therefore, it is particularly important to detect whether the camera device is blocked and how to improve the accuracy of camera device occlusion detection. Summary of the invention
[0004] The embodiments of the present disclosure at least provide a camera device occlusion detection method, device, electronic device and storage medium, which can not only realize occlusion detection of the camera device, but also improve the detection accuracy.
[0005] The present disclosure provides a camera device occlusion detection method, including:
[0006] Acquiring video data of the driving area of the vehicle by means of a camera device;
[0007] Performing face detection on a current image frame in the video data, and if no face is detected, encoding the current image frame according to pixel values in the current image frame to obtain feature encoding information of the current image frame;
[0008] Based on the feature coding information of the current image frame and preset feature coding information, it is determined whether the camera device is blocked, wherein the preset feature coding information includes feature coding information of an image frame containing a face in the video data.
[0009] In a possible implementation manner, encoding the current image frame according to pixel values in the current image frame includes:
[0010] Determining a reference pixel threshold of the current image frame;
[0011] The pixel value of each pixel point of the current image frame is compared with the reference pixel threshold in turn, the pixel points greater than the reference pixel threshold are encoded as 1, and the pixel points not greater than the reference pixel threshold are encoded as 0, so as to obtain the feature coding information of the current image frame.
[0012] In a possible implementation, the reference pixel threshold is an average pixel value of the current image frame.
[0013] In a possible implementation manner, determining whether the camera device is blocked based on the feature coding information of the current image frame and preset feature coding information includes:
[0014] When the Hamming distance between the feature coding information of the current image frame and the preset feature coding information is greater than a preset threshold, it is determined that the camera device is blocked.
[0015] In a possible implementation, the method further includes:
[0016] When the Hamming distance is not greater than the preset threshold, determining a pixel distribution histogram of the current image frame;
[0017] Based on the pixel distribution histogram of the current image frame, it is determined whether the camera device is blocked.
[0018] In a possible implementation, determining whether the camera device is blocked based on a pixel distribution histogram of the current image frame includes:
[0019] When the pixel distribution ratio of a preset interval in the pixel distribution histogram is greater than a preset ratio threshold, it is determined that the camera device is blocked.
[0020] In a possible implementation, the method further includes:
[0021] When the pixel distribution ratio of a preset interval in the pixel distribution histogram is not greater than the preset ratio threshold, determining the maximum connected domain of the current image frame;
[0022] When the area of the maximum connected domain is greater than a preset area threshold, it is determined that the camera device is blocked.
[0023] In a possible implementation, the method further includes:
[0024] When it is determined that the camera device is blocked, a prompt message is output.
[0025] In a possible implementation manner, when it is determined that the camera device is blocked, outputting prompt information includes:
[0026] Determining a continuous blocking time of the camera device according to a camera device detection result of each frame image in the video data;
[0027] When the continuous shielding time reaches a preset time, the prompt information is output.
[0028] The present disclosure provides a camera device occlusion detection device, comprising:
[0029] A video acquisition module, used to acquire video data of the driving area of the vehicle through a camera device;
[0030] A face detection module is used to perform face detection on a current image frame in the video data, and if no face is detected, encode the current image frame according to pixel values in the current image frame to obtain feature encoding information of the current image frame;
[0031] The occlusion determination module is used to determine whether the camera device is occluded based on the feature coding information of the current image frame and preset feature coding information, wherein the preset feature coding information includes the feature coding information of the image frame containing the face in the video data.
[0032] In a possible implementation, the face detection module is specifically used for:
[0033] Determining a reference pixel threshold of the current image frame;
[0034] The pixel value of each pixel point of the current image frame is compared with the reference pixel threshold in turn, the pixel points greater than the reference pixel threshold are encoded as 1, and the pixel points not greater than the reference pixel threshold are encoded as 0, so as to obtain the feature coding information of the current image frame.
[0035] In a possible implementation, the reference pixel threshold is an average pixel value of the current image frame.
[0036] In a possible implementation manner, the occlusion determination module is specifically configured to:
[0037] When the Hamming distance between the feature coding information of the current image frame and the preset feature coding information is greater than a preset threshold, it is determined that the camera device is blocked.
[0038] In a possible implementation manner, the occlusion determination module is specifically configured to:
[0039] When the Hamming distance is not greater than the preset threshold, determining a pixel distribution histogram of the current image frame;
[0040] Based on the pixel distribution histogram of the current image frame, it is determined whether the camera device is blocked.
[0041] In a possible implementation manner, the occlusion determination module is specifically configured to:
[0042] When the pixel distribution ratio of a preset interval in the pixel distribution histogram is greater than a preset ratio threshold, it is determined that the camera device is blocked.
[0043] In a possible implementation manner, the occlusion determination module is specifically configured to:
[0044] When the pixel distribution ratio of a preset interval in the pixel distribution histogram is not greater than the preset ratio threshold, determining the maximum connected domain of the current image frame;
[0045] When the area of the maximum connected domain is greater than a preset area threshold, it is determined that the camera device is blocked.
[0046] In a possible implementation, the device further includes:
[0047] The information output module is used to output prompt information when it is determined that the camera device is blocked.
[0048] In a possible implementation manner, the information output module is specifically used to:
[0049] Determining a continuous blocking time of the camera device according to a camera device detection result of each frame image in the video data;
[0050] When the continuous shielding time reaches a preset time, the prompt information is output.
[0051] An embodiment of the present disclosure provides an electronic device, including: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the camera device occlusion detection method as described in any of the aforementioned embodiments is performed.
[0052] An embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the camera device occlusion detection method as described in any of the aforementioned embodiments is executed.
[0053] The camera device occlusion detection method, device, electronic device and storage medium provided by the embodiments of the present disclosure encode the current image frame according to the pixel values in the current image frame to obtain feature coding information of the current image frame when no face is recognized, and judge whether the camera device is occluded based on the feature coding information of the current image frame and preset feature coding information. In this way, the image can be further judged when no face is recognized, thereby improving the accuracy of the judgment.
[0054] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0056] Figure 1 A flow chart of a camera device occlusion detection method provided by an embodiment of the present disclosure is shown;
[0057] Figure 2 A flow chart of a method for determining feature coding information of a current image frame provided by an embodiment of the present disclosure is shown;
[0058] Figure 3 A flow chart of another camera device occlusion detection method provided by an embodiment of the present disclosure is shown;
[0059] Figure 4 A flow chart of a method for outputting prompt information provided by an embodiment of the present disclosure is shown;
[0060] Figure 5 A flow chart of another camera device occlusion detection method provided by an embodiment of the present disclosure is shown;
[0061] Figure 6 A schematic structural diagram of a camera device occlusion detection device provided by an embodiment of the present disclosure is shown;
[0062] Figure 7 A schematic structural diagram of another camera device occlusion detection device provided by an embodiment of the present disclosure is shown;
[0063] Figure 8 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0065] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0066] The term "and / or" herein only describes an association relationship, indicating that three relationships may exist. For example, A and / or B may represent the following three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set consisting of A, B, and C.
[0067] As people's living standards improve, vehicles have become an indispensable means of transportation in people's lives. The camera device in the cabin can be used to restrict the driver's driving behavior, thereby reducing the probability of traffic accidents and helping to improve driving safety. However, in actual use, the camera device may be blocked, and if the camera device is blocked, it is impossible to accurately detect the driver's behavior.
[0068] Research has found that although there are methods in the prior art that can detect whether the camera device is blocked, such as using face detection to determine whether the camera device is blocked, this method is prone to misjudgment or missed judgment when the overall brightness of the image is high or low.
[0069] Based on the above research, the present disclosure provides a camera device occlusion detection method, the method comprising: acquiring video data of a driving area of a vehicle through a camera device; performing face detection on a current image frame in the video data, and if no face is detected, encoding the current image frame according to pixel values in the current image frame to obtain feature coding information of the current image frame; determining whether the camera device is occluded based on the feature coding information of the current image frame and preset feature coding information, wherein the preset feature coding information includes feature coding information of an image frame containing a face in the video data.
[0070] In the embodiment of the present disclosure, when no face is recognized, the current image frame is encoded according to the pixel values in the current image frame to obtain feature coding information of the current image frame, and based on the feature coding information of the current image frame and preset feature coding information, it is determined whether the camera device is blocked. In this way, when no face is recognized, further judgment can be made on the image, thereby improving the accuracy of the judgment.
[0071] The following is a detailed description of the camera device occlusion detection method provided in the embodiments of the present disclosure in conjunction with the accompanying drawings. Figure 1 FIG. 1 is a flowchart of a camera device occlusion detection method provided by an embodiment of the present disclosure. The camera device occlusion detection method includes the following S101 to S103:
[0072] S101, acquiring video data of a driving area of a vehicle through a camera device.
[0073] The driving area refers to the area in the vehicle where the driver controls the vehicle. During the driving of the vehicle, the driver is usually in the driving area of the vehicle, and the terminal device can obtain video data of the driving area of the vehicle.
[0074] Video data refers to a continuous sequence of images, which is essentially composed of a group of continuous images, wherein an image frame is the smallest visual unit of a video and is a static image. A temporally continuous sequence of image frames is synthesized together to form a dynamic video. In this implementation, in order to facilitate subsequent detection and recognition, it is necessary to extract the image frames in the video data.
[0075] Exemplarily, since video data usually includes many frames of images per second (for example, 24 frames of images per second), frame extraction can be performed in the process of extracting image frames from the video data, wherein frame extraction refers to frame extraction according to a preset number of interval frames, for example, extracting one frame of image every 20 frames; frame extraction can also be performed according to a preset time interval, for example, extracting an image every 10ms.
[0076] It should be noted that the specific number of interval frames and interval time mentioned above can be set according to actual needs and are not limited here.
[0077] Optionally, the video data of the driving area can be obtained by shooting a camera device installed inside the vehicle, and then the terminal device obtains the video data shot by the camera device. That is, in the embodiment of the present disclosure, the execution subject of the camera device occlusion detection method can be a terminal device, wherein the terminal device includes but is not limited to a vehicle-mounted device, a wearable device, a user terminal, and a handheld device.
[0078] In other embodiments, the executor of the camera device occlusion detection method may also be a server, wherein the server may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud storage, big data and artificial intelligence platforms.
[0079] In some possible implementations, the camera device occlusion detection method may also be implemented by a processor calling computer-readable instructions stored in a memory.
[0080] S102, performing face detection on the current image frame in the video data, and if no face is detected, encoding the current image frame according to pixel values in the current image frame to obtain feature encoding information of the current image frame.
[0081] It can be understood that after the image frame extraction process is performed on the video data, multiple image frames will be obtained. Among them, the current image frame refers to the image frame that needs to be detected and recognized at present, the image frame that is located before the current image frame in the video data is called the previous image frame, and the image frame that is located after the current image frame in the video data is called the subsequent image frame.
[0082] For example, after extracting multiple frames of images, face detection can be performed on the extracted images to determine whether there is a face in the current image frame. Specifically, if a face is detected in the current image frame, it means that the driver is in the driving area at this time and the camera device is not blocked; if no face is detected in the current image frame, further judgment needs to be made on the current image frame to improve the accuracy of the judgment.
[0083] In this implementation, when no human face is recognized in the current image frame, the current image frame is further encoded according to the pixel values in the current image frame to obtain feature encoding information of the current image frame. Figure 2 As shown, the step of encoding the current image frame according to the pixel values in the current image frame may include the following S1021-S1022:
[0084] S1021, determining a reference pixel threshold of the current image frame.
[0085] In this embodiment, the reference pixel threshold is the average pixel value of the current image frame, so that the feature encoding information obtained based on the reference pixel threshold has a unique correspondence with the current image frame, thereby further improving the accuracy of judgment. Of course, in other embodiments, the reference pixel threshold can also be set according to actual conditions, for example, the corresponding reference pixel threshold can be determined according to the overall brightness of the current image, rather than the average pixel value of the current image frame.
[0086] Exemplarily, in order to improve the accuracy of determining the reference pixel threshold, before determining the reference pixel threshold of the current image frame, noise reduction processing may be performed on the current image frame, thereby reducing the impact of imaging noise.
[0087] In some implementations, a Gaussian smoothing algorithm may be used to perform noise reduction processing on the current image frame. In other embodiments, the noise reduction processing may also be performed using a median filtering algorithm or a mean filtering algorithm, which is not specifically limited.
[0088] S1022, compare the pixel value of each pixel point of the current image frame with the reference pixel threshold in turn, encode the pixel points greater than the reference pixel threshold as 1, and encode the pixel points not greater than the reference pixel threshold as 0, to obtain feature coding information of the current image frame.
[0089] Exemplarily, after determining the reference pixel threshold, the current image frame can be encoded according to the reference pixel threshold. The specific encoding process can be encoding pixels greater than the reference pixel threshold as 1, and encoding pixels not greater than the reference pixel threshold as 0, thereby obtaining the feature encoding information. The feature encoding information can be a two-dimensional array or a two-dimensional matrix that is consistent with the size of the current image frame being encoded. For example, when the average pixel of the current image frame is 100, if the pixel value of a certain pixel in the current image frame is 123, the pixel is encoded as 1, and if the pixel value of a certain pixel in the current image frame is 80, the pixel is encoded as 0.
[0090] Optionally, in order to reduce the dimension of feature coding information to reduce the amount of calculation, after encoding each pixel in the current image frame, the codes of each pixel can be concatenated in sequence according to a certain scanning order (for example, rows first and then columns) to form a one-dimensional array or vector as the feature coding information of the image frame.
[0091] S103, determining whether the camera device is blocked based on feature coding information of the current image frame and preset feature coding information, wherein the preset feature coding information includes feature coding information of an image frame containing a face in the video data.
[0092] In this embodiment, the preset feature coding information includes feature coding information of an image frame containing a human face in the video data, that is, the preset feature coding information is feature coding information of a preceding image frame of the current image frame, and the preceding image frame contains a human face. That is, the image containing a human face captured after the camera device is started is used as a basis for judging whether the subsequent image frame is blocked by the camera device.
[0093] It can be understood that after the vehicle is started, the camera device can be powered on and start shooting the driving area of the vehicle to obtain video data. If the first frame image obtained based on the video data does not contain a face, at this time, the pre-stored feature coding information containing a face can be used as the preset feature coding information; and if the first frame image contains a face, the feature coding information of the first frame image will be used as the preset feature coding information.
[0094] It should be noted that if it is determined through video data that multiple consecutive frames of images contain human faces, the preset feature coding information can be updated, that is, the feature coding information of the first frame of image is replaced by the subsequent feature coding information containing human faces. For example, it can be updated once every preset time interval, and the specific interval time is not limited, for example, it can be 1 minute or 2 minutes.
[0095] Exemplarily, the feature coding information of the current image frame may be compared with the preset feature coding information to determine whether the camera device is blocked. Specifically, the Hamming distance between the feature coding information of the current image frame and the preset feature coding information may be calculated, and when the Hamming distance between the feature coding information of the current image frame and the preset feature coding information is greater than a preset threshold, it is determined that the camera device is blocked.
[0096] In the disclosed embodiment, when no face is recognized, the current image frame is also encoded according to the pixel values in the current image frame to obtain feature coding information of the current image frame, and based on the feature coding information of the current image frame and preset feature coding information, it is determined whether the camera device is blocked. In this way, when no face is recognized, further judgment can be made on the image, thereby improving the accuracy of the judgment, especially making it more accurate to judge whether the driver is away from his post.
[0097] See also Figure 3FIG. 2 is a flowchart of another camera device occlusion detection method provided by an embodiment of the present disclosure, including the following S201 to S205:
[0098] S201, acquiring video data of a driving area of a vehicle through a camera device.
[0099] This step is similar to the above step S101 and will not be described again.
[0100] S202, performing face detection on the current image frame in the video data, and if no face is detected, encoding the current image frame according to pixel values in the current image frame to obtain feature encoding information of the current image frame.
[0101] This step is similar to the above step S102 and will not be described again.
[0102] S203, determining whether the Hamming distance between the feature coding information of the current image frame and the preset feature coding information is greater than a preset threshold; if so, executing step S205; if not, executing step S204.
[0103] This step is similar to the above step S103 and will not be described again.
[0104] S204: Determine whether the camera device is blocked based on the pixel distribution histogram of the current image frame.
[0105] Exemplarily, when the Hamming distance between the feature coding information of the current image frame and the preset feature coding information is not greater than the preset threshold, it means that there may be a face in the current image frame, but it is not recognized during the face detection process due to some specific reasons (such as dim ambient light). Therefore, in order to further improve the accuracy of judgment, it is also necessary to judge the current image frame from other angles to further determine whether the camera device is blocked.
[0106] In an embodiment of the present disclosure, when the Hamming distance between the feature coding information of the current image frame and the preset feature coding information is not greater than a preset threshold, the pixel distribution histogram of the current image frame is determined, and when the pixel distribution proportion of a preset interval in the pixel distribution histogram is greater than a preset proportion threshold, it is determined that the camera device is blocked.
[0107] Specifically, the distribution of the pixel value of each pixel point in the current image frame can be statistically analyzed to obtain a pixel distribution histogram of the current image frame. For example, the distribution of the pixel value of each pixel point in the current image frame can be statistically analyzed according to a plurality of pre-divided pixel intervals, and the plurality of pixel intervals can be [0-19], [20-80], [81-126], and [127-255], etc. It can be understood that in this embodiment, the plurality of pixel intervals shown are only for illustration, and in other embodiments, the plurality of pixel intervals can also be divided according to other requirements.
[0108] In some embodiments, the preset interval can be obtained by performing a large number of tests based on the actual use environment of the camera device. For example, a histogram of the image of the vehicle driving area scene can be statistically analyzed, and it can be determined that the pixel ratio of the pixel interval [20-80] in the normal image taken when the camera device is not obstructed and the pixel ratio of the pixel interval [20-80] in the image taken when the camera device is obstructed have a relatively obvious boundary. Therefore, the preset interval can be set to the pixel interval of [20-80].
[0109] In addition, the greater the proportion of total pixels with lower pixel values (for example, less than 20) or greater than the high brightness threshold, the smaller the probability of valid content existing in the image. Therefore, in other embodiments, the preset interval can also be an interval with lower pixel values or an interval with higher pixel values, such as a pixel interval of [0 to 20] or a pixel interval of [130 to 255], without specific limitation.
[0110] In this implementation, the preset interval is one of the multiple pixel intervals, for example, the preset interval is [20-80]. If the number of pixel points within the preset interval [20-80] is large and greater than the preset proportion threshold, it can be determined that the camera device is blocked.
[0111] S205: Determine whether the camera device is blocked.
[0112] S206, output prompt information.
[0113] Exemplarily, after determining that the camera device is blocked, a prompt message may be output to remind the driver to process the blocked camera device so that the camera device can normally capture the image of the driver, thereby helping to improve driving safety.
[0114] The prompt information includes but is not limited to voice prompt information, graphic prompt information, light prompt information, etc. For example, a voice prompt information of "the camera device is blocked, please confirm" can be output.
[0115] In some embodiments, in order to avoid the frequent output of prompt information due to momentary occlusion affecting the occupants of the vehicle, see Figure 4 As shown, when outputting the prompt information, the following S2061 to S2062 may be included:
[0116] S2061: Determine a continuous blocking time of the camera device according to a camera device detection result of each frame image in the video data.
[0117] S2062: When the continuous shielding time reaches a preset time, output the prompt information.
[0118] In the present embodiment, when the current image frame determines that the camera device is blocked, it is also necessary to determine whether the judgment result of the subsequent frame image is also blocked. If at least one subsequent frame image determines that the camera device is not blocked, it means that the current blockage is just a flash, and at this time, no prompt information is output; if the judgment result of at least one subsequent frame image is also that the camera device is blocked, that is, multiple consecutive frames of images all determine that the camera device is blocked, it means that the camera device is continuously blocked at this time, which is intentional blocking, not accidental blocking, and when the continuous blocking time reaches a preset time (for example, 5 seconds), a prompt information is output for prompting.
[0119] See also Figure 5 FIG. 2 is a flowchart of another camera device occlusion detection method provided by an embodiment of the present disclosure, including the following S301 to S310:
[0120] S301, obtaining video data of a driving area of a vehicle through a camera device.
[0121] This step is similar to the above step S101 and will not be described again.
[0122] S302, performing face detection on the current image frame in the video data, and if no face is detected, encoding the current image frame according to pixel values in the current image frame to obtain feature encoding information of the current image frame.
[0123] This step is similar to the above step S102 and will not be described again.
[0124] S303, determining whether the Hamming distance between the feature coding information of the current image frame and the preset feature coding information is greater than a preset threshold; if so, executing step S308; if not, executing step S304.
[0125] Exemplarily, if the Hamming distance between the feature coding information of the current image frame and the preset feature coding information is greater than a preset threshold, it means that the current image frame does not contain a face. At this time, step S308 is executed to determine whether the camera device is blocked; if the Hamming distance between the feature coding information of the current image frame and the preset feature coding information is not greater than the preset threshold, it means that there may be a face in the current image frame and further judgment is required. Therefore, step S304 is executed.
[0126] S304: Determine a pixel distribution histogram of the current image frame.
[0127] This step is similar to the above step S204 and will not be described again.
[0128] S305, determining whether the pixel distribution ratio of a preset interval in the pixel distribution histogram is greater than a preset ratio threshold; if so, executing step S308; if not, executing step S306.
[0129] Exemplarily, if the pixel distribution ratio of a preset interval in the pixel distribution histogram is greater than a preset ratio threshold, it means that the invalid content accounts for a large proportion in the current image frame, and step S308 is executed to determine whether the camera device is blocked; if the pixel distribution ratio of a preset interval in the pixel distribution histogram is not greater than the preset ratio threshold, it means that the valid content ratio of the current image frame is normal, and step S306 needs to be executed for further judgment.
[0130] S306: Determine the maximum connected domain of the current image frame.
[0131] S307, determining whether the area of the maximum connected domain is greater than a preset area threshold; if so, executing step S308; if not, executing step S310.
[0132] The maximum connected domain refers to an image region composed of pixel points with the same pixel value or all pixel values within a certain error and adjacent to each other. The maximum connected domain is a closed region. For example, the preset area threshold can be set to an area of 60% of the normal image. If the maximum connected domain is greater than the preset area threshold, step S308 is executed to determine that the camera device is blocked; if the maximum connected domain is not greater than the preset area threshold, step S310 is executed to determine that the camera device is not blocked.
[0133] It can be understood that in order to further improve the judgment accuracy and prevent misjudgment caused by sudden changes, for example, misjudgment caused by momentary occlusion, in some embodiments, when it is determined that the area of the maximum connected domain of the current image frame is greater than the preset area threshold, the following (1) to (3) may also be performed:
[0134] (1) determining the maximum connected domain of at least one image frame before and / or after the current image frame;
[0135] (2) determining an average value of the area of the largest connected domain of the current image frame and the at least one image frame;
[0136] (3) When the average value of the area of the maximum connected domain of the current image frame and the at least one frame of image is greater than the preset area threshold, it is determined that the camera device is blocked.
[0137] In this way, when it is determined that the area of the largest connected domain of the current image frame is greater than the preset area threshold, the average value of the area of the largest connected domain of multiple frames of images before or after the current image frame is also determined, thereby avoiding misjudgment caused by flash (such as passing in front of the camera device for a moment), and further improving the accuracy of the judgment.
[0138] S308: Determine whether the camera device is blocked.
[0139] S309, output prompt information.
[0140] This step is similar to the above step S206 and will not be described again.
[0141] S310: Determine whether the camera device is blocked.
[0142] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0143] Based on the same technical concept, a camera device occlusion detection device corresponding to the camera device occlusion detection method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned camera device occlusion detection method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0144] Reference Figure 6 FIG. 5 is a schematic diagram of a camera device occlusion detection device 500 provided in an embodiment of the present disclosure. The camera device occlusion detection device 500 includes:
[0145] The video acquisition module 501 is used to acquire video data of the driving area of the vehicle through a camera device;
[0146] A face detection module 502 is used to perform face detection on a current image frame in the video data, and if no face is detected, encode the current image frame according to pixel values in the current image frame to obtain feature encoding information of the current image frame;
[0147] The occlusion determination module 503 is used to determine whether the camera device is occluded based on the feature coding information of the current image frame and preset feature coding information, wherein the preset feature coding information includes the feature coding information of the image frame containing the face in the video data.
[0148] In a possible implementation, the face detection module 502 is specifically used for:
[0149] Determining a reference pixel threshold of the current image frame;
[0150] The pixel value of each pixel point of the current image frame is compared with the reference pixel threshold in turn, the pixel points greater than the reference pixel threshold are encoded as 1, and the pixel points not greater than the reference pixel threshold are encoded as 0, so as to obtain the feature coding information of the current image frame.
[0151] In a possible implementation, the reference pixel threshold is an average pixel value of the current image frame.
[0152] In a possible implementation manner, the occlusion determination module 503 is specifically configured to:
[0153] When the Hamming distance between the feature coding information of the current image frame and the preset feature coding information is greater than a preset threshold, it is determined that the camera device is blocked.
[0154] In a possible implementation manner, the occlusion determination module 503 is specifically configured to:
[0155] When the Hamming distance is not greater than the preset threshold, determining a pixel distribution histogram of the current image frame;
[0156] Based on the pixel distribution histogram of the current image frame, it is determined whether the camera device is blocked.
[0157] In a possible implementation manner, the occlusion determination module 503 is specifically configured to:
[0158] When the pixel distribution ratio of a preset interval in the pixel distribution histogram is greater than a preset ratio threshold, it is determined that the camera device is blocked.
[0159] In a possible implementation manner, the occlusion determination module 503 is specifically configured to:
[0160] When the pixel distribution ratio of a preset interval in the pixel distribution histogram is not greater than the preset ratio threshold, determining the maximum connected domain of the current image frame;
[0161] When the area of the maximum connected domain is greater than a preset area threshold, it is determined that the camera device is blocked.
[0162] See also Figure 7 As shown, in a possible implementation manner, the device further includes:
[0163] The information output module 504 is used to output prompt information when it is determined that the camera device is blocked.
[0164] In a possible implementation manner, the information output module 504 is specifically configured to:
[0165] Determining a continuous blocking time of the camera device according to a camera device detection result of each frame image in the video data;
[0166] When the continuous shielding time reaches a preset time, the prompt information is output.
[0167] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0168] Based on the same technical concept, the embodiment of the present disclosure also provides an electronic device. Figure 8 , which is a schematic diagram of the structure of an electronic device 700 provided in an embodiment of the present disclosure, including a processor 701, a memory 702, and a bus 703. The memory 702 is used to store execution instructions, including a memory 7021 and an external memory 7022; the memory 7021 is also called an internal memory, which is used to temporarily store the operation data in the processor 701 and the data exchanged with the external memory 7022 such as a hard disk. The processor 701 exchanges data with the external memory 7022 through the memory 7021.
[0169] In the embodiment of the present application, the memory 702 is specifically used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 701. That is, when the electronic device 700 is running, the processor 701 communicates with the memory 702 through the bus 703, so that the processor 701 executes the application code stored in the memory 702, and then executes the method described in any of the above embodiments.
[0170] Among them, the memory 702 can be, but is not limited to, random access memory (Random Access Memory, RAM), read only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
[0171] The processor 701 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present invention may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0172] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 700. In other embodiments of the present application, the electronic device 700 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0173] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the camera device occlusion detection method in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0174] The embodiments of the present disclosure also provide a computer program product, which carries a program code. The instructions included in the program code can be used to execute the steps of the camera device occlusion detection method in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0175] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0176] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0177] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0178] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0179] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0180] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A camera device occlusion detection method, characterized in that: include: Acquiring video data of the driving area of the vehicle by means of a camera device; Performing face detection on a current image frame in the video data, and if no face is detected, encoding the current image frame according to pixel values in the current image frame to obtain feature encoding information of the current image frame; When a Hamming distance between the feature coding information of the current image frame and preset feature coding information is not greater than a preset threshold, determining a pixel distribution histogram of the current image frame, wherein the preset feature coding information includes feature coding information of an image frame containing a face in the video data; When the pixel distribution ratio of a preset interval in the pixel distribution histogram is not greater than a preset ratio threshold, determining the maximum connected domain of the current image frame; When the area of the maximum connected domain is greater than a preset area threshold, it is determined that the camera device is blocked.
2. The method according to claim 1, characterized in that The encoding of the current image frame according to the pixel values in the current image frame comprises: Determining a reference pixel threshold of the current image frame; The pixel value of each pixel point of the current image frame is compared with the reference pixel threshold in turn, the pixel points greater than the reference pixel threshold are encoded as 1, and the pixel points not greater than the reference pixel threshold are encoded as 0, so as to obtain the feature coding information of the current image frame.
3. The method according to claim 2, characterized in that The reference pixel threshold is the average pixel value of the current image frame.
4. The method according to claim 1, characterized in that: The method further comprises: When the Hamming distance between the feature coding information of the current image frame and the preset feature coding information is greater than a preset threshold, it is determined that the camera device is blocked.
5. The method according to claim 1, characterized in that The method further comprises: When the pixel distribution ratio of a preset interval in the pixel distribution histogram is greater than a preset ratio threshold, it is determined that the camera device is blocked.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: When it is determined that the camera device is blocked, a prompt message is output.
7. The method according to claim 6, characterized in that When it is determined that the camera device is blocked, outputting prompt information includes: Determining a continuous blocking time of the camera device according to a camera device detection result of each frame image in the video data; When the continuous shielding time reaches a preset time, the prompt information is output.
8. A camera device occlusion detection device, characterized in that: include: A video acquisition module, used to acquire video data of the driving area of the vehicle through a camera device; A face detection module is used to perform face detection on a current image frame in the video data, and if no face is detected, encode the current image frame according to pixel values in the current image frame to obtain feature encoding information of the current image frame; an occlusion determination module, configured to determine a pixel distribution histogram of the current image frame when a Hamming distance between feature coding information of the current image frame and preset feature coding information is not greater than a preset threshold, wherein the preset feature coding information includes feature coding information of an image frame containing a face in the video data; When the pixel distribution ratio of a preset interval in the pixel distribution histogram is not greater than a preset ratio threshold, determining the maximum connected domain of the current image frame; When the area of the maximum connected domain is greater than a preset area threshold, it is determined that the camera device is blocked.
9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the camera device occlusion detection method as described in any one of claims 1-7 is executed.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the camera device occlusion detection method according to any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Abnormal state monitoring method and device for construction site
CN109858441A
Shielding detection method and system, computer equipment and readable storage medium
CN111862228A
Image detection method and system and camera shielding monitoring method and system
CN112261402A