Image detection method
By combining MAD and feature space methods, ghost detection is optimized, solving the problems of noise sensitivity and low robustness of traditional ghost detection in high dynamic range scenes, and achieving more efficient image detection.
Patent Information
- Application Number
- PCT/CN2025/100513
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-07-30
- Filing Date
- 2025-06-11
- Publication Date
- 2026-02-05
AI Technical Summary
Existing ghost detection methods are sensitive to noise and have low robustness in high dynamic range scenes. Furthermore, traditional methods require large detection windows and filtering operations, resulting in high costs.
We adopt a method that combines MAD and feature space. By setting the size of the detection window, we obtain the mean absolute difference of pixel values and the feature vector of image features. We combine multiple features to judge the similarity of image blocks and optimize ghost detection.
It improves the robustness of ghost detection, reduces the reliance on pre- and post-filtering, lowers costs, and improves detection accuracy and computational efficiency.
Smart Images

Figure CN2025100513_05022026_PF_FP_ABST
Abstract
Description
Method for detecting images
[0001] Cross-reference to related applications
[0002] The present disclosure is based on and claims priority from Chinese patent application 202411034217.4 filed on July 30, 2024, the disclosure of which is incorporated herein in its entirety by reference. TECHNICAL FIELD
[0003] Embodiments of the present disclosure relate to the field of communication, in particular, to a method for detecting images. BACKGROUND
[0004] Currently, mainstream HDR imaging is based on multi-frame different exposure technology. That is, a different exposure package, such as three frames containing different exposure times of long, medium, and short, respectively record the information of dark areas, medium areas, and bright areas, and then the exposure fusion technology is used to fuse them into a frame recording all the information. Generally speaking, these different exposure frames are collected by the same CIS at different time points. If the camera or the object in the scene moves between these time points, then an important problem is caused - ghost caused by motion.
[0005] In related technologies, the mean absolute difference (MAD) of pixel values at the corresponding window positions of two images is calculated, and based on the MAD values of the corresponding blocks of the two images and a preset threshold, it is determined whether there is motion at the position of the image to detect ghosting. However, this method is greatly affected by the environment, sensitive to noise, and has low robustness. SUMMARY
[0006] Embodiments of the present disclosure provide a method for detecting images to at least solve the problem of ghost detection in related technologies being greatly affected by the environment, sensitive to noise, and having low robustness.
[0007] According to an embodiment of the present disclosure, a method for detecting images is provided, comprising:
[0008] Based on a detection window of a set size, the average absolute difference MAD of pixel values of two adjacent frames of images is obtained, and the feature vector of the image feature of each frame of image in the two adjacent frames of images is obtained; according to the feature vector and the MAD, the relative motion parameter of the two adjacent frames of images at the position of the detection window is determined; and according to the relative motion parameter and a preset image relative motion threshold, the detection result of the image is determined.
[0009] According to another embodiment of the present disclosure, a computer readable storage medium is also provided, and the computer readable storage medium stores a computer program, wherein the computer program is set to execute the steps in any of the above method embodiments when running.
[0010] According to yet another embodiment of the present disclosure, an electronic device is also provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor being arranged to execute the computer program to perform the steps of any of the above method embodiments.
[0011] According to yet another embodiment of the present disclosure, a computer program product is also provided, comprising a computer program which, when executed by a processor, implements the steps of any of the above method embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0012] Fig. 1 is a hardware structure block diagram of a mobile terminal of an image detection method according to an embodiment of the present disclosure;
[0013] Fig. 2 is a flow chart of image detection according to an embodiment of the present disclosure;
[0014] Fig. 3 is a flow chart of ghosting removal of an HDR module according to an embodiment of the present disclosure;
[0015] Fig. 4 is a flow chart of ghosting detection processing of layer mapping according to an embodiment of the present disclosure;
[0016] Fig. 5 is a flow chart of ghosting detection according to an embodiment of the present disclosure;
[0017] Fig. 6 is a diagram of HOG histogram division according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0018] Embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0019] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence.
[0020] At present, ghosting detection technology is widely used in various tasks of computer vision, such as picture splicing of different perspectives, multi-frame image noise reduction of camera devices such as smartphones, image super-resolution applications, video anti-shake, and generation of high dynamic range imaging based on multiple exposures.
[0021] The traditional ghosting detection method usually uses a fixed size detection window to calculate the MAD of the corresponding window position of the two images. When the MAD value of the two image blocks corresponding to the detection window is greater than a preset threshold, it is considered that there is ghosting caused by motion at this position. When the MAD is less than the preset threshold, it is considered that this position is static.
[0022] A big defect of this way is sensitive to noise, especially in flat areas and in the case of poor signal-to-noise ratio. Such a situation is very common in high dynamic range (HDR) scenes, and the HDR area is usually multi-frame exposure, that is, the low brightness, medium brightness and high brightness areas are captured by long, medium and short exposure respectively. In low-illumination environments such as night, the areas captured by short exposure or even medium exposure are often accompanied by lower signal-to-noise ratio. If you want to improve robustness, you need to increase the size of the detection window and add pre-filtering or post-filtering operations. However, in the production of image signal processors (ISPs), these methods require a large number of line buffers for buffering, which is very costly.
[0023] Based on the above-mentioned existing technical problems, the embodiment of the present disclosure proposes a detection method of an image, the technical concept of which is to use the combination of MAD and feature space as the image block similarity criterion. In the feature space, multiple features can be combined for judgment, and the judgment basis of the image block similarity is optimized. Based on the optimized judgment basis of the image block similarity, ghosting is detected, solving the problems of traditional ghosting detection methods, such as being greatly affected by the environment, being sensitive to noise, and having low robustness, and greatly improving the noise robustness.
[0024] The detection method of the image of the embodiment of the present disclosure can be used in the ISP of a mobile phone or a vehicle-mounted SOC chip, can exist as a logical algorithm of an HDR module, and can also be used in other algorithms requiring multi-frame processing, such as time domain denoising.
[0025] The method embodiments provided in the embodiments of the present disclosure can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking the case of running on a mobile terminal, FIG. 1 is a hardware structure block diagram of a mobile terminal of a detection method of an image according to an embodiment of the present disclosure. As shown in FIG. 1, the mobile terminal can include one or more (only one is shown in FIG. 1) processors 102 (the processor 102 can include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal can further include a transmission device 106 for communication function and an input and output device 108. Those skilled in the art can understand that the structure shown in FIG. 1 is only schematic, which does not limit the structure of the mobile terminal. For example, the mobile terminal can include more or fewer components than those shown in FIG. 1, or have a different configuration from that shown in FIG. 1.
[0026] The memory 104 can be used to store computer programs, such as software programs of application software and modules, such as a computer program corresponding to the image detection method in the embodiments of the present disclosure. The processor 102 can execute various functional applications and data processing, i.e., implement the above method, by running the computer program stored in the memory 104. The memory 104 can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 104 can further include a memory remotely arranged with respect to the processor 102, and the remote memory can be connected to the mobile terminal through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0027] The transmission device 106 is configured to receive or send data via a network. Specific examples of the network can include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is configured to communicate with the Internet in a wireless manner.
[0028] In the present embodiment, an image detection method running on the above mobile terminal is provided. FIG. 2 is a flowchart of image detection according to the embodiments of the present disclosure. As shown in FIG. 2, the flow includes the following steps:
[0029] In step S201, based on a detection window of a set size, an average absolute difference MAD of pixel values of two adjacent images is obtained, and a feature vector of an image feature of each of the two adjacent images is obtained.
[0030] The MAD is a calculation method based on pixel values, which can evaluate the similarity of images by calculating the average absolute difference of pixel values of images at the detection window position of the two adjacent images. This method has the advantages of simplicity, intuitiveness, and fast calculation speed. However, it only focuses on the change of pixel values, and ignores the image content information; while the feature space can represent the image content information by extracting key image features in the image.
[0031] In the embodiments of the present disclosure, the MAD and the feature space are combined as the basis for judging the image ghosting, and the image block similarity criterion is optimized by using the complementarity of different types of criteria. One or more image features can be combined in the feature space for judgment.
[0032] For example, MAD focuses on the change of two adjacent frames of images in the time domain, while the feature space focuses on the content of the image in the spatial domain. Combining the two can complement the time domain and the spatial domain, and can evaluate the similarity of the image from both the time and the space dimensions, thereby improving the accuracy of image detection.
[0033] For example, MAD is simple and fast to calculate, while the feature space is complex to calculate but can provide more abundant image content information. Combining the two can complement the calculation complexity.
[0034] For example, MAD only focuses on the change of pixel values, and does not focus on the specific content of the image, so it cannot identify the influence of image noise, occlusion and other interference, while the feature space focuses more on the content of the image, and can judge the influence of noise and occlusion based on image features. Combining the two can improve the robustness of detection.
[0035] As an example, a fixed size detection window can be determined in advance, and the mean absolute difference MAD of the pixel values of the image blocks at the detection window position of the two adjacent frames of images is obtained, and the feature vector of the image features of the image blocks at the detection window position of each of the two adjacent frames of images is obtained.
[0036] The execution order of the obtaining of the MAD of the image blocks at the detection window position of the two adjacent frames of images and the obtaining of the feature vector of the image features of the image blocks at the detection window position of each of the two adjacent frames of images can be performed simultaneously or in reverse order. That is, the MAD of the image blocks at the detection window position of the two adjacent frames of images and the feature vector of the image features of the image blocks at the detection window position of each of the two adjacent frames of images can be obtained simultaneously; the MAD of the image blocks at the detection window position of the two adjacent frames of images can be obtained first, and then the feature vector of the image features of the image blocks at the detection window position of each of the two adjacent frames of images can be obtained; or the feature vector of the image features of the image blocks at the detection window position of each of the two adjacent frames of images can be obtained first, and then the MAD of the image blocks at the detection window position of the two adjacent frames of images can be obtained.
[0037] As an example, the image features can include but are not limited to color features (such as color histograms), texture features (such as direction gradient histograms), shape features, spatial features, edge features, gradient features, depth features, etc.
[0038] It should be noted that the size of the detection window can be selected according to the actual situation, but it cannot be too small, otherwise it is not robust enough, and it cannot be too large, otherwise the pixels of the image at the detection window position are likely to belong to different objects, i.e. there is relative motion between the pixels of the image at the detection window position.
[0039] In an exemplary embodiment, before acquiring the mean absolute difference (MAD) of pixel values of two adjacent frames of images based on a set size of a detection window, and a feature vector of an image feature of each of the two adjacent frames of images, the method further comprises:
[0040] The pixel values of each of the two adjacent frames of images are preprocessed, and the preprocessing comprises at least one of black level correction and white balance correction.
[0041] For example, FIG. 3 is a flowchart of ghost removal of an HDR module according to an embodiment of the present disclosure. As shown in FIG. 3, the HDR module can have a ghost removal function, and the flow of ghost removal can include preprocessing, exposure alignment, ghost detection, and the like.
[0042] The preprocessing can include black level correction (BLC) and white balance correction (WBC).
[0043] The BLC can refer to subtracting an offset caused by a dark current from an input signal, thereby preparing for subsequent white balance correction and exposure alignment. As follows: out = I in -BL
[0044] wherein I in represents an input pixel value, BL represents a pixel value offset caused by a black level, and I out represents an output pixel value.
[0045] By correcting the black level, image noise can be reduced, and the contrast and visual comfort of the image can be improved.
[0046] The WBC can multiply a gain to each pixel channel to correct the imbalance of incident light spectrum itself and different color channel quantum efficiency, and the gain can be manually set or automatically calculated, as shown in the following formula:
[0047] wherein R in is an R input pixel channel, R_gain is an R pixel channel gain, and R out is an R output pixel channel; G in is a G input pixel channel, 1.0 is a G pixel channel gain, and G out is a G output pixel channel; B in is a B input pixel channel, B_gain is a B pixel channel gain, and B out is a B output pixel channel.
[0048] By correcting the white balance, color distortion can be reduced, and the color accuracy and visual comfort of the image can be improved.
[0049] In an exemplary embodiment, before obtaining the mean absolute difference (MAD) of pixel values of adjacent two frames of images based on a set size of a detection window, and a feature vector of an image feature of each of the adjacent two frames of images, the method further comprises:
[0050] obtaining pixel values of each of the adjacent two frames of images, an exposure time of each of the adjacent two frames of images, and an exposure time of a reference frame;
[0051] determining an exposure coefficient of each of the adjacent two frames of images according to the exposure time of each of the adjacent two frames of images and the exposure time of the reference frame;
[0052] performing exposure alignment processing on a pixel point of each of the adjacent two frames of images according to the pixel values of each of the adjacent two frames of images and the exposure coefficient of each of the adjacent two frames of images.
[0053] As an example, after preprocessing, exposure alignment processing can be performed. Exposure alignment can ensure that images with different exposure settings have comparability in brightness information, so as to effectively compare in subsequent HDR synthesis, ghost detection or other image processing tasks.
[0054] For example, as shown in FIG. 3, the principle of HDR is to fuse different exposure images recording different brightness information into one frame of image. Due to different exposure times, the pixel values corresponding to the same brightness area in the scene in different frames are different. In order to facilitate the comparison of the pixel values of adjacent two frames on the same reference in the subsequent ghost detection (or HDR synthesis) process, exposure alignment processing is needed. The alignment method can be as follows:
[0055] A reference frame can be determined first to remain unchanged, and other image frames can be multiplied by an exposure coefficient, which can be determined by the exposure times of the reference frame and the image frames, as shown in the following formula: short_aligned = I short
[0056] wherein I short is the pixel value of the short image frame before alignment processing, I short_aligned is the pixel value of the short image frame after alignment processing;
[0057] I middle is the pixel value of the medium image frame before alignment processing, is the exposure coefficient of the medium image frame, exposure_time shortexposure_time is the exposure time of the short image frame middle I is the exposure time of the medium image frame middle_aligned is the pixel value of the medium image frame after alignment processing
[0058] I long is the pixel value of the long image frame before alignment processing exposure_time is the exposure coefficient of the long image frame long I is the exposure time of the long image frame long_aligned is the pixel value of the long image frame after alignment processing
[0059] It should be noted that the above formula is only an example of aligning to the short image frame, and in actual operation, it can also be aligned to the long frame or other frames, and the embodiments of the present disclosure are not limited thereto.
[0060] In an exemplary embodiment, the average absolute difference MAD of the pixel values of the adjacent two image frames based on the detection window of the set size, and the feature vector of the image feature of each of the adjacent two image frames, include:
[0061] The pixel points of the adjacent two image frames of the original image layer are respectively smoothed, and the adjacent two image frames after smoothing are respectively down-sampled;
[0062] The average absolute difference MAD of the pixel values of the adjacent two image frames after down-sampling based on the detection window of the set size, and the feature vector of the image feature of each of the adjacent two image frames.
[0063] As an example, the Gaussian kernel is a commonly used smoothing filter, which has the advantages of smoothing the image while reducing the edge blur, and can be used to smooth the image first, so as to reduce the image noise while retaining the edge and texture information of the image. After Gaussian smoothing, the image can be down-sampled, which can reduce the calculation amount in the subsequent image detection process while retaining the key information of the image.
[0064] For example, FIG. 4 is a schematic diagram of a ghost detection processing flow of layer mapping according to an embodiment of the present disclosure, as shown in FIG. 4, denoted as DS1 layer, the original image can be denoted as DS0 layer, and the down-sampling layer of the original image can be denoted as DS1 layer. First, the DS0 layer can be smoothed by using a Gaussian filter. A 5x5 Gaussian kernel can be used for smoothing, and the value of each pixel is obtained by weighted average of the pixel values in the surrounding 5x5 region. The 5x5 Gaussian kernel can be applied to each pixel of the DS0 layer.
[0065] In the calculation of the weighted average of the current pixel and its surrounding pixels, the surrounding pixel weight can be determined by a Gaussian distribution.
[0066] After the smoothing process, downsampling can be performed to reduce the amount of pixel data while preserving the main features of the image. In the embodiments of the application, downsampling can be achieved by selecting one pixel out of every 2x2 pixels into the DS1 layer. The resulting image size of the DS1 layer will be half of that of the DS0 layer.
[0067] For example, one pixel can be selected out of a 2x2 pixel block into the DS1 layer. The selection strategy can be diverse, for example, the center pixel, the average value, the median value, or other selection methods based on specific criteria can be selected, and the embodiments of the present disclosure do not limit this. The selection process needs to ensure that the selected pixel can represent the characteristics of the 2x2 pixel block it is in.
[0068] The embodiments of the present disclosure can process the image detection process in the downsampled layer of the original image, thereby reducing the computational resource overhead.
[0069] In addition, the introduction of image features as the basis for image detection judgment in the embodiments of the present disclosure improves the robustness. The improvement of robustness can use a smaller detection window for detection, and a smaller detection window brings higher detection accuracy. For example, the size of the detection window is reduced from 5x5 to 3x3, and the detection radius is almost halved, thereby improving the accuracy of detection.
[0070] Moreover, the improvement of robustness brings the reduction of the detection window, and at the same time, it can rely less on pre-filtering and post-filtering, thereby greatly reducing the demand for Line Buffer and achieving a significant reduction in cost.
[0071] In an exemplary embodiment, after determining the detection result of the image, further comprising:
[0072] Mapping and upsampling the detection result to map the detection result to the original image layer.
[0073] As an example, after the image detection is completed, the detection result in the downsampled layer of the image can be mapped and processed by upsampling to restore the result to the original image layer.
[0074] As an example, the resulting ghost detection result is calculated in the DS1 layer, and needs to be mapped to the DS0 layer, which is used to map the ghost detection result on the low-resolution image layer back to the high-resolution image layer. The mapping method can include but is not limited to nearest neighbor algorithm, bilinear algorithm, etc.
[0075] For example, FIG. 5 is a schematic diagram of a ghost detection flow according to an embodiment of the present disclosure. As shown in FIG. 5, a detection window of M*N can be determined at the DS1 layer, and the MAD of two adjacent frames of images can be obtained by the following formula:
[0076] where (x, y) can represent the coordinates of the center pixel of the detection window.
[0077] The feature vector of the image feature of the image block at the detection window position of each frame of image can be obtained in the feature space, and a suitable image feature such as HOG needs to be selected.
[0078] The following takes the extraction process of HOG feature as an example for description.
[0079] The gradient can be obtained at each pixel position of the detection window of M*N, as shown in the following formula:
[0080] where G h and G v are the derivatives in the horizontal direction and the vertical direction at (i, j) respectively, and the gradient G=(G h , G v ) at (i, j) is obtained. After obtaining the M*N gradients, the histogram can be counted according to the direction of the gradient vector.
[0081] FIG. 6 is a schematic diagram of HOG histogram division according to an embodiment of the present disclosure. As shown in FIG. 6, the histogram can be divided into four bins by the angle bisector of the four quadrants of the coordinates. Whether a gradient falls into which bin is determined according to the following formula: G h >0, G v >0, |G v ≥G h |G∈bin0 G h <0, G v >0, |G v ≥G h |G∈bin1 G h >0, G v <0, |G v ≥G h |G∈bin2 G h >0, G v <0, |G v ≥G h |G∈bin3 G h >0, G v >0, |G h >G v |G∈bin0 G h >0, G v <0, |Gh G v |G∈bin2 G h <0,G v >0,|G h >G v |G∈bin3 G h <0,G v <0,|G h >G v |G∈bin3
[0082] After the above calculation, the histogram obtained by statistics can be regarded as a 4-dimensional vector.
[0083] It should be noted that more dimensions can be obtained if a larger window or more bins are divided. In addition, here it can not be limited to one type of feature, and multiple features can be spliced to obtain more dimensions. Splicing can be operated according to the following formula: F = concat{F0, F1,..., Fk} k-1}
[0084] Where F is the spliced feature, F0 to Fk are the k features participating in splicing. k-1
[0085] The embodiment of the disclosure can detect based on the features of the image content due to the introduction of the feature space, so that the description level of the image is improved from the pixel-level description at the bottom layer to the visual feature layer, so that the image content and noise can be better distinguished, and therefore the robustness to random noise can be stronger.
[0086] In step S202, the relative motion parameters of the adjacent two frames of images at the detection window position are determined according to the feature vector and the MAD.
[0087] Exemplarily, the relative motion parameters of the adjacent two frames of images at the detection window position can be determined according to the feature vector of the image features of each frame of image in the adjacent two frames of images at the detection window position and the MAD, and whether the ghosting occurs can be determined based on the relative motion parameters.
[0088] In an exemplary embodiment, the feature vector includes a first feature vector corresponding to a first frame of image of the adjacent two frames of images and a second feature vector corresponding to a second frame of image of the adjacent two frames of images, and the relative motion parameters of the adjacent two frames of images at the detection window position are determined according to the feature vector and the MAD, including:
[0089] The Hamming distance of the adjacent two frames of images at the detection window position is determined according to the first feature vector and the second feature vector.
[0090] According to the Hamming distance and the MAD, a relative motion parameter of the two adjacent frames of images at the detection window position is determined.
[0091] As an example, a Hamming distance can be calculated according to a first feature vector of image features of an image block at the detection window position of the first frame of images and a second feature vector of image features of an image block at the detection window position of the second frame of images, and according to the calculated Hamming distance and the MAD, a relative motion parameter of the two adjacent frames of images at the detection window position is determined.
[0092] For example, when comparing two frames of images, a sampling window of NxN can be used to traverse the entire image, and each determination only involves NxN pixels of an image block at a certain window position. That is, the MAD is calculated and the features are extracted from the NxN pixel image block of the first image and the NxN pixel image block at the corresponding position of the second image, and the Hamming distance between the two features is calculated.
[0093] In an exemplary embodiment, the determination of the Hamming distance of the two adjacent frames of images at the detection window position according to the first feature vector and the second feature vector comprises:
[0094] The dimensions of the first feature vector and the dimensions of the second feature vector are determined, and compression processing is performed on the dimensions of the first feature vector and the dimensions of the second feature vector respectively to obtain the compressed first feature vector and the compressed second feature vector;
[0095] The compressed first feature vector and the compressed second feature vector are binarized respectively, and the binarized first feature vector and the binarized second feature vector are subjected to bitwise AND operation to obtain a third feature vector;
[0096] The number of 1s in the third feature vector is counted to obtain the Hamming distance.
[0097] For example, as shown in FIG. 5, the extracted features are often long, and in order to simplify the calculation, remove redundancy, increase robustness, etc., compression processing can be performed on the features, for example, Principal Component Analysis (PCA) method, etc. The following is an example of PCA compression and dimension reduction processing:
[0098] Suppose there are m samples, each sample has a feature vector of n dimensions, and an n-dimensional linear relationship tensor X can be obtained, which can be normalized according to the following formula:
[0099] where X stdis the normalized tensor X, μ is the mean vector of n-dimensional features, and σ is the standard deviation vector of n-dimensional features.
[0100] The covariance matrix C of the X tensor can be further calculated as follows:
[0101] The eigenvalues and eigenvectors V of C are then solved as follows: CV = λV
[0102] The k (k ≤ n) eigenvectors corresponding to the largest eigenvalues can be selected as needed to form the dimension reduction matrix W, which can be composed of multiple V. The dimension reduction of the eigenvector x can be performed to obtain the vector y according to the following formula: y = Wx T
[0103] After the feature is compressed, it can be directly compared, such as directly calculating the Manhattan distance or Euclidean distance between the features. The embodiment of the disclosure can select to perform binarization processing first, and then calculate the Hamming distance between the features after the binarization processing, which not only makes the calculation extremely fast, but also makes the algorithm more robust.
[0104] For example, taking the symmetric center 0 as the threshold of binarization, the binarization example is as follows:
[0105] where V k represents the kth dimension of the eigenvector V.
[0106] After obtaining the binarized eigenvector, the Hamming distance can be calculated.
[0107] The bit-wise AND operation can be performed on the eigenvectors extracted from the long image frame and the short image frame, as follows: V res = V long & V short
[0108] where the symbol & represents the bit-wise AND operation, and V res is the vector obtained by the bit-wise AND operation.
[0109] The number of 1s in the V res vector can be counted to obtain the Hamming distance D H .
[0110] After obtaining the Hamming distance of the feature space, the Hamming distance can be combined with the MAD calculated above to obtain the relative motion parameter Motion. For example, the Hamming distance and the MAD can be combined by multiplication, as shown in the following formula: Motion = k × MAD α × D H β
[0111] If α = 1 and β = 1, the above formula becomes: Motion = k x MAD x D H
[0112] In the above formula, k is a coefficient, which can be used to adjust the range of the value of the motion parameter Motion.
[0113] In addition to multiplication, an exponential operation can also be performed, for example, as shown in the following formula:
[0114] In step S203, a detection result of the image is determined according to the relative motion parameter and a preset image relative motion threshold.
[0115] Exemplarily, a ghost detection result of the image can be determined according to the relative motion parameter and the preset image relative motion threshold.
[0116] In an exemplary embodiment, the image relative motion threshold includes a first image relative motion threshold and a second image relative motion threshold, and determining the detection result of the image according to the relative motion parameter and the preset image relative motion threshold includes:
[0117] In a case where the relative motion parameter is less than or equal to the first image relative motion threshold, the detection result of the image is determined as no ghost;
[0118] In a case where the relative motion parameter is greater than the second image relative motion threshold, the detection result of the image is determined as having ghost; wherein the second image relative motion threshold is greater than the first image relative motion threshold;
[0119] In a case where the relative motion parameter is greater than the first image relative motion threshold and less than or equal to the second image relative motion threshold, a ghost degree of the image is determined according to the relative motion parameter, the first image relative motion threshold and the second image relative motion threshold.
[0120] As an example, the image relative motion threshold can include a first image relative motion threshold and a second image relative motion threshold, wherein the second image relative motion threshold can be greater than the first image relative motion threshold.
[0121] As an example, a judgment can be made based on the relative motion parameter, the first image relative motion threshold and the second image relative motion threshold, if the relative motion parameter is less than or equal to the first image relative motion threshold, the image can be determined as having no ghost; if the relative motion parameter is greater than the first image relative motion threshold and less than or equal to the second image relative motion threshold, a ghost degree of the image can be calculated; if the relative motion parameter is greater than the second image relative motion threshold, the image can be determined as having ghost.
[0122] In an example embodiment, the determining the ghosting degree of the image according to the relative motion parameter, the first image relative motion threshold and the second image relative motion threshold comprises:
[0123] calculating a first difference between the relative motion parameter and the first image relative motion threshold, and a second difference between the second image relative motion threshold and the first image relative motion threshold;
[0124] determining a ratio of the first difference and the second difference;
[0125] determining the ghosting degree of the image according to the ratio.
[0126] As an example, the ghosting degree of the image can be calculated according to the first difference between the relative motion parameter and the first image relative motion threshold, and the second difference between the second image relative motion threshold and the first image relative motion threshold.
[0127] For example, after obtaining the relative motion parameter Motion, Motion can be compared with two preset thresholds thd_low and thd_high, and the ghosting degree Ghost Map can be obtained. When Motion is less than thd_low, it can be determined that there is no ghosting; when Motion is greater than thd_high, it can be determined that there is ghosting, and when Motion is between thd_low and thd_high, the ghosting degree can be determined by linear interpolation.
[0128] For example, as shown in the following formula:
[0129] In the embodiments of the present disclosure, based on a detection window of a set size, the average absolute difference MAD of pixel values of two adjacent images and the feature vector of the image feature of each of the two adjacent images are obtained; the relative motion parameter of the two adjacent images at the position of the detection window is determined according to the feature vector and the MAD; and the detection result of the image is determined according to the relative motion parameter and a preset image relative motion threshold, thereby solving the problem in the related art that the ghosting detection manner is greatly affected by the environment, sensitive to noise and low in robustness, greatly improving the noise robustness and improving the accuracy of image detection.
[0130] Those skilled in the art can clearly understand that the method according to the above-mentioned embodiments can be realized by means of software on a general hardware platform, and of course can also be realized by hardware, but in many cases the former is a better implementation. Based on such understanding, the technical solutions of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device) to execute the methods described in the various embodiments of the present disclosure.
[0131] The embodiments of the present disclosure further provide a computer readable storage medium, which stores a computer program. The computer program is configured to execute the steps in any of the above-mentioned method embodiments when running.
[0132] In an example embodiment, the above-mentioned computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.
[0133] The embodiments of the present disclosure further provide an electronic device, which includes a memory and a processor. The memory stores a computer program. The processor is configured to execute the computer program to perform the steps in any of the above-mentioned method embodiments.
[0134] In an example embodiment, the above-mentioned electronic device can further include a transmission device and an input / output device. The transmission device is connected to the processor. The input / output device is connected to the processor.
[0135] The specific examples in the present embodiment can refer to the examples described in the above-mentioned embodiments and example implementations. The present embodiment will not be described here again.
[0136] The embodiments of the present disclosure further provide a computer program product, which includes a computer program. The computer program is executed by a processor to perform the steps in any of the above-mentioned method embodiments.
[0137] It is apparent that those skilled in the art should understand that the modules or steps of the present disclosure described above can be realized by general computing devices, which can be centralized on a single computing device or distributed on a network composed of multiple computing devices, and can be realized by program codes executable by the computing devices, so that they can be stored in storage devices and executed by the computing devices, and in some cases, the steps shown or described can be executed in different orders, or they can be respectively manufactured into individual integrated circuit modules, or multiple modules or steps among them can be manufactured into a single integrated circuit module. Thus, the present disclosure is not limited to any specific combination of hardware and software.
[0138] The above merely shows exemplary embodiments of the present disclosure and is not intended to limit the present disclosure. The present disclosure can have various modifications and changes for those skilled in the art. Any modification, equivalent replacement, improvement, etc. within the principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A detection method of an image, comprising: obtaining a mean absolute difference (MAD) of pixel values of two adjacent images and a feature vector of an image feature of each of the two adjacent images based on a detection window of a set size; determining a relative motion parameter of the two adjacent images at a position of the detection window according to the feature vector and the MAD; determining a detection result of the image according to the relative motion parameter and a preset image relative motion threshold.
2. The method of claim 1, wherein, The feature vector comprises a first feature vector corresponding to a first image of the two adjacent images and a second feature vector corresponding to a second image of the two adjacent images, and the determining of the relative motion parameter of the two adjacent images at the position of the detection window according to the feature vector and the MAD comprises: determining a Hamming distance of the two adjacent images at the position of the detection window according to the first feature vector and the second feature vector; determining the relative motion parameter of the two adjacent images at the position of the detection window according to the Hamming distance and the MAD.
3. The method of claim 2, wherein, The determining of the Hamming distance of the two adjacent images at the position of the detection window according to the first feature vector and the second feature vector comprises: determining dimensions of the first feature vector and the second feature vector, and respectively compressing the dimensions of the first feature vector and the second feature vector to obtain compressed first feature vector and second feature vector; respectively binarizing the compressed first feature vector and the second feature vector, and performing a bitwise AND operation on the binarized first feature vector and the second feature vector to obtain a third feature vector; counting a number of 1s in the third feature vector to obtain the Hamming distance.
4. The method of claim 1, wherein, The image relative motion threshold comprises a first image relative motion threshold and a second image relative motion threshold, and the determining of the detection result of the image according to the relative motion parameter and the preset image relative motion threshold comprises: in a case where the relative motion parameter is less than or equal to the first image relative motion threshold, determining that the detection result of the image is no ghosting; in a case where the relative motion parameter is greater than the second image relative motion threshold, determining that the detection result of the image is ghosting; wherein the second image relative motion threshold is greater than the first image relative motion threshold; in a case where the relative motion parameter is greater than the first image relative motion threshold and less than or equal to the second image relative motion threshold, determining a ghosting degree of the image according to the relative motion parameter, the first image relative motion threshold and the second image relative motion threshold.
5. The method of claim 4, wherein, The determining of the ghosting degree of the image according to the relative motion parameter, the first image relative motion threshold and the second image relative motion threshold comprises: calculating a first difference value of the relative motion parameter and the first image relative motion threshold, and a second difference value of the second image relative motion threshold and the first image relative motion threshold; determining a ratio of the first difference value and the second difference value; determining a ghosting degree of the image according to the ratio.
6. The method of claim 1, wherein, The average absolute difference (MAD) of pixel values of the adjacent two frames of images and the feature vector of the image feature of each of the adjacent two frames of images are obtained based on the detection window of the set size, including: pixel points of the adjacent two frames of images of the original image layer are respectively smoothed, and the adjacent two frames of images after the smoothing are respectively down-sampled; The average absolute difference (MAD) of pixel values of the adjacent two frames of images after the down-sampling and the feature vector of the image feature of each of the adjacent two frames of images are obtained based on the detection window of the set size.
7. The method of claim 6, wherein, After determining the detection result of the image, further comprising: mapping and up-sampling the detection result to the original image layer.
8. The method of claim 1, wherein, Before obtaining the average absolute difference (MAD) of pixel values of the adjacent two frames of images and the feature vector of the image feature of each of the adjacent two frames of images based on the detection window of the set size, further comprising: obtaining the pixel value of each of the adjacent two frames of images, the exposure time of each of the adjacent two frames of images, and the exposure time of the reference frame; determining the exposure coefficient of each of the adjacent two frames of images according to the exposure time of each of the adjacent two frames of images and the exposure time of the reference frame; performing exposure alignment processing on the pixel points of each of the adjacent two frames of images with the pixel points of the reference frame according to the pixel value of each of the adjacent two frames of images and the exposure coefficient of each of the adjacent two frames of images.
9. The method of claim 1, wherein, Before obtaining the average absolute difference (MAD) of pixel values of the adjacent two frames of images and the feature vector of the image feature of each of the adjacent two frames of images based on the detection window of the set size, further comprising: respectively pre-processing the pixel value of each of the adjacent two frames of images, the pre-processing including at least one of the following: black level correction, white balance correction.
10. A computer-readable storage medium having stored therein a computer program, wherein, The computer program is executed by the processor to realize the steps of the method described in any one of claims 1 to 9. 11.An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor realizes the steps of the method described in any one of claims 1 to 9 when executing the computer program. 12.A computer program product comprising a computer program, wherein the computer program realizes the steps of the method described in any one of claims 1 to 9 when executed by a processor.
Citation Information
Patent Citations
Image processing method and device
CN111684489A
Video jitter detection method, device and system
CN111741186A
Motion and brightness detection method based on frame difference absolute error and SAD
CN112561951A
Image motion area positioning method and device, storage medium and terminal
CN115760903A
Detecting and compensating for motion between a flash and a no-flash image
US20150332475A1