An image inpainting method, device, storage medium and electronic equipment

By acquiring and comparing images before and after the camera was equipped with a dome, and using a machine learning model to identify and repair blurred areas, the problem of decreased camera image clarity was solved, thus improving the quality of surveillance.

CN116188280BActive Publication Date: 2026-07-28ZHEJIANG UNIVIEW TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIVIEW TECH CO LTD
Filing Date
2021-11-26
Publication Date
2026-07-28

AI Technical Summary

Technical Problem

When a camera is equipped with a dome, the image clarity at certain angles decreases, affecting the quality of monitoring. Existing technologies make it difficult to quickly and accurately identify and repair blurry areas.

Method used

By acquiring images with and without a camera dome, the blurred areas are identified through comparative analysis, and repair is performed based on a machine learning model.

Benefits of technology

It can quickly and accurately identify and repair blurred areas in camera images, thus improving the quality of surveillance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116188280B_ABST
    Figure CN116188280B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an image repairing method and device, a storage medium and an electronic device. The method comprises: acquiring a first image and a second image captured by a camera; wherein the first image is an image captured when the camera is configured with a ball cover, and the second image is an image captured when the camera is not configured with the ball cover; the first image and the second image correspond to the same shooting scene; determining a blurred area in the first image according to the first image and the second image; and repairing the blurred area in the first image. The technical scheme provided by the embodiments of the present application can quickly and accurately determine the blurred area in the image captured by the camera, and repair the blurred area, thereby effectively improving the monitoring quality of the camera.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image restoration method, apparatus, storage medium and electronic device. Background Technology

[0002] To protect camera lenses from contamination or damage, high-transmittance PC or PMMA dome covers are typically installed. However, due to various reasons such as mold wear or wear during manufacturing, cameras equipped with dome covers may experience a significant decrease in image sharpness at certain angles, affecting the monitoring quality. Therefore, the ability to quickly identify areas of reduced sharpness in surveillance images and restore their original image quality greatly improves the user experience of surveillance cameras. Summary of the Invention

[0003] This invention provides an image restoration method, apparatus, storage medium, and electronic device that can quickly and accurately identify blurred areas in images captured by a camera and restore those areas, thereby effectively improving the monitoring quality of the camera.

[0004] In a first aspect, embodiments of the present invention provide an image restoration method, comprising:

[0005] Acquire a first image and a second image captured by the camera; wherein the first image is an image captured when the camera is equipped with a dome cover, and the second image is an image captured when the camera is not equipped with the dome cover; the first image and the second image correspond to the same shooting scene;

[0006] The blurred region in the first image is determined based on the first image and the second image;

[0007] The blurred areas in the first image are repaired.

[0008] Secondly, embodiments of the present invention also provide an image restoration apparatus, comprising:

[0009] The image acquisition module is used to acquire a first image and a second image captured by the camera; wherein the first image is an image captured when the camera is equipped with a dome cover, and the second image is an image captured when the camera is not equipped with the dome cover; the first image and the second image correspond to the same shooting scene;

[0010] A blurred region determination module is used to determine a blurred region in the first image based on the first image and the second image;

[0011] The image restoration module is used to restore blurred areas in the first image.

[0012] Thirdly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the image restoration method provided in embodiments of the present invention.

[0013] Fourthly, embodiments of the present invention provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the image restoration method provided in the embodiments of the present invention.

[0014] This invention provides an image restoration scheme that acquires a first image and a second image captured by a camera. The first image is taken when the camera is equipped with a dome lens, and the second image is taken when the camera is not equipped with the dome lens. The first and second images correspond to the same shooting scene. Blurred areas in the first image are determined based on the first and second images, and these blurred areas are then restored. The technical solution provided by this invention can quickly and accurately determine and restore blurred areas in images captured by a camera, effectively improving the monitoring quality of the camera. Attached Figure Description

[0015] Figure 1 This is a flowchart of an image restoration method provided in an embodiment of the present invention;

[0016] Figure 2 This is a flowchart of an image restoration method provided in another embodiment of the present invention;

[0017] Figure 3 This is a schematic diagram of the structure of an image restoration device provided in another embodiment of the present invention;

