Stroboscopic detection method and device

By acquiring and calculating the pixel value difference between two grayscale images, a target grayscale image is generated to detect flicker, solving the problem of increased sensor cost and achieving efficient and accurate flicker detection.

CN114650413BActive Publication Date: 2026-02-10BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011521847.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-21
Publication Date
2026-02-10
Estimated Expiration
2040-12-21

AI Technical Summary

Technical Problem

In existing technologies, electronic devices need to be equipped with sensors to detect flicker, which increases production costs and hinders widespread adoption.

Method used

By acquiring two grayscale images, calculating the difference in pixel values ​​at the same pixel positions in the two grayscale images, generating a target grayscale image, and determining the flicker detection result based on the pixel value information of the target grayscale image.

Benefits of technology

It achieves flicker detection without increasing the production cost of electronic devices, and its operation is simple, with high detection accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114650413B_ABST
    Figure CN114650413B_ABST
Patent Text Reader

Abstract

The present disclosure provides a stroboscopic detection method and device. The method comprises: acquiring two frames of grayscale images, the two frames of grayscale images being determined by at least two frames of preview images generated continuously; calculating the difference value of the pixel values at the same pixel position in the two frames of grayscale images; taking the difference value as the pixel value of the target grayscale image at the same pixel position to obtain a target grayscale image; determining the stroboscopic detection result for the at least two frames of preview images according to the pixel value information in the target grayscale image; using the above method for stroboscopic detection does not increase the production cost of the electronic device, and has the characteristics of simple operation, etc., and is beneficial to promotion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer communication technology, and in particular to a flicker detection method and apparatus. Background Technology

[0002] When an electronic device turns on its camera, it controls the shutter to be pressed to expose the image captured by the camera. After one exposure, a preview image is obtained and displayed on the screen. When the camera's exposure time is not an integer multiple of the light emission frequency of the light source, the preview image will show alternating bright and dark stripes, i.e., the preview image will flicker.

[0003] In related technologies, sensors with flicker detection capabilities are installed within electronic devices to detect whether flicker occurs in preview images. However, installing sensors within electronic devices increases production costs and hinders widespread adoption. Therefore, those skilled in the art urgently need to develop a novel flicker detection method. Summary of the Invention

[0004] To overcome the problems existing in related technologies, this disclosure provides a flicker detection method and apparatus.

[0005] According to a first aspect of the present disclosure, a flicker detection method is provided, the method comprising:

[0006] Two grayscale images are acquired, wherein the two grayscale images are determined by at least two consecutively generated preview images;

[0007] Calculate the difference between pixel values ​​at the same pixel position in the two grayscale images, and use the difference as the pixel value at the same pixel position in the target grayscale image to obtain the target grayscale image;

[0008] Based on the pixel value information in the target grayscale image, determine the flicker detection result for the at least two preview images.

[0009] Optionally, determining the flicker detection result for the at least two preview images based on the pixel value information in the target grayscale image includes:

[0010] Determine the statistical value of the pixel value of each row of pixels in the target grayscale image, and determine the sorting position of the statistical value of each row of pixels in a one-dimensional array based on the row number of each row of pixels;

[0011] Based on the sorting position of each statistical value in the one-dimensional array, sort the statistical values ​​to obtain the one-dimensional array;

[0012] According to the data arrangement order of the one-dimensional array, multiple target subarrays that meet the single effective flash condition are sequentially determined from the one-dimensional array. Each target subarray includes consecutive positive numbers and consecutive non-positive numbers after them, or each target subarray includes consecutive negative numbers and consecutive non-negative numbers after them.

[0013] The flicker detection result is determined based on the amount of data included in each target subarray.

[0014] Optionally, determining multiple target subarrays that meet the single-effective strobe condition from the one-dimensional array sequentially includes:

[0015] A subarray is determined from the one-dimensional array, the subarray comprising consecutive positive numbers followed by consecutive non-positive numbers, or the subarray comprising consecutive negative numbers followed by consecutive non-negative numbers;

[0016] Calculate a first ratio of the number of positive or negative numbers to the total number of data included in the subarray, determine whether the first ratio satisfies a preset ratio condition, and in response to the first ratio satisfying the preset ratio condition, determine the subarray as a target subarray;

[0017] or,

[0018] Divide the total number of rows of pixels included in the target grayscale image by the total number, multiply the division result by the preset occurrence duration of one effective strobe, determine whether the multiplication result is less than or equal to the preset exposure duration corresponding to a frame of preview image, and in response to the multiplication result being less than or equal to the preset exposure duration, determine the subarray as a target data.

[0019] or,

[0020] Determine whether the first ratio satisfies the preset ratio condition, and determine whether the multiplication result is less than or equal to the preset exposure time. In response to the first ratio satisfying the preset ratio condition and the multiplication result being less than or equal to the preset exposure time, the subarray is determined as a target subarray.

[0021] Optionally, the method further includes:

[0022] Divide the total number of data in all identified target subarrays by the total number of rows of pixels in a single frame of preview image;

[0023] Determine whether the obtained target division result is greater than or equal to a preset value. In response to the target division result being greater than or equal to the preset value, determine the flicker detection result for the at least two preview images based on the number of data included in each target subarray.

[0024] Optionally, determining the flicker detection result for the at least two preview images based on the number of data included in each target subarray includes:

[0025] For any two adjacent target subarrays, determine the quantitative relationship between the data included in the two target subarrays.

[0026] The flicker detection result is determined based on the identified multiple quantitative relationships.

[0027] Optionally, determining the flicker detection result based on the determined multiple quantitative relationships includes any one of the following:

[0028] Determine whether the number of quantities that conform to the preset quantity relationship among the plurality of quantity relationships is greater than or equal to the preset number; in response to the number of quantities that conform to the preset quantity relationship being greater than or equal to the preset number, determine that the two-frame preview images are flickering.

[0029] Determine the number of quantities that conform to the preset quantity relationship among the plurality of quantity relationships, determine the ratio of the quantity to the total number of the plurality of quantity relationships, determine whether the ratio is greater than or equal to a preset value, and in response to the ratio being greater than or equal to the preset value, determine that the two-frame preview images exhibit flickering.

[0030] Optionally, acquiring two grayscale images includes at least one of the following:

[0031] Obtain the grayscale images of two consecutively generated preview frames;

