A method and related apparatus for image stroboscopic detection
By segmenting the image and analyzing the peak parameters, the problem of decreased accuracy caused by moving objects and light sources in traditional flicker detection is solved, achieving higher flicker detection accuracy and recall.
Patent Information
- Application Number
- CN202210305709.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2042-03-25
Smart Images

Figure CN114627096B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an image stroboscopic detection method and related devices. Background Art
[0002] Image sensors are often affected by exposure patterns, resulting in different light energies received by pixels in different rows within a video frame, causing flicker in the video frame. Traditional flicker detection methods often perform an autocorrelation operation on an array of frame difference means between adjacent images. This calculation calculates the power spectrum of the autocorrelation array within a set frequency range and compares the spectrum with a preset threshold to determine whether flicker is present in the video frame.
[0003] Video frames often contain moving objects, such as pedestrians and vehicles. These objects can create bright areas in the frame difference image. These bright areas interfere with the calculation of the frame difference mean array, reducing flicker detection accuracy. Furthermore, since practical applications often use mixed light sources, the power spectrum peak of the frame difference mean array can be affected by ambient light and may fall outside the set frequency range, further reducing flicker detection accuracy and recall. Summary of the Invention
[0004] The present invention provides an image stroboscopic detection method and related devices, which are used to improve the accuracy and recall rate of stroboscopic detection.
[0005] In a first aspect, an embodiment of the present invention provides an image stroboscopic detection method, the method comprising:
[0006] Segmenting the first image and the second image based on a preset number of columns to obtain a plurality of first sub-images of the first image and a plurality of second sub-images of the second image; wherein the second images are acquired after the first images and have the same size as the first images; and for each first sub-image, there exists a second sub-image with the same pixel coordinates as the first sub-image;
[0007] For each first sub-image, determining a frame difference mean array for the first sub-image based on the image brightness of the first sub-image and the image brightness of an image to be processed corresponding to the first sub-image; wherein the image to be processed is a second sub-image having the same pixel coordinates as the first sub-image;
[0008] Determine whether the first image has stroboscopic patterns based on peak parameters in each of the frame difference mean value arrays.
[0009] The embodiment of the present application performs segmentation processing on the first image and the second image based on a preset number of columns, respectively, to obtain multiple first sub-images of the first image and multiple second sub-images of the second image. The acquisition timing of the second image is after the first image, and the second image and the first image have the same size. The second sub-image with the same pixel coordinates as the first sub-image is used as the image to be processed. For each first sub-image, the frame difference mean array of the first sub-image is determined according to the image brightness of the first sub-image and the image brightness of the image to be processed corresponding to the first sub-image. The above process is to reduce the influence of moving objects on the accuracy of stroboscopic detection by segmenting the image and performing stroboscopic detection on each sub-image obtained after segmentation. And based on the peak parameters in each frame difference mean array, it is determined whether the first image has stroboscopic detection to improve the accuracy and recall rate of stroboscopic detection.
[0010] In some possible embodiments, before segmenting the first image and the second image based on the preset number of columns, the method further includes:
[0011] Determine whether a frame difference brightness ratio of the first image is not less than a preset ratio threshold; wherein the frame difference brightness ratio is determined according to the following method:
[0012] Determining target pixels in the first image and the second image whose brightness is within a preset brightness range, and constructing a mask image based on the target pixels;
[0013] Determining a first intermediate image based on the product of the brightness of the mask image and the pixel at the same position in the first image, and determining a second intermediate image based on the product of the brightness of the mask image and the pixel at the same position in the second image;
[0014] Frame difference processing is performed on the first intermediate image and the second intermediate image to obtain a frame difference image, and a ratio of the image brightness of the frame difference image to the image brightness of the first intermediate image is used as the frame difference brightness ratio.
[0015] This embodiment of the present application constructs a mask image based on target pixels in the first and second images whose brightness falls within a preset brightness range. A frame difference image corresponding to the first and second images is then determined based on this mask image. The ratio of the image brightness of the frame difference image to the image brightness of the first intermediate image is used as the frame difference brightness ratio. Thus, the presence of stroboscopic light can be determined in the first image based on the comparison of this frame difference brightness ratio with a preset ratio threshold.
[0016] In some possible embodiments, determining the frame difference mean array of the first sub-image according to the image brightness of the first sub-image and the image brightness of the to-be-processed image corresponding to the first sub-image includes:
[0017] For each pixel point in each row of pixels in the first sub-image, determine a brightness difference between the pixel point and a target point; wherein the target point is a point in the image to be processed at the same position as the pixel point;
[0018] Determine the average brightness of the pixels in the row according to the brightness difference of each pixel;
[0019] The frame difference mean value array is determined according to the brightness mean value of each row of pixels.
[0020] In this embodiment, the brightness difference value of each pixel in each row of pixels in the first sub-image is calculated by subtracting the brightness of the point in the image to be processed that is located at the same position as the pixel. The brightness difference value of each pixel is then determined based on the brightness difference value of each pixel, and a frame difference mean array is determined based on the brightness mean of each row of pixels. This allows the first sub-image to be divided into multiple frame difference mean arrays by row, and stroboscopic detection is performed on each frame difference mean array to reduce the impact of moving objects in the image on the accuracy of stroboscopic detection.
[0021] In some possible embodiments, determining whether the first image has stroboscopic effects based on peak parameters in each of the frame difference mean value arrays includes:
[0022] Determining peak parameters in each frame difference mean array according to a peak search algorithm, and determining whether a first sub-image corresponding to the frame difference mean array has stroboscopic frequency according to the peak parameters;
[0023] If any of the first sub-images has stroboscopic effect, it is determined that the first image has stroboscopic effect; otherwise, it is determined that the first image has no stroboscopic effect.
[0024] Because the power spectrum peak of the frame difference mean array may be affected by ambient light and may be far from the set frequency range, the present embodiment uses a peak search algorithm to determine the peak parameters in each frame difference mean array. Based on these peak parameters, it is determined whether the first sub-image corresponding to the frame difference mean array exhibits flicker. Therefore, if flicker is present in any first sub-image, flicker can be determined in the first image, thereby improving the accuracy of flicker detection.
[0025] In some possible embodiments, determining peak parameters in each frame difference mean array based on a peak search algorithm, and determining whether a first sub-image corresponding to each frame difference mean array has stroboscopic light according to the peak parameters of the frame difference mean array, includes:
[0026] For each frame difference mean array, a peak search algorithm is used to determine the number of first target peaks in the frame difference mean array; wherein the first target peak is a peak in the frame difference mean array whose peak parameter is greater than a first peak threshold;
[0027] If the number of the first target peaks is less than a first number threshold, it is determined that the first sub-image does not have stroboscopic light. Otherwise, an autocorrelation array of the frame difference mean array is determined according to an autocorrelation function, and the number of second target peaks in the autocorrelation array is determined using the peak search algorithm. The second target peaks are peaks in the frame difference mean array whose peak parameters are greater than a second peak threshold.
[0028] If the number of the second target wave peaks is less than the second number threshold, it is determined that the first sub-image does not have stroboscopic motion; otherwise, it is determined that the first sub-image does have stroboscopic motion.
[0029] In this embodiment, a peak search algorithm is pre-determined to determine the number of first target peaks in the frame difference mean array. If the number of first target peaks meets a first threshold, stroboscopic imagery is determined for the first sub-image. Otherwise, an autocorrelation array of the frame difference mean array is determined based on an autocorrelation function to perform noise reduction on the frame difference mean data. A peak search algorithm is then used to determine the number of second target peaks in the autocorrelation array. The presence of stroboscopic imagery is determined based on a comparison of the number of second target peaks with the second threshold.
[0030] In some possible embodiments, before determining the autocorrelation array of the frame difference mean array according to the autocorrelation function, the method further includes:
[0031] Determine that the number of third target peaks is not less than a third number threshold; wherein the number of the third target peaks is determined according to the following method:
[0032] The Fourier spectrum of the frame difference mean array is determined according to a Fourier transform formula, and the number of the third target peaks in the Fourier spectrum is determined using a peak search algorithm; the third target peak is a peak in the Fourier spectrum whose peak parameter is greater than a third peak threshold.
[0033] Taking into account that the autocorrelation array occupies a large amount of computing resources, the embodiment of the present application determines the Fourier spectrum of the frame difference mean data according to the Fourier transform formula before determining the autocorrelation array of the frame difference mean data, and determines whether the first sub-image has stroboscopic motion based on the number of third target peaks in the Fourier spectrum, so as to improve the accuracy of stroboscopic detection.
[0034] In some possible embodiments, before determining the autocorrelation array of the frame difference mean array according to the autocorrelation function, the method further includes:
[0035] Determine whether a peak width difference of the frame difference mean array is not less than a preset width threshold; wherein the peak width difference is determined according to the following method:
[0036] determining a maximum peak width and a minimum peak width of each of the first target peaks;
[0037] The difference between the maximum peak width and the minimum peak width is taken as the peak width difference.
[0038] Considering that autocorrelation arrays consume significant computing resources, this embodiment of the present application determines whether the number of third target peaks in the Fourier spectrum of the frame difference mean data meets the third target number of peaks, and whether the peak width difference of the frame difference mean array meets a preset width threshold, before determining the autocorrelation array of the frame difference mean data. If any of these threshold conditions are met, it can be determined that stroboscopic light is present in the first sub-image.
[0039] In some possible embodiments, the peak parameters include at least: peak height, peak width, and peak protrusion.
[0040] In the embodiment of the present application, the peak parameters are determined based on the peak height, peak width and peak protrusion. Therefore, the accuracy of stroboscopic detection can be improved by using the peak parameters to determine the target peak for stroboscopic detection.
[0041] In a second aspect, an embodiment of the present invention provides an image stroboscopic detection device, the device comprising:
[0042] a segmentation processing module configured to perform segmentation processing on the first image and the second image based on a preset number of columns, respectively, to obtain a plurality of first sub-images of the first image and a plurality of second sub-images of the second image; wherein the second images are acquired after the first images, and the second images have the same size as the first images; and for each first sub-image, there exists a second sub-image with the same pixel coordinates as the first sub-image;
[0043] an array determination module configured to determine, for each first sub-image, a frame difference mean array of the first sub-image based on the image brightness of the first sub-image and the image brightness of a to-be-processed image corresponding to the first sub-image; wherein the to-be-processed image is a second sub-image having the same pixel coordinates as the first sub-image;
[0044] The stroboscopic detection module is configured to determine whether the first image has stroboscopic frequency based on the peak parameters in each of the frame difference mean value arrays.
[0045] In some possible embodiments, before performing the segmentation processing on the first image and the second image based on the preset number of columns, the segmentation processing module is further configured to:
[0046] Determine whether a frame difference brightness ratio of the first image is not less than a preset ratio threshold; wherein the frame difference brightness ratio is determined according to the following method:
[0047] Determining target pixels in the first image and the second image whose brightness is within a preset brightness range, and constructing a mask image based on the target pixels;
[0048] Determining a first intermediate image based on the product of the brightness of the mask image and the pixel at the same position in the first image, and determining a second intermediate image based on the product of the brightness of the mask image and the pixel at the same position in the second image;
[0049] Frame difference processing is performed on the first intermediate image and the second intermediate image to obtain a frame difference image, and a ratio of the image brightness of the frame difference image to the image brightness of the first intermediate image is used as the frame difference brightness ratio.
[0050] In some possible embodiments, the determining of the frame difference mean array of the first sub-image based on the image brightness of the first sub-image and the image brightness of the to-be-processed image corresponding to the first sub-image is performed by the array determining module being configured to:
[0051] For each pixel point in each row of pixels in the first sub-image, determine a brightness difference between the pixel point and a target point; wherein the target point is a point in the image to be processed at the same position as the pixel point;
[0052] Determine the average brightness of the pixels in the row according to the brightness difference of each pixel;
[0053] The frame difference mean value array is determined according to the brightness mean value of each row of pixels.
[0054] In some possible embodiments, the determining whether the first image has stroboscopic patterns based on the peak parameters in the frame difference mean array is performed, and the stroboscopic pattern detection module is configured to:
[0055] Determining peak parameters in each frame difference mean array according to a peak search algorithm, and determining whether a first sub-image corresponding to the frame difference mean array has stroboscopic frequency according to the peak parameters;
[0056] If any of the first sub-images has stroboscopic effect, it is determined that the first image has stroboscopic effect; otherwise, it is determined that the first image has no stroboscopic effect.
[0057] In some possible embodiments, the peak search algorithm is executed to determine peak parameters in each frame difference mean array, and based on the peak parameters of each frame difference mean array, it is determined whether stroboscopic light exists in the first sub-image corresponding to the frame difference mean array. The stroboscopic light detection module is configured to:
[0058] For each frame difference mean array, a peak search algorithm is used to determine the number of first target peaks in the frame difference mean array; wherein the first target peak is a peak in the frame difference mean array whose peak parameter is greater than a first peak threshold;
[0059] If the number of the first target peaks is less than a first number threshold, it is determined that the first sub-image does not have stroboscopic light. Otherwise, an autocorrelation array of the frame difference mean array is determined according to an autocorrelation function, and the number of second target peaks in the autocorrelation array is determined using the peak search algorithm. The second target peaks are peaks in the frame difference mean array whose peak parameters are greater than a second peak threshold.
[0060] If the number of the second target wave peaks is less than the second number threshold, it is determined that the first sub-image does not have stroboscopic motion; otherwise, it is determined that the first sub-image does have stroboscopic motion.
[0061] In some possible embodiments, before determining the autocorrelation array of the frame difference mean array according to the autocorrelation function, the stroboscopic detection module is further configured to:
[0062] Determine that the number of third target peaks is not less than a third number threshold; wherein the number of the third target peaks is determined according to the following method:
[0063] The Fourier spectrum of the frame difference mean array is determined according to a Fourier transform formula, and the number of the third target peaks in the Fourier spectrum is determined using a peak search algorithm; the third target peak is a peak in the Fourier spectrum whose peak parameter is greater than a third peak threshold.
[0064] In some possible embodiments, before determining the autocorrelation array of the frame difference mean array according to the autocorrelation function, the stroboscopic detection module is further configured to:
[0065] Determine whether a peak width difference of the frame difference mean array is not less than a preset width threshold; wherein the peak width difference is determined according to the following method:
[0066] determining a maximum peak width and a minimum peak width of each of the first target peaks;
[0067] The difference between the maximum peak width and the minimum peak width is taken as the peak width difference.
[0068] In some possible embodiments, the peak parameters include at least: peak height, peak width, and peak protrusion.
[0069] In a third aspect, an embodiment of the present application further provides an electronic device, including:
[0070] processor;
[0071] a memory for storing instructions executable by the processor;
[0072] The processor is configured to execute the instructions to implement any one of the methods provided in the first aspect of the present application.
[0073] In a fourth aspect, an embodiment of the present application further provides a storage medium, which, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute any of the methods provided in the first aspect of the present application.
[0074] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements any of the methods provided in the first aspect of the present application.
[0075] Other features and advantages of the present application will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present application. The purposes and other advantages of the present application can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. Obviously, the drawings introduced below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0077] Figure 1 A schematic diagram of an application scenario shown in an embodiment of the present application;
[0078] Figure 2a This is an overall flow chart of the image stroboscopic detection method shown in an embodiment of the present application;
[0079] Figure 2b This is a schematic diagram of segmented processing shown in an embodiment of the present application;
[0080] Figure 2c This is a schematic diagram of a frame difference mean array shown in an embodiment of the present application;
[0081] Figure 2d This is a schematic diagram of a peak spectrum of a frame difference mean value array shown in an embodiment of the present application;
[0082] Figure 2e This is a schematic diagram of an autocorrelation array peak spectrum shown in an embodiment of the present application;
[0083] Figure 3Another flow chart of the image stroboscopic detection method shown in an embodiment of the present application;
[0084] Figure 4 This is a structural diagram of an image stroboscopic detection device 400 shown in an embodiment of the present application;
[0085] Figure 5 This is a schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0086] The technical solutions in the embodiments of the present application will be described clearly and in detail below with reference to the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, "face" will mean or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0087] In the description of the embodiments of the present application, unless otherwise specified, the term "multiple" refers to two or more, and other quantifiers should be understood similarly. The preferred embodiments described herein are only used to illustrate and explain the present application and are not used to limit the present application. In addition, the embodiments of the present application and the features in the embodiments may be combined with each other if there is no conflict.
[0088] To further illustrate the technical solutions provided by the embodiments of the present application, this is described in detail below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of the present application provide the method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on routine or no creative labor. In steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided by the embodiments of the present application. During the actual processing process or when the control device is executed, the method can be executed in the order of the methods shown in the embodiments or drawings or in parallel.
[0089] As mentioned earlier, traditional flicker detection methods often perform autocorrelation operations on the frame difference mean array of adjacent images, calculate the spectrum value of the power spectrum of the autocorrelation array within a set frequency range, and determine whether flicker exists in the video frame based on the comparison result of the spectrum value with a preset threshold.
[0090] Specifically, in the related art, two adjacent frames of image A and B are first subjected to frame difference processing. A frame difference mean array is determined based on the frame difference images of A and B. An autocorrelation algorithm is then used to determine the autocorrelation array of the frame difference mean array. This autocorrelation array is then Fourier transformed to obtain spectrum values (amp_mean_100 and amp_mean_120) near 100 Hz and 120 Hz. Finally, these spectrum values are compared with pre-calibrated thresholds. If amp_mean_100 is greater than amp_mean_120 and the difference between amp_mean_100 and apm_mean_120 is greater than the specified threshold, the image frame is considered to contain 100 Hz flicker. Similarly, if amp_mean_120 is greater than amp_mean_100 and the difference between amp_mean_120 and amp_mean_100 is greater than the specified threshold, the image frame is considered to contain 120 Hz flicker.
[0091] The above process has two main issues. First, moving objects may produce bright areas in the frame difference image. These bright areas interfere with the calculation of the frame difference mean array, resulting in reduced flicker detection accuracy. Second, in practical applications, light sources are often mixed. The power spectrum peak of the frame difference mean array may be affected by ambient light and may be far from the set frequency range, thus reducing flicker detection accuracy and recall.
[0092] To solve the above problems, the inventive concept of the present application is as follows: based on a preset number of columns, the first image and the second image are segmented and processed respectively to obtain multiple first sub-images of the first image and multiple second sub-images of the second image. The second sub-image having the same pixel coordinates as the first sub-image is used as the image to be processed. For each first sub-image, the frame difference mean array of the first sub-image is determined according to the image brightness of the first sub-image and the image brightness of the image to be processed corresponding to the first sub-image. The above process is to reduce the influence of moving objects on the accuracy of stroboscopic detection by segmenting the image and performing stroboscopic detection on each sub-image obtained after segmentation. And based on the peak parameters in each frame difference mean array, it is determined whether the first image has stroboscopic detection to improve the accuracy and recall rate of stroboscopic detection.
[0093] The image stroboscopic detection method in the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0094] See also Figure 1 , is a schematic diagram of an application environment according to an embodiment of the present application.
[0095] like Figure 1As shown, the application environment may include, for example, a network 10, a server 20, at least one monitoring device 30, and a terminal device 40. The monitoring device 30 is used to monitor the monitoring area in real time and send the monitoring video to the server 20 via the network 10. The monitoring device 30 may include Figure 1 Various surveillance cameras such as 30_1, 30_2 and 30_n are shown in the figure.
[0096] The terminal device 40 can send a request to browse the surveillance video to the server 20. In response to the request, the server 20 issues an image transmission command to the monitoring device 30 via the network 10. The monitoring device 30 responds to the image transmission command and uploads the video frames of the monitored area in real time. The uploaded images are then displayed on the terminal device 40 via the network 10.
[0097] In some possible embodiments, the monitoring device 30 performs stroboscopic detection on the collected video frame images in real time, and performs stroboscopic removal operations on the video frame images with stroboscopic images.
[0098] The description of this application only details a single server or terminal device. However, those skilled in the art should understand that the server 20, monitoring device 30, and terminal device 40 shown are intended to represent the server, monitoring device, and terminal device for displaying monitoring images involved in the technical solution of this application. The detailed description of a single server and terminal device is at least for convenience of explanation and does not imply any limitation on the number, type, or location of terminal devices and servers.
[0099] The following describes in detail an image stroboscopic detection method provided by an embodiment of the present application in conjunction with the accompanying drawings. Figure 2a As shown, the following steps are included:
[0100] Step 201: Segmenting the first image and the second image based on a preset number of columns to obtain a plurality of first sub-images of the first image and a plurality of second sub-images of the second image; wherein the second images are acquired after the first images and have the same size as the first images; and for each first sub-image, there exists a second sub-image with the same pixel coordinates as the first sub-image.
[0101] As mentioned earlier, moving objects may create bright areas in the frame difference image, which can interfere with the calculation of the frame difference mean array. This is primarily because if there is flicker in the image and a moving object, the flicker detection process will mistakenly interpret the flicker as motion, resulting in reduced flicker detection accuracy.
[0102] To solve this problem, when performing stroboscopic detection on the first image, the embodiment of the present application predetermines the second image. The second image is an adjacent frame or a close frame that is acquired after the first image. The specific number of frames of the second image can be limited according to the actual situation. Then, the first image and the second image are segmented based on the preset number of columns. After a large number of tests, it is found that after dividing the image into 3 segments, the interference of moving objects on the accuracy of stroboscopic detection can be basically eliminated. Therefore, the preset number of columns can be set to 3, that is, Figure 2b As shown in the figure, after the first image is divided, the second image is divided into three segments in the same way. Since the first image and the second image have the same size, Figure 2b As shown, each pixel in the first sub-image n obtained by segmentation corresponds to a second sub-image n, where n∈[1, 2, 3]. That is, for each first sub-image, there exists a second sub-image with the same pixel coordinates as the first sub-image. This segmentation operation is used to segment moving objects in video frames. Flicker detection is then performed by comparing sub-images with the same pixel coordinates, thereby reducing the impact of moving objects on flicker detection accuracy.
[0103] The essential reason for the occurrence of flicker is the different total exposure integrals of the image sensor to light. In the overexposed area of the image, even if the total exposure integral of the image sensor is reduced, the overexposed area will not darken due to the image sensor phenomenon. In the dark area of the image, since the total exposure integral of the image sensor itself is very small, even if the image pixels are reduced due to the flicker phenomenon, the reduction ratio is smaller than that of the normally exposed part. Therefore, after removing the overexposed and dark areas in the image, the image averaging operation can better represent the brightness of the flickering area. Therefore, before executing the above step 201, the frame difference brightness ratio of the first image can be determined in advance, and whether the first image has flicker is determined based on the comparison result of the frame difference brightness ratio and the preset ratio threshold. This judgment method is used to determine whether there is flicker in the video frame image under a relatively still picture.
[0104] During implementation, target pixels in the first and second images whose brightness falls within a preset brightness range are first identified, and a mask image is constructed based on the target pixels. Specifically, after determining the target pixels, a binary mask image can be constructed based on the pixel coordinates of the target pixels. This is to remove overexposed and underexposed pixels from the image data and generate a mask image. A first intermediate image is then determined based on the product of the brightness of the mask image and the pixels at the same position in the first image, and a second intermediate image is determined based on the product of the brightness of the mask image and the pixels at the same position in the second image. Finally, frame difference processing is performed on the first and second intermediate images to generate a frame difference image. The ratio of the image brightness of the frame difference image to the image brightness of the first intermediate image is used as the frame difference brightness ratio. If this frame difference brightness ratio is less than a preset ratio threshold, it can be determined that the first image does not exhibit stroboscopic effects.
[0105] Step 202: For each first sub-image, determine a frame difference mean array of the first sub-image based on the image brightness of the first sub-image and the image brightness of a to-be-processed image corresponding to the first sub-image; wherein the to-be-processed image is a second sub-image having the same pixel coordinates as the first sub-image;
[0106] During implementation, for each pixel in each row of pixels in the first sub-image, the brightness difference between the pixel and a target point is determined; the target point is the point in the image to be processed that is located at the same position as the pixel. Based on the brightness difference of each pixel, the mean brightness of the row of pixels is determined. After determining the mean brightness of each row of pixels in this manner, the mean brightness of each row of pixels is used as each digit in the frame difference mean array to construct the frame difference mean array.
[0107] Specific as Figure 2c As shown, Figure 2c The first sub-image shown includes three rows of pixels, A1 to A3. Row A1 includes six pixels, a1 to a6. Taking a1 as an example, determine the pixel b1 corresponding to a1 in the image to be processed, and determine the brightness difference h1 between a1 and b1. The brightness differences h2 to h6 corresponding to a2 to a6 are obtained in the same manner. The sum of h1 to h6 is then divided by the number of pixels in row A1 (i.e., a1 to a6, which is 6) to obtain the average brightness value H1 for row A1. This method yields the average brightness values H1 to H3 for A1 to A3 in the first sub-image. The resulting array of frame difference averages for the first sub-image is {H1, H2, H3}.
[0108] Step 203: Determine whether the first image has stroboscopic effects based on the peak parameters in each of the frame difference mean value arrays.
[0109] During implementation, a peak search algorithm can be used to determine peak parameters in each frame difference mean array, and based on the peak parameters, it can be determined whether the first sub-image corresponding to the frame difference mean array exhibits stroboscopic motion. If any of the first sub-images exhibits stroboscopic motion, then it is determined that the first image exhibits stroboscopic motion; otherwise, it is determined that the first image does not exhibit stroboscopic motion.
[0110] In some possible embodiments, the peak parameters include at least: peak height, peak width, and peak protrusion.
[0111] Specifically, for each frame difference mean array, a peak search algorithm is used to determine the number of first target peaks in the frame difference mean array. The first target peak is a peak in the frame difference mean array whose peak parameter is greater than the first peak threshold. If the number of first target peaks detected is less than the first number threshold, it can be determined that there is no flicker in the first sub-image. Otherwise, it is necessary to determine the autocorrelation array of the frame difference mean array based on the autocorrelation function, and use the peak search algorithm to determine the number of second target peaks in the autocorrelation array; the second target peak is a peak in the frame difference mean array whose peak parameter is greater than the second peak threshold. The reason is that noise will affect the peak image of the frame difference mean array, resulting in an increase in the number of first target peaks. Therefore, the autocorrelation array of the frame difference mean array can be determined based on the autocorrelation function to achieve the purpose of noise reduction. The peak image of the frame difference mean array can be as follows Figure 2d As shown, the peak image of the autocorrelation array of the frame difference mean array can be shown as Figure 2e shown.
[0112] Extensive testing has shown that when an image exhibits stroboscopic effects, both the number of first and second target peaks is greater than or equal to 3. Therefore, if the number of first target peaks detected is less than 3, it can be determined that the first sub-image does not exhibit stroboscopic effects. Otherwise, the autocorrelation array of the frame difference mean array is taken to perform noise reduction on the frame difference mean array. If the number of second peaks in the autocorrelation array is still greater than 3, stroboscopic effects are detected in the first sub-image. In this case, stroboscopic effects can be determined for the first sub-image without performing stroboscopic detection on other first sub-images.
[0113] Furthermore, given the relatively high computational complexity and time consumption of the autocorrelation array, before determining whether flicker is present in the first sub-image based on the autocorrelation array, the Fourier spectrum of the frame difference mean array can be determined using the Fourier transform formula. A peak search algorithm can then be used to determine the number of third target peaks in the Fourier spectrum. Extensive testing has shown that if an image lacks flicker, its Fourier spectrum typically lacks peaks, so the third target peak threshold can be set to 1. If the number of third target peaks is less than the third threshold, flicker can be determined for the first sub-image, eliminating the need for further testing.
[0114] If the number of third target peaks is not less than the third threshold, further testing is performed to determine whether the peak width difference in the frame difference mean array is less than a preset width threshold. Specifically, if the number of third target peaks is not less than the third threshold, the maximum and minimum peak widths of each first target peak are determined, and the difference between the maximum and minimum peak widths is used as the peak width difference. If the peak width difference is less than the preset width threshold, stroboscopic activity is determined in the first sub-image. Otherwise, a final stroboscopic test is performed on the first sub-image using the autocorrelation array.
[0115] The above process segments the image and performs stroboscopic detection on each segmented sub-image to reduce the impact of moving objects on stroboscopic detection accuracy. The presence of stroboscopic motion in the first image is determined based on the peak parameters in the mean array of frame differences, thereby improving stroboscopic detection accuracy and recall.
[0116] To facilitate understanding of how to perform stroboscopic detection on the first image in the technical solution of this application, the embodiment of this application provides a complete process of the stroboscopic detection process, specifically as follows: Figure 3 As shown, the following steps are included:
[0117] Step 301: Determine a mask image for the first image and the second image, determine a first intermediate image based on the product of the brightness of the mask image and the pixel points at the same position in the first image, and determine a second intermediate image based on the product of the brightness of the mask image and the pixel points at the same position in the second image.
[0118] Step 302: performing frame difference processing on the first intermediate image and the second intermediate image to obtain a frame difference image, and taking the ratio of the image brightness of the frame difference image to the image brightness of the first intermediate image as the frame difference brightness ratio.
[0119] Step 303: Determine whether the frame difference brightness ratio is less than a preset ratio threshold.
[0120] Step 304: If the ratio is less than a preset ratio threshold, it is preliminarily determined that the first image has stroboscopic effects.
[0121] Step 305: If the ratio is not less than the preset threshold, the first image and the second image are segmented based on a preset number of columns to obtain a plurality of first sub-images and a plurality of second sub-images. For each first sub-image, an array of frame difference mean values is determined based on the brightness of the first sub-image and the brightness of the corresponding image to be processed.
[0122] Step 306: For each frame difference mean value array, a peak search algorithm is used to determine the number of first target peaks in the frame difference mean value array.
[0123] Step 307: Determine whether the number of first target peaks is less than a first number threshold.
[0124] Step 308: If the number is not less than the first threshold, determine the Fourier spectrum of the frame difference mean array according to the Fourier transform formula, and use a peak search algorithm to determine the number of the third target peaks in the Fourier spectrum. Otherwise, execute the above step 304.
[0125] Step 309: Determine whether the third target peak quantity is less than a third quantity threshold.
[0126] Step 310: If it is not less than the third quantity threshold, determine the maximum peak width and the minimum peak width of each first target peak, and use the difference between the maximum peak width and the minimum peak width as the peak width difference. Otherwise, execute the above step 304.
[0127] Step 311: Determine whether the peak width difference is less than a preset width threshold.
[0128] Step 312: If it is not less than the preset width threshold, then determine the autocorrelation array of the frame difference mean array according to the autocorrelation function, and use the peak search algorithm to determine the number of second target peaks in the autocorrelation array. Otherwise, execute the following step 314.
[0129] Step 313: Determine whether the second target peak number is less than a second number threshold. If not, execute the following step 314; otherwise, execute the above step 304.
[0130] Step 314: Preliminarily determine whether the first sub-image has stroboscopic effects.
[0131] Step 315: Determine a final stroboscopic detection result for the first sub-image by combining the stroboscopic detection results of the first two frames. Specifically, since the stroboscopic detection results of adjacent video frames should be identical, to improve stroboscopic detection accuracy, after initially determining the stroboscopic detection result for the first sub-image, the final stroboscopic detection result for the first sub-image can be determined by combining the stroboscopic detection results of the first two frames. For example, if the preliminary stroboscopic detection result for the first sub-image indicates the presence of stroboscopic light, while the stroboscopic detection results of the first two frames indicate the absence of stroboscopic light, the final stroboscopic detection result for the first sub-image indicates the absence of stroboscopic light.
[0132] Through the above steps 301 to 315, it can be determined whether each first sub-image in the first image has flicker. If any first sub-image has flicker, it indicates that the first image has flicker, and the flicker detection of the first image can be terminated at this time. Otherwise, after all first sub-images are detected, the flicker detection result of the first image is determined based on the final flicker detection result of each first sub-image.
[0133] In addition, considering that the stroboscopic stripes have a relatively slow scrolling speed in the video frame image, in this case, if adjacent frame images are used for comparison (i.e., the first image and the second image mentioned above), it may lead to the problem that the stroboscopic stripes with a relatively slow scrolling speed cannot be detected. To solve this problem, the second image when executing step 301 can be an adjacent frame image of the first image, and the acquisition timing of the second image is after the first image. If, after passing step 315, it is determined that the stroboscopic detection result of the first image is that there is no stroboscopic, a third image whose acquisition timing is after the second image and is similar to the first image can be selected. The third image is used to replace the second image, and the above steps 301 to 315 are repeated. If the detection results obtained by the first and third images through the above process indicate that there is no stroboscopic in the first image, it can be determined that there is no stroboscopic in the first image. Otherwise, it means that there are stroboscopic stripes with a relatively slow scrolling speed in the first image.
[0134] Based on the same inventive concept, the embodiment of the present application further provides an image stroboscopic detection device 400, specifically as follows Figure 4 Shown, including:
[0135] The segmentation processing module 401 is configured to perform segmentation processing on the first image and the second image based on a preset number of columns, thereby obtaining a plurality of first sub-images of the first image and a plurality of second sub-images of the second image; wherein the second images are acquired after the first images and have the same size as the first images; and for each first sub-image, there exists a second sub-image with the same pixel coordinates as the first sub-image;
[0136] An array determining module 402 is configured to determine, for each first sub-image, a frame difference mean array of the first sub-image based on the image brightness of the first sub-image and the image brightness of a to-be-processed image corresponding to the first sub-image; wherein the to-be-processed image is a second sub-image having the same pixel coordinates as the first sub-image;
[0137] The stroboscopic detection module 403 is configured to determine whether the first image has stroboscopic frequency based on the peak parameters in each of the frame difference mean value arrays.
[0138] In some possible embodiments, before performing the segmentation processing on the first image and the second image based on the preset number of columns, the segmentation processing module 401 is further configured to:
[0139] Determine whether a frame difference brightness ratio of the first image is not less than a preset ratio threshold; wherein the frame difference brightness ratio is determined according to the following method:
[0140] Determining target pixels in the first image and the second image whose brightness is within a preset brightness range, and constructing a mask image based on the target pixels;
[0141] Determining a first intermediate image based on the product of the brightness of the mask image and the pixel at the same position in the first image, and determining a second intermediate image based on the product of the brightness of the mask image and the pixel at the same position in the second image;
[0142] Frame difference processing is performed on the first intermediate image and the second intermediate image to obtain a frame difference image, and a ratio of the image brightness of the frame difference image to the image brightness of the first intermediate image is used as the frame difference brightness ratio.
[0143] In some possible embodiments, when determining the frame difference mean array of the first sub-image based on the image brightness of the first sub-image and the image brightness of the to-be-processed image corresponding to the first sub-image, the array determining module 402 is configured to:
[0144] For each pixel point in each row of pixels in the first sub-image, determine a brightness difference between the pixel point and a target point; wherein the target point is a point in the image to be processed at the same position as the pixel point;
[0145] Determine the average brightness of the pixels in the row according to the brightness difference of each pixel;
[0146] The frame difference mean value array is determined according to the brightness mean value of each row of pixels.
[0147] In some possible embodiments, to determine whether the first image has stroboscopic information based on the peak parameters in the frame difference mean array, the stroboscopic detection module 403 is configured to:
[0148] Determining peak parameters in each frame difference mean array according to a peak search algorithm, and determining whether a first sub-image corresponding to the frame difference mean array has stroboscopic frequency according to the peak parameters;
[0149] If any of the first sub-images has stroboscopic effect, it is determined that the first image has stroboscopic effect; otherwise, it is determined that the first image has no stroboscopic effect.
[0150] In some possible embodiments, the peak search algorithm is executed to determine peak parameters in each frame difference mean array, and based on the peak parameters of each frame difference mean array, it is determined whether stroboscopic light exists in the first sub-image corresponding to the frame difference mean array. The stroboscopic light detection module 403 is configured to:
[0151] For each frame difference mean array, a peak search algorithm is used to determine the number of first target peaks in the frame difference mean array; wherein the first target peak is a peak in the frame difference mean array whose peak parameter is greater than a first peak threshold;
[0152] If the number of the first target peaks is less than a first number threshold, it is determined that the first sub-image does not have stroboscopic light. Otherwise, an autocorrelation array of the frame difference mean array is determined according to an autocorrelation function, and the number of second target peaks in the autocorrelation array is determined using the peak search algorithm. The second target peaks are peaks in the frame difference mean array whose peak parameters are greater than a second peak threshold.
[0153] If the number of the second target wave peaks is less than the second number threshold, it is determined that the first sub-image does not have stroboscopic motion; otherwise, it is determined that the first sub-image does have stroboscopic motion.
[0154] In some possible embodiments, before determining the autocorrelation array of the frame difference mean array according to the autocorrelation function, the stroboscopic detection module 403 is further configured to:
[0155] Determine that the number of third target peaks is not less than a third number threshold; wherein the number of the third target peaks is determined according to the following method:
[0156] The Fourier spectrum of the frame difference mean array is determined according to a Fourier transform formula, and the number of the third target peaks in the Fourier spectrum is determined using a peak search algorithm; the third target peak is a peak in the Fourier spectrum whose peak parameter is greater than a third peak threshold.
[0157] In some possible embodiments, before determining the autocorrelation array of the frame difference mean array according to the autocorrelation function, the stroboscopic detection module 403 is further configured to:
[0158] Determine whether a peak width difference of the frame difference mean array is not less than a preset width threshold; wherein the peak width difference is determined according to the following method:
[0159] determining a maximum peak width and a minimum peak width of each of the first target peaks;
[0160] The difference between the maximum peak width and the minimum peak width is taken as the peak width difference.
[0161] In some possible embodiments, the peak parameters include at least: peak height, peak width, and peak protrusion.
[0162] Refer to the following Figure 5 The electronic device 130 according to this embodiment of the present application is described. Figure 5 The electronic device 130 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.
[0163] like Figure 5As shown, the electronic device 130 is a general electronic device. Components of the electronic device 130 may include, but are not limited to, the at least one processor 131, the at least one memory 132, and a bus 133 connecting different system components (including the memory 132 and the processor 131).
[0164] Bus 133 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, and a processor or local bus using any of a variety of bus architectures.
[0165] The memory 132 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 1321 and / or a cache memory 1322 , and may further include a read-only memory (ROM) 1323 .
[0166] The memory 132 may also include a program / utility 1325 having a set (at least one) of program modules 1324, such program modules 1324 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0167] The electronic device 130 may also communicate with one or more external devices 134 (e.g., a keyboard, pointing device, etc.), one or more devices that enable a user to interact with the electronic device 130, and / or any device that enables the electronic device 130 to communicate with one or more other electronic devices (e.g., a router, a modem, etc.). Such communication may occur via an input / output (I / O) interface 135. Furthermore, the electronic device 130 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 136. As shown, the network adapter 136 communicates with other modules of the electronic device 130 via a bus 133. It should be understood that, although not shown, other hardware and / or software modules may be used in conjunction with the electronic device 130, including but not limited to microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0168] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 132 including instructions, and the instructions can be executed by the processor 131 of the apparatus 400 to perform the above method. Alternatively, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0169] In an exemplary embodiment, a computer program product is further provided, including a computer program / instruction. When the computer program / instruction is executed by the processor 131, an image stroboscopic detection method as provided in the present application is implemented.
[0170] In an exemplary embodiment, various aspects of an image stroboscopic detection method provided by the present application may also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of an image stroboscopic detection method according to various exemplary embodiments of the present application described above in this specification.
[0171] The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0172] The program product for image stroboscopic detection according to an embodiment of the present application may be a portable compact disc read-only memory (CD-ROM) and include program code, and may be run on an electronic device. However, the program product of the present application is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0173] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0174] Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0175] The program code for performing the operations of the present application can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "Like" or similar programming languages. The program code can be executed entirely on the user electronic device, partially on the user device, as a separate software package, partially on the user electronic device and partially on a remote electronic device, or entirely on the remote electronic device or server. In cases involving remote electronic devices, the remote electronic device can be connected to the user electronic device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external electronic device (for example, using an Internet service provider to connect through the Internet).
[0176] It should be noted that although several units or subunits of the device are mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, depending on the embodiment of the application, the features and functions of two or more units described above can be embodied in a single unit. Conversely, the features and functions of a single unit described above can be further divided and embodied by multiple units.
[0177] Furthermore, although the operations of the method of the present application are described in a particular order in the accompanying drawings, this does not require or imply that the operations must be performed in this particular order, or that all illustrated operations must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0178] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0179] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable image scaling device to produce a machine, so that the instructions executed by the processor of the computer or other programmable image scaling device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0180] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable image scaling device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, the instruction device being implemented in the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0181] These computer program instructions may also be loaded onto a computer or other programmable image scaling device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide for implementing the process described in the flow. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0182] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.
[0183] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.
Claims
1. A method for detecting image stroboscopic light, characterized in that: The method comprises: Segmenting the first image and the second image based on a preset number of columns to obtain a plurality of first sub-images of the first image and a plurality of second sub-images of the second image; wherein the second images are acquired after the first images and have the same size as the first images; and for each first sub-image, there exists a second sub-image with the same pixel coordinates as the first sub-image; For each first sub-image, determining a frame difference mean array for the first sub-image based on the image brightness of the first sub-image and the image brightness of an image to be processed corresponding to the first sub-image; wherein the image to be processed is a second sub-image having the same pixel coordinates as the first sub-image; determining whether the first image has stroboscopic patterns based on peak parameters in each of the frame difference mean value arrays; Before segmenting the first image and the second image based on the preset number of columns, the method further includes: determining that a frame difference brightness ratio of the first image is not less than a preset ratio threshold; The frame difference brightness ratio is determined according to the following method: Acquire target pixels whose brightness is within a preset brightness range from the first image and the second image, and construct a mask image based on the target pixels; Determine a first intermediate image based on the product of the brightness of the mask image and the pixel at the same position in the first image, and determine a second intermediate image based on the product of the brightness of the mask image and the pixel at the same position in the second image; Frame difference processing is performed on the first intermediate image and the second intermediate image to obtain a frame difference image, and a ratio of the image brightness of the frame difference image to the image brightness of the first intermediate image is used as the frame difference brightness ratio.
2. The method according to claim 1, characterized in that The determining of the frame difference mean array of the first sub-image according to the image brightness of the first sub-image and the image brightness of the to-be-processed image corresponding to the first sub-image includes: For each pixel point in each row of pixels in the first sub-image, determine a brightness difference between the pixel point and a target point; wherein the target point is a point in the image to be processed at the same position as the pixel point; Determine the average brightness of the pixels in the row according to the brightness difference of each pixel; The frame difference mean value array is determined according to the brightness mean value of each row of pixels.
3. The method according to claim 1, characterized in that The determining whether the first image has stroboscopic motion based on the peak parameters in each of the frame difference mean value arrays includes: Determining peak parameters in each frame difference mean array according to a peak search algorithm, and determining whether a first sub-image corresponding to the frame difference mean array has stroboscopic frequency according to the peak parameters; If any of the first sub-images has stroboscopic effect, it is determined that the first image has stroboscopic effect; otherwise, it is determined that the first image has no stroboscopic effect.
4. The method according to claim 3, characterized in that The method of determining peak parameters in each frame difference mean array based on a peak search algorithm, and determining whether a first sub-image corresponding to each frame difference mean array has stroboscopic light according to the peak parameters of each frame difference mean array, includes: For each frame difference mean array, a peak search algorithm is used to determine the number of first target peaks in the frame difference mean array; wherein the first target peak is a peak in the frame difference mean array whose peak parameter is greater than a first peak threshold; If the number of the first target peaks is less than a first number threshold, it is determined that the first sub-image does not have stroboscopic light. Otherwise, an autocorrelation array of the frame difference mean array is determined according to an autocorrelation function, and the number of second target peaks in the autocorrelation array is determined using the peak search algorithm. The second target peaks are peaks in the frame difference mean array whose peak parameters are greater than a second peak threshold. If the number of the second target wave peaks is less than the second number threshold, it is determined that the first sub-image does not have stroboscopic motion; otherwise, it is determined that the first sub-image does have stroboscopic motion.
5. The method according to claim 4, characterized in that Before determining the autocorrelation array of the frame difference mean value array according to the autocorrelation function, the method further includes: Determine that the number of third target peaks is not less than a third number threshold; wherein the number of the third target peaks is determined according to the following method: The Fourier spectrum of the frame difference mean array is determined according to a Fourier transform formula, and the number of the third target peaks in the Fourier spectrum is determined using a peak search algorithm; the third target peak is a peak in the Fourier spectrum whose peak parameter is greater than a third peak threshold.
6. The method according to claim 5, characterized in that Before determining the autocorrelation array of the frame difference mean value array according to the autocorrelation function, the method further includes: Determine whether a peak width difference of the frame difference mean array is not less than a preset width threshold; wherein the peak width difference is determined according to the following method: determining a maximum peak width and a minimum peak width of each of the first target peaks; The difference between the maximum peak width and the minimum peak width is taken as the peak width difference.
7. The method according to any one of claims 1 to 6, characterized in that: The peak parameters include at least: peak height, peak width and peak protrusion.
8. An image stroboscopic detection device, characterized in that: The device comprises: a segmentation processing module configured to perform segmentation processing on the first image and the second image based on a preset number of columns, respectively, to obtain a plurality of first sub-images of the first image and a plurality of second sub-images of the second image; wherein the second images are acquired after the first images, and the second images have the same size as the first images; and for each first sub-image, there exists a second sub-image with the same pixel coordinates as the first sub-image; an array determination module configured to determine, for each first sub-image, a frame difference mean array of the first sub-image based on the image brightness of the first sub-image and the image brightness of a to-be-processed image corresponding to the first sub-image; wherein the to-be-processed image is a second sub-image having the same pixel coordinates as the first sub-image; a stroboscopic detection module configured to determine whether the first image has stroboscopic patterns based on peak parameters in each of the frame difference mean value arrays; The segmentation processing model is further configured to: before segmenting the first image and the second image based on a preset number of columns, determine that a frame difference brightness ratio of the first image is not less than a preset ratio threshold; The frame difference brightness ratio is determined according to the following method: Determining target pixels in the first image and the second image whose brightness is within a preset brightness range, and constructing a mask image based on the target pixels; Determining a first intermediate image based on the product of the brightness of the mask image and the pixel at the same position in the first image, and determining a second intermediate image based on the product of the brightness of the mask image and the pixel at the same position in the second image; Frame difference processing is performed on the first intermediate image and the second intermediate image to obtain a frame difference image, and a ratio of the image brightness of the frame difference image to the image brightness of the first intermediate image is used as the frame difference brightness ratio.
9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Flicker detection method and device thereof
CN101567977A
Image segmentation method and device and storage medium
CN110211086A
Video flicker determination method and device, equipment and storage medium
CN114202519A