[0018] Figure 4 This is a schematic diagram of the structure of an electronic device according to another embodiment of the present invention. Detailed Implementation

[0019] Embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. While some embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the invention. It should be understood that the accompanying drawings and embodiments are for illustrative purposes only and are not intended to limit the scope of protection of the invention.

[0020] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0021] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0022] It should be noted that the concepts of "first" and "second" mentioned in this invention are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0023] It should be noted that the terms "a" and "a plurality of" used in this invention are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0024] The names of the messages or information exchanged between the multiple devices in the embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of these messages or information.

[0025] Figure 1 This is a flowchart illustrating an image restoration method according to an embodiment of the present invention. This embodiment is applicable to image restoration applications. The method can be executed by an image restoration device, which may consist of hardware and / or software and is generally integrated into an electronic device. Figure 1 As shown, the method specifically includes the following steps:

[0026] Step 110: Acquire a first image and a second image captured by the camera; wherein the first image is an image captured when the camera is equipped with a dome cover, and the second image is an image captured when the camera is not equipped with the dome cover; the first image and the second image correspond to the same shooting scene.

[0027] The camera may include a dome camera, a hemispherical camera, and a bullet camera. It should be noted that this embodiment of the invention does not limit the type of camera.

[0028] In this embodiment of the invention, a first image captured when the camera is equipped with a dome lens and a second image captured when the camera is not equipped with the dome lens are acquired. Since a dome lens is typically used to protect the camera lens from contamination or damage, in response to a second image capture event—that is, when an instruction is received to capture an image from a camera without a dome lens—the dome lens can be automatically removed using a dome lens removal device, and then an image can be captured. This captured image is then used as the second image. Optionally, the first image and the second image can correspond to the same shooting scene; that is, the shooting angle and content of the first and second images can be the same.

[0029] Optionally, before acquiring the first and second images captured by the camera, the method further includes: acquiring third images captured by the camera at various shooting angles when the dome cover is not configured; acquiring the first and second images captured by the camera includes: determining the current shooting angle of the camera; acquiring the first image captured by the camera at the current shooting angle; searching for a target image in the third image that corresponds to the same shooting angle as the current shooting angle, and using the target image as the second image. The first and second images correspond to the same shooting scene. The advantage of this configuration is that it not only allows for simple and quick acquisition of images captured by the camera without the dome cover, but also effectively avoids damage to the camera and the dome cover caused by each removal and installation of the dome cover.

[0030] In this embodiment of the invention, third images captured by the camera at various shooting angles without a dome cover are obtained. For example, the dome cover can be temporarily removed from the camera using an automatic dome cover removal device, and the third images captured by the camera at various shooting angles can be obtained by rotating the pan-tilt head. Different shooting angles result in different fields of view for the camera on the map, including the field of view radius, the field of view angle, and the field of view orientation. For instance, the longitudinal angle corresponding to the camera's pan-tilt head can be divided into equal parts. At each equal longitudinal angle, the pan-tilt head can rotate one revolution horizontally in steps of p°, and the image captured by the camera after each pan-tilt head rotation can be obtained. Optionally, each shooting angle and the corresponding third image can be stored. For example, the current shooting angle of the camera can be determined using the camera's built-in electronic compass, where the current shooting angle can be understood as the shooting angle the camera is currently at. Then, the first image captured by the camera at the current shooting angle is obtained, and a target image corresponding to the same shooting angle as the current shooting angle is found in the third image. This target image is then used as the second image captured by the camera without a dome cover.

[0031] Step 120: Determine the blurred region in the first image based on the first image and the second image.

[0032] Since the second image was taken without a dome camera, it has higher clarity and better quality. The first image, however, was taken with a dome camera; due to potential wear and tear on the dome, some areas in the first image may have lower clarity. In this embodiment, the blurred areas in the first image can be determined by comparing and analyzing the first and second images. For example, the first and second images can be simultaneously input into a pre-trained blurred area analysis model, and the blurred areas in the first image can be determined based on the model's output. The blurred area analysis model is a machine learning model that uses a clear image as a benchmark to intelligently analyze the image to be analyzed. After inputting the first and second images into the blurred area analysis model, the first image can be used as the image to be analyzed, and the second image as the clear benchmark image.