[0032] Acquire multiple consecutively generated preview images, obtain a grayscale image based on a portion of the preview images, and obtain another grayscale image based on another portion of the preview images.

[0033] According to a second aspect of the present disclosure, a flicker detection device is provided, the device comprising:

[0034] The grayscale image acquisition module is configured to acquire two grayscale images, which are determined by at least two consecutively generated preview images;

[0035] The pixel value calculation module is configured to calculate the difference between pixel values ​​at the same pixel position in the two grayscale images, and use the difference as the pixel value at the same pixel position in the target grayscale image to obtain the target grayscale image.

[0036] The flicker detection module is configured to determine the flicker detection result for the at least two preview images based on the pixel value information in the target grayscale image.

[0037] Optionally, the flicker detection module includes:

[0038] The sorting position determination submodule is configured to determine the statistical value of the pixel value of each row of pixels in the target grayscale image, and determine the sorting position of the statistical value of each row of pixels in a one-dimensional array based on the row number of each row of pixels.

[0039] The one-dimensional array obtaining submodule is configured to sort the statistical values ​​according to their sorting positions in the one-dimensional array to obtain the one-dimensional array;

[0040] The target subarray obtaining submodule is configured to sequentially determine multiple target subarrays that meet the single effective flash condition from the one-dimensional array according to the data arrangement order of the one-dimensional array. Each target subarray includes consecutive positive numbers and consecutive non-positive numbers after them, or each target subarray includes consecutive negative numbers and consecutive non-negative numbers after them.

[0041] The flicker detection submodule is configured to determine the flicker detection result based on the number of data included in each target subarray.

[0042] Optionally, the target subarray obtaining submodule includes:

[0043] A subarray obtaining unit is configured to determine a subarray from the one-dimensional array, the subarray comprising consecutive positive numbers followed by consecutive non-positive numbers, or the subarray comprising consecutive negative numbers followed by consecutive non-negative numbers;

[0044] The ratio determination unit is configured to calculate a first ratio between the number of positive or negative numbers and the total number of data included in the subarray, determine whether the first ratio satisfies a preset ratio condition, and, in response to the first ratio satisfying the preset ratio condition, determine the subarray as a target subarray; or...

[0045] The exposure duration determination unit is configured to divide the total number of rows of pixels included in the target grayscale image by the total number of pixels, multiply the division result by a preset occurrence duration of one effective strobe, determine whether the multiplication result is less than or equal to a preset exposure duration corresponding to a frame of preview image, and, in response to the multiplication result being less than or equal to the preset exposure duration, determine the subarray as a target data; or,

[0046] The condition judgment unit is configured to determine whether the first ratio satisfies a preset ratio condition and whether the multiplication result is less than or equal to the preset exposure time. In response to the first ratio satisfying the preset ratio condition and the multiplication result being less than or equal to the preset exposure time, the subarray is determined as a target subarray.

[0047] Optionally, the device further includes:

[0048] The quantity calculation module is configured to divide the total number of data included in all identified target subarrays by the total number of rows of pixels included in a single frame of preview image;

[0049] The result comparison module is configured to determine whether the obtained target division result is greater than or equal to a preset value, and in response to the target division result being greater than or equal to the preset value, to determine the flicker detection result for the at least two frames of preview images based on the number of data included in each target subarray.

[0050] Optionally, the flicker detection submodule includes:

[0051] The ratio calculation unit is configured to determine the quantitative relationship between the data included in any two adjacent target subarrays.

[0052] The flicker detection unit is configured to determine the flicker detection result based on a plurality of determined quantitative relationships.

[0053] Optionally, the flicker detection unit includes any one of the following:

[0054] The first flicker detection subunit is configured to determine whether the number of the plurality of quantitative relationships that conform to a preset quantitative relationship is greater than or equal to a preset number, and in response to the number of the number that conforms to the preset quantitative relationship being greater than or equal to the preset number, to determine that flicker occurs in the two-frame preview images;

[0055] The second flicker detection subunit is configured to determine the number of quantities that conform to the preset quantity relationship among the plurality of quantity relationships, determine the ratio of the quantity to the total number of the plurality of quantity relationships, determine whether the ratio is greater than or equal to a preset value, and determine that flicker occurs in the two-frame preview image in response to the ratio being greater than or equal to the preset value.

[0056] Optionally, the grayscale image acquisition module includes at least one of the following:

[0057] The first grayscale image acquisition submodule is configured to acquire grayscale images of two consecutively generated preview images;

[0058] The second grayscale image acquisition submodule is configured to acquire multiple consecutively generated preview images, obtain a grayscale image based on a portion of the preview images, and obtain another grayscale image based on another portion of the preview images.

[0059] According to a third aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the method described in any one of the first aspects above.

[0060] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising:

[0061] processor;

[0062] Memory used to store processor-executable instructions;

[0063] The processor is configured as follows:

[0064] Two grayscale images are acquired, wherein the two grayscale images are determined by at least two consecutively generated preview images;

[0065] Calculate the difference between pixel values ​​at the same pixel position in the two grayscale images, and use the difference as the pixel value at the same pixel position in the target grayscale image to obtain the target grayscale image;

[0066] Based on the pixel value information in the target grayscale image, determine the flicker detection result for the at least two preview images.

[0067] The technical solutions provided in this disclosure can include the following beneficial effects:

[0068] In this embodiment, two grayscale images are acquired, determined by at least two consecutively captured preview images. The difference between pixel values ​​at the same pixel position in the two grayscale images is calculated, and this difference is used as the pixel value at the corresponding same pixel position in the target grayscale image, thus obtaining the target grayscale image. Based on the pixel value information in the target grayscale image, the flicker detection result for the two preview images is determined. Using the above method for flicker detection does not increase the production cost of electronic devices and has the advantages of simple computation, making it conducive to widespread adoption.

[0069] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0070] Figure 1 This is a flowchart illustrating a flicker detection method according to an exemplary embodiment;

[0071] Figure 2This is a flowchart illustrating another flicker detection method according to an exemplary embodiment;

[0072] Figure 3 This is a block diagram illustrating a flicker detection device according to an exemplary embodiment;

[0073] Figure 4 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment. Detailed Implementation

[0074] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0075] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.

