CN-115761575-B - Image detection method, device and computer readable storage medium
Abstract
The application provides an image detection method, an image detection device and a computer readable storage medium, wherein a current image in a video stream is acquired, a reference image is acquired, the current image is input into a rain removal model to obtain a processed image processed by the rain removal model, a first frame difference image of the current image and the reference image and a second frame difference image of the processed image and the reference image are respectively acquired, difference information of the first frame difference image and the second frame difference image is acquired, and whether the difference information meets preset conditions is judged. Through the mode, whether the current image is rainy or not can be accurately judged through the difference information of the current image and the current image after rain removal, interference of other factors in the image background can be eliminated, accuracy is improved, misjudgment is prevented, and robustness is improved.
Inventors
- MAO LIJIAN
- Zhang Liugun
- XIONG JIANPING
Assignees
- 浙江大华技术股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20221027
Claims (8)
- 1. An image detection method, characterized in that the image detection method comprises: acquiring a current image in a video stream and acquiring a reference image; Inputting the current image into a rain removal model to obtain a processed image processed by the rain removal model; Respectively acquiring a first frame difference image of the current image and the reference image and a second frame difference image of the processed image and the reference image; Acquiring difference information of the first frame difference image and the second frame difference image, and judging whether the difference information meets preset conditions or not; if yes, determining that the scene of the current image is a raining scene; the obtaining the difference information of the first frame difference map and the second frame difference map includes: Calculating a third frame difference map of the first frame difference map and the second frame difference map; acquiring a plurality of pixel blocks of the third frame difference image, and calculating a pixel value of each pixel block; acquiring the number of pixel blocks of which the pixel value is greater than or equal to a preset pixel value threshold in the third frame difference image; Generating the difference information using the number; The judging whether the difference information meets the preset condition comprises the following steps: Based on the difference information, acquiring the number of pixel blocks with the pixel value larger than or equal to a preset pixel value threshold; and when the number is greater than or equal to the preset number, determining that the scene of the current image is a raining scene.
- 2. The image detection method according to claim 1, wherein, The reference image is a previous frame image of the current image in the video stream.
- 3. The image detection method according to claim 1, wherein, The obtaining a plurality of pixel blocks of the third frame difference map, and calculating a pixel value of each pixel block includes: The first frame difference image is subjected to blocking processing to obtain a plurality of first pixel blocks, and the second frame difference image is subjected to blocking processing to obtain a plurality of second pixel blocks; The first pixel block and the second pixel block at the same position are subjected to difference to obtain a pixel block on the third frame difference image; and taking the difference value of the first pixel block and the second pixel block as the pixel value of the pixel block at the same position on the third frame difference image.
- 4. The image detection method according to claim 1 or 3, wherein, The obtaining a plurality of pixel blocks of the third frame difference map includes: performing target detection on the moving object on the current image based on the video stream to obtain the position information of the moving object; And after the third frame difference image is subjected to pixel block division, eliminating pixel blocks containing moving objects based on the position information, and obtaining a plurality of pixel blocks of the third frame difference image.
- 5. The image detection method according to claim 1, wherein, After the scene of the current image is determined to be a rainy scene, the image detection method further includes: Continuously acquiring other images in the video stream, and acquiring a raining image which is determined to be a raining scene in the other images; and when the scenes with continuous multi-frame images are all the raining scenes, determining the scenes of the video stream as the raining scenes.
- 6. The image detection method according to claim 1, wherein, After the current image in the video stream is acquired, the image detection method further comprises: acquiring current scene information of the current image; When the current image is determined to be an indoor scene based on the current scene information, continuing to acquire a next frame image of the current image in the video stream; And acquiring a reference image when the current image is determined to be an outdoor scene based on the current scene information.
- 7. An image detection device is characterized by comprising a processor and a memory connected with the processor, wherein, The memory stores program instructions; The processor is configured to execute the program instructions stored in the memory to implement the image detection method according to any one of claims 1-6.
- 8. A computer readable storage medium, characterized in that the storage medium stores program instructions which, when executed, implement the image detection method according to any one of claims 1-6.
Description
Image detection method, device and computer readable storage medium Technical Field The present application relates generally to the field of video image processing technology, and in particular, to an image detection method, apparatus, and computer readable storage medium. Background In the technical field of video image processing, for the recognition and judgment in a rainy day, whether to rain or whether to judge weather category according to the road surface condition in a video is generally judged through water mist caused by the fact that a vehicle passes through the road surface in a video frame, the vehicle is easy to be interfered by irrelevant objects, the vehicle cannot be detected under the condition of small rainfall, the vehicle is low in accuracy, time delay is achieved, and robustness is low. Disclosure of Invention To solve the above technical problems, the present application provides an image detection method, an image detection device and a computer readable storage medium. In order to solve the above technical problems, the present application provides an image detection method, which includes: acquiring a current image in a video stream and acquiring a reference image; Inputting the current image into a rain removal model to obtain a processed image processed by the rain removal model; Respectively acquiring a first frame difference image of the current image and the reference image and a second frame difference image of the processed image and the reference image; Acquiring difference information of the first frame difference image and the second frame difference image, and judging whether the difference information meets preset conditions or not; If yes, determining that the scene of the current image is a rainy scene. Wherein the reference image is a previous frame image of the current image in the video stream. Wherein the obtaining the difference information of the first frame difference map and the second frame difference map includes: Calculating a third frame difference map of the first frame difference map and the second frame difference map; acquiring a plurality of pixel blocks of the third frame difference image, and calculating a pixel value of each pixel block; acquiring the number of pixel blocks of which the pixel value is greater than or equal to a preset pixel value threshold in the third frame difference image; The difference information is generated using the number. The method comprises the steps of obtaining a plurality of pixel blocks of a third frame difference image, and calculating a pixel value of each pixel block; The first frame difference image is subjected to blocking processing to obtain a plurality of first pixel blocks, and the second frame difference image is subjected to blocking processing to obtain a plurality of second pixel blocks; The first pixel block and the second pixel block at the same position are subjected to difference to obtain a pixel block on the third frame difference image; and taking the difference value of the first pixel block and the second pixel block as the pixel value of the pixel block at the same position on the third frame difference image. Wherein the obtaining the plurality of pixel blocks of the third frame difference map includes: performing target detection on the moving object on the current image based on the video stream to obtain the position information of the moving object; And after the third frame difference image is subjected to pixel block division, eliminating pixel blocks containing moving objects based on the position information, and obtaining a plurality of pixel blocks of the third frame difference image. Wherein, the judging whether the difference information meets the preset condition comprises: Based on the difference information, acquiring the number of pixel blocks with the pixel value larger than or equal to a preset pixel value threshold; and when the number is greater than or equal to the preset number, determining that the scene of the current image is a raining scene. Wherein after the determining that the scene of the current image is a raining scene, the image detection method further includes: Continuously acquiring other images in the video stream, and acquiring a raining image which is determined to be a raining scene in the other images; And when the scenes with the continuous multi-frame images are all rainy scenes, determining that the scenes of the video stream are rainy scenes. Wherein, after the current image in the video stream is acquired, the image detection method further comprises: acquiring current scene information of the current image; When the current image is determined to be an indoor scene based on the current scene information, continuing to acquire a next frame image of the current image in the video stream; And acquiring a reference image when the current image is determined to be an outdoor scene based on the current scene information. In order to solve the technic