[0033] Optionally, the first image and the second image can be divided into h corresponding image blocks in the same way. Then, the sharpness evaluation value of each corresponding image block in the first image and the second image can be calculated. By comparing the sharpness evaluation values ​​of each corresponding image block in the first image and the second image, it can be determined whether the region corresponding to the image block in the first image is a blurred region. Here, the sharpness evaluation value is an evaluation index used to measure image quality.

[0034] Step 130: Repair the blurred areas in the first image.

[0035] In this embodiment of the invention, blurred areas in the first image can be repaired until the sharpness evaluation value of the blurred area is greater than a preset sharpness evaluation value. For example, blurred areas in the first image can be repaired based on sharp areas in the first image. Here, sharp areas refer to the areas in the first image excluding blurred areas. Optionally, when the first image and the second image correspond to the same shooting scene, the blurred area in the first image can be replaced with the area in the second image corresponding to the blurred area in the first image to repair the blurred area in the first image. It should be noted that this embodiment of the invention does not limit the method of repairing blurred areas in the first image.

[0036] Optionally, repairing the blurred areas in the first image includes: repairing the blurred areas in the first image until the difference between the sharpness evaluation value of the repaired blurred area and the sharpness evaluation value of the target area is less than a first preset sharpness evaluation value threshold, or the ratio of the sharpness evaluation value of the repaired blurred area to the sharpness evaluation value of the target area is greater than a second preset sharpness evaluation value threshold; wherein, the target area is the area in the second image corresponding to the blurred area. Specifically, using the second image as a reference, after repairing the blurred areas in the first image, the sharpness evaluation value of the repaired blurred area is calculated, and it is determined whether the difference between the sharpness evaluation value and the sharpness evaluation value of the target area is less than the first preset sharpness evaluation value threshold. If so, it indicates that the repaired blurred area meets the sharpness requirements; otherwise, the repair of the blurred area continues. As another example, after repairing the blurred areas in the first image, the sharpness evaluation value of the repaired blurred area is calculated, and it is determined whether the difference between the sharpness evaluation value and the sharpness evaluation value of the target area is greater than a second preset sharpness evaluation value threshold. If so, it indicates that the repaired blurred area meets the sharpness requirements; otherwise, the repair of the blurred area continues. The advantage of this setting is that it can effectively ensure the clarity of the repaired image.

[0037] This invention provides an image restoration method that acquires a first image and a second image captured by a camera. The first image is taken when the camera is equipped with a dome lens, and the second image is taken when the camera is not equipped with the dome lens. The first and second images correspond to the same shooting scene. Blurred areas in the first image are determined based on the first and second images, and these blurred areas are then restored. The technical solution provided by this invention can quickly and accurately determine and restore blurred areas in images captured by a camera, effectively improving the monitoring quality of the camera.

[0038] In some embodiments, determining a blurred region in the first image based on the first image and the second image includes: dividing the first image and the second image into at least two image blocks respectively, generating at least two image block pairs; wherein, the image blocks in the first image correspond one-to-one with the image blocks in the second image, and the image block pairs include the image blocks in the first image and the second image that correspond one-to-one; calculating, for each image block pair, a first sharpness evaluation value of the first image block and a second sharpness evaluation value of the second image block in the current image block pair; wherein, the first image block is an image block in the first image, and the second image block is an image block in the second image; and determining, based on the first sharpness evaluation value and the second sharpness evaluation value, whether the region where each image block in the first image is located is a blurred region.

[0039] For example, both the first and second images can be divided into M*N image blocks, with each image block in the first image corresponding one-to-one with an image block in the second image, forming a pair of corresponding image blocks. Therefore, M*N image block pairs can be generated. Each image block pair includes a first image block and a second image block, where the first image block belongs to the first image, and the second image is the corresponding image block in the second image. The first and second image blocks are the same size and shape. It should be noted that the M*N image blocks in the first or second image can be the same or different in size. For example, when the M*N image blocks are the same size, their resolution can be m*n. For each image block pair, a first sharpness evaluation value for the first image block and a second sharpness evaluation value for the second image block are calculated. Then, based on the first and second sharpness evaluation values, it is determined whether each first image block is a blurred image block, that is, whether the region where each image block in the first image is located is a blurred region. For example, the ratio of the first sharpness evaluation value to the second sharpness evaluation value can be calculated, and it can be determined whether the ratio is less than a preset sharpness ratio threshold. If so, the first image block corresponding to the first sharpness evaluation value can be determined to be a blurred image block, that is, the area where the first image block is located in the first image is a blurred area.