[0076] It should be understood that although the terms first, second, third, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, without departing from the scope of this disclosure, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0077] Figure 1 This is a flowchart illustrating a flicker detection method according to an exemplary embodiment. Figure 1 The method shown is applied to an electronic device, and the method includes:

[0078] In step 101, two grayscale images are acquired, which are determined by at least two consecutively generated preview images.

[0079] An electronic device is equipped with a camera and uses the camera to take pictures. After the camera is turned on, the electronic device controls the shutter to be pressed. Each time the shutter is pressed, an exposure is performed, generating a preview image, which is then displayed on the screen. The electronic device obtains multiple consecutively generated preview images by pressing the shutter multiple times. For example, the electronic device can immediately press the shutter once after turning on the camera, and then press the shutter at preset time intervals.

[0080] In some scenarios, electronic devices trigger the shutter to be pressed at preset time intervals. The preset time is very short, so that the content of the two preview images obtained after the shutter is pressed twice in a row is basically the same.

[0081] The logarithmic relationship between white and black is used to divide the spectrum into several levels, known as grayscale. Grayscale can be divided into 256 levels. An image represented using grayscale is called a grayscale image. Electronic devices obtain two grayscale images based on at least two consecutively generated preview images.

[0082] In one embodiment, there are several ways to acquire two grayscale images. For example, the first method is to acquire grayscale images of two consecutively generated preview images.

[0083] For example, a preview image is an RGB image, which is composed of an R channel image, a G channel image, and a B channel image, and each channel image is a grayscale image. This step allows you to obtain the same channel image from two preview images.

[0084] For example, a preview image is an RGB image. In an RGB image, a pixel at a certain position has an R pixel value, a G pixel value, and a B pixel value. The R pixel value, G pixel value, and B pixel value are counted, and the resulting pixel value is used as the pixel value of the pixel at that position in the grayscale image, thus obtaining the grayscale image of the preview image.

[0085] The grayscale image of the preview image can be obtained using existing methods, and the embodiments disclosed herein will not be described in detail here.

[0086] The second method involves an electronic device acquiring multiple consecutively generated preview images, obtaining a grayscale image based on a portion of the preview images, and obtaining another grayscale image based on another portion of the preview images.

[0087] The continuously generated preview images can be divided into two parts according to the order in which they are generated, with one part of the preview images being generated earlier than the other part.

[0088] When a portion of the preview image includes at least two preview images, the average pixel value at the same pixel position in the at least two preview images can be calculated. This average value is then used as the pixel value at the corresponding same pixel position in a target preview image, thus obtaining a target preview image. A grayscale image of the target preview image can be obtained using the method described in the first approach above.

[0089] When another part of the preview image includes at least two preview images, another target preview image can be obtained by following the above method, and then a grayscale image of the other target preview image can be obtained.

[0090] In one embodiment, the electronic device can store the generated preview image in a preset space and retrieve at least two consecutively generated preview images from the preset space. For example, the electronic device can establish a correspondence between the preview image and its generation time, store the correspondence in the preset space, and retrieve two consecutively generated preview images from the preset space by identifying the generation time in different correspondences within the preset space.

[0091] In step 102, the difference between the pixel values ​​at the same pixel position in the two grayscale images is calculated, and the difference is used as the pixel value at the same pixel position in the target grayscale image to obtain the target grayscale image.

[0092] The two grayscale images are the same size. For each pixel value in one grayscale image, calculate the difference between the pixel value at that pixel position and the pixel value at the same pixel position in the other grayscale image. Use this difference as the pixel value at that pixel position in the target grayscale image. After completing the calculation for each pixel position, the target grayscale image is obtained.

[0093] In step 103, the flicker detection results for at least two preview images are determined based on the pixel value information in the target grayscale image.

[0094] Pixel value information can indicate the changes in pixel values ​​in the target grayscale image. Based on the changes in pixel values ​​in the target grayscale image, the flicker detection results for at least two preview images can be determined.

[0095] The flicker detection results for at least two preview images include: flickering in at least two preview images, or flickering not occurring in at least two preview images.

[0096] If flickering is detected in at least two preview images, the flickering in subsequent preview images can be eliminated by adjusting the exposure time, thereby eliminating the bright and dark stripes in the subsequent preview images and improving the image quality of the preview images.

[0097] In one embodiment, Figure 2This is a flowchart illustrating another flicker detection method according to an exemplary embodiment, see [link to flowchart]. Figure 2 The electronic device determines the operation based on the pixel value information in the target grayscale image for the flicker detection results of at least two preview images, which can be achieved in the following way:

[0098] In step 201, the statistical value of the pixel value of each row of pixels in the target grayscale image is determined, and the sorting position of the statistical value of each row of pixels in the one-dimensional array is determined according to the row number of each row of pixels.

[0099] The target grayscale image consists of multiple rows of pixels. For any row of pixels, after calculating the statistical values ​​of multiple pixel values ​​for that row, the row number of that row is determined as the sorting position of the statistical value in the one-dimensional array.

[0100] By statistically analyzing the multiple pixel values ​​of each row of pixels, a statistical value is obtained.

[0101] For example, if the target grayscale image consists of M rows of pixels, after calculating the statistical value N1 of multiple pixel values ​​in the first row, N1 is determined to be the first position in the one-dimensional array. After calculating the statistical value N2 of multiple pixel values ​​in the second row, N2 is determined to be the second position in the one-dimensional array, and so on. After calculating the statistical value N... of multiple pixel values ​​in the Mth row... M Next, determine N. M It is the Mth position in a one-dimensional array.

[0102] There are various statistical values ​​for multiple pixel values, such as the arithmetic mean of multiple pixel values, the geometric mean of multiple pixel values, and the maximum value of multiple pixel values.

[0103] In step 202, the statistical values ​​are sorted according to their sorting positions in the one-dimensional array to obtain the one-dimensional array.

[0104] For example, based on the sorting position of each of the above M statistical values ​​in the one-dimensional array, the M statistical values ​​are sorted to obtain a one-dimensional array (N1, N2, ..., N...). M ).

[0105] In step 203, according to the data arrangement order of the one-dimensional array, multiple target subarrays that meet the single effective strobe condition are determined sequentially from the one-dimensional array. Each target subarray includes consecutive positive numbers and consecutive non-positive numbers that follow them, or each target subarray includes consecutive negative numbers and consecutive non-negative numbers that follow them.

