Method and apparatus for detecting phase focus on state
By calculating the brightness difference in the image matrix of the image sensor, the phase focusing status is automatically determined, which solves the problem of low detection efficiency in the existing technology and realizes efficient and accurate phase focusing status detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- KUNSHAN QIUTI PHOTOELECTRIC TECH CO LTD
- Filing Date
- 2022-10-26
- Publication Date
- 2026-04-14
AI Technical Summary
The detection efficiency of phase focusing on the active state in existing technologies is low, relying heavily on manual observation, which leads to inefficiency.
By acquiring the image matrix output by the image sensor, the difference in brightness values between occluded pixels and ordinary pixels is calculated. The brightness difference is used to determine the activation status of phase focusing. Parallel computing and cumulative number judgment are adopted to improve detection accuracy and efficiency.
It enables efficient detection of phase-detection autofocus activation without manual observation, improving detection efficiency and reducing the impact of errors and human judgment.
Smart Images

Figure CN115802022B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of phase focus on / off detection, and more particularly to a method and apparatus for detecting the on / off state of phase focus. Background Technology
[0002] Phase detection autofocus (PDAF) works by reserving some masked pixels on the image sensor specifically for phase detection. It determines the focus offset value by measuring the distance between pixels and their changes, thereby achieving accurate focusing.
[0003] Enabling masked pixels is a crucial step in achieving phase-detection autofocus. A photosensitive sensor typically includes both regular pixels and masked pixels. Masked pixels are distributed across the sensor, usually arranged in pairs (two masked pixels per pair) in a staggered configuration. When activated, these two masked pixels cover half of the pixel's area. This half of the pixel is insensitive, and signal gain is used to compensate for this. Enabling masked pixels does not compensate for their sensitivity; conversely, deactivating them does. In some applications, it's necessary to detect the activation status of phase-detection autofocus to determine if the sensor has automatically enabled it. Current methods often rely on manual visual inspection, resulting in low efficiency.
[0004] Therefore, improving the detection efficiency of phase-detection autofocus activation is a pressing technical problem that needs to be solved. Summary of the Invention
[0005] The present invention provides a method and apparatus for detecting phase focus on state, which is used to improve the detection efficiency of phase focus on state.
[0006] The embodiments of the present invention provide the following solutions:
[0007] In a first aspect, embodiments of the present invention provide a method for detecting the phase-detection autofocus activation state, comprising:
[0008] Obtain the image matrix output by the image sensor, wherein each element of the image matrix corresponds to the brightness value of a pixel;
[0009] Based on the image matrix, the first brightness value of the occluded pixel and the second brightness value of the normal pixel are obtained;
[0010] Determine whether the first brightness difference of the masked pixels is greater than a first preset threshold; wherein, the first brightness difference is the difference between the first brightness value and the second brightness value;
[0011] If so, then the phase focusing of the image sensor is determined to be enabled.
[0012] In one optional embodiment, obtaining a second brightness value for a common pixel based on the image matrix includes:
[0013] Obtain the first pixel coordinates of multiple ordinary pixels in the image matrix;
[0014] The pixel brightness value of each ordinary pixel is determined in the image matrix based on the first pixel coordinates;
[0015] The average value of the plurality of pixel brightness values is determined as the second brightness value.
[0016] In an optional embodiment, obtaining the first pixel coordinates of the plurality of ordinary pixels in the image matrix includes:
[0017] Obtain the format information of the pixel channels in the image matrix and the second pixel coordinates of the occluded pixels;
[0018] Based on the format information and the second pixel coordinates, the first pixel coordinates corresponding to a plurality of ordinary pixels adjacent to the outer periphery of the occluded pixel are determined, wherein the pixel channels of the occluded pixel and the ordinary pixels are the same.
[0019] In an optional embodiment, before obtaining the first brightness value of the occluded pixel and the second brightness value of the ordinary pixel based on the image matrix, the method further includes:
[0020] Obtain the brightness value of each pixel in the image matrix, and obtain the target brightness value of the target pixel and the adjacent brightness values of the pixels adjacent to the target pixel;
[0021] A second brightness difference is obtained based on the difference between the target brightness value and the adjacent brightness values;
[0022] When the second brightness difference is greater than the second set threshold, the target pixel is determined to be the occluded pixel.
[0023] In one optional embodiment, determining that the phase focusing of the image sensor is enabled includes:
[0024] Traverse each of the occluded pixels in the image matrix to obtain the cumulative number of occluded pixels that is greater than the first brightness difference;
[0025] When the accumulated number exceeds a set number, the phase focusing of the image sensor is determined to be enabled.
[0026] In an optional embodiment, the image matrix has multiple pixel channels, and the step of traversing each of the occluded pixels in the image matrix to obtain the cumulative number of occluded pixels greater than the first brightness difference includes:
[0027] Configure the cumulative variable and channel thread for each pixel channel based on the number of channels in the pixel channel;
[0028] Parallel calculations are performed based on the cumulative variable and the corresponding channel thread to obtain the number of single-channel occluded pixels in each pixel channel that are greater than the first brightness difference.
[0029] The cumulative number is obtained by summing the number of all the single channels.
[0030] In an optional embodiment, before determining that the phase focusing of the image sensor is enabled when the accumulated number is greater than a set number, the method further includes:
[0031] Obtain the scaling factor and the number of occluded pixels, wherein the scaling factor represents the proportion of the set number in the number of occluded pixels;
[0032] The set quantity is obtained by multiplying the proportional coefficient by the number of shielding elements.
[0033] Secondly, embodiments of the present invention also provide a detection device for phase focusing on state, comprising:
[0034] The matrix acquisition module is used to acquire the image matrix output by the image sensor, wherein each element of the image matrix corresponds to the brightness value of a pixel.
[0035] A brightness acquisition module is used to obtain a first brightness value of the occluded pixel and a second brightness value of the ordinary pixel based on the image matrix;
[0036] The difference determination module is used to determine whether the first brightness difference of the occluded pixel is greater than a first preset threshold; wherein, the first brightness difference is the difference between the first brightness value and the second brightness value;
[0037] The state determination module is used to determine that the phase focusing of the image sensor is in the enabled state when the first brightness difference of the masked pixels is greater than a first set threshold.
[0038] Thirdly, embodiments of the present invention also provide an electronic device, including a processor and a memory, the memory being coupled to the processor, the memory storing instructions that, when executed by the processor, cause the electronic device to perform the steps of any of the methods described in the first aspect.
[0039] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any one of the first aspects.
[0040] The method and apparatus for detecting the phase focusing activation state of the present invention have the following advantages compared with the prior art:
[0041] The detection method of the present invention obtains the image matrix output by the image sensor, and obtains the first brightness value of the occluded pixel and the second brightness value of the ordinary pixel based on the image matrix. Since the occluded pixel will be partially occluded after the phase focusing of the image sensor is turned on, the brightness value of the occluded pixel is smaller than that of the ordinary pixel. The first brightness difference can be calculated by the difference between the first brightness value and the second brightness value. Therefore, when the first brightness difference of the occluded pixel is greater than a first set threshold, it can be determined that the phase focusing of the image sensor is turned on. This detection process does not require the user to manually observe the image sensor, thereby improving the detection efficiency of the phase focusing turned on state. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 A flowchart illustrating a method for detecting the on state of phase focusing according to an embodiment of the present invention;
[0044] Figure 2 A schematic diagram of the image matrix provided in the embodiments of the present invention. Figure 1 ;
[0045] Figure 2-1 A schematic diagram of the image matrix provided in the embodiments of the present invention. Figure 2 ;
[0046] Figure 3 This is a schematic diagram showing the brightness comparison of phase focusing in the open and closed states according to an embodiment of the present invention;
[0047] Figure 4 This is a flowchart illustrating the operation of the detection method provided in an embodiment of the present invention.
[0048] Figure 5 This is a schematic diagram of a phase focusing activation detection device provided in an embodiment of the present invention. Detailed Implementation
[0049] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention are within the protection scope of the embodiments of the present invention.
[0050] There are various application scenarios that require detection of phase focus activation. For example, in image testing algorithm simulation, phase focus is usually not required to be enabled. Phase focus is often automatically controlled to be enabled or disabled through configuration files. If phase focus is enabled due to configuration file issues, it will affect the final algorithm performance. Relying on human judgment or other means to determine whether phase focus is enabled is extremely inefficient. Improving the efficiency of phase focus activation detection is of great significance. The following embodiments of the present invention will specifically illustrate how to improve the efficiency of phase focus detection.
[0051] Please see Figure 1 , Figure 1 A flowchart of a method for detecting the phase focus on state according to an embodiment of the present invention includes:
[0052] S11. Obtain the image matrix output by the image sensor, wherein each element of the image matrix corresponds to the brightness value of a pixel.
[0053] Specifically, an image sensor utilizes the photoelectric conversion function of optoelectronic devices to convert the light image on the photosensitive surface into an electrical signal proportional to the light image. The image matrix is the image output after the object to be imaged is captured by the image sensor, and each pixel in the image corresponds to a brightness value. The image matrix can be any of the following: a whiteboard RAW (RAW Image Format), a checkerboard chart RAW, or a bar chart RAW. A chart is a black and white pattern, with the black parts used to block the light source. A whiteboard RAW image is a RAW format image taken by the image sensor without a chart in front of the light source; this image is simply called a "whiteboard RAW image." A bar chart RAW image is a RAW format image taken by the image sensor with a bar chart (i.e., black and white lines) in front of the light source; this image is simply called a "bar chart RAW image." The checkerboard chart RAW image is a RAW format image captured by an image sensor with a checkerboard chart (i.e., black and white squares) placed in front of the light source. This image is simply referred to as the "checkerboard chart RAW image". After obtaining the image matrix output by the image sensor, proceed to step S12.
[0054] S12. Based on the image matrix, obtain the first brightness value of the occluded pixel and the second brightness value of the ordinary pixel.
[0055] Specifically, the masked pixels (or PD points) and ordinary pixels are distributed according to the set positions. The masked pixels and ordinary pixels can be determined based on their respective coordinate positions in the image matrix to obtain the first brightness value and the second brightness value. The masked pixel can be any masked pixel among all the masked pixels in the image matrix.
[0056] In practical applications, due to the potential presence of dead pixels in ordinary pixels, or limitations in the image sensor manufacturing process, the brightness value of a single ordinary pixel may be incorrect or inaccurate, leading to inaccurate acquisition of the second brightness value. Therefore, in one specific embodiment, obtaining the second brightness value of an ordinary pixel based on an image matrix includes:
[0057] Obtain the first pixel coordinates of multiple ordinary pixels in the image matrix; determine the pixel brightness value of each ordinary pixel in the image matrix based on the first pixel coordinates; and determine the average value of the multiple pixel brightness values as the second brightness value.
[0058] Specifically, an image matrix is represented in two-dimensional form, but it needs to be stored in computer memory in a one-dimensional linear manner. For example, an image matrix can be represented by an M×N matrix 'a'. A coordinate system is established at the top left corner of the image, where j represents the x-coordinate of a pixel, i represents the y-coordinate of a pixel, and a[i][j] represents the brightness value of a pixel. In a computer, the image is stored in memory as an array, i.e., a set of continuous data buff[M×N]. Assuming the coordinates of the current pixel are (j, i), the brightness values of each pixel in the image are stored sequentially from left to right and from top to bottom in the buff. Therefore, the brightness value of the current pixel is buff[i×N+j], which is the (i×N+j)th element in the buff. Thus, the pixel brightness value of each ordinary pixel can be determined in the image matrix based on the first pixel coordinates of the ordinary pixels. The average of the calculated brightness values of multiple pixels is used as the second brightness value to reduce the impact of errors or inaccuracies in the brightness values of individual ordinary pixels on the accuracy of the second brightness value.
[0059] Since each pixel channel corresponds to a color, the brightness values of different colors will differ under the same brightness. Therefore, if multiple ordinary pixels are in different pixel channels, the second brightness value will be inaccurate due to data confusion. Based on this, in one specific implementation, obtaining the first pixel coordinates of multiple ordinary pixels in the image matrix includes:
[0060] Obtain the format information of the pixel channels in the image matrix and the second pixel coordinates of the occluded pixel; based on the format information and the second pixel coordinates, determine the first pixel coordinates of multiple ordinary pixels adjacent to the occluded pixel, wherein the pixel channels of the occluded pixel and the ordinary pixels are the same.
[0061] For details, please refer to Figure 2 In a RAW image matrix, the format information is represented in the format RGGB, meaning each channel unit S of the image matrix includes pixel channels R, Gr, Gb, and B. Figure 2 The specific arrangement within the image. It can be understood that the format information can be determined based on the pixel channels in the image matrix, or it can be BGGR, GRBG, or GBRG, etc. Please refer to... Figure 2-1 and Figure 3 The masked pixels and normal pixels are arranged in a specific way. In the figure, the pixel channels of B0-B8 are the same. Among them, B0 is the masked pixel and B1-B8 are normal pixels. After the masked pixel B0 is turned on, its brightness will be reduced by about 30% due to the metal masking effect of the masked pixel. Therefore, the first pixel coordinates of normal pixels B1-B8 can be determined by the format information and the second pixel coordinates, and then the second brightness value can be accurately calculated.
[0062] Continuing with the example of an M×N image matrix a, the coordinates of each pixel in the matrix are counted starting from 0. The coordinates of the occluded pixel B0 are (j, i). After determining the position of the pixel, the corresponding brightness value can be output. The brightness value of the normal pixel B1 is buff[(i-2)×N+j], the brightness value of the normal pixel B2 is buff[(i-2)×N+j], the brightness value of the normal pixel B3 is buff[(i+2)×N+j-2], and the brightness value of the normal pixel B4 is buff[(i+2)×N+j-2]. The brightness value of ordinary pixel B5 is buff[i×N+j-2], the brightness value of ordinary pixel B6 is buff[(i-2)×N+j+2], the brightness value of ordinary pixel B7 is buff[(i+2)×N+j], and the brightness value of ordinary pixel B8 is buff[(i+2)×N+j+2]. The brightness value of each ordinary pixel is calculated separately, and the average of these values is the second brightness value.
[0063] In practical applications, since the data represented in the image matrix is the brightness value corresponding to each pixel, the occluded pixel cannot be accurately determined if the coordinates of the occluded pixel are missing. Therefore, in one specific implementation, before obtaining the first brightness value of the occluded pixel and the second brightness value of the ordinary pixel based on the image matrix, the following steps are also included:
[0064] The brightness value of each pixel in the image matrix is obtained, and the target brightness value and the adjacent brightness values of the target pixel are obtained. The second brightness difference is obtained based on the difference between the target brightness value and the adjacent brightness values. When the second brightness difference is greater than a second set threshold, the target pixel is determined to be an occluded pixel.
[0065] Specifically, the target pixel can be any pixel in the image matrix, and the pixels adjacent to the target pixel can be determined based on the reading order of the brightness values in the image matrix, for example, for... Figure 2 The image matrix is read from left to right and from top to bottom. The brightness value of the pixel to the left of the target pixel is determined as the adjacent brightness value to reduce the number of data reading operations. A second brightness difference is obtained based on the difference between the target brightness value and the adjacent brightness values. If the second brightness difference is greater than a second set threshold, it indicates that the brightness value of the target pixel is smaller than that of the surrounding pixels. This may be due to the metal occlusion of the target pixel caused by the activation of phase focusing, resulting in a lower brightness value of the pixel. Therefore, the target pixel is determined to be an occluded pixel. If the second brightness difference is not greater than the second set threshold, it indicates that the target pixel is a normal pixel. The second set threshold can be determined based on the experience of technicians, for example, any value between 5% and 30% of the brightness value of a normal pixel; it can also be determined through calibration experiments, for example, 25% of the brightness value of a normal pixel. After obtaining the first brightness value of the occluded pixel and the second brightness value of the normal pixel, the process proceeds to step S13.
[0066] S13. Determine whether the first brightness difference of the masked pixel is greater than a first set threshold; wherein, the first brightness difference is the difference between the first brightness value and the second brightness value.
[0067] Specifically, the first brightness difference is the brightness difference between the masked pixel and the normal pixel. The second brightness value can be the brightness value of any normal pixel or the average brightness value of multiple normal pixels. Similarly, the first set threshold can be determined based on the experience of technicians or through calibration tests.
[0068] S14. If yes, then the phase focusing of the image sensor is determined to be in the enabled state.
[0069] Specifically, if the first brightness difference is greater than the first set threshold, it indicates that the brightness difference between the occluded pixel and the normal pixel is large, and phase focusing has been enabled. This causes the occluded pixel to have a lower brightness value due to metal occlusion, thus determining that the phase focusing of the image sensor is enabled. Conversely, if the first brightness difference is not greater than the first set threshold, i.e., if not, then the phase focusing of the image sensor is disabled.
[0070] In practical applications, due to the large pixel count of image sensors, there may be dead pixels. If the phase focusing status is determined solely by the brightness difference between a occluded pixel and a normal pixel, the result may be inaccurate due to the influence of dead pixels. Therefore, in one specific implementation, determining that the phase focusing of the image sensor is enabled includes:
[0071] Traverse each occluded pixel in the image matrix to obtain the cumulative number of occluded pixels that are greater than the first brightness difference; when the cumulative number is greater than a set number, determine that the phase focusing of the image sensor is turned on.
[0072] Specifically, the cumulative number represents the total number of occluded pixels in the image matrix that are greater than the first brightness difference. When the cumulative number is greater than a set number, it indicates that a large number of occluded pixels have been activated, which can accurately determine that the phase focusing of the image sensor is enabled. The cumulative number can be set to a fixed value, such as 1000.
[0073] In one specific implementation, the image matrix has multiple pixel channels. By traversing each occluded pixel in the image matrix, the cumulative number of occluded pixels greater than a first brightness difference is obtained, including:
[0074] Configure the cumulative variable and channel thread for each pixel channel based on the number of channels; perform parallel calculations based on the cumulative variable and the corresponding channel thread to obtain the number of occluded pixels in each pixel channel that are greater than the first brightness difference; obtain the cumulative number based on the sum of the numbers of all single channels.
[0075] Specifically, the cumulative variable is used to store the number of occluded pixels in each pixel channel that are greater than the first set threshold. The channel thread is used to calculate the number of occluded pixels in each corresponding pixel channel that are greater than the first set threshold. Multiple channel threads and cumulative variables can be used to perform parallel calculations to calculate the number of occluded pixels in each pixel channel that are greater than the first brightness difference in a single channel in a parallel manner. The sum of these numbers is the cumulative number.
[0076] The following embodiments of the present invention will use the pixel channel of RGGB as an example to provide an example of how to calculate the cumulative quantity.
[0077]
[0078]
[0079] By using parallel threads to calculate the number of masked pixels in each channel that are greater than the first brightness difference, the computational efficiency can be effectively improved, further enhancing the detection efficiency of phase focusing in the active state.
[0080] In practical implementation, if the accumulated number is set to a fixed value, changes in the size of the image matrix may lead to insufficient accuracy in determining the phase focus activation state of the image sensor. In one specific implementation, before determining that the phase focus of the image sensor is activated when the accumulated number exceeds a set number, the following steps are also included:
[0081] Obtain the scaling factor and the number of occluded pixels, where the scaling factor represents the proportion of the set number in the total number of occluded pixels; obtain the set number by multiplying the scaling factor and the number of occluded pixels.
[0082] Specifically, the scaling factor can be set to 10%, or it can be set to other values. The set quantity is obtained by multiplying the scaling factor by the number of occlusions. By setting the scaling factor, the set quantity can be made to follow the number of occlusions, thereby improving the adaptability to image sensors with different resolutions.
[0083] The following embodiments of the present invention will be combined with Figure 4 This paper elaborates on the overall operation flow of the phase focusing on-state detection method. An M×N image matrix is stored in memory buffer. Variables i and count are defined. Variable i stores the vertical coordinate of a pixel and is initially set to 2. Variable count stores the number of occluded pixels that are greater than a first set threshold and is initially set to 0. Variable j is defined to store the horizontal coordinate of a pixel. The brightness values of each pixel g0 in the image matrix are traversed, and the position of g0 in the image matrix is buffer[i×N+j]. The average brightness avg of the surrounding ordinary pixels is calculated. The first brightness difference a = |g0-avg| / g0 is calculated. If a ≥ 25%, variable count is incremented by 1. If a < 25%, the judgment of the current pixel ends, and j is incremented by 1 to proceed to the judgment of the next pixel. If j < M-2, it means the end of the line. Increment i by 1 until all pixel brightness difference calculations are completed. Set the number to 1000. If the variable count (i.e., the cumulative number) is greater than the set number, it means the image sensor has enabled pixel masking, and the phase focusing of the image sensor is confirmed to be on. Otherwise, the phase focusing of the image sensor is off.
[0084] Based on the same inventive concept as the detection method, embodiments of the present invention also provide a device for detecting the phase focusing on state. Please refer to [link to relevant documentation]. Figure 5 ,include:
[0085] The matrix acquisition module 501 is used to acquire the image matrix output by the image sensor, wherein each element of the image matrix corresponds to the brightness value of a pixel.
[0086] The brightness acquisition module 502 is used to obtain a first brightness value of the occluded pixel and a second brightness value of the ordinary pixel based on the image matrix.
[0087] The difference determination module 503 is used to determine whether the first brightness difference of the occluded pixel is greater than a first preset threshold; wherein, the first brightness difference is the difference between the first brightness value and the second brightness value;
[0088] The state determination module 504 is used to determine that the phase focusing of the image sensor is in the on state when the first brightness difference of the occluded pixel is greater than the first set threshold.
[0089] In one optional embodiment, the brightness acquisition module includes:
[0090] The coordinate acquisition submodule is used to acquire the first pixel coordinates of multiple ordinary pixels in the image matrix;
[0091] The first brightness determination submodule is used to determine the pixel brightness value of each of the ordinary pixels in the image matrix based on the first pixel coordinates;
[0092] The second brightness determination submodule is used to determine the average value of the multiple pixel brightness values as the second brightness value.
[0093] In one optional embodiment, the coordinate acquisition submodule includes:
[0094] The information acquisition unit is used to acquire the format information of the pixel channels on the image matrix and the second pixel coordinates of the occluded pixel.
[0095] The coordinate determination unit is used to determine the first pixel coordinates corresponding to a plurality of ordinary pixels adjacent to the outer periphery of the occluded pixel based on the format information and the second pixel coordinates, wherein the occluded pixel and the ordinary pixel have the same pixel channel.
[0096] In an optional embodiment, the detection device further includes:
[0097] A brightness acquisition module is used to acquire the brightness value of each pixel in the image matrix, and to obtain the target brightness value of the target pixel and the adjacent brightness values of the pixels adjacent to the target pixel.
[0098] The difference acquisition module is used to obtain a second brightness difference based on the difference between the target brightness value and the adjacent brightness values;
[0099] The pixel determination module is used to determine the target pixel as the occluded pixel when the second brightness difference is greater than a second set threshold.
[0100] In one optional embodiment, the state determination module includes:
[0101] The first quantity acquisition submodule is used to traverse each of the occluded pixels in the image matrix and obtain the cumulative number of the occluded pixels that is greater than the first brightness difference.
[0102] The state determination submodule is used to determine that the phase focusing of the image sensor is enabled when the accumulated number is greater than a set number.
[0103] In one optional embodiment, the image matrix has multiple pixel channels, and the first quantity obtaining submodule includes:
[0104] A configuration unit is configured to configure the cumulative variable and channel thread for each pixel channel according to the number of channels in the pixel channel;
[0105] The calculation unit is used to perform parallel calculations based on the accumulated variable and the corresponding channel thread to obtain the number of occluded pixels in each pixel channel that is greater than the first brightness difference in a single channel.
[0106] The obtaining unit is used to obtain the cumulative quantity based on the sum of the quantities of all the single channels.
[0107] In an optional embodiment, the state determination module further includes:
[0108] The coefficient acquisition submodule is used to acquire the ratio coefficient and the number of occluded pixels, wherein the ratio coefficient represents the proportion of the set number in the number of occluded pixels;
[0109] The second quantity acquisition submodule is used to obtain the set quantity based on the product of the ratio coefficient and the number of obstructions.
[0110] Based on the same inventive concept as the detection method, embodiments of the present invention also provide an electronic device, including a processor and a memory, wherein the memory is coupled to the processor and stores instructions that, when executed by the processor, cause the electronic device to perform the steps of any of the methods in the detection method.
[0111] Based on the same inventive concept as the detection method, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the detection methods.
[0112] The technical solutions provided in the embodiments of the present invention have at least the following technical effects or advantages:
[0113] The detection method acquires the image matrix output by the image sensor, and obtains the first brightness value of the occluded pixel and the second brightness value of the normal pixel based on the image matrix. Since the occluded pixel will be partially occluded after the phase focusing of the image sensor is turned on, the brightness value of the occluded pixel is smaller than that of the normal pixel. The first brightness difference can be calculated by the difference between the first brightness value and the second brightness value. Therefore, when the first brightness difference of the occluded pixel is greater than a first set threshold, it can be determined that the phase focusing of the image sensor is turned on. This detection process does not require the user to manually observe the image sensor, thereby improving the detection efficiency of the phase focusing turned on state.
[0114] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0115] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (modules, systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0116] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0117] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0118] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.
[0119] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A method for detecting the phase-detection autofocus activation state, characterized in that, include: Obtain an image matrix output by an image sensor, wherein each element of the image matrix corresponds to the brightness value of a pixel; the image matrix is any one of a whiteboard RAW (RAW Image Format), a checkerboard chart RAW, or a bar chart RAW; Based on the image matrix, a first brightness value for the masked pixels and a second brightness value for the ordinary pixels are obtained; the masked pixels and the ordinary pixels are arranged in a specific form; Determine whether the first brightness difference of the masked pixels is greater than a first preset threshold; wherein, the first brightness difference is the difference between the first brightness value and the second brightness value; If so, then the phase focusing of the image sensor is determined to be enabled; Obtaining the second brightness value of ordinary pixels based on the image matrix includes: Obtain the first pixel coordinates of multiple ordinary pixels in the image matrix; The pixel brightness value of each ordinary pixel is determined in the image matrix based on the first pixel coordinates; The average value of the plurality of pixel brightness values is determined as the second brightness value.
2. The method for detecting the phase focusing on state according to claim 1, characterized in that, Obtaining the first pixel coordinates of multiple ordinary pixels in the image matrix includes: Obtain the format information of the pixel channels in the image matrix and the second pixel coordinates of the occluded pixels; Based on the format information and the second pixel coordinates, the first pixel coordinates corresponding to a plurality of ordinary pixels adjacent to the outer periphery of the occluded pixel are determined, wherein the pixel channels of the occluded pixel and the ordinary pixels are the same.
3. The method for detecting the phase focusing on state according to claim 1, characterized in that, Before obtaining the first brightness value of the occluded pixel and the second brightness value of the ordinary pixel based on the image matrix, the method further includes: Obtain the brightness value of each pixel in the image matrix, and obtain the target brightness value of the target pixel and the adjacent brightness values of the pixels adjacent to the target pixel; A second brightness difference is obtained based on the difference between the target brightness value and the adjacent brightness values; When the second brightness difference is greater than the second set threshold, the target pixel is determined to be the occluded pixel.
4. The method for detecting the phase focusing on state according to claim 1, characterized in that, The step of determining that the phase focusing of the image sensor is enabled includes: Traverse each of the occluded pixels in the image matrix to obtain the cumulative number of occluded pixels that is greater than the first brightness difference; When the accumulated number exceeds a set number, the phase focusing of the image sensor is determined to be enabled.
5. The method for detecting the phase focusing on state according to claim 4, characterized in that, The image matrix has multiple pixel channels. The step of traversing each of the occluded pixels in the image matrix to obtain the cumulative number of occluded pixels greater than the first brightness difference includes: Configure the cumulative variable and channel thread for each pixel channel based on the number of channels in the pixel channel; Parallel calculations are performed based on the cumulative variable and the corresponding channel thread to obtain the number of single-channel occluded pixels in each pixel channel that are greater than the first brightness difference. The cumulative number is obtained by summing the number of all the single channels.
6. The method for detecting the phase focusing on state according to claim 4, characterized in that, Before determining that the phase focusing of the image sensor is enabled when the accumulated number is greater than a set number, the method further includes: Obtain the scaling factor and the number of occluded pixels, wherein the scaling factor represents the proportion of the set number in the number of occluded pixels; The set quantity is obtained by multiplying the proportional coefficient by the number of shielding elements.
7. A device for detecting the phase focusing activation state, characterized in that, include: The matrix acquisition module is used to acquire the image matrix output by the image sensor, wherein each element of the image matrix corresponds to the brightness value of a pixel; the image matrix is any one of a whiteboard RAW (RAW Image Format), a checkerboard chart RAW, or a bar chart RAW; Obtain the first pixel coordinates of multiple ordinary pixels in the image matrix; The pixel brightness value of each ordinary pixel is determined in the image matrix based on the first pixel coordinates; The average value of the multiple pixel brightness values is determined as the second brightness value; A brightness acquisition module is used to obtain a first brightness value of the occluded pixels and a second brightness value of the ordinary pixels based on the image matrix; the occluded pixels and the ordinary pixels are arranged in a specific form; The difference determination module is used to determine whether the first brightness difference of the occluded pixel is greater than a first preset threshold; wherein, the first brightness difference is the difference between the first brightness value and the second brightness value; The state determination module is used to determine that the phase focusing of the image sensor is in the enabled state when the first brightness difference of the masked pixels is greater than a first set threshold.
8. An electronic device, characterized in that, The device includes a processor and a memory, the memory being coupled to the processor, the memory storing instructions that, when executed by the processor, cause the electronic device to perform the steps of the method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the steps of the method described in any one of claims 1-6.
Citation Information
Patent Citations
Semiconductor device and manufacturing method thereof
CN110087065A
Image shooting method and related device
CN113132620A