Image processing method and device, electronic equipment and computer readable storage medium
Through image calibration and weight calculation, the problem of exposure image displacement deviation caused by the movement of the image sensor in dynamic scenes is solved, ghosts are eliminated, and image quality is improved.
Patent Information
- Application Number
- CN202310242792.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-01
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2043-03-01
AI Technical Summary
In dynamic scenes, due to the exposure time interval between different frames of exposure images and the displacement deviation caused by the movement of the image sensor, image blur and ghosting occur, affecting image quality.
Through image calibration, the scene positions of exposure images with different exposure times are matched, the motion area and weight of the calibration image are calculated, and image synthesis is performed to eliminate ghosts and improve image quality.
It effectively eliminates the blurring phenomenon and ghosting caused by the movement of the image sensor, and improves the imaging quality of the image. The algorithm is simple, the calculation amount is small, and the applicability is strong.
Smart Images

Figure CN118587103A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image processing method, device, electronic device and computer-readable storage medium. Background Art
[0002] In the related art, when the scene is a changing dynamic scene, there will be a displacement deviation between the different frames of exposure images due to the exposure time interval between the different frames, resulting in a blurred ghost phenomenon due to the moving objects, which seriously affects the image quality. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art.
[0004] To this end, an object of the present invention is to propose an image processing method, which, through image calibration, matches the scene positions of exposure images with different exposure times, eliminates the differences caused by the movement of the image sensor during shooting, avoids the blurring phenomenon caused by pixel-level fusion, and thus is beneficial to improving image quality. The calibration images are synthesized by recalculating the weights corresponding to the calibration images and the moving areas of the calibration images, thereby effectively eliminating the generation of ghost images in the synthesized images, thereby further improving the image quality.
[0005] Therefore, a second object of the present invention is to provide an image processing device.
[0006] To this end, a third object of the present invention is to provide an electronic device.
[0007] To this end, a fourth object of the present invention is to provide a computer-readable storage medium.
[0008] In order to achieve the above-mentioned objectives, an embodiment of the first aspect of the present invention proposes an image processing method, comprising the following steps: acquiring multiple frames of images with different exposures; calibrating the exposure images to obtain a calibration image; calculating a first weight corresponding to the calibration image; determining a motion area of the calibration image; calculating a second weight of the motion area of the calibration image; synthesizing multiple frames of the calibration image according to the first weight and the second weight to obtain a target synthesized image.
[0009] According to the image processing method of the embodiment of the present invention, the exposure image is calibrated to obtain a calibration image, the motion area of the calibration image is determined, the first weight corresponding to the calibration image and the second weight corresponding to the motion area of the calibration image are calculated, and then multiple frames of calibration images are synthesized according to the first weight and the second weight to obtain a target synthesized image. Therefore, the present invention takes into account the situation that the image sensor may move during shooting, and through image calibration, the scene positions of exposure images with different exposure times are matched, the difference caused by the movement of the image sensor during shooting is eliminated, and the blurring phenomenon caused by pixel-level fusion is avoided, which is conducive to improving the image quality; by recalculating the calibration image and the weight corresponding to the motion area of the calibration image, the ghost of the synthesized image is effectively eliminated, thereby further improving the image quality. In addition, the algorithm is simple in the implementation process of the present invention, the amount of calculation is small, it is easy to implement, and it has strong applicability.
[0010] In addition, the image processing method of the above embodiment of the present invention may also have the following additional technical features:
[0011] In one embodiment of the present invention, calibrating the exposure image includes: performing image registration on the exposure image to obtain a registered image; and performing image correction on the registered image to obtain the calibrated image.
[0012] In one embodiment of the present invention, image registration is performed on the exposure image, including: placing the exposure amount of the exposure image at a preset exposure level according to a preset exposure curve to obtain an adjusted exposure image, wherein the adjusted exposure image includes a reference image and a pre-registered image; and acquiring feature point pairs between the pre-registered image and the reference image to obtain the registered image.
[0013] In one embodiment of the present invention, obtaining the feature point pair between the pre-registered image and the reference image includes: performing feature point detection on the pre-registered image and the reference image to obtain feature point information of the pre-registered image and the reference image accordingly; the reference image includes a preset origin, and starting from the preset origin, feature point matching is performed on the pre-registered image and the reference image within a preset matching range to obtain the feature point pair.
[0014] In one embodiment of the present invention, the registration image is corrected, including: calculating the distance of the feature point pairs; statistically calculating the distance of the feature point pairs, and using the distance of the feature point pairs that meets preset conditions as the image offset; calculating the offset direction required for the registration image; and performing an offset operation on the registration image according to the image offset and the offset direction to correct the registration image and obtain the calibrated image.
[0015] In one embodiment of the present invention, the method further includes: if no feature point pair is matched within the preset matching range, expanding the matching range according to a preset step length to re-match the feature points until the feature point pair is obtained.
[0016] In one embodiment of the present invention, the calculating the distance of the feature point pair includes: taking the reference image as a reference, calculating the Euclidean distance between the matching feature points of the reference image and the registration image, and using the calculated Euclidean distance as the distance of the feature point pair.
[0017] In one embodiment of the present invention, the distance between the feature point pairs that meet the preset conditions includes: the distance between the feature point pairs that appear the most times.
[0018] In one embodiment of the present invention, the calculation of the offset direction required for the registered image includes: calculating the quadrant position of the corresponding pixel point coordinates in the registered image with the pixel point coordinates of the reference image as the origin; and determining the offset direction required for the registered image according to the quadrant position.
[0019] In one embodiment of the present invention, after performing an offset operation on the registered image according to the image offset amount and the offset direction, it also includes: performing zero padding processing on the boundary of the offset registered image to make it the same size as the corresponding exposure image to obtain the calibration image.
[0020] In one embodiment of the present invention, determining the motion region of the calibration image includes: acquiring binary images of the calibration image and the reference image; and subtracting the binary images of the calibration image and the reference image to obtain an absolute value to obtain the motion region of the calibration image.
[0021] In one embodiment of the present invention, before calculating the first weight corresponding to the calibration image, the method includes: determining a non-moving area of the calibration image.
[0022] In one embodiment of the present invention, determining the non-motion region of the calibration image includes: inverting the motion region of the calibration image to obtain the non-motion region.
[0023] In one embodiment of the present invention, the image of the non-moving area includes a long-exposure image and a short-exposure image. After determining the non-moving area of the calibration image, the method further includes: mapping a preset signal-to-noise ratio of the long-exposure image to the short-exposure image of the non-moving area in an RGB color space to improve the signal-to-noise ratio of the short-exposure image.
[0024] In one embodiment of the present invention, calculating the first weight corresponding to the calibration image includes: calculating the contrast, exposure and image entropy of the calibration image; and calculating the weight corresponding to the calibration image through the contrast, exposure and image entropy to obtain the first weight.
[0025] In one embodiment of the present invention, the calculating the contrast of the calibration image includes: performing Laplace filtering on an exposure image corresponding to the calibration image, and then obtaining an absolute value of the obtained filtering result to obtain the contrast of the calibration image.
[0026] In one embodiment of the present invention, the calculating the exposure of the calibration image includes: calculating the exposure of the calibration image using a triangular weight function.
[0027] In one embodiment of the present invention, calculating the image entropy of the calibration image includes: using a preset matrix as the range of entropy value calculation, calculating the entropy value of the middle point by calculating the probability of occurrence of all pixel points in the preset matrix, and using the entropy value as the image entropy of the calibration image.
[0028] In one embodiment of the present invention, calculating the weight corresponding to the calibration image by using the contrast, exposure, and image entropy includes: multiplying the contrast, exposure, and image entropy and normalizing them to obtain the weight of the calibration image.
[0029] In one embodiment of the present invention, calculating the second weight corresponding to the motion area of the calibration image includes: W′ x, =(W 1 *(I 1ex +I 2ex )+W 2 ) / I 1ex , where W′ x, is the second weight, I 1ex The exposure image I 1 The corresponding exposure, I 2ex The exposure image I 2 The corresponding exposure, W 1 The exposure image I 1 The corresponding first weight, W 2 The exposure image I 2 The corresponding first weight, where I 1 and I 2 are two adjacent exposure frames, and (x, y) represents the coordinate point of the reference image.
[0030] In one embodiment of the present invention, image synthesis is performed on multiple frames of the calibration image according to the first weight and the second weight, including: performing weighted average calculation on the first weight and the second weight to obtain a weight map of the calibration image; obtaining a pixel value of each pixel point of the image to be synthesized according to the weight map; and synthesizing the target synthesized image according to the pixel value of each pixel point of the image to be synthesized.
[0031] In one embodiment of the present invention, performing weighted average calculation on the first weight and the second weight includes: Among them, I (x,) is the target synthesized image, i is the current image to be synthesized, n and m are the sizes of the current image to be synthesized, respectively. i(,) is the pixel value of the current image to be synthesized, B i(,) is the value of the non-motion area, W i(x,y) is the first weight corresponding to the calibration image, W′ i(,) is the second weight corresponding to the motion area.
[0032] In order to achieve the above-mentioned objectives, an embodiment of the second aspect of the present invention proposes an image processing device, including: an acquisition module, used to acquire multiple frames of different exposure images; a calibration module, used to calibrate the exposure image to obtain a calibration image; a first calculation module, used to calculate a first weight corresponding to the calibration image; a processing module, used to determine the motion area of the calibration image; a second calculation module, used to calculate a second weight of the motion area of the calibration image; and a synthesis module, used to synthesize multiple frames of the calibration image according to the first weight and the second weight to obtain a target synthesized image.
[0033] According to the image processing device of the embodiment of the present invention, the exposure image is calibrated to obtain a calibration image, the motion area of the calibration image is determined, the first weight corresponding to the calibration image and the second weight corresponding to the motion area of the calibration image are calculated, and then multiple frames of calibration images are synthesized according to the first weight and the second weight to obtain a target synthesized image. Therefore, the present invention takes into account the situation that the image sensor may move during shooting, and through image calibration, the scene positions of exposure images with different exposure times are matched, the difference caused by the movement of the image sensor during shooting is eliminated, and the blurring phenomenon caused by pixel-level fusion is avoided, which is conducive to improving the image quality; by recalculating the calibration image and the weight corresponding to the motion area of the calibration image, the generation of ghost images of the synthesized image is effectively eliminated, thereby further improving the image quality. In addition, the algorithm is simple in the implementation process of the present invention, the amount of calculation is small, it is easy to implement, and it has strong applicability.
[0034] In order to achieve the above-mentioned purpose, the third aspect embodiment of the present invention proposes an electronic device, which includes the image processing device as described in the second aspect embodiment of the present invention; or, the electronic device includes: a processor, a memory, and an image processing program stored in the memory and executable on the processor, and when the image processing program is executed by the processor, it implements the image processing method as described in the first aspect embodiment of the present invention.
[0035] According to the electronic device of the embodiment of the present invention, by calibrating the exposure image, a calibration image is obtained, the motion area of the calibration image is determined, the first weight corresponding to the calibration image and the second weight corresponding to the motion area of the calibration image are calculated, and then multiple frames of calibration images are synthesized according to the first weight and the second weight to obtain a target synthesized image. Therefore, the present invention takes into account the situation that the image sensor may move during shooting, and through image calibration, the scene positions of exposure images with different exposure times are matched, the difference caused by the movement of the image sensor during shooting is eliminated, and the blurring phenomenon caused by pixel-level fusion is avoided, which is conducive to improving the image quality; by recalculating the calibration image and the weight corresponding to the motion area of the calibration image, the generation of ghost images of the synthesized image is effectively eliminated, thereby further improving the image quality. In addition, the algorithm is simple in the implementation process of the present invention, the amount of calculation is small, it is easy to implement, and it has strong applicability.
[0036] In order to achieve the above-mentioned objectives, the fourth aspect embodiment of the present invention proposes a computer-readable storage medium, on which an image processing program is stored. When the image processing program is executed by a processor, the image processing method as described in the above-mentioned first aspect embodiment of the present invention is implemented.
[0037] According to the computer-readable storage medium of the embodiment of the present invention, when the image processing program stored thereon is executed by the processor, the exposure image is calibrated to obtain a calibration image, the motion area of the calibration image is determined, the first weight corresponding to the calibration image and the second weight corresponding to the motion area of the calibration image are calculated, and then multiple frames of calibration images are synthesized according to the first weight and the second weight to obtain a target synthetic image. Therefore, the present invention takes into account the situation that the image sensor may move during shooting, and through image calibration, the scene positions of exposure images with different exposure times are matched, the difference caused by the movement of the image sensor during shooting is eliminated, and the blurring phenomenon caused by pixel-level fusion is avoided, which is conducive to improving the image quality; by recalculating the calibration image and the weight corresponding to the motion area of the calibration image, the generation of synthetic image ghosts is effectively eliminated, thereby further improving the image quality. In addition, the algorithm is simple in the implementation process of the present invention, the amount of calculation is small, it is easy to implement, and it has strong applicability.
[0038] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0040] Figure 1 is a flowchart of an image processing method according to an embodiment of the present invention;
[0041] Figure 2 is a schematic diagram of an image correction process according to an embodiment of the present invention;
[0042] Figure 3 is a schematic diagram of a process for determining a motion region of a calibration image according to an embodiment of the present invention;
[0043] Figure 4 is a schematic diagram of a process of calculating a first weight corresponding to a non-motion area in a calibration image according to an embodiment of the present invention;
[0044] Figure 5 is a schematic structural diagram of an image processing device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to be able to understand the features and technical contents of the embodiments of the present invention in more detail, the implementation of the embodiments of the present invention is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present invention. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0046] The current image sensors cannot fully acquire all the information in the natural scene, and cannot effectively restore the real image information in the natural scene, resulting in low image quality. In order to improve the image quality, such LDR (Low Dynamic Range) images need to be converted into HDR (High Dynamic Range) images through corresponding image processing technology.
[0047] In the related art, the synthesis method of high dynamic range images is mainly to calculate the weights based on the image information entropy or contrast or Dense SIFT (Scale-invariant feature transform) and other descriptive operators, and then fuse multiple exposure images to obtain high dynamic range images. However, the above-mentioned synthesis method of high dynamic range images can guarantee the quality of the synthesized image when the scene is static, but cannot guarantee the image quality when the scene is a dynamic scene.
[0048] Therefore, through image calibration, the scene positions of exposure images with different exposure times are matched, the differences caused by the movement of the image sensor during shooting are eliminated, and the blurring phenomenon caused by pixel-level fusion is avoided, which is beneficial to improving image quality. The calibration images are synthesized by recalculating the weights corresponding to the moving areas and non-moving areas in the calibration images, which effectively eliminates the generation of ghost images in the synthesized images, thereby further improving image quality.
[0049] Reference below Figure 1-Figure 5 An image processing method, an apparatus, an electronic device, and a computer-readable storage medium according to embodiments of the present invention are described.
[0050] Figure 1 FIG. 1 is a flow chart of an image processing method according to an embodiment of the present invention. Figure 1 As shown, the image processing method includes steps S1 to S6.
[0051] Step S1: Acquire multiple frames of images with different exposures.
[0052] In a specific embodiment, multiple frames of different exposure images input by an image sensor may be obtained, for example, denoted as I n Multiple frames of different exposure images refer to multiple exposure images with different exposure degrees, that is, different exposure levels. For example, during shooting, the image sensor may move or shake, which may result in exposure time intervals between different frames of exposure images, making the scene positions of different frames of exposure images mismatched, or different shooting angles, resulting in displacement deviations between different frames of exposure images, and thus blurring. The image sensor is, for example, but not limited to, a CMOS image sensor.
[0053] Step S2, calibrating the exposure image to obtain a calibrated image.
[0054] The calibration image is an image that has been registered and calibrated. After acquiring multiple frames of images with different exposures, the images are calibrated to obtain the calibration image.
[0055] In the embodiment, as described above, when acquiring multiple frames of different exposure images, there is an exposure time interval between them because the image sensor moves or shakes during shooting, so that the exposure levels between the multiple frames of exposure images are different, which in turn affects the image quality. Therefore, the exposure images are calibrated to calibrate the different exposure images to the same shooting angle, thereby reducing the impact of the multiple exposure images on the image quality due to the differences in shooting angles, thereby improving the image quality. Therefore, the multiple calibration images obtained after calibration have the same exposure level and the same shooting angle, which is beneficial to the blur phenomenon caused by the fusion of different pixel levels during image synthesis, eliminating ghost images, and improving image quality.
[0056] Step S3, calculating a first weight corresponding to the calibration image.
[0057] In an embodiment, after the calibration image is determined, the first weight of the calibration image is calculated by contrast, exposure and image entropy. It can be understood that by calculating the first weight of the calibration image, it is convenient to synthesize the calibration image according to the first weight.
[0058] Step S4: Determine the motion area of the calibration image.
[0059] Specifically, after obtaining the calibration image, the motion area of the calibration image is determined. When the image sensor shoots a dynamic scene, there are moving objects in the dynamic scene. The motion area is the part of the image in the dynamic scene where the moving object is located. Conversely, the part outside the motion area is the non-motion area, also called the background area. Specifically, the aforementioned image calibration process solves the impact of image sensor movement on the HDR image, but has not yet eliminated the ghost problem caused by moving objects in the image. Therefore, the embodiment of the present invention obtains a motion map of the calibration image to determine its motion area, and after determining the motion area of the calibration image, the motion area of the calibration image is inverted to obtain the non-motion area. After obtaining the non-motion area, it is easy to improve the signal-to-noise ratio of the short exposure image of the non-motion area, and for the motion area, re-assign its corresponding weight, and finally obtain a synthesized ghost-free image, thereby improving the image quality.
[0060] Step S5: Calculate the second weight of the motion area of the calibration image.
[0061] Specifically, the weight of the motion region is calculated, that is, the second weight. After the first weight and the second weight are calculated, the synthesis of multiple calibration images can be performed according to the first weight and the second weight.
[0062] Step S6: synthesize the multiple frames of calibration images according to the first weight and the second weight to obtain a target synthesized image.
[0063] Specifically, when performing image synthesis, two adjacent frames of calibration images are synthesized according to the first weight and the second weight, and then image synthesis of multiple frames of calibration images corresponding to multiple frames of different exposure images is achieved, so as to obtain the final target synthesized image with ghost elimination and high image quality.
[0064] Thus, the above-mentioned image processing method obtains a calibration image by calibrating the exposure image, determines the motion area of the calibration image, calculates the first weight corresponding to the calibration image and the second weight corresponding to the motion area of the calibration image, and then synthesizes multiple frames of calibration images according to the first weight and the second weight to obtain a target synthetic image. Therefore, the present invention takes into account the situation that the image sensor may move during shooting, and through image calibration, the scene positions of exposure images with different exposure times are matched, the difference caused by the movement of the image sensor during shooting is eliminated, and the blurring phenomenon caused by pixel-level fusion is avoided, which is conducive to improving the image quality; by recalculating the calibration image and the weight corresponding to the motion area of the calibration image, the generation of synthetic image ghosts is effectively eliminated, thereby further improving the image quality. In addition, the algorithm is simple in the implementation process of the present invention, the amount of calculation is small, it is easy to implement, and it has strong applicability.
[0065] In some embodiments, calibrating the exposure image includes: performing image registration on the exposure image to obtain a registered image; and performing image correction on the registered image to obtain a calibrated image.
[0066] Specifically, in an embodiment of the present invention, image registration is performed on each exposure image when different exposure images are synthesized so that the exposure amount of each exposure image is at the same level, and then the scene position of each exposure image with different exposure time is matched, thereby avoiding blurring caused by pixel-level fusion, and thus helping to improve the image quality of the synthesized image.
[0067] As mentioned above, the image sensor may move or shake during shooting, resulting in an exposure time interval between the exposure images, thereby matching the scene positions of the exposure images with different exposure times, and the shooting angles of the multiple exposure images will be different, thereby affecting the image quality. Therefore, in an embodiment of the present invention, after the images are registered, a registered image is obtained, and the registered image is further corrected to correct the different exposure images to the same shooting angle, thereby reducing the impact of the differences in shooting angles of the multiple exposure images on the image quality, thereby improving the image quality. As a result, the multiple calibrated images obtained after registration and correction have the same exposure level and the same shooting angle, which is beneficial to eliminate the blurring phenomenon caused by the fusion of different pixel levels during image synthesis, eliminate ghosting, and improve image quality.
[0068] In one embodiment of the present invention, image registration is performed on an exposure image, including: placing the exposure amount of the exposure image at a preset exposure level according to a preset exposure curve to obtain an adjusted exposure image, the adjusted exposure image including a reference image and a pre-registered image; acquiring feature point pairs between the pre-registered image and the reference image to obtain a registered image.
[0069] Specifically, when the image sensor is shooting, there are not only moving objects in the dynamic scene, but also the possibility of the image sensor itself moving. Therefore, image registration is required when synthesizing different exposure images to match the scene positions of the exposure images with different exposure times, thereby avoiding the blurring phenomenon caused by pixel-level fusion and improving image quality. The specific image registration process includes: according to the preset exposure curve, the exposure amount of the exposure image is placed at a preset exposure level to obtain an adjusted exposure image. The adjusted exposure image includes a reference image and a pre-registered image. By obtaining the feature point pair between the pre-registered image and the reference image, a registered image is obtained according to the matching result of the feature point pair. Thus, multiple frames of different exposure images can be placed at a preset exposure level so that their exposure amounts are the same and they have the same exposure level. In other words, for the input multiple frames of different exposure images I n , placing multiple frames of differently exposed images at the same exposure level according to a preset exposure curve, and obtaining an adjusted exposure pattern, so as to obtain a registered image according to feature point pairs between the pre-registered image and the reference image, wherein the differently exposed images are placed at the same exposure level, for example, I ′ n =f(x,y), where f(x,y) is the preset exposure curve, I ′ n is the pre-registered image, (x, y) is the pixel position coordinate of the reference image.
[0070] In one embodiment of the present invention, obtaining feature point pairs between a pre-registered image and a reference image includes: performing feature point detection on the pre-registered image and the reference image to obtain feature point information of the pre-registered image and the reference image respectively; the reference image may include a preset origin, starting from the preset origin, performing feature point matching on the pre-registered image and the reference image within a preset matching range to obtain feature point pairs.
[0071] Specifically, the pre-registered image I ′ n The pre-registration image I and the reference image are respectively subjected to feature point detection, and feature point information of the pre-registration image and the reference image is obtained accordingly. In an embodiment of the present invention, a SURF (Speeded Up Robust Features, fast feature point detection) algorithm can be used to detect feature points of the pre-registration image I ′ nThe feature point detection is performed on the reference image and the image, respectively, so as to improve the efficiency and accuracy of the feature point detection. Further, the obtained feature point information includes, for example: the feature point position of the image and the feature point information of the feature matrix.
[0072] After obtaining the feature point information, starting from the preset origin of the reference image, feature point matching is performed on the pre-registered image and the reference image within a preset matching range to obtain a feature point pair. Specifically, the preset origin is a point pre-selected in the matching image, and feature point matching is performed with the point as the starting point or initial point. The initial matching range is the preset matching range. When the feature point is matched, the corresponding feature point pair is recorded. In a specific embodiment, for example, I(0,0) on the reference image is used as the preset origin, and feature point matching is performed starting from I(0,0), and the initial matching range R is 10. Compared to the method of performing global search and matching after selecting an initial point, the embodiment of the present invention selects an initial point and sets a matching range to perform feature point matching within the matching range. There is no need to perform global matching, which is conducive to performing feature point matching as quickly as possible while saving resources. Therefore, the matching efficiency is higher.
[0073] In one embodiment of the present invention, Figure 2 As shown, the registration image is corrected, including: step S32: calculating the distance of the feature point pair; step S33: statistically calculating the distance of the feature point pair obtained, and taking the distance of the feature point pair that meets the preset conditions as the image offset; step S34: calculating the offset direction required for the registration image; step S35: performing an offset operation on the registration image according to the image offset and the offset direction to correct the registration image and obtain a calibrated image. Furthermore, through image correction, the mobile image sensor has a good imaging effect for synthesizing high-dynamic images, effectively avoiding the difference in the image sensor to be synthesized during the movement process, which is conducive to improving the quality of the synthesized image.
[0074] Specifically, after the image registration, the registered image is further corrected to obtain a calibrated image. Specifically, it includes: calculating the feature point matching between the reference image and the pre-registered image to obtain a feature point pair; calculating the distance between two matched feature points in the obtained feature point pair. Since the obtained feature point pairs are generally multiple, the distance of the feature point pairs calculated is also multiple, and the distances of multiple feature point pairs are counted, and the distances of the feature point pairs that meet the preset conditions are used as the image offset, that is, the current required offset of the registered image; further, the offset direction required for the registered image is calculated, and then, after determining the image offset and offset direction, the registered image can be offset according to the image offset and offset direction to obtain a calibrated image. It can be understood that the calibrated image obtained after the offset operation eliminates the image deviation, so that the accuracy is better, which is conducive to improving the quality of the composite image, wherein the reference image can be a standard image that meets the requirements in multiple frames of exposure images.
[0075] In one embodiment of the present invention, the method further includes: if no feature point pair is matched within the preset matching range, the matching range is expanded according to a preset step length to re-match the feature points until the feature point pair is obtained.
[0076] Specifically, if the feature point cannot be matched within the initial matching range, the matching range needs to be further expanded to ensure that the feature point pair can be obtained and to improve the reliability of the feature point matching. In an embodiment of the present invention, the matching range is gradually expanded with a preset step size. In a specific embodiment, the initial matching range is, for example, 10, and the preset step size is, for example, 5, that is, when the feature point cannot be matched, the matching range is expanded with a step size of 5 each time, so that the feature point matching is performed as quickly as possible while saving resources, and the reliability of the feature point matching is improved.
[0077] In one embodiment of the present invention, in the above step S32, calculating the distance of the feature point pair includes: taking the reference image as a reference, calculating the Euclidean distance between the matching feature points of the reference image and the registered image, and using the calculated Euclidean distance as the distance of the feature point pair.
[0078] Specifically, the Euclidean distance between the feature points that match the reference image and the registered image is calculated based on the preset reference image, as the distance between the feature point pairs between the reference image and the registered image. In a specific embodiment, the distance between the feature point pairs can be calculated by the following calculation formula: Dis(x, y) = |I(x 1 ,y 1 )-I′(x 2 ,y 2 )|, where Dis(x,y) is the distance between the calculated feature points, I(x 1 ,y 1) is the reference image, I′(x 2 ,y 2 ) is the registration image.
[0079] In one embodiment of the present invention, in step S33, the distance of the feature point pair that meets the preset condition includes: the distance of the feature point pair that appears the most times.
[0080] Specifically, after calculating the distance of the feature point pairs, the distance of the feature point pairs is statistically analyzed. The distance of the feature point pairs is normally distributed, and the distance value with the most occurrences is used as the offset between the registered image and the reference image, that is, the image offset.
[0081] In one embodiment of the present invention, in step S34, calculating the offset direction required for registering the image includes: calculating the quadrant position of the corresponding pixel point coordinates in the registering image with the pixel point coordinates of the reference image as the origin; and determining the offset direction required for registering the image according to the quadrant position.
[0082] Specifically, let the reference image be I(x 1 ,y 1 ) is the reference image, (x 1 ,y 1 ) is the pixel coordinate, I′(x 2 ,y 2 ) is the registration image, (x 2 ,y 2 ) is the pixel coordinate. 1 ,y 1 ) is the origin, calculate (x 2 ,y 2 ) is located in the quadrant, thereby calculating the offset direction required for registering the image, and then performing the offset operation. In a specific embodiment, the offset direction required for registering the image can be calculated by the following calculation formula: Among them, Dir(x,y) is the offset direction.
[0083] In one embodiment of the present invention, after performing an offset operation on the registered image according to the image offset amount and the offset direction, the method further includes: padding the border of the offset registered image with zeros to make it the same size as the corresponding exposure image, so as to obtain a calibration image. In other words, for the offset registered image, padding the border with zeros to make it the same size as the initially acquired corresponding exposure image, so as to obtain a calibration image, thereby facilitating subsequent image synthesis.
[0084] In one embodiment of the present invention, Figure 3As shown, determining the motion area of the calibration image includes: step S41: acquiring binary images of the calibration image and the reference image; step S42: subtracting the binary images of the calibration image and the reference image to obtain an absolute value, thereby obtaining the motion area of the calibration image.
[0085] Specifically, first determine the binary images corresponding to the calibration image and the reference image, then subtract the two binary images to obtain the absolute value. The difference image obtained at this time is the marking image of the relative motion part of the calibration image and the reference image, that is, the motion area of the calibration image.
[0086] In one embodiment of the present invention, in step S41, a binary image of the calibration image is obtained, including: grayscale processing of the calibration image to obtain a first grayscale image; determining a first threshold for dividing the first grayscale image; and dividing the first grayscale image according to the first threshold to obtain a binary image of the calibration image.
[0087] Specifically, the calibration image is grayed out, including: 1 =0.3R+0.59G+0.11B, where Gray 1 is the grayscale value of the first grayscale image, R is the red component, G is the green component, and B is the blue component. After graying the calibration image, a first threshold is further determined, recorded as Threshold1, and Threshold1 is used to divide the first grayscale image, and the first grayscale image can be divided to obtain a binary image of the calibration image.
[0088] In one embodiment of the present invention, determining a first threshold for dividing a first grayscale image includes: counting a histogram of the first grayscale image, accumulating the number of occurrences of each pixel value, and obtaining a first total number of occurrences; accumulating the number of occurrences of each pixel value on the counted histogram from small to large until the accumulated number of occurrences is greater than or equal to half of the first total number of occurrences, and determining that the current corresponding pixel value is the first threshold.
[0089] Specifically, the histogram of the first grayscale image is counted, the number of occurrences at each pixel level is accumulated, the first total number is calculated, recorded as SumAll1, SumHalf1=SumAll1 / 2 is calculated, and the number Value1 at each pixel level on the statistical histogram is accumulated from small to large, until Value1>=SumHalf1, and the pixel level at this time is the first threshold Threshold1 for dividing the first grayscale image.
[0090] In one embodiment of the present invention, the first grayscale image is divided according to a first threshold, including: determining whether the pixel value of each pixel in the first grayscale image is greater than or equal to the first threshold; setting the pixel values greater than or equal to the first threshold to 1, and setting the pixel values less than the first threshold to 0, so as to obtain a binary image of the calibration image.
[0091] Specifically, it is to determine whether the pixel value of each pixel in the first grayscale image is greater than or equal to the first threshold Threshold1. If the pixel value of a pixel is greater than or equal to Threshold1, the pixel is represented by 1. If the pixel value of a pixel is less than Threshold1, Threshold1 is represented by 0. Thus, a binary image divided by Threshold1 can be obtained, that is, a binary image corresponding to the calibration image.
[0092] In one embodiment of the present invention, in step S41, a binary image of a reference image is obtained, including: grayscale processing of the reference image to obtain a second grayscale image; determining a second threshold for dividing the second grayscale image; and dividing the second grayscale image according to the second threshold to obtain a binary image of the reference image.
[0093] Specifically, the reference image is grayed out, including: 2 =0.3R+0.59G+0.11B, where Gray 2 is the grayscale value of the second grayscale image, R is the red component, G is the green component, and B is the blue component. After the reference image is grayscaled, the second threshold is further determined, recorded as Threshold2, and Threshold2 is used to divide the second grayscale image, and the second grayscale image can be divided to obtain a binary image of the reference image.
[0094] In one embodiment of the present invention, determining a second threshold for dividing the second grayscale image includes: counting the histogram of the second grayscale image, accumulating the number of occurrences of each pixel value to obtain a second total number of times; accumulating the number of occurrences of each pixel value on the counted histogram from small to large until the accumulated number of times is greater than or equal to half of the second total number of times, and determining that the current corresponding pixel value is the second threshold.
[0095] Specifically, the histogram of the second grayscale image is counted, the number of occurrences at each pixel level is accumulated, the second total number is calculated, recorded as SumAll2, SumHalf2=SumAll2 / 2 is calculated, and the number Value2 at each pixel level on the statistical histogram is accumulated from small to large, until Value2>=SumHalf2, and the pixel level at this time is the second threshold Threshold2 for dividing the second grayscale image.
[0096] In one embodiment of the present invention, the second grayscale image is divided according to a second threshold, including: determining whether the pixel value of each pixel in the second grayscale image is greater than the second threshold; setting the pixel values greater than or equal to the second threshold to 1, and setting the pixel values less than the second threshold to 0, so as to obtain a binary image of the reference image.
[0097] Specifically, it is to determine whether the pixel value of each pixel in the second grayscale image is greater than or equal to the second threshold Threshold2. If the pixel value of a pixel is greater than or equal to Threshold2, the pixel is represented by 1. If the pixel value of a pixel is less than Threshold2, Threshold2 is represented by 0. In this way, a binary image divided by Threshold2 can be obtained, that is, a binary image corresponding to the reference image can be obtained.
[0098] Furthermore, after obtaining the two images corresponding to the calibration image and the reference image respectively, the absolute value is obtained by subtracting the binary images of the calibration image and the reference image. The difference image obtained at this time is the marking image of the relative motion part between the calibration image and the reference image, that is, the motion area of the calibration image.
[0099] In one embodiment of the present invention, before calculating the first weight corresponding to the calibration image, the method includes: determining a non-motion area of the calibration image.
[0100] Specifically, before calculating the first weight of the calibration image, a non-motion area of the calibration image, that is, a background area, is determined.
[0101] In one embodiment of the present invention, determining the non-motion region of the calibration image includes: inverting the motion region of the calibration image to obtain the non-motion region.
[0102] Specifically, the motion region of the calibration image obtained above is a binary image, so the motion region is inverted to obtain the non-motion region, that is, the background region. It can be understood that since the background region is obtained by inverting the motion region, it is also a binary image, which is opposite to the binary image of the motion region, that is, when 1 is taken in the binary image of the motion region, 0 is taken in the background region, and when 0 is taken in the binary image of the motion region, 1 is taken in the background region.
[0103] In one embodiment of the present invention, the image of the non-moving area includes a long-exposure image and a short-exposure image. After determining the non-moving area of the calibration image, the method further includes: mapping a preset signal-to-noise ratio of the long-exposure image to the short-exposure image in an RGB color space to improve the signal-to-noise ratio of the short-exposure image.
[0104] Specifically, the motion area is inverted to obtain a non-motion area, that is, the background area, and the signal-to-noise ratio of the short exposure image is enhanced according to the part of the background area with a value of 1, specifically including: in the RGB color space, taking the preset signal-to-noise ratio of the long exposure image as the standard, mapping it to the short exposure image of the background area to improve the signal-to-noise ratio of the short exposure image, thereby improving the signal-to-noise ratio of the short exposure through long exposure to reduce the noise level in the short exposure image, which is beneficial to the display of detail information of the final synthesis result and to improve the image quality.
[0105] The specific calculation and processing process includes: first calculate the ratio of the G component in the long and short exposures Among them, I 1 G (,) and I 2 G (,) They correspond to the exposure images I 1 and exposure image I 2 The magnitude of the G component at a certain point, I 1 and I 2 are two adjacent exposure images, and (x, y) represents the coordinate point. After obtaining RateG, the exposure image I can be calculated by RateG. 1 and exposure image I 2 The magnitude of the R and B components can be determined by To calculate I 1 R (,) and I 2 R (,) , can be obtained through To calculate I 1 B (,) and I 2 B (,) , where I 1 R (,) and I 2 R (,) They correspond to the exposure images I 1 and exposure image I 2 The magnitude of the R component at a certain point, I 1 B (,) and I 2 B (,) They correspond to the exposure images I 1 and exposure image I 2 The size of the B component at a certain point. In this way, the components of the exposure image in each channel can be obtained respectively, thereby achieving the signal-to-noise ratio enhancement of the short exposure image with a value of 1 in the background area.
[0106] In one embodiment of the present invention, Figure 4As shown, calculating the first weight corresponding to the calibration image includes: calculating the contrast, exposure and image entropy of the calibration image; and calculating the weight corresponding to the calibration image through the contrast, exposure and image entropy to obtain the first weight.
[0107] In one embodiment of the present invention, Figure 4 As shown, the weight corresponding to the calibration image is calculated by contrast, exposure, and image entropy: the contrast, exposure, and image entropy are multiplied and normalized to obtain the weight corresponding to the calibration image.
[0108] Specifically, the weights calculated above, such as contrast, exposure, and image entropy, are multiplied and normalized to obtain the weight corresponding to the calibration image. The specific calculation formula is, for example:
[0109]
[0110] Among them, W x,y is the first weight, W CON is the contrast, W EX is the exposure, W EN is the image entropy, MaxWeight is W CON The maximum value, W EX The maximum value and W EN The product of the maximum values of .
[0111] In one embodiment of the present invention, Figure 4 As shown, calculating the weight corresponding to the calibration image includes: calculating the contrast, exposure and image entropy of the calibration image; and calculating the weight corresponding to the calibration image through the contrast, exposure and image entropy.
[0112] Specifically, after determining the calibration image, the first weight corresponding to the calibration image is calculated, and after determining the motion area of the calibration image, the next synthesis operation can be performed, that is, the weight of the motion area is calculated, and the two calculated weights are combined and weighted mean is calculated to obtain the target synthetic image. In the embodiment of the present invention, the weight calculation of the calibration image is performed through contrast, exposure and image entropy, which can effectively improve the dynamic range of the synthetic image, help improve the accuracy of image synthesis, and thus improve the image quality.
[0113] In one embodiment of the present invention, the process of calculating the contrast of the calibration image includes: performing Laplace filtering on the exposure image corresponding to the calibration image, and then obtaining an absolute value of the obtained filtering result to obtain the contrast of the calibration image.
[0114] Specifically, the exposure image I n Use Laplace filter to filter, and take the absolute value of the filtering result to get the contrast, which is recorded as W CONAmong them, the Laplacian kernel of the Laplacian filter is represented by [0,1,0; 1,-4,1; 0,1,0].
[0115] In one embodiment of the present invention, calculating the exposure of the calibration image includes: using a triangular weight function to calculate the exposure of the calibration image, which can effectively reduce the amount of calculation and improve the calculation efficiency.
[0116] Specifically, the principle of using the triangular weight function to calculate the exposure of the calibration image is that the closer the image pixel value is to half of the maximum pixel value, the greater the weight. The specific calculation formula is, for example:
[0117]
[0118] Among them, is the calculated exposure, Value is the pixel value of the pixel point, and MaxValue is the maximum value of the pixel values.
[0119] In one embodiment of the present invention, the process of calculating the image entropy of the calibration image includes: using a preset matrix as the range of entropy value calculation, calculating the entropy value of the middle point by calculating the probability of occurrence of all pixel points in the preset matrix, and using the entropy value as the image entropy of the calibration image.
[0120] In a specific embodiment, the preset matrix is, for example, a 3×3 matrix. That is, the 3×3 matrix is used as the range of entropy value calculation, and the entropy value of the middle point is calculated by calculating the probability of nine pixels appearing in the 3×3 matrix, which is recorded as W EN , the entropy value W EN Image entropy as calibration image.
[0121] In one embodiment of the present invention, the second weight corresponding to the motion area may be calculated by the following calculation formula:
[0122] W′ x, =(W 1 *(I 1ex +I 2ex )+W 2 ) / I 1ex ,
[0123] Among them, W′ x, is the second weight, I 1ex The exposure image I 1 The corresponding exposure, I 2ex The exposure image I 2 The corresponding exposure, W 1 The exposure image I 1 The corresponding first weight, that is, the exposure image I 1 The first weight of the corresponding calibration image, W 2 The exposure image I 2The corresponding first weight, that is, the exposure image I 2 The first weight of the corresponding calibration image, where I 1 and I 2 are two adjacent exposure frames, and (x, y) represents the coordinate point of the reference image.
[0124] In one embodiment of the present invention, multiple frames of calibration images are synthesized according to a first weight and a second weight, including: performing a weighted average calculation on the first weight and the second weight to obtain a weight map of the calibration image; obtaining a pixel value of each pixel point of the image to be synthesized according to the weight map; and synthesizing a target synthesized image according to the pixel value of each pixel point of the image to be synthesized.
[0125] Specifically, the calculated first weight and second weight are combined to form a final weight map, and the pixel value of each pixel is calculated by weighted averaging to obtain a final de-ghosting synthetic image, that is, a target synthetic image.
[0126] In one embodiment of the present invention, performing weighted average calculation on the first weight and the second weight includes:
[0127]
[0128] Among them, I (x,) is the target synthesized image, i is the current image to be synthesized, n and m are the sizes of the current image to be synthesized, i(,) is the pixel value of the current image to be synthesized, B i(,) is the non-movement value, which can be 0 or 1. i(x,y) is the first weight corresponding to the calibration image, W′ i(,) is the second weight corresponding to the motion area, and (x, y) represents the pixel coordinates of the reference image.
[0129] In summary, the image processing method of the embodiment of the present invention starts from the most fundamental reason for the appearance of ghost images in dynamic HDR images. In view of the fact that there are not only moving objects in dynamic scenes, but also the image sensor may move or shake during shooting, the different exposure images are first registered and corrected to the same exposure level and the same shooting angle. Through image registration and correction, the differences caused by the movement of the image sensor during shooting are eliminated; then the moving object detection is performed, the weight of the moving object is re-determined and the image synthesis is performed accordingly to obtain a high-quality synthetic image without ghost images. Among them, the SURF algorithm is used for fast image registration, and the Euclidean distance is calculated by calculating the matched feature point pairs, and the image offset is obtained accordingly, and the image offset direction is calculated. The registered image is offset according to the image offset and the offset direction to achieve image correction. Further, the motion area and background area in the calibration image are determined, and the background area weight and the motion area weight are calculated by a redefined weight calculation method, which are merged into a weight map, and finally the high-dynamic image synthesis without ghost images is performed to improve the image quality.
[0130] Compared with the prior art, the weight calculation method in the embodiment of the present invention is simple, occupies less resources, has high calculation efficiency, and has good portability and applicability; the signal-to-noise ratio of short exposure is improved by long exposure to reduce the noise level in the short exposure image, which is beneficial to the display of detailed information of the final synthesis result; it has a good imaging effect for synthesizing high-dynamic images with a moving image sensor, and effectively avoids the difference in the image sensor to the synthesized image during the movement process, thereby improving the image quality; contrast, exposure, and image entropy are used to determine the weight of the final fused image, which effectively improves the dynamic range of the synthesized image; by detecting moving objects, determining the moving area, recalculating the weight map, and based on the reference image, the generation of ghost images of the synthesized image is effectively eliminated, thereby improving the quality of the synthesized image.
[0131] In summary, according to the image processing method of the embodiment of the present invention, an exposure image is acquired, image registration is performed on the exposure image to obtain a registered image, image correction is performed on the registered image to obtain a calibrated image, the motion area of the calibrated image is determined, the first weight corresponding to the calibrated image and the second weight corresponding to the motion area are calculated, and then multiple frames of calibrated images are synthesized according to the first weight and the second weight to obtain a target synthesized image. Therefore, the present invention takes into account the situation that the image sensor may move during shooting, and through image registration and correction, the scene positions of exposure images with different exposure times are matched, the difference caused by the movement of the image sensor during shooting is eliminated, and the blurring phenomenon caused by pixel-level fusion is avoided, which is conducive to improving the image quality; by detecting moving objects, determining motion areas, and recalculating weight maps to perform image synthesis, the generation of ghost images of the synthesized image is effectively eliminated, thereby further improving the image quality. In addition, the algorithm is simple in the implementation process of the present invention, the amount of calculation is small, it is easy to implement, and it has strong applicability.
[0132] A further embodiment of the present invention also discloses an image processing device.
[0133] Figure 5 is a schematic diagram of the structure of an image processing device according to an embodiment of the present invention. Figure 5 As shown, the image processing device 100 includes: an acquisition module 110 , a calibration module 120 , a first calculation module 130 , a processing module 140 , a second calculation module 150 and a synthesis module 160 .
[0134] Specifically, the acquisition module 110 is used to acquire multiple frames of images with different exposures.
[0135] The calibration module 120 is used to calibrate the exposure image to obtain a calibrated image.
[0136] The first calculation module 130 is used to calculate the first weight corresponding to the calibration image;
[0137] The processing module 140 is used to determine the motion region of the calibration image.
[0138] The second calculation module 150 is used to calculate the second weight of the motion area of the calibration image.
[0139] The synthesis module 160 is used to perform image synthesis on multiple frames of calibration images according to the first weight and the second weight to obtain a target synthesized image.
[0140] In one embodiment of the present invention, the calibration module 120 is used to perform image registration on the exposure image to obtain a registered image; and perform image correction on the registered image to obtain a calibrated image.
[0141] In one embodiment of the present invention, the calibration module 120 is used to place the exposure amount of the exposure image at a preset exposure level according to a preset exposure curve to obtain an adjusted exposure image, wherein the adjusted exposure image includes a reference image and a pre-registered image; and obtain feature point pairs between the pre-registered image and the reference image to obtain a registered image.
[0142] In one embodiment of the present invention, the calibration module 120 is used to perform feature point detection on the pre-registered image and the reference image to obtain feature point information of the pre-registered image and the reference image accordingly; the reference image includes a preset origin, and starting from the preset origin, feature point matching is performed on the pre-registered image and the reference image within a preset matching range to obtain a feature point pair.
[0143] In one embodiment of the present invention, the calibration module 120 is used to calculate the distance between feature point pairs; statistically calculate the distance between feature point pairs, and use the distance between feature point pairs that meets preset conditions as image offsets; calculate the offset direction required for registering the image; and perform an offset operation on the registered image according to the image offset and the offset direction to correct the registered image and obtain a calibrated image.
[0144] In one embodiment of the present invention, the calibration module 120 is further configured to expand the matching range according to a preset step length to re-match the feature points if no feature point pair is matched within the preset matching range, until a feature point pair is obtained.
[0145] In one embodiment of the present invention, the calibration module 120 is used to calculate the Euclidean distance between the matching feature points of the reference image and the registration image based on the reference image, and use the calculated Euclidean distance as the distance of the feature point pair.
[0146] In one embodiment of the present invention, the calibration module 120 is used to calibrate the distance of the feature point pair that appears most frequently.
[0147] In one embodiment of the present invention, the calibration module 120 is used to calculate the quadrant position of the corresponding pixel coordinates in the registration image using the pixel coordinates of the reference image as the origin; and determine the offset direction required for the registration image according to the quadrant position.
[0148] In one embodiment of the present invention, the calibration module 120 is further configured to perform zero padding on the boundary of the offset registration image so as to make the boundary have the same size as the corresponding exposure image, so as to obtain a calibration image.
[0149] In one embodiment of the present invention, the processing module 140 is used to obtain binary images of the calibration image and the reference image; and to subtract the binary images of the calibration image and the reference image to obtain an absolute value, thereby obtaining a motion region of the calibration image.
[0150] In one embodiment of the present invention, the first calculation module 130 is used to determine a non-motion area of the calibration image.
[0151] In one embodiment of the present invention, the processing module 140 is used to invert the motion region of the calibration image to obtain the non-motion region.
[0152] In one embodiment of the present invention, the processing module 140 is further configured to map the preset signal-to-noise ratio of the long exposure image to the short exposure image in the RGB color space to improve the signal-to-noise ratio of the short exposure image.
[0153] In one embodiment of the present invention, the first calculation module 130 is used to calculate the contrast, exposure and image entropy of the calibration image; and calculate the weight corresponding to the calibration image through the contrast, exposure and image entropy to obtain the first weight.
[0154] In one embodiment of the present invention, the first calculation module 130 is used to perform Laplace filtering on the exposure image corresponding to the calibration image, and then obtain an absolute value of the obtained filtering result to obtain the contrast of the calibration image.
[0155] In one embodiment of the present invention, the first calculation module 130 is configured to calculate the exposure of the calibration image using a triangular weight function.
[0156] In one embodiment of the present invention, the first calculation module 130 is used to use a preset matrix as the range of entropy value calculation, calculate the entropy value of the middle point by calculating the probability of occurrence of all pixels in the preset matrix, and use the entropy value as the image entropy of the calibration image.
[0157] In one embodiment of the present invention, the first calculation module 130 is used to multiply the contrast, exposure, and image entropy and normalize them to obtain the weight of the calibration image.
[0158] In one embodiment of the present invention, the second calculation module 150 is used for W′ x, =(W 1 *(I 1ex +I 2ex )+W 2 ) / I 1ex , where W′ x, is the second weight, I 1ex The exposure image I 1 The corresponding exposure, I 2ex The exposure image I 2 The corresponding exposure, W 1 The exposure image I 1 The corresponding first weight, W 2 The exposure image I 2 The corresponding first weight, where I 1and I 2 are two adjacent exposure frames, and (x, y) represents the coordinate point of the reference image.
[0159] In one embodiment of the present invention, the synthesis module 160 is used to perform a weighted average calculation on the first weight and the second weight to obtain a weight map of the calibration image; obtain the pixel value of each pixel point of the image to be synthesized according to the weight map; and synthesize the target synthesized image according to the pixel value of each pixel point of the image to be synthesized.
[0160] In one embodiment of the present invention, the synthesis module 160 is used to Among them, I (x,) is the target synthesized image, i is the current image to be synthesized, n and m are the sizes of the current image to be synthesized, respectively. i(,) is the pixel value of the current image to be synthesized, B i(,) is the value of the non-motion area, W i(x,y) is the first weight corresponding to the calibration image, W′ i(,) is the second weight corresponding to the motion area
[0161] It should be noted that, when performing image processing, the specific implementation method of the image processing device 100 is similar to the specific implementation method of the image processing method of any one of the above-mentioned embodiments of the present invention. Therefore, for a detailed exemplary description of the image processing device 100, please refer to the above-mentioned relevant description part of the image processing method. In order to reduce redundancy, it will not be repeated here.
[0162] Therefore, according to the image processing device 100 of the embodiment of the present invention, an exposure image is acquired, image registration is performed on the exposure image to obtain a registered image, image correction is performed on the registered image to obtain a calibration image, the motion area of the calibration image is determined, the first weight corresponding to the calibration image and the second weight corresponding to the motion area are calculated, and then multiple frames of calibration images are synthesized according to the first weight and the second weight to obtain a target synthesized image. Therefore, the present invention takes into account the situation that the image sensor may move during shooting, and through image registration and correction, the scene positions of exposure images with different exposure times are matched, the differences caused by the movement of the image sensor during shooting are eliminated, and the blurring phenomenon caused by pixel-level fusion is avoided, which is conducive to improving the image quality; by detecting moving objects, determining motion areas, and recalculating weight maps to perform image synthesis, the generation of ghost images of the synthesized image is effectively eliminated, thereby further improving the image quality. In addition, the algorithm is simple in the implementation process of the present invention, the amount of calculation is small, it is easy to implement, and it has strong applicability.
[0163] A further embodiment of the present invention also discloses an electronic device.
[0164] In one embodiment of the present invention, the electronic device includes the image processing device 100 described in any one of the above embodiments.
[0165] In another embodiment of the present invention, the electronic device includes: a processor, a memory, and an image processing program stored in the memory and executable on the processor, wherein when the image processing program is executed by the processor, the image processing method described in any one of the above embodiments of the present invention is implemented.
[0166] In a specific embodiment, the electronic device is, for example, an image sensing device, and the image sensing device includes, for example, a CMOS image sensor.
[0167] Therefore, when performing image processing, the specific implementation of the electronic device can refer to the aforementioned description of the image processing method or the image processing device 100, and will not be repeated here to reduce redundancy.
[0168] According to the electronic device of the embodiment of the present invention, an exposure image is acquired, image registration is performed on the exposure image to obtain a registered image, image correction is performed on the registered image to obtain a calibrated image, the motion area of the calibrated image is determined, a first weight corresponding to the calibrated image and a second weight corresponding to the motion area are calculated, and then multiple frames of calibrated images are synthesized according to the first weight and the second weight to obtain a target synthesized image. Therefore, the present invention takes into account the situation that the image sensor may move during shooting, and through image registration and correction, the scene positions of exposure images with different exposure times are matched, the difference caused by the movement of the image sensor during shooting is eliminated, and the blurring phenomenon caused by pixel-level fusion is avoided, which is conducive to improving the image quality; by detecting moving objects, determining motion areas, and recalculating weight maps to perform image synthesis, the generation of ghost images of the synthesized image is effectively eliminated, thereby further improving the image quality. In addition, the algorithm is simple in the implementation process of the present invention, the amount of calculation is small, it is easy to implement, and it has strong applicability.
[0169] A further embodiment of the present invention also discloses a computer-readable storage medium, on which an image processing program is stored. When the image processing program is executed by a processor, the image processing method described in any one of the above embodiments of the present invention is implemented. For a detailed description of the execution process of the image processing method, please refer to the relevant part of the previous text, which will not be repeated here.
[0170] Therefore, according to the computer-readable storage medium of the embodiment of the present invention, when the image processing program stored thereon is executed by the processor, an exposure image can be obtained, image registration can be performed on the exposure image to obtain a registered image, image correction can be performed on the registered image to obtain a calibration image, the motion area of the calibration image can be determined, the first weight corresponding to the calibration image and the second weight corresponding to the motion area can be calculated, and then multiple frames of calibration images can be synthesized according to the first weight and the second weight to obtain a target synthetic image. Therefore, the present invention takes into account the situation that the image sensor may move during shooting, and through image registration and correction, the scene positions of exposure images with different exposure times are matched, the differences caused by the movement of the image sensor during shooting are eliminated, and the blurring phenomenon caused by pixel-level fusion is avoided, thereby helping to improve the image quality; by detecting moving objects, determining motion areas, and recalculating weight maps to perform image synthesis, the generation of synthetic image ghosts is effectively eliminated, thereby further improving the image quality. In addition, the algorithm is simple in the implementation process of the present invention, the amount of calculation is small, it is easy to implement, and it has strong applicability.
[0171] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example.
[0172] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. An image processing method, It is characterized in that The following steps are involved: Acquire multiple frames of images with different exposures; Calibrate the exposure image to obtain a calibrated image; Calculating a first weight corresponding to the calibration image; determining a motion region of the calibration image; calculating a second weight of a motion region of the calibration image; Image synthesis is performed on multiple frames of the calibration image according to the first weight and the second weight to obtain a target synthesized image.
2. The image processing method according to claim 1, It is characterized in that Calibrating the exposure image includes: Performing image registration on the exposure image to obtain a registered image; Performing image correction on the registered image to obtain the calibrated image.
3. The image processing method according to claim 2, It is characterized in that Performing image registration on the exposure image includes: Setting the exposure amount of the exposure image to a preset exposure level according to a preset exposure curve to obtain an adjusted exposure image, wherein the adjusted exposure image includes a reference image and a pre-registered image; Acquire feature point pairs between the pre-registered image and a reference image to obtain the registered image.
4. The image processing method according to claim 3, It is characterized in that Acquiring feature point pairs between the pre-registered image and the reference image, comprising: Performing feature point detection on the pre-registered image and the reference image to obtain feature point information of the pre-registered image and the reference image accordingly; The reference image includes a preset origin. Starting from the preset origin, feature point matching is performed on the pre-registered image and the reference image within a preset matching range to obtain the feature point pair.
5. The image processing method according to claim 3, It is characterized in that Correcting the registered image includes: Calculating the distance between the feature point pairs; The distances of the feature point pairs obtained by statistical calculation are used as the image offsets; Calculating the offset direction required for the registered image; An offset operation is performed on the registered image according to the image offset amount and the offset direction to correct the registered image to obtain the calibrated image.
6. The image processing method according to claim 4, It is characterized in that Also includes: If the feature point pair is not matched within the preset matching range, the matching range is expanded according to a preset step size to re-match the feature points until the feature point pair is obtained.
7. The image processing method according to claim 5, It is characterized in that The calculating the distance of the feature point pair comprises: Taking the reference image as a reference, the Euclidean distance between the matching feature points of the reference image and the registration image is calculated, and the calculated Euclidean distance is used as the distance of the feature point pair.
8. The image processing method according to claim 5, It is characterized in that The distances of the feature point pairs that meet the preset conditions include: the distances of the feature point pairs that appear the most times.
9. The image processing method according to claim 5, It is characterized in that The calculating the offset direction required for the registration image includes: Calculate the quadrant position of the corresponding pixel point coordinates in the registration image using the pixel point coordinates of the reference image as the origin; The shift direction required for registering the images is determined according to the quadrant position.
10. The image processing method according to claim 5, It is characterized in that After performing an offset operation on the registered image according to the image offset amount and the offset direction, the method further includes: The boundary of the offset registration image is zero-filled to make it the same size as the corresponding exposure image, so as to obtain the calibration image.
11. The image processing method according to claim 4, It is characterized in that Determining a motion region of the calibration image includes: Acquire binary images of the calibration image and the reference image; The binary images of the calibration image and the reference image are subtracted to obtain an absolute value, thereby obtaining a motion region of the calibration image.
12. The image processing method according to claim 1, It is characterized in that Before calculating the first weight corresponding to the calibration image, the method includes: A non-motion region of the calibration image is determined.
13. The image processing method according to claim 12, It is characterized in that Determining a non-motion area of the calibration image includes: The motion region of the calibration image is inverted to obtain the non-motion region.
14. The image processing method according to claim 12, It is characterized in that The image of the non-motion area includes a long-exposure image and a short-exposure image. After determining the non-motion area of the calibration image, the method further includes: In the RGB color space, the preset signal-to-noise ratio of the long exposure image is mapped to the short exposure image to improve the signal-to-noise ratio of the short exposure image.
15. The image processing method according to claim 1, It is characterized in that Calculating a first weight corresponding to the calibration image includes: calculating contrast, exposure and image entropy of the calibration image; The weight corresponding to the calibration image is calculated by using the contrast, exposure, and image entropy to obtain the first weight.
16. The image processing method according to claim 15, It is characterized in that The calculating the contrast of the calibration image comprises: After Laplace filtering is performed on the exposure image corresponding to the calibration image, an absolute value of the obtained filtering result is obtained to obtain the contrast of the calibration image.
17. The image processing method according to claim 16, It is characterized in that The calculating the exposure of the calibration image includes: calculating the exposure of the calibration image using a triangular weight function.
18. The image processing method according to claim 17, It is characterized in that The calculating the image entropy of the calibration image comprises: A preset matrix is used as the range for entropy value calculation, and the entropy value of the middle point is calculated by calculating the probability of occurrence of all pixel points in the preset matrix, and the entropy value is used as the image entropy of the calibration image.
19. The image processing method according to claim 18, It is characterized in that Calculating the weight corresponding to the calibration image by using the contrast, exposure, and image entropy, including: The contrast, exposure, and image entropy are multiplied and normalized to obtain the weight of the calibration image.
20. The image processing method according to claim 3, It is characterized in that Calculating a second weight corresponding to the motion area of the calibration image includes: In' x,y =(In 1 *(AND lex +I 2ex )+W 2 ) / AND lex , Among them, W′ x,y is the second weight, I 1ex The exposure image I 1 The corresponding exposure, I 2ex The exposure image I 2 The corresponding exposure, W 1 The exposure image I 1 The corresponding first weight, W 2 The exposure image I 2 The corresponding first weight, where I 1 and I 2 are two adjacent exposure image frames, and (x, y) represents the coordinate point of the reference image.
21. The image processing method according to claim 20, It is characterized in that Performing image synthesis on a plurality of frames of the calibration image according to the first weight and the second weight includes: Performing weighted average calculation on the first weight and the second weight to obtain a weight map of the calibration image; Obtaining a pixel value of each pixel of the image to be synthesized according to the weight map; The target synthesized image is obtained by synthesizing according to the pixel value of each pixel point of the image to be synthesized.
22. The image processing method according to claim 21, It is characterized in that Performing a weighted average calculation on the first weight and the second weight includes: Among them, I (x,) is the target synthesized image, i is the current image to be synthesized, n and m are the sizes of the current image to be synthesized, respectively. i(,) is the pixel value of the current image to be synthesized, B i(,) is the value of the non-motion area, W i(x,y) is the first weight corresponding to the calibration image, W′ i(,) is the second weight corresponding to the motion area.
23. An image processing device, It is characterized in that include: An acquisition module, used for acquiring multiple frames of images with different exposures; A calibration module, used for calibrating the exposure image to obtain a calibration image; A first calculation module, used to calculate a first weight corresponding to the calibration image; a processing module, configured to determine a motion region of the calibration image; A second calculation module, used for calculating a second weight of the motion area of the calibration image; A synthesis module is used to perform image synthesis on multiple frames of the calibration image according to the first weight and the second weight to obtain a target synthesized image.
24. An electronic device, It is characterized in that include: The image processing apparatus according to claim 23, or A processor, a memory, and an image processing program stored in the memory and executable on the processor, wherein the image processing program, when executed by the processor, implements the image processing method according to any one of claims 1 to 22.
25. A computer-readable storage medium, It is characterized in that An image processing program is stored on the computer-readable storage medium, and when the image processing program is executed by the processor, the image processing method according to any one of claims 1 to 22 is implemented.
Citation Information
Patent Citations
Edge detection and frame difference method-based high-dynamic range video de-ghosting method
CN105931213A
Multi-exposure image fusion method of automatically removing ghosts
CN108416754A
Image processing method and device, electronic equipment and computer readable storage medium
CN112257713A
Image processing method, image processing device, terminal and readable storage medium
CN115035013A
Multi stage motion compensated hdr
IN201841034147A
Cited By
Visible light and infrared image registration fusion method for unmanned aerial vehicle photoelectric turret
CN119762556A
Visible Light and Infrared Image Registration and Fusion Method for UAV Optoelectronic Turret
CN119762556B
Visible light and SAR image registration fusion method in dynamic flight of unmanned aerial vehicle
CN119762557A
Method for registering and fusing infrared image and SAR image in dynamic flight of unmanned aerial vehicle
CN119762558A
Method for registering and fusing infrared images and SAR images during dynamic flight of unmanned aerial vehicles
CN119762558B