[0106] A single effective flicker is a flicker that occurs within one light emission cycle of the light source. For example, if the light emission frequency of the light source is 50Hz and the light wave is a sine wave, and the lower part of the sine wave is flipped to the top, the light emission frequency of the light source is 100Hz, and one light emission cycle of the light source is 10ms, then a single effective flicker is a flicker that occurs within one light emission cycle of the light source, which is 10ms.

[0107] During the exposure process, the captured image is exposed line by line. If a single effective flicker occurs, bright and dark stripes with a certain regularity will appear in the corresponding area of ​​the preview image.

[0108] The single-flash condition is a condition set for a single effective flash. When the target subarray meets the single-flash condition, the changes in the pixel values ​​of the multiple rows used to generate the target subarray in the target grayscale image conform to the changes in pixel values ​​when a single effective flash occurs.

[0109] For any data in a one-dimensional array, it may not appear in different target subarrays at the same time.

[0110] In one embodiment, the operation of an electronic device sequentially determining multiple target subarrays that meet the single effective strobe condition from a one-dimensional array can be implemented in the following way:

[0111] From a one-dimensional array, a subarray is determined, which includes consecutive positive numbers and consecutive non-positive numbers following them. A first ratio is calculated between the number of positive numbers in the subarray and the total number of data in the subarray. It is determined whether the first ratio satisfies a preset ratio condition. In response to the first ratio satisfying the preset ratio condition, the subarray is determined as a target subarray.

[0112] Alternatively, a subarray can be determined from a one-dimensional array, the subarray comprising consecutive negative numbers and consecutive non-negative numbers thereafter, a first ratio of the number of negative numbers in the subarray to the total number of data in the subarray can be calculated, whether the first ratio satisfies a preset ratio condition can be determined, and in response to the first ratio satisfying the preset ratio condition, the subarray can be determined as a target subarray.

[0113] If the first ratio calculated for a subarray meets the preset ratio condition, it is determined that a single effective flash occurred when the image region corresponding to the subarray was exposed, and the subarray is determined as a target subarray.

[0114] If it is determined that the first ratio does not meet the preset ratio condition, then the next subarray following the first subarray in the one-dimensional array is judged to determine whether the next subarray meets the preset ratio condition.

[0115] A single effective flicker occurs within one light emission cycle of the light source. Within one light emission cycle, a portion of the light emitted by the light source has high energy, which corresponds to bright stripes in the preview image, while the other portion of the light emitted has low energy, which corresponds to dark stripes in the preview image. Within the area of ​​the screen corresponding to a single effective flicker in the preview image, the widths of the bright stripes and the dark stripes are in a certain proportion.

[0116] In a one-dimensional array, each data point is generated from the pixel values ​​of a row of pixels. A positive number indicates that the area containing the pixel that generated the positive number in the preview image displays a bright stripe, while a non-positive number indicates that the area containing the pixel that generated the non-positive number in the preview image displays a dark stripe.

[0117] Typically, the width of each row of pixels in a preview image is fixed and uniform. When a subarray contains N1 consecutive positive numbers and N2 consecutive non-positive numbers, it can be determined that within the image region corresponding to that subarray in the preview image, the ratio of the width of the bright stripes to the width of the image region is... The ratio of the width of the dark stripes to the width of the image area is

[0118] The preset ratio condition can be for The conditions set. For example... Alternatively, the preset ratio condition can be for... The conditions set. For example...

[0119] In one embodiment, the operation of an electronic device sequentially determining multiple target subarrays that meet the single effective strobe condition from a one-dimensional array can be implemented in the following way:

[0120] A subarray is determined from a one-dimensional array. The subarray consists of consecutive positive numbers followed by consecutive non-positive numbers, or consecutive negative numbers followed by consecutive non-negative numbers. The total number of rows of pixels in the target grayscale image is divided by the total number of data in the subarray. The result of the division is multiplied by the preset duration of one effective strobe. It is determined whether the result of the multiplication is less than or equal to the preset exposure duration corresponding to a frame of preview image. In response to the result of the multiplication being less than or equal to the preset exposure duration, the subarray is determined as a target data.

[0121] Assume that the number of consecutive positive numbers in a subarray is N1, the number of consecutive non-positive numbers is N2, the total number of rows of pixel values ​​included in the target grayscale image is M, the preset duration of one effective strobe is T1, and the preset exposure duration corresponding to one frame of preview image is T2.

[0122] A preview image is an image obtained by the electronic device after exposing and processing a single frame of an image captured by the camera. The preset exposure time T2 corresponding to a preview image is the duration required to expose and process that single frame. The formula is: When a subarray satisfies the conditions defined by the above formula, the subarray is determined as a target subarray.

[0123] The preset duration T1 of an effective strobe can be determined based on the emission period of the light source. For example, if the emission frequency of the light source is 100Hz and one emission period of the light source is 10ms, the preset duration T1 of an effective strobe is 10ms.

[0124] The preset exposure time T2 for a single frame of preview image can be determined based on the hardware performance of the electronic device and user requirements. The preset exposure time for a single frame of preview image can be 15ms, 30ms, 40ms, 50ms, 70ms, or 100ms, etc. When the preset exposure time for a single frame of preview image is 100ms, the display performance of the electronic device is relatively poor.

[0125] In this embodiment, for a subarray, when the product result is less than or equal to the preset exposure time, it is determined that the exposure time of the entire image meets the preset exposure time requirement and there will be no exposure timeout. At this time, a subarray is determined as a target subarray.

[0126] In one embodiment, the methods in the two embodiments above can be combined to sequentially determine multiple target subarrays that meet the single effective strobe condition from a one-dimensional array.

[0127] The electronic device can determine whether the first ratio satisfies the preset ratio condition and whether the multiplication result is less than or equal to the preset exposure time T2 corresponding to a preview image frame. In response to the first ratio satisfying the preset ratio condition and the multiplication result being less than or equal to the preset exposure time T2, a subarray is determined as a target subarray.

[0128] For example, if a subarray simultaneously satisfies and Then a subarray is defined as a target subarray.

[0129] Compared to using a single judgment condition to determine the target subarray from a one-dimensional array, this embodiment combines two judgment conditions to make the determination result of the target subarray more accurate, and ultimately improves the accuracy of the flicker detection result.