[0040] Optionally, based on the first clarity evaluation value and the second clarity evaluation value, determining whether the region where each image block in the first image is located is a blurred region includes: for each image block in the first image, calculating the difference or ratio between the first clarity evaluation value corresponding to the current image block and the corresponding second clarity evaluation value; when the difference is greater than the first preset clarity evaluation value threshold or the ratio is less than the second preset clarity evaluation value threshold, determining that the region where the current image block in the first image is located is a blurred region. Specifically, for each of the M*N first image blocks, calculate the difference between the first clarity evaluation value corresponding to the current first image block and the second clarity evaluation value of the corresponding second image block. When the difference is greater than the preset clarity evaluation value threshold, it can be determined that the current first image block is a blurred image block, that is, the region where the current first image block is located in the first image is a blurred region. For example, the first clarity evaluation value of the i-th first image block can be expressed as Ei, and the second clarity evaluation value of the second image block corresponding to this first image block can be expressed as Ei'. Among them, i = 1, 2, 3…, compare the difference Gi = Ei - Ei' between the two with the first preset clarity evaluation value threshold e1. When Gi > e1, it can be determined that the region where the i-th first image block is located in the first image is a blurred region. When Gi ≤ e1, it can be determined that the region where the i-th first image block is located in the first image is a clear region. Another example is that the ratio Fi = Ei / Ei' of the first clarity evaluation value Ei to the second clarity evaluation value expressed as Ei' is compared with the second preset clarity evaluation value threshold e2. When Fi < e2, it can be determined that the region where the i-th first image block is located in the first image is a blurred region. When Fi ≥ e2, it can be determined that the region where the i-th first image block is located in the first image is a clear region.

[0041] In the embodiments of the present invention, the gradient information function method or the image frequency domain analysis method can be used to determine the clarity evaluation value of the image block. It should be noted that the embodiments of the present invention do not limit the determination method of the clarity evaluation value. Optionally, calculating the clarity evaluation value of the image block includes: determining the gray matrix of the image block; calculating the horizontal gradient, vertical gradient, first diagonal gradient and second diagonal gradient of the image block according to the gray matrix; calculating the clarity evaluation value of the image block according to the horizontal gradient, vertical gradient, first diagonal gradient and second diagonal gradient. For example, taking the resolution of the image block as m*n, the gray level of each pixel point in the image block is counted, and the gray matrix of the image block is determined based on the gray levels of each pixel point. Among them, the gray matrix Q can be expressed as where A n,m represents the gray level of the pixel point (m, n) in the image block. Calculate the horizontal gradient H, vertical gradient V, first diagonal gradient Z and second diagonal gradient L of the image block according to the gray matrix Q. Among them,

[0042]

[0043]

[0044]

[0045]

[0046] Then, based on the horizontal gradient H, the vertical gradient V, the first diagonal gradient Z, and the second diagonal gradient L, the sharpness evaluation value E of the image patch is calculated, where,

[0047] In some embodiments, after determining the blurred region in the first image based on the first image and the second image, the method further includes: determining the position information of the blurred region in the first image; and repairing the image captured by the camera with the dome cover based on the position information. Since the images captured by the same camera are of the same size, and if a portion of the image captured by the camera is blurred due to wear or other reasons, the position of the blurred region remains fixed. Therefore, the position information of the blurred region in the first image can be determined. When the camera with the dome cover captures an image, the possible blurred regions in the captured image can be directly determined based on this position information, and the blurred regions at the corresponding positions can be directly repaired. The advantage of this design is that it effectively ensures the quality of the images captured by the camera.