[0130] In step 204, the flicker detection results for at least two preview images are determined based on the amount of data included in each target subarray.

[0131] In one embodiment, multiple target subarrays that meet the single effective strobe condition are sequentially determined from the one-dimensional array according to the data arrangement order of the one-dimensional array.

[0132] For any two adjacent target subarrays, determine the quantitative relationship of the data included in the two target subarrays, and based on the determined quantitative relationships, determine the flicker detection result for at least two preview images.

[0133] There are many types of quantitative relationships. For example, a quantitative relationship may include at least one of the following: the ratio of the number of data in one target subarray to the number of data in another target subarray, or the difference between the number of data in one target subarray and the number of data in another target subarray.

[0134] When the quantitative relationship includes the ratio of the number of data in one target subarray to the number of data in another target subarray, for any two adjacent target subarrays, the ratio of the number of data in the first target subarray to the number of data in the second target subarray can be calculated, or the ratio of the number of data in the second set of data to the number of data in the first set of data can be calculated.

[0135] For example, following the data arrangement order of a one-dimensional array, target subarrays A, B, C, D, and E are determined sequentially from the one-dimensional array. The number of data elements in target subarray A is S1, in target subarray B is S2, in target subarray C is S3, in target subarray D is S4, and in target subarray E is S5. The calculation... and and Used to determine the results of strobe detection.

[0136] There are multiple ways to determine the flicker detection result based on the established quantitative relationships.

[0137] The first method: Determine whether the number of multiple quantitative relationships that conform to the preset quantitative relationship is greater than or equal to the preset number. In response to the number of the number that conforms to the preset quantitative relationship being greater than or equal to the preset number, determine that the two preview images are flickering.

[0138] For example, the quantitative relationship includes the ratio of the number of data contained in one target subarray to the number of data contained in another target subarray. A preset quantitative relationship includes a range of ratios. In this case, it can be determined whether the number of ratios falling within a first preset ratio range is greater than or equal to a preset number among all calculated ratios. In response to the number of ratios falling within the first preset ratio range being greater than or equal to the preset number, it is determined that flickering occurs in the two preview images.

[0139] The size of the first preset ratio range can be set according to needs and experience. For example, the first preset ratio range is [0.6, 1.5]. For example, determine... and If both frames fall within [0.6, 1.5], then flickering is detected in both preview images.

[0140] For example, the quantitative relationship includes the difference between the number of data items in one target subarray and the number of data items in another target subarray. A preset quantitative relationship includes a range of these differences. In this case, the number of differences among all calculated differences that fall within a first preset range can be determined. If this number exceeds a threshold, flickering in the two preview images is determined.

[0141] The size of the first preset difference range can be set according to needs and experience.

[0142] The second method is to determine the number of quantities that conform to the preset quantity relationship among multiple quantity relationships, determine the ratio of this quantity to the total quantity of multiple quantity relationships, determine whether the ratio is greater than or equal to the preset value, and determine that flickering occurs in the two preview images in response to the ratio being greater than or equal to the preset value.

[0143] For example, the quantitative relationship includes the ratio of the number of data contained in one target subarray to the number of data contained in another target subarray. The preset quantitative relationship includes a range of ratios. In this case, a first number of target ratios falling within a second preset ratio range is determined from all calculated ratios. This first number is divided by the total number of all ratios. It is then determined whether the calculation result is greater than or equal to a preset value. In response to the calculation result being greater than or equal to the preset value, flickering is detected in the two preview images.

[0144] The size of the second preset ratio range can be set according to needs and experience. For example, the second preset ratio range is [0.6, 1.5].

[0145] For example, the quantitative relationship includes the difference between the number of data contained in one target subarray and the number of data contained in another target subarray. The preset quantitative relationship includes a range of these differences. In this case, a second number of target differences falling within a second preset difference range is determined from all calculated differences. This second number is divided by the total number of all ratios. It is then determined whether the calculation result is greater than or equal to a preset value. In response to the calculation result being greater than or equal to the preset value, flickering is detected in the two preview images.

[0146] The size of the second preset difference range can be set according to needs and experience.

[0147] In one embodiment, the electronic device may further determine whether the target division result is greater than or equal to a preset value after determining all target subarrays from the one-dimensional array and dividing the total number of data included in all target subarrays by the total number of rows of pixels included in a frame preview image.

[0148] The electronic device will only determine the flicker detection result for at least two preview images based on the amount of data included in each target subarray if the target division result is greater than or equal to a preset value. Once the electronic device determines that the target division result is less than the preset value, it will determine that no flicker occurred in the two preview images.

[0149] The preset values ​​in this embodiment can be set according to needs and experience. For example, the preset values ​​are 0.5, 0.6, 0.75, 0.8, etc.

[0150] By using the method provided in this embodiment, the accuracy of flicker detection results is improved.

[0151] In one embodiment, the electronic device performs flicker detection in the following manner:

[0152] Obtain the grayscale images of two consecutively generated preview images, calculate the difference between the pixel values ​​at the same pixel position in the two grayscale images, and use the difference as the pixel value at the same pixel position in the target grayscale image to obtain the target grayscale image.

[0153] Determine the arithmetic mean of the pixel values ​​of each row in the target grayscale image. Based on the row number of each row, determine the sorting position of the arithmetic mean of the pixel values ​​of each row in the one-dimensional array. Sort the arithmetic means according to their sorting positions in the one-dimensional array to obtain the one-dimensional array.

[0154] Combined use and Two judgment conditions are used to determine the target subarray from the one-dimensional array. For any two adjacent target subarrays, the ratio of the number of data in the first target subarray to the number of data in the second target subarray is calculated. When all the calculated ratios fall within [0.6, 1.5], it is determined that the two preview images are flickering.

[0155] Experimental results show that the flicker detection method provided in this embodiment takes about 0.3ms. For scenes with flicker, the probability of correctly detecting flicker from the preview image is greater than 96%. For scenes without flicker, the probability of incorrectly detecting flicker from the preview image is less than 1%.

[0156] The method provided in this embodiment has the advantages of simple operation and high accuracy.

[0157] In this embodiment, two grayscale images are acquired, determined by at least two consecutively captured preview images. The difference between pixel values ​​at the same pixel position in the two grayscale images is calculated, and this difference is used as the pixel value at the corresponding same pixel position in the target grayscale image, thus obtaining the target grayscale image. Based on the pixel value information in the target grayscale image, the flicker detection result for the two preview images is determined. Using the above method for flicker detection does not increase the production cost of electronic devices and has the advantages of simple computation, making it conducive to widespread adoption.

[0158] For the foregoing method embodiments, in order to simplify the description, they are all described as a series of actions. However, those skilled in the art should know that this disclosure is not limited to the described order of actions, because according to this disclosure, some steps may be performed in other orders or simultaneously.

[0159] Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by this disclosure.

[0160] Corresponding to the aforementioned application function implementation method embodiments, this disclosure also provides embodiments of application function implementation apparatus and corresponding electronic devices.

[0161] Figure 3 This is a block diagram of a flicker detection device according to an exemplary embodiment. The device is applied to an electronic device and includes: a grayscale image acquisition module 31, a pixel value calculation module 32, and a flicker detection module 33; wherein,

[0162] The grayscale image acquisition module 31 is configured to acquire two grayscale images, which are determined by at least two consecutively generated preview images.

[0163] The pixel value calculation module 32 is configured to calculate the difference between pixel values ​​at the same pixel position in the two grayscale images, and use the difference as the pixel value at the same pixel position in the target grayscale image to obtain the target grayscale image.

[0164] The flicker detection module 33 is configured to determine the flicker detection result for the at least two preview images based on the pixel value information in the target grayscale image.

[0165] In an optional embodiment, in Figure 3 Based on the flicker detection device shown, the flicker detection module 33 may include: a sorting position determination submodule, a one-dimensional array acquisition submodule, a target subarray acquisition submodule, and a flicker detection submodule; wherein...

[0166] The sorting position determination submodule is configured to determine the statistical value of the pixel value of each row of pixels in the target grayscale image, and determine the sorting position of the statistical value of each row of pixels in a one-dimensional array based on the row number of each row of pixels.

[0167] The one-dimensional array obtaining submodule is configured to sort each statistical value according to its sorting position in the one-dimensional array to obtain the one-dimensional array;

[0168] The target subarray obtaining submodule is configured to sequentially determine multiple target subarrays that meet the single effective flash condition from the one-dimensional array according to the data arrangement order of the one-dimensional array. Each target subarray includes consecutive positive numbers and consecutive non-positive numbers after them, or each target subarray includes consecutive negative numbers and consecutive non-negative numbers after them.

[0169] The flicker detection submodule is configured to determine the flicker detection result based on the number of data included in each target subarray.

[0170] In an optional embodiment, the target subarray acquisition submodule may include: a subarray acquisition unit and a ratio judgment unit; wherein,

[0171] The subarray obtaining unit is configured to determine a subarray from the one-dimensional array, the subarray comprising consecutive positive numbers and consecutive non-positive numbers thereafter, or the subarray comprising consecutive negative numbers and consecutive non-negative numbers thereafter.

[0172] The ratio judgment unit is configured to calculate a first ratio between the number of positive or negative numbers and the total number of data included in the subarray, determine whether the first ratio satisfies a preset ratio condition, and, in response to the first ratio satisfying the preset ratio condition, determine the subarray as a target subarray.

[0173] In an optional embodiment, the target subarray acquisition submodule may include: a subarray acquisition unit and an exposure duration determination unit; wherein,

[0174] The subarray obtaining unit is configured to determine a subarray from the one-dimensional array, the subarray comprising consecutive positive numbers and consecutive non-positive numbers thereafter, or the subarray comprising consecutive negative numbers and consecutive non-negative numbers thereafter.

[0175] The exposure duration determination unit is configured to divide the total number of rows of pixels included in the target grayscale image by the total number, multiply the division result by the preset occurrence duration of one effective strobe, determine whether the multiplication result is less than or equal to the preset exposure duration corresponding to a frame of preview image, and determine the subarray as a target data in response to the multiplication result being less than or equal to the preset exposure duration.

[0176] In an optional embodiment, the target subarray acquisition submodule may include: a subarray acquisition unit and a condition judgment unit; wherein,

[0177] The subarray obtaining unit is configured to determine a subarray from the one-dimensional array, the subarray comprising consecutive positive numbers and consecutive non-positive numbers thereafter, or the subarray comprising consecutive negative numbers and consecutive non-negative numbers thereafter.

[0178] The condition judgment unit is configured to determine whether the first ratio satisfies a preset ratio condition and whether the multiplication result is less than or equal to the preset exposure time. In response to the first ratio satisfying the preset ratio condition and the multiplication result being less than or equal to the preset exposure time, the subarray is determined as a target subarray.

[0179] In an optional embodiment, the apparatus may further include: a quantity calculation module and a result comparison module; wherein,

[0180] The quantity calculation module is configured to divide the total number of data included in all determined target subarrays by the total number of rows of pixels included in a frame of preview image;

[0181] The result comparison module is configured to determine whether the obtained target division result is greater than or equal to a preset value, and in response to the target division result being greater than or equal to the preset value, to determine the flicker detection result for the at least two frames of preview images based on the number of data included in each target subarray.

[0182] In an optional embodiment, the flicker detection submodule may include: a ratio calculation unit and a flicker detection unit; wherein,

[0183] The ratio calculation unit is configured to determine the quantitative relationship between the data included in any two adjacent target subarrays.

[0184] The flicker detection unit is configured to determine the flicker detection result based on a plurality of determined quantitative relationships.

[0185] In an optional embodiment, the flicker detection unit may include any one of the following: a first flicker detection subunit and a second flicker detection subunit; wherein,

[0186] The first flicker detection subunit is configured to determine whether the number of the plurality of quantitative relationships that conform to a preset quantitative relationship is greater than or equal to a preset number, and in response to the number of the number that conforms to the preset quantitative relationship being greater than or equal to the preset number, to determine that flicker occurs in the two-frame preview image;

[0187] The second flicker detection subunit is configured to determine the number of quantities that conform to the preset quantity relationship among the plurality of quantity relationships, determine the ratio of the quantity to the total number of the plurality of quantity relationships, determine whether the ratio is greater than or equal to a preset value, and determine that flicker occurs in the two-frame preview image in response to the ratio being greater than or equal to the preset value.

[0188] In an optional embodiment, in Figure 3 Based on the flicker detection device shown, the grayscale image acquisition module may include any one of the following: a first grayscale image acquisition submodule and a second grayscale image acquisition submodule; wherein,

[0189] The first grayscale image acquisition submodule is configured to acquire grayscale images of two consecutively generated preview images;

[0190] The second grayscale image acquisition submodule is configured to acquire multiple consecutively generated preview images, obtain a grayscale image based on a portion of the preview images, and obtain another grayscale image based on another portion of the preview images.

[0191] Figure 4This is a schematic diagram illustrating the structure of an electronic device 1600 according to an exemplary embodiment. For example, device 1600 may be a user device, specifically a mobile phone, computer, digital broadcasting electronic device, messaging transceiver, game console, tablet device, medical device, fitness equipment, personal digital assistant, wearable device such as smartwatch, smart glasses, smart bracelet, smart running shoes, etc.

[0192] Reference Figure 4 The device 1600 may include one or more of the following components: a processing component 1602, a memory 1604, a power supply component 1606, a multimedia component 1608, an audio component 1610, an input / output (I / O) interface 1612, a sensor component 1614, and a communication component 1616.

[0193] Processing component 1602 typically controls the overall operation of device 1600, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 1602 may include one or more processors 1620 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 1602 may include one or more modules to facilitate interaction between processing component 1602 and other components. For example, processing component 1602 may include a multimedia module to facilitate interaction between multimedia component 1608 and processing component 1602.

[0194] Memory 1604 is configured to store various types of data to support the operation of device 1600. Examples of this data include instructions for any application or method operating on device 1600, contact data, phonebook data, messages, pictures, videos, etc. Memory 1604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0195] Power supply component 1606 provides power to various components of device 1600. Power supply component 1606 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to device 1600.

[0196] Multimedia component 1608 includes a screen that provides an output interface between the device 1600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 1608 includes a front-facing camera and / or a rear-facing camera. When the device 1600 is in an operating mode, such as an adjustment mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0197] Audio component 1610 is configured to output and / or input audio signals. For example, audio component 1610 includes a microphone (MIC) configured to receive external audio signals when device 1600 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1604 or transmitted via communication component 1616. In some embodiments, audio component 1610 also includes a speaker for outputting audio signals.

[0198] I / O interface 1612 provides an interface between processing component 1602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0199] Sensor assembly 1614 includes one or more sensors for providing status assessments of various aspects of device 1600. For example, sensor assembly 1614 can detect the on / off state of device 1600, the relative positioning of components such as the aforementioned components being the display and keypad of device 1600, environmental detection of changes in the position of device 1600 or a component of device 1600, the presence or absence of user contact with device 1600, the orientation or acceleration / deceleration of device 1600, and temperature changes of device 1600. Sensor assembly 1614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 1614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 1614 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.

[0200] Communication component 1616 is configured to facilitate wired or wireless communication between device 1600 and other devices. Device 1600 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 1616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the aforementioned communication component 1616 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0201] In an exemplary embodiment, the apparatus 1600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.

[0202] In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided, such as a memory 1604 including instructions. When the instructions in the storage medium are executed by the processor 1620 of the device 1600, the device 1600 is enabled to perform a flicker detection method. The method includes: acquiring two grayscale images, the two grayscale images being determined by at least two consecutively generated preview images; calculating the difference between pixel values ​​at the same pixel position in the two grayscale images, using the difference as the pixel value at the same pixel position in a target grayscale image to obtain a target grayscale image; and determining a flicker detection result for the at least two preview images based on pixel value information in the target grayscale image.

[0203] The non-transitory computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0204] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0205] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A flicker detection method, characterized in that, The method includes: Two grayscale images are acquired, wherein the two grayscale images are determined by at least two consecutively generated preview images; Calculate the difference between pixel values ​​at the same pixel position in the two grayscale images, and use the difference as the pixel value at the same pixel position in the target grayscale image to obtain the target grayscale image; Based on the pixel value information in the target grayscale image, the flicker detection result for the at least two frames of preview images is determined, wherein the pixel value information is used to indicate the pixel value changes in the target grayscale image; The step of determining the flicker detection result for the at least two preview images based on the pixel value information in the target grayscale image includes: Determine the statistical value of the pixel value of each row of pixels in the target grayscale image, and determine the sorting position of the statistical value of each row of pixels in a one-dimensional array based on the row number of each row of pixels; Based on the sorting position of each statistical value in the one-dimensional array, sort the statistical values ​​to obtain the one-dimensional array; According to the data arrangement order of the one-dimensional array, multiple target subarrays that meet the single effective flash condition are sequentially determined from the one-dimensional array. Each target subarray includes consecutive positive numbers and consecutive non-positive numbers after them, or each target subarray includes consecutive negative numbers and consecutive non-negative numbers after them. The flicker detection result is determined based on the amount of data included in each target subarray.

2. The method according to claim 1, characterized in that, The step of sequentially determining multiple target subarrays that meet the single effective strobe condition from the one-dimensional array includes: A subarray is determined from the one-dimensional array, the subarray comprising consecutive positive numbers followed by consecutive non-positive numbers, or the subarray comprising consecutive negative numbers followed by consecutive non-negative numbers; Calculate a first ratio of the number of positive or negative numbers to the total number of data included in the subarray, determine whether the first ratio satisfies a preset ratio condition, and in response to the first ratio satisfying the preset ratio condition, determine the subarray as a target subarray; or, Divide the total number of rows of pixels included in the target grayscale image by the total number, multiply the division result by the preset occurrence duration of one effective strobe, determine whether the multiplication result is less than or equal to the preset exposure duration corresponding to a frame of preview image, and in response to the multiplication result being less than or equal to the preset exposure duration, determine the subarray as a target data. or, Determine whether the first ratio satisfies the preset ratio condition, and determine whether the multiplication result is less than or equal to the preset exposure time. In response to the first ratio satisfying the preset ratio condition and the multiplication result being less than or equal to the preset exposure time, the subarray is determined as a target subarray.

3. The method according to claim 1, characterized in that, The method further includes: Divide the total number of data in all identified target subarrays by the total number of rows of pixels in a single frame of preview image; Determine whether the obtained target division result is greater than or equal to a preset value. In response to the target division result being greater than or equal to the preset value, determine the flicker detection result for the at least two preview images based on the number of data included in each target subarray.

4. The method according to claim 1, characterized in that, Determining the flicker detection result for the at least two preview images based on the number of data included in each target subarray includes: For any two adjacent target subarrays, determine the quantitative relationship between the data included in the two target subarrays. The flicker detection result is determined based on the identified multiple quantitative relationships.

5. The method according to claim 4, characterized in that, The determination of the flicker detection result based on the determined multiple quantitative relationships includes any one of the following: Determine whether the number of quantities that conform to the preset quantity relationship among the plurality of quantity relationships is greater than or equal to the preset number; in response to the number of quantities that conform to the preset quantity relationship being greater than or equal to the preset number, determine that the two-frame preview images are flickering. Determine the number of quantities that conform to the preset quantity relationship among the plurality of quantity relationships, determine the ratio of the quantity to the total number of the plurality of quantity relationships, determine whether the ratio is greater than or equal to a preset value, and in response to the ratio being greater than or equal to the preset value, determine that the two-frame preview images exhibit flickering.

6. A flicker detection device, characterized in that, The device includes: The grayscale image acquisition module is configured to acquire two grayscale images, which are determined by at least two consecutively generated preview images; The pixel value calculation module is configured to calculate the difference between pixel values ​​at the same pixel position in the two grayscale images, and use the difference as the pixel value at the same pixel position in the target grayscale image to obtain the target grayscale image. The flicker detection module is configured to determine the flicker detection result for the at least two frames of preview images based on the pixel value information in the target grayscale image, wherein the pixel value information is used to indicate the pixel value changes in the target grayscale image; The flicker detection module includes: The sorting position determination submodule is configured to determine the statistical value of the pixel value of each row of pixels in the target grayscale image, and determine the sorting position of the statistical value of each row of pixels in a one-dimensional array based on the row number of each row of pixels. The one-dimensional array obtaining submodule is configured to sort the statistical values ​​according to their sorting positions in the one-dimensional array to obtain the one-dimensional array; The target subarray obtaining submodule is configured to sequentially determine multiple target subarrays that meet the single effective flash condition from the one-dimensional array according to the data arrangement order of the one-dimensional array. Each target subarray includes consecutive positive numbers and consecutive non-positive numbers after them, or each target subarray includes consecutive negative numbers and consecutive non-negative numbers after them. The flicker detection submodule is configured to determine the flicker detection result based on the number of data included in each target subarray.

7. The apparatus according to claim 6, characterized in that, The target subarray acquisition submodule includes: A subarray obtaining unit is configured to determine a subarray from the one-dimensional array, the subarray comprising consecutive positive numbers followed by consecutive non-positive numbers, or the subarray comprising consecutive negative numbers followed by consecutive non-negative numbers; The ratio determination unit is configured to calculate a first ratio between the number of positive or negative numbers and the total number of data included in the subarray, determine whether the first ratio satisfies a preset ratio condition, and, in response to the first ratio satisfying the preset ratio condition, determine the subarray as a target subarray; or... The exposure duration determination unit is configured to divide the total number of rows of pixels included in the target grayscale image by the total number of pixels, multiply the division result by a preset occurrence duration of one effective strobe, determine whether the multiplication result is less than or equal to a preset exposure duration corresponding to a frame of preview image, and, in response to the multiplication result being less than or equal to the preset exposure duration, determine the subarray as a target data; or, The condition judgment unit is configured to determine whether the first ratio satisfies a preset ratio condition and whether the multiplication result is less than or equal to the preset exposure time. In response to the first ratio satisfying the preset ratio condition and the multiplication result being less than or equal to the preset exposure time, the subarray is determined as a target subarray.

8. The apparatus according to claim 6, characterized in that, The device further includes: The quantity calculation module is configured to divide the total number of data included in all identified target subarrays by the total number of rows of pixels included in a single frame of preview image; The result comparison module is configured to determine whether the obtained target division result is greater than or equal to a preset value, and in response to the target division result being greater than or equal to the preset value, to determine the flicker detection result for the at least two frames of preview images based on the number of data included in each target subarray.

9. The apparatus according to claim 6, characterized in that, The flicker detection submodule includes: The ratio calculation unit is configured to determine the quantitative relationship between the data included in any two adjacent target subarrays. The flicker detection unit is configured to determine the flicker detection result based on a plurality of determined quantitative relationships.

10. The apparatus according to claim 9, characterized in that, The flicker detection unit includes any one of the following: The first flicker detection subunit is configured to determine whether the number of the plurality of quantitative relationships that conform to a preset quantitative relationship is greater than or equal to a preset number, and in response to the number of the number that conforms to the preset quantitative relationship being greater than or equal to the preset number, to determine that flicker occurs in the two-frame preview images; The second flicker detection subunit is configured to determine the number of quantities that conform to the preset quantity relationship among the plurality of quantity relationships, determine the ratio of the quantity to the total number of the plurality of quantity relationships, determine whether the ratio is greater than or equal to a preset value, and determine that flicker occurs in the two-frame preview image in response to the ratio being greater than or equal to the preset value.

11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method of any one of claims 1-5.

12. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured as follows: Two grayscale images are acquired, wherein the two grayscale images are determined by at least two consecutively generated preview images; Calculate the difference between pixel values ​​at the same pixel position in the two grayscale images, and use the difference as the pixel value at the same pixel position in the target grayscale image to obtain the target grayscale image; Based on the pixel value information in the target grayscale image, the flicker detection result for the at least two frames of preview images is determined, wherein the pixel value information is used to indicate the pixel value changes in the target grayscale image; The step of determining the flicker detection result for the at least two preview images based on the pixel value information in the target grayscale image includes: Determine the statistical value of the pixel value of each row of pixels in the target grayscale image, and determine the sorting position of the statistical value of each row of pixels in a one-dimensional array based on the row number of each row of pixels; Based on the sorting position of each statistical value in the one-dimensional array, sort the statistical values ​​to obtain the one-dimensional array; According to the data arrangement order of the one-dimensional array, multiple target subarrays that meet the single effective flash condition are sequentially determined from the one-dimensional array. Each target subarray includes consecutive positive numbers and consecutive non-positive numbers after them, or each target subarray includes consecutive negative numbers and consecutive non-negative numbers after them. The flicker detection result is determined based on the amount of data included in each target subarray.

Citation Information

Patent Citations

  • Picture flicker processing method and device of camera, equipment and storage medium

    CN110445952A