[0048] Figure 2 A flowchart of an image restoration method provided in another embodiment of the present invention is shown below. Figure 2 As shown, the method specifically includes the following steps:

[0049] Step 210: Acquire a first image and a second image captured by the camera; wherein the first image is an image captured when the camera is equipped with a dome cover, and the second image is an image captured when the camera is not equipped with a dome cover; the first image and the second image correspond to the same shooting scene.

[0050] Step 220: Divide the first image and the second image into at least two image blocks respectively to generate at least two image block pairs; wherein, the image blocks in the first image correspond one-to-one with the image blocks in the second image, and the image block pairs include the image blocks in the first image and the second image that correspond one-to-one.

[0051] Step 230: For each image block pair, calculate the first sharpness evaluation value of the first image block and the second sharpness evaluation value of the second image block in the current image block pair; wherein, the first image block is an image block in the first image and the second image block is an image block in the second image.

[0052] Step 240: For each image block in the first image, calculate the difference or ratio between the first sharpness evaluation value and the corresponding second sharpness evaluation value of the current image block.

[0053] Step 250: When the difference is greater than the first preset sharpness evaluation value threshold or the ratio is less than the second preset sharpness evaluation value threshold, the region where the current image block in the first image is located is determined to be a blurred region.

[0054] Step 260: Repair the blurred areas in the first image until the difference between the sharpness evaluation value of the repaired blurred area and the sharpness evaluation value of the target area is less than a first preset sharpness evaluation value threshold, or the ratio of the sharpness evaluation value of the repaired blurred area to the sharpness evaluation value of the target area is greater than a second preset sharpness evaluation value threshold; wherein, the target area is the area in the second image corresponding to the blurred area.

[0055] Step 270: Determine the location information of the blurred region in the first image.

[0056] Step 280: Repair the images captured by the camera when it is equipped with a dome cover based on the location information.

[0057] This invention provides an image restoration method that can quickly and accurately identify and restore blurred areas in images captured by a camera, thereby effectively improving the monitoring quality of the camera.

[0058] Figure 3 This is a schematic diagram of an image restoration device according to another embodiment of the present invention. Figure 3 As shown, the device includes: an image acquisition module 310, a blurred region determination module 320, and a blurred region repair module 330. Among them,

[0059] Image acquisition module 310 is used to acquire a first image and a second image captured by a camera; wherein the first image is an image captured when the camera is equipped with a dome cover, and the second image is an image captured when the camera is not equipped with the dome cover; the first image and the second image correspond to the same shooting scene.

[0060] The blurred region determination module 320 is used to determine the blurred region in the first image based on the first image and the second image;

[0061] The blurred area repair module 330 is used to repair blurred areas in the first image.

[0062] This invention provides an image restoration device that acquires a first image and a second image captured by a camera. The first image is taken when the camera is equipped with a dome lens, and the second image is taken when the camera is not equipped with the dome lens. The first and second images correspond to the same shooting scene. Blurred areas in the first image are determined based on the first and second images, and these blurred areas are then restored. The technical solution provided by this invention can quickly and accurately determine and restore blurred areas in images captured by a camera, effectively improving the monitoring quality of the camera.

[0063] Optionally, the fuzzy region determination module includes:

[0064] An image block pair generation unit is used to divide the first image and the second image into at least two image blocks respectively, and generate at least two image block pairs; wherein, the image blocks in the first image correspond one-to-one with the image blocks in the second image, and the image block pair includes the image blocks that correspond one-to-one in the first image and the second image.

[0065] The sharpness evaluation value calculation unit is used to calculate, for each image block pair, a first sharpness evaluation value of the first image block and a second sharpness evaluation value of the second image block in the current image block pair; wherein, the first image block is an image block in the first image and the second image block is an image block in the second image.

[0066] The blurred region determination unit is used to determine whether the region where each image block in the first image is located is a blurred region based on the first sharpness evaluation value and the second sharpness evaluation value.

[0067] Optionally, the sharpness evaluation value calculation unit is used for:

[0068] Determine the grayscale matrix of the image patch;

[0069] Calculate the horizontal gradient, vertical gradient, first diagonal gradient, and second diagonal gradient of the image block based on the grayscale matrix;

[0070] The sharpness evaluation value of the image patch is calculated based on the horizontal gradient, vertical gradient, first diagonal gradient, and second diagonal gradient.

[0071] Optionally, the fuzzy region determination unit is used for:

[0072] For each image block in the first image, calculate the difference or ratio between the first sharpness evaluation value and the corresponding second sharpness evaluation value for the current image block;

[0073] When the difference is greater than the first preset sharpness evaluation threshold or the ratio is less than the second preset sharpness evaluation threshold, the region where the current image block in the first image is located is determined to be a blurred region.

[0074] Optionally, the blurred area repair module is used for:

[0075] The blurred areas in the first image are repaired until the difference between the sharpness evaluation value of the repaired blurred area and the sharpness evaluation value of the target area is less than a first preset sharpness evaluation value threshold, or the ratio of the sharpness evaluation value of the repaired blurred area to the sharpness evaluation value of the target area is greater than a second preset sharpness evaluation value threshold; wherein, the target area is the area in the second image corresponding to the blurred area.

[0076] Optionally, the device further includes:

[0077] The image capturing module is used to capture a third image taken by the camera at various shooting angles when the dome is not configured, before acquiring the first and second images captured by the camera;

[0078] The image acquisition module is used for:

[0079] Determine the current shooting angle of the camera;

[0080] Acquire the first image captured by the camera at the current shooting angle;

[0081] In the third image, find the target image corresponding to the same shooting angle as the current shooting angle, and use the target image as the second image.

[0082] Optionally, the device further includes:

[0083] The location information determination module is used to determine the location information of the blurred region in the first image after determining the blurred region in the first image based on the first image and the second image;

[0084] An image restoration module is used to restore images captured by the camera when the dome is configured, based on the location information.

[0085] The above-described apparatus can execute the methods provided in all the foregoing embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the above methods. Technical details not described in detail in the embodiments of the present invention can be found in the methods provided in all the foregoing embodiments of the present invention.

[0086] This invention also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the image restoration method provided in this invention.

[0087] Storage medium – any type of memory device or storage device. The term “storage medium” is intended to include: mounting media, such as CD-ROMs, floppy disks, or magnetic tape devices; computer system memory or random access memory, such as DRAM, DDRRAM, SRAM, EDORAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (e.g., hard disks or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. Furthermore, storage media may reside in a first computer system in which a program is executed, or may reside in a different second computer system connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term “storage medium” can include two or more storage media that may reside in different locations (e.g., in different computer systems connected via a network). Storage media may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.

[0088] Of course, the computer-executable instructions provided in the embodiments of the present invention are not limited to the image restoration operations described above, but can also perform related operations in the image restoration method provided in any embodiment of the present invention.

[0089] This invention provides an electronic device that can integrate the image restoration device provided in this invention. Figure 4 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. The electronic device 400 may include: a memory 401, a processor 402, and a computer program stored in the memory 401 and executable on the processor. When the processor 402 executes the computer program, it implements the image restoration method as described in the embodiment of the present invention.

[0090] The electronic device provided in this embodiment of the invention acquires a first image and a second image captured by a camera; wherein the first image is an image captured when the camera is equipped with a dome lens, and the second image is an image captured when the camera is not equipped with the dome lens; the first image and the second image correspond to the same shooting scene; a blurred area in the first image is determined based on the first image and the second image; and the blurred area in the first image is repaired. The technical solution provided in this embodiment of the invention can quickly and accurately determine the blurred area in the image captured by the camera and repair the blurred area, which can effectively improve the monitoring quality of the camera.

[0091] The image restoration apparatus, storage medium, and electronic device provided in the above embodiments can execute the image restoration method provided in any embodiment of the present invention, and have the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in the above embodiments can be found in the image restoration method provided in any embodiment of the present invention.

[0092] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. An image restoration method, characterized in that, include: Acquire a first image and a second image captured by the camera; wherein the first image is an image captured when the camera is equipped with a dome cover, and the second image is an image captured when the camera is not equipped with the dome cover; the first image and the second image correspond to the same shooting scene; The blurred region in the first image is determined based on the first image and the second image; Repair the blurred areas in the first image; Determine the location information of the blurred region in the first image; After the camera with the dome-shaped cover captures an image, the blurred areas in the captured image are determined based on the position information, and the blurred areas at the corresponding positions are directly repaired. The process of determining the blurred region in the first image based on the first image and the second image includes: The first image and the second image are divided into at least two image blocks respectively, generating at least two image block pairs; wherein, the image blocks in the first image correspond one-to-one with the image blocks in the second image, and the image block pairs include the image blocks that correspond one-to-one in the first image and the second image; For each image block pair, calculate the first sharpness evaluation value of the first image block and the second sharpness evaluation value of the second image block in the current image block pair; wherein, the first image block is the image block in the first image and the second image block is the image block in the second image; Based on the first sharpness evaluation value and the second sharpness evaluation value, it is determined whether the region where each image block in the first image is located is a blurred region.

2. The method according to claim 1, characterized in that, Calculate the sharpness rating of the image patch, including: Determine the grayscale matrix of the image patch; Calculate the horizontal gradient, vertical gradient, first diagonal gradient, and second diagonal gradient of the image block based on the grayscale matrix; The sharpness evaluation value of the image patch is calculated based on the horizontal gradient, vertical gradient, first diagonal gradient, and second diagonal gradient.

3. The method according to claim 1, characterized in that, Based on the first sharpness evaluation value and the second sharpness evaluation value, determine whether the region where each image patch in the first image is located is a blurred region, including: For each image block in the first image, calculate the difference or ratio between the first sharpness evaluation value and the corresponding second sharpness evaluation value for the current image block; When the difference is greater than the first preset sharpness evaluation threshold or the ratio is less than the second preset sharpness evaluation threshold, the region where the current image block in the first image is located is determined to be a blurred region.

4. The method according to claim 1, characterized in that, Repairing the blurred areas in the first image includes: The blurred areas in the first image are repaired until the difference between the sharpness evaluation value of the repaired blurred area and the sharpness evaluation value of the target area is less than a first preset sharpness evaluation value threshold, or the ratio of the sharpness evaluation value of the repaired blurred area to the sharpness evaluation value of the target area is greater than a second preset sharpness evaluation value threshold; wherein, the target area is the area in the second image corresponding to the blurred area.

5. The method according to claim 1, characterized in that, Before acquiring the first and second images captured by the camera, the process also includes: The third images captured by the camera at various shooting angles when the dome cover is not configured are obtained respectively; Acquire the first and second images captured by the camera, including: Determine the current shooting angle of the camera; Acquire the first image captured by the camera at the current shooting angle; In the third image, find the target image corresponding to the same shooting angle as the current shooting angle, and use the target image as the second image.

6. An image restoration device, characterized in that, include: The image acquisition module is used to acquire a first image and a second image captured by the camera; wherein the first image is an image captured when the camera is equipped with a dome cover, and the second image is an image captured when the camera is not equipped with the dome cover; the first image and the second image correspond to the same shooting scene; A blurred region determination module is used to determine a blurred region in the first image based on the first image and the second image; A blurred area repair module is used to repair blurred areas in the first image; A location information determination module is used to determine the location information of the blurred region in the first image; The image restoration module is used to determine the blurred areas in the captured image based on the position information after the camera with the dome is configured to capture the image, and to directly restore the blurred areas at the corresponding positions. The fuzzy region determination module includes: An image block pair generation unit is used to divide the first image and the second image into at least two image blocks respectively, and generate at least two image block pairs; wherein, the image blocks in the first image correspond one-to-one with the image blocks in the second image, and the image block pair includes the image blocks that correspond one-to-one in the first image and the second image. The sharpness evaluation value calculation unit is used to calculate, for each image block pair, a first sharpness evaluation value of the first image block and a second sharpness evaluation value of the second image block in the current image block pair; wherein, the first image block is an image block in the first image and the second image block is an image block in the second image. The blurred region determination unit is used to determine whether the region where each image block in the first image is located is a blurred region based on the first sharpness evaluation value and the second sharpness evaluation value.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processing device, it implements the image restoration method as described in any one of claims 1-5.

8. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the image restoration method as described in any of claims 1-5.