Test image generation method and related equipment

By using a regularized reconstruction and size parameter-driven dynamic adaptation method, phase detection test images are automatically generated, solving the problems of cumbersome generation process and poor adaptability in existing technologies. This achieves efficient and universal image generation and testing, applicable to various module and sensor structures.

CN121750853APending Publication Date: 2026-03-27KUNSHAN QIUTI PHOTOELECTRIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

The existing technology for generating phase detection autofocus test images is cumbersome, inefficient, poorly adaptable, and prone to pixel misalignment. It cannot meet the real-time testing needs of high-speed production lines, especially in scenarios involving parallel testing of multiple models and frequent resolution iterations.

Method used

By employing a regularized reconstruction and size parameter-driven dynamic adaptation method, phase detection test images are automatically generated. This includes separating, grouping, and replacing the original image data to generate target images that meet the requirements of phase detection autofocus testing.

Benefits of technology

It improves the efficiency of phase detection autofocus testing, enhances the versatility and compatibility of the method, can quickly generate test images locally, reduces manual intervention, adapts to images with different resolutions and sizes, and is suitable for various module and sensor structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121750853A_ABST
    Figure CN121750853A_ABST
Patent Text Reader

Abstract

The invention discloses a test image generation method and related equipment, and relates to the technical field of image processing, and the method comprises the steps: carrying out the separation processing of original image data according to a preset size constraint condition, and obtaining Bayer array data and phase detection array data; performing row grouping on the Bayer array data according to the size parameter of the Bayer array data and the size parameter of the phase detection array data to obtain a first grouped data set; according to the phase detection array data, carrying out replacement processing on original data of a preset row of each group of initial data in the first grouped data set to obtain a second grouped data set; and generating a target test image according to the second grouped data set. Through dynamic adaptation of regularization reconstruction and size parameter driving, the phase detection test image is automatically generated locally, the phase detection automatic focusing test efficiency can be improved, and the universality and compatibility of the method can be enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and more particularly, to a test image generation method and related equipment. BACKGROUND

[0002] With the rapid development of mobile terminal imaging systems, intelligent driving cameras and industrial detection vision systems, phase detection auto focus (PDAF) has become the mainstream focusing scheme for high-resolution image sensors due to its rapid locking capability for moving targets. In the production line production and laboratory calibration link, the raw image data output by the sensor must be specially processed to generate special images that meet the identification format of the test instrument, so as to evaluate the focusing performance and aberration compensation capability of the module. However, the generation process of the phase detection auto focus test image involves multi-source data splicing, row and column alignment and bit width rearrangement. If relying on traditional offline scripts or third-party tools, the whole frame of raw image data often needs to be saved to the local first, and then multi-step parsing and conversion are performed, which is cumbersome and is easily affected by resolution and pixel arrangement differences.

[0003] The related art usually obtains a phase detection auto focus test image by manually configuring parameters and using external batch processing tools. Although the format conversion can be completed, there are obvious defects. On the one hand, file-level reading and writing and row-by-row script rearrangement will occupy a large amount of I / O and CPU resources, which cannot meet the real-time testing needs of high-tact production lines. On the other hand, when the sensor resolution, phase detection auto focus pixel width or arrangement strategy changes, the script needs to be repeatedly modified or the configuration file needs to be regenerated, which has high maintenance cost. Especially in the scene of multi-model parallel line testing and frequent resolution iteration, the process of the related art which takes file conversion as the core not only slows down the testing process, but also may force engineers to repeatedly verify the correctness of the script, causing a testing bottleneck. That is, there are technical problems of low efficiency, poor adaptability and easy pixel misalignment in generating a phase detection auto focus test image in the related art. SUMMARY

[0004] A series of simplified concepts are introduced in the summary part of the present application, which will be further described in detail in the specific embodiment part. The summary part of the present application does not mean to try to limit the key features and necessary technical features of the claimed technical solution, and even less means to determine the protection scope of the claimed technical solution.

[0005] The test image generation method and related equipment provided by the present application can automatically generate a phase detection test image locally through regularized reconstruction and dynamic adaptation driven by size parameters, which can improve the phase detection auto focus testing efficiency and enhance the universality and compatibility of the method.

[0006] In a first aspect, the present application provides a test image generation method, comprising: performing separation processing on original image data according to a preset size constraint condition to obtain Bayer array data and phase detection array data; performing row grouping on the Bayer array data according to a size parameter of the Bayer array data and a size parameter of the phase detection array data to obtain a first grouped data set; performing replacement processing on original data of a preset row of each group of initial data in the first grouped data set according to the phase detection array data to obtain a second grouped data set; and generating a target test image according to the second grouped data set, wherein the target test image is used for phase detection autofocus testing.

[0007] In some embodiments, the phase detection array data includes left phase detection pixel array data and right phase detection pixel array data; the preset size constraint condition is used for: the size parameter of the Bayer array data being a first height x a first width; and the size parameter of the left phase detection pixel array data and the right phase detection pixel array data being a second height x a second width, wherein the first height is an integer multiple of the second height, and the first width is twice the second width.

[0008] In some embodiments, the performing row grouping on the Bayer array data according to the size parameter of the Bayer array data and the size parameter of the phase detection array data to obtain a first grouped data set comprises: determining a grouping row number based on a ratio of the first height to the second height; dividing the Bayer array data into a plurality of groups of initial data according to the grouping row number, wherein each group of the initial data contains a number of rows equal to the grouping row number; and determining a set composed of the plurality of groups of initial data as the first grouped data set.

[0009] In some embodiments, the performing replacement processing on original data of a preset row of each group of initial data in the first grouped data set according to the phase detection array data to obtain a second grouped data set comprises: performing a traversal operation on the plurality of groups of initial data in the first grouped data set; extracting target left phase detection row data and target right phase detection row data corresponding to a current grouping index value from the left phase detection pixel array data and the right phase detection pixel array data, respectively, according to the current grouping index value; performing merging processing on the target left phase detection row data and the target right phase detection row data according to a preset cross rule to obtain cross arrangement row data; replacing a first row of the current grouped data with the cross arrangement row data to obtain target data; and determining a set composed of all the target data as the second grouped data set when the traversal operation ends.

[0010] In some embodiments, the extracting, according to the current grouping index value, target left phase detection row data and target right phase detection row data corresponding to the current grouping index value from the left phase detection pixel array data and the right phase detection pixel array data respectively, comprises: extracting, from the left phase detection pixel array data, pixel data of a row corresponding to the current grouping index value as the target left phase detection row data; and extracting, from the right phase detection pixel array data, pixel data of a row corresponding to the current grouping index value as the target right phase detection row data.

[0011] In some embodiments, the merging processing of the target left phase detection row data and the target right phase detection row data according to a preset cross rule to obtain cross arrangement row data comprises: interleaving arrangement of pixels of the target left phase detection row data as odd index bits and pixels of the target right phase detection row data as even index bits to obtain the cross arrangement row data with a width equal to that of the Bayer array data.

[0012] In some embodiments, the generating, according to the second grouping data set, a target test image comprises: merging processing of each target data in the second grouping data set in row order to obtain reconstructed two-dimensional array data; and pixel packaging processing of the reconstructed two-dimensional array data according to a preset image format packaging rule to obtain the target test image, wherein the preset image format packaging rule comprises Unpacked RAW10 format packaging specification; and the test image generation method further comprises: transmitting the target test image to a phase detection auto-focusing test module through a preset test interface.

[0013] In a second aspect, the present application further provides a test image generation apparatus, comprising: an image separation unit configured to separate an original image data according to a preset size constraint condition to obtain Bayer array data and phase detection array data; a Bayer grouping unit configured to group the Bayer array data according to a size parameter of the Bayer array data and a size parameter of the phase detection array data to obtain a first grouping data set; a grouping replacement unit configured to replace original data of a preset row of each group of initial data in the first grouping data set according to the phase detection array data to obtain a second grouping data set; and an image generation unit configured to generate a target test image according to the second grouping data set, wherein the target test image is used for phase detection auto-focusing test.

[0014] In a third aspect, the present application further provides an electronic device, comprising: a memory and a processor, wherein the processor is configured to implement steps of the test image generation method of the first aspect when executing a computer program stored in the memory.

[0015] In a fourth aspect, the present application also provides a computer readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the test image generation method of the first aspect.

[0016] In a fifth aspect, the present application also provides a computer program product comprising a computer program or computer executable instructions, which, when executed by a processor, implements the test image generation method provided by the embodiments of the present application.

[0017] To sum up, the present application adopts a regularized image reconstruction step, which can be directly embedded into an automatic test process, and can realize automatic image analysis and automatic phase detection focus test image data injection without manual intervention, thus saving the process of saving images and relying on external tools for conversion in the traditional way, and the processing process can be completed locally quickly, which can save image conversion and processing time, and further improve the overall test efficiency. Based on the image size parameter, dynamic grouping and replacement are performed, which has good adaptability, can be compatible with original images of different resolutions and size configurations, and can run only by meeting the basic size constraints, is suitable for various modules and sensor structures, and can enhance the universality and reusability of the method. To sum up, the test image generation method provided by the present application realizes the generation of phase detection test images locally by regularized reconstruction and dynamic adaptation based on size parameters, which can improve the phase detection automatic focus test efficiency and enhance the universality and compatibility of the method. BRIEF DESCRIPTION OF DRAWINGS

[0018] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included to provide a description of the preferred embodiments, and are not intended to limit the scope of the present application. Moreover, like reference numerals designate like parts throughout the several views in the drawings. In the drawings: Figure 1 A flowchart of a test image generation method provided by an embodiment of the present application; Figure 2 A schematic structural diagram of a test image generation device provided by an embodiment of the present application; Figure 3 A schematic structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0019] The terms “first,” “second,” “third,” “fourth,” and the like in the description, claims, and drawings of the application, if any, are used for distinguishing between similar objects and are not necessarily used to describe a particular sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the descriptive terminology can be used interchangeably. Accordingly, terms such as “first,” “second,” and the like, where used in the description, are not intended to connote a specific sequential or chronological order, unless otherwise specifically indicated. Furthermore, the terms “is” and “has,” along with any variants thereof, are intended to encompass non-exclusive inclusions, unless otherwise indicated. For example, a process, method, system, product, or apparatus that comprises several steps or units is not necessarily limited to only those steps or units explicitly listed, but can include additional steps or units not explicitly listed, or can include steps or units inherent to the process, method, system, product, or apparatus.

[0020] In the present application, “module” or “unit” refers to a computer program or a part of a computer program with a specific function, and works in cooperation with other related parts to achieve a predetermined target. These modules or units can be implemented by software, hardware (such as processing circuitry or memory), or a combination of both. One or more processors or memories can implement one or more modules or units. Meanwhile, each module or unit can also be part of a larger module or unit.

[0021] The technical solutions in the present application will be described in detail below in conjunction with the accompanying drawings in the embodiments. It should be noted that the described embodiments are only a part of the present application, not all embodiments. In the following description, “some embodiments” mentioned is only a subset of all possible embodiments, which can be the same or different subset, and different embodiments can be combined with each other without conflict.

[0022] Figure 1 is a flowchart of a test image generation method provided by an embodiment of the present application. For example, referring to Figure 1 The test image generation method provided by the embodiment of the present application can include the following steps 101 to 104: Step 101, according to the preset size constraint condition, the original image data is separated and processed to obtain the Bayer array data and the phase detection array data; In some examples, the preset size constraint condition is a set of size relationship rules preset according to an image source (such as an image sensor module design specification), and the preset size constraint condition can ensure that the Bayer array data and the phase detection array data in the original image data can be correctly split and corresponded; for example, if the width of the original image data is 4000 and the height is 3750, the size of the Bayer array data is 4000x3000, and the size of the phase detection array data is 2000x750. The original image data is an unprocessed image data output from an image sensor or an image signal processor (ISP), and the format is usually Unpacked RAW10 or RAW12, etc.; the structure of the original image data in the memory is a complete frame data spliced according to a certain rule, which includes the Bayer array data and the phase detection array data. The separation process is to cut or extract the Bayer part and the phase detection part according to the preset size constraint condition, to obtain two independent pixel matrices, i.e., the Bayer array data and the phase detection array data. The Bayer array data is standard color image sensor data, which is color raw pixel data arranged in a red-green-green-blue (RGGB) or green-red-blue-green (GRBG) mode, and is mainly used for image imaging and color restoration. The phase detection array data refers to the data of the left phase detection region and the right phase detection region, and the phase detection array data comes from a specific pixel region of the original image data and is specially used for focus information extraction and does not participate in image display.

[0023] For example, the width and height information can be first parsed from the original image data according to the resolution of the image frame, and a dimension check is performed thereon; for example, when an unpacked raw10 image with a size of 4000x3750 is read, according to the preset rule, the first 3000 lines are directly extracted as the Bayer array data, and the remaining 750 lines are stored as the phase detection array data. The separation process can be completed by using an efficient memory mapping method, which avoids repeated copying and ensures that the processing speed meets the real-time requirements of the production test line.

[0024] Through the implementation of step 101, the original image data is first split into the Bayer array data and the phase detection array data according to the preset size constraint, the effective pixel range can be locked, repeated I / O on the whole frame image is avoided, the data block size for subsequent operations is ensured to be accurate and the start and end addresses are clear, the risk of pixel misplacement and bit depth truncation is reduced, and a foundation is laid for subsequent efficient rearrangement.

[0025] In step 102, the Bayer array data is grouped by rows according to the size parameters of the Bayer array data and the size parameters of the phase detection array data, to obtain a first grouped data set; In some examples, the number of rows of each group of data can be calculated using the height of the Bayer array data and the height of the phase detection array, and then the entire Bayer array data can be equally divided according to the number of rows to form a plurality of small grouped data blocks. The first grouped data set is the result after the grouping operation, which is a set containing a plurality of "row blocks", each "row block" being composed of a fixed number of image rows; for example, the size of the Bayer array data is 4000x3000, and after grouping, 750 grouped data are formed, each group of data having a size of 4000x4.

[0026] For example, according to the image size parsed in the previous step, the number of rows that each group should contain can be calculated; then, using the row-by-row step-by-step slicing method, the Bayer array data is divided into several segments from top to bottom; for example, for an image with a height of 3000, grouping by 4 rows, starting from the 1st row, every 4 rows generate a group, and finally 750 groups of data are constructed; each group is stored in the form of a two-dimensional matrix, which facilitates subsequent direct positioning and replacement of the first row data; this operation can be performed in batches in memory to ensure that frame data processing and preparation are completed quickly on the test pipeline.

[0027] Through the implementation of step 102, according to the size parameters of the two types of arrays, the Bayer array data is dynamically grouped according to the height of the phase detection array data, so that the number of groups and the span are automatically adjusted regardless of the resolution or the height of the phase detection array data, enhancing the adaptability and reusability of the method for multiple models and multiple specifications of sensors.

[0028] Step 103, according to the phase detection array data, replacing the original data of the preset row of each initial data in the first grouped data set to obtain a second grouped data set; In some examples, the original data of the preset row of the initial data is the preset row to be replaced in each grouped data block divided from the Bayer array data, which can be the first row of each group of data; for example, if each initial data in the first grouped data set has 4 rows, such as "row0" to "row3", the preset row refers to "row0", which originally stores ordinary Bayer image pixel data. The replacement operation replaces the preset row data of each initial data with a new row of data generated by the cross combination of the left phase detection data and the right phase detection data. After the replacement operation, the first row of each group in the first grouped data set is replaced by the new row arranged by the phase detection array data, and the entire set is referred to as the second grouped data set.

[0029] By implementing step 103, the original Bayer data is replaced by phase detection pixel data in the preset row of each group. By operating in a local row rather than the entire frame range, the insertion position and interleaving order of the phase detection pixel data can be precisely controlled, avoiding the cache overhead caused by entire row shifting, and ensuring that the generated image fully meets the requirements of the phase detection autofocus test format.

[0030] In step 104, a target test image is generated according to the second group data set, wherein the target test image is used for phase detection autofocus test. In some examples, the target test image is a complete image data generated by recombining the second group data set in row order and conforming to a certain format. The target test image retains the Bayer image information while embedding pixel rows dedicated to phase detection, which are designed for subsequent focus performance testing. Phase detection autofocus test is one of the key test processes in image sensor modules, which is used to evaluate the accuracy and response performance of phase detection autofocus (PDAF). The phase detection autofocus test image must contain the arrangement of "left / right phase pixels" to verify whether the focusing direction can be quickly determined by the parallax difference in the image.

[0031] For example, each group in the second group data set can be spliced in the original order to form a complete two-dimensional pixel array. Then, the array is packaged at the pixel level according to format specifications such as Unpacked RAW10, and output as a standard raw format file. The target test image does not require additional manual operation and can be directly read and executed by the PDAF test system for focus performance evaluation.

[0032] By implementing step 104, the replaced groups are spliced to directly output a new target test image, which can bypass external scripts and secondary file conversion and immediately obtain a testable image on the device side. In this way, the test system can seamlessly call the result file to complete the focus algorithm evaluation, greatly shortening the single-frame processing time, improving the test efficiency, and reducing the cost of manual intervention.

[0033] In summary, the embodiment of the present application adopts a regularized image reconstruction step, which can be directly embedded into an automatic test process, and can realize automatic image analysis and phase detection automatic focusing test image data injection without manual intervention, thereby saving the process of saving images and relying on external tools for conversion in the traditional process, and the processing process can be quickly completed locally, thereby saving image conversion and processing time and further improving the overall test efficiency. The dynamic grouping and replacement based on the image size parameter have good adaptability, can be compatible with original images of different resolutions and size configurations, and can be run only by satisfying the basic size constraint, are suitable for various modules and sensor structures, and can enhance the universality and reusability of the method. In summary, the test image generation method provided by the embodiment of the present application realizes the generation of a phase detection test image locally through regularized reconstruction and dynamic adaptation of the size parameter, can improve the phase detection automatic focusing test efficiency and enhance the universality and compatibility of the method.

[0034] In some embodiments, the aforementioned phase detection array data can include left phase detection pixel array data and right phase detection pixel array data; and the aforementioned preset size constraint condition is used to: constrain the size parameter of the Bayer array data to be a first height x a first width; and constrain the size parameter of the left phase detection pixel array data and the right phase detection pixel array data to be a second height x a second width, wherein the first height is an integer multiple of the second height, and the first width is twice the second width.

[0035] In some examples, the left phase detection pixel array data is phase detection pixel data rows extracted from the original image data for simulating or replacing the left eye view angle of the sensor, can be compared with right phase pixels for parallax comparison to realize phase detection automatic focusing; and the left phase detection pixel array data can be extracted from a predefined region of the original image. The right phase detection pixel array data is phase detection pixel row data symmetrical to the left phase data and representing the right view angle of the sensor, can be paired with the left phase data to form a left-right parallax pair. The first height x the first width is the size of the original Bayer array data, representing the resolution of the image in the pixel dimension. The second height x the second width is the size of the left phase detection pixel array data / right phase detection pixel array data for phase detection. The first height is an integer multiple of the second height, and the first width is twice the second width, which can ensure that each group of Bayer array data can be aligned with a group of left phase detection pixel array data and right phase detection pixel array data; for example, assuming that the first height is 3000, the second height is 1000; the first width is 4000, and the second width is 2000.

[0036] By implementing the above embodiments, the left phase detection pixel array data and the right phase detection pixel array data are respectively defined as "second width x second height", and the first width is twice the second width, and the first height is an integer multiple of the second height, which can ensure that the left and right phase information corresponds to the Bayer column width perfectly at the pixel level; regardless of the resolution of the photosensitive chip, as long as the integer multiple relationship is met, the core logic does not need to be modified, and both rigorous alignment and cross-model generalization are considered.

[0037] In some embodiments, the foregoing step 102 can include: determining the grouping row number based on the ratio of the first height to the second height; dividing the Bayer array data into a plurality of groups of initial data according to the grouping row number, wherein each group of initial data contains a number of rows equal to the grouping row number; and determining a set composed of the plurality of groups of initial data as the first grouped data set.

[0038] In some examples, the ratio of the first height to the second height determines the number of rows that each group of initial data should contain, so that the target image reconstructed finally can one-to-one map the phase detection row. The grouping row number is the number of rows contained in each initial group determined according to the above ratio, that is, grouping row number = first height ÷ second height. The Bayer array data can be continuously cut into a plurality of groups of initial data by taking every "grouping row number" of rows as a group along the vertical pixel rows; for example, if the Bayer array data is 3000 rows and the grouping row number is 3, then it can be divided into 1000 groups of initial data. The initial data refers to the data segment composed of continuous pixel rows extracted from the Bayer array data according to the grouping row number, and each segment is the basic unit of subsequent data replacement. All initial data together form a list or array set, which is determined as the first grouped data set and is used as the object of subsequent operations, and can be saved in data structures such as two-dimensional array list, matrix stack, etc.

[0039] By implementing the above embodiments, the grouping row number is determined by the ratio of the first height to the second height, so that each group of initial data naturally matches a row of phase detection array data; when the chip size changes or the second width is adjusted, the grouping row number will be automatically recalculated, dynamically adaptive without rewriting code or configuration, which can greatly reduce maintenance costs.

[0040] In some embodiments, the foregoing step 103 can include: performing a traversal operation on the plurality of groups of initial data in the first grouped data set; according to the current grouped index value traversed, extracting target left phase detection row data and target right phase detection row data corresponding to the current grouped index value from the left phase detection pixel array data and the right phase detection pixel array data, respectively; performing merging processing on the target left phase detection row data and the target right phase detection row data according to a preset interleaving rule to obtain interleaved arrangement row data; replacing the first row of the current grouped data traversed with the interleaved arrangement row data to obtain target data; and when the traversal operation ends, determining a set of all the target data as the second grouped data set.

[0041] In some examples, each group of initial data in the first grouped data set can be processed one by one, facilitating the preset row replacement operation on each group of initial data. The first grouped data set can be accessed in sequence by a for loop or other iteration methods. The current grouped index value is the serial number of the initial data currently traversed in the entire first grouped data set. For example, when the 25th group is traversed, the index value is 24 (counting from 0). The target left phase detection row data and the target right phase detection row data are a row of data extracted from the left phase detection pixel array and the right phase detection pixel array, respectively, for merging. The current grouped index value can be used as a row number to extract an entire row of pixels from the left phase detection pixel array and the right phase detection pixel array corresponding to the current grouped index value. The preset interleaving rule is a fixed mode or algorithm for interleaving the target left phase detection row data and the target right phase detection row data. The preset interleaving rule can be a preset encoding logic, which can specify that odd index uses the target left phase detection row data and even index uses the right phase detection row data. For example, the 1st index takes the pixel in the target left phase detection row data, the 2nd index takes the pixel in the target right phase detection row data, the 3rd index takes the pixel in the target left phase detection row data, and so on, to form interleaved mixed arrangement. The interleaved arrangement row data is one-dimensional pixel row data formed by interleaving the target left phase detection row data and the target right phase detection row data, which is used to replace the first row of the current grouped data traversed. The target data is the new grouped data with the first row replaced, which still retains other rows of the original grouped data to form an updated grouped unit. When the traversal operation ends, i.e., all initial data have completed the replacement operation and all form new target data, all the target data completed the replacement are collected as a unified second grouped data set, which is used for subsequent image generation.

[0042] For example, each group of initial data in the first grouped data set can be processed in sequence. For the current group, a row of data corresponding to the index value of the current group is extracted from the left phase detection pixel array and the right phase detection pixel array, respectively; then, according to a predefined cross-merging rule, the two rows of data are interleaved to form a new row of data, that is, the cross-arranged row of data; next, the merged row is used to replace the first row in the current initial data to form an updated target data; this operation is performed until all grouped data is processed, and a complete second grouped data set is finally formed to provide structured data input for the next image reconstruction.

[0043] Through implementation of the above embodiments, the left and right phase detection row data is extracted synchronously according to the grouped index, and the left and right phase detection row data is replaced in the first row of the group, which can ensure that the insertion position of the cross-arranged row of data is completely controllable and the cache locality is high; the target grouped set can be obtained at the end of the traversal, without additional sorting or temporary buffering, which can reduce the memory peak and improve the running speed of the embedded platform.

[0044] In some embodiments, the above-mentioned target left phase detection row data and target right phase detection row data are extracted from the left phase detection pixel array data and the right phase detection pixel array data, respectively, according to the current grouped index value, which can include: extracting the pixel data of the row corresponding to the current grouped index value from the left phase detection pixel array data to determine the target left phase detection row data; extracting the pixel data of the row corresponding to the current grouped index value from the right phase detection pixel array data to determine the target right phase detection row data.

[0045] In some examples, the target left phase detection row data can be obtained by acquiring a whole row of pixels corresponding to the row (i.e., the current index row) of the initial data currently being processed from the left phase detection pixel array data; and the target right phase detection row data can be obtained by acquiring a whole row of pixels corresponding to the row (i.e., the current index row) of the initial data currently being processed from the right phase detection pixel array data.

[0046] Through implementation of the above embodiments, the target row is extracted from the left phase detection pixel array data / right phase detection pixel array data in a manner that one grouped index value corresponds to one row of data, which can avoid cumulative offset or addressing error, facilitate online debugging and error backtracking, and improve the reliability and traceability of pixel-level calibration.

[0047] In some embodiments, the above-mentioned merging processing of the target left phase detection row data and the target right phase detection row data according to the preset cross rule to obtain the cross-arranged row of data can include: interleaving the pixels of the target left phase detection row data as odd index bits and the pixels of the target right phase detection row data as even index bits to obtain the cross-arranged row of data with a width equal to that of the Bayer array data.

[0048] In some examples, the target left phase detection row data and the target right phase detection row data, which are two pixel rows of the same length, can be interleaved into a new array to obtain cross-arranged row data with the same width as the Bayer array data; in the implementation process, the target left phase detection row data can be inserted into positions with odd index numbers 1, 3, 5, etc., and the target right phase detection row data can be inserted into positions with even index numbers 2, 4, 6, etc.

[0049] For example, after the target left phase detection row data and the target right phase detection row data are extracted, the pixels of the target left phase detection row data can be placed in the base positions and the pixels of the target right phase detection row data can be inserted into the even positions according to a set cross-arrangement rule, to construct a new row data with a length equal to the original row width of the Bayer array, that is, cross-arranged row data. After the cross-arranged row data is generated, it is replaced into the Bayer grouping data, so that the test image has both the standard Bayer structure and the phase difference information, and the test value and the effect restoration degree of the focusing algorithm can be improved.

[0050] Through the implementation of the above examples, the pixels of the target left phase detection row data are taken in the odd index positions, and the pixels of the target right phase detection row data are taken in the even index positions, and this cross-splicing rule makes the new row width consistent with the Bayer column width and the left and right phase pixels are alternately distributed, and this fixed odd-even strategy can eliminate the arrangement ambiguity caused by image rotation / mirroring to the greatest extent.

[0051] In some examples, the foregoing step 104 can include: merging the target data in the second grouping data set in row order to obtain reconstructed two-dimensional array data; and performing pixel packaging processing on the reconstructed two-dimensional array data according to a preset image format packaging rule to obtain a target test image, wherein the preset image format packaging rule can include an Unpacked RAW10 format packaging specification; and the foregoing test image generation method can further include: transmitting the target test image to a phase detection autofocus test module through a preset test interface.

[0052] In some examples, the reconstructed two-dimensional array data is a complete pixel matrix formed by vertically splicing all the target data in the original row order, and the size of the reconstructed two-dimensional array data is consistent with the size of the Bayer array data. The preset image format packaging rule is a constraint such as byte layout, bit depth, and row alignment that must be observed when the reconstructed two-dimensional array data is packaged into a specific RAW file format, and can be saved in a configuration file or a compile-time macro definition. The pixel packaging processing process is to pack the reconstructed two-dimensional array data into a specific RAW file format, and the specific RAW file format can be RAW10, RAW12, RAW14, etc. bit pixel value rearrangement, alignment to byte boundary and writing into a buffer or file. The preset test interface is a data transmission channel preset by a production line or a laboratory test station. The phase detection autofocus test module is a combination of software and / or hardware for reading a RAW frame with a target test image, running a focusing algorithm and outputting performance indicators.

[0053] For example, after generating the complete target data, the groups can be quickly stacked in row order to obtain a reconstructed two-dimensional array data with the same resolution as the Bayer array data; then, according to a preconfigured Unpacked RAW10 packaging rule, 16 bit alignment writing is performed on each 10 bit pixel to form a RAW buffer with a predictable size; finally, the buffer is directly pushed to the phase detection autofocus test module through a high-speed test interface such as PCIe DMA; the phase detection autofocus test module can load the image and start focusing performance calculation within milliseconds, and the entire process avoids temporary file landing and format conversion, ensuring zero-copy and high throughput of the test link and meeting the requirements of the production line real-time cycle time (CT).

[0054] Through the implementation of the above embodiment, the target groups are reconstructed into a two-dimensional array in row order and packaged into Unpacked RAW10 at one time, and then pushed to the phase detection autofocus test module through the test interface, which can realize the process closed loop of generating and testing at the same time; the format conversion in the related art is avoided, ensuring zero loss and zero delay of the data link, and further improving the real-time performance and accuracy of the focusing performance evaluation. The Unpacked RAW10 format packaging specification stores the effective 10-bit image data in a 16-bit per pixel alignment manner, which can make the image data structure clearer and more direct to read, and facilitate the verification and operation of the pixel-level data in the algorithm development and debugging process; and the Unpacked RAW10 has good alignment characteristics, supports high-throughput data transmission, is suitable for high-speed automated testing scenarios, and is helpful to build a stable and efficient phase detection autofocus test link.

[0055] Further, as an implementation of the foregoing method embodiment, the application further provides a test image generation device for implementing the foregoing method embodiment. The device embodiment corresponds to the foregoing method embodiment, and for the sake of readability, the foregoing method embodiment will not be described one by one. However, it should be clear that the device in the present embodiment can correspondingly implement all the contents of the foregoing method embodiment. For example, Figure 2As shown, the test image generation apparatus 20 comprises an image separation unit 201, a Bayer grouping unit 202, a grouping replacement unit 203 and an image generation unit 204. The image separation unit 201 is configured to separate original image data according to a preset size constraint condition to obtain Bayer array data and phase detection array data. The Bayer grouping unit 202 is configured to group the Bayer array data according to a size parameter of the Bayer array data and a size parameter of the phase detection array data to obtain a first grouping data set. The grouping replacement unit 203 is configured to replace original data of a preset row of each group of initial data in the first grouping data set according to the phase detection array data to obtain a second grouping data set. The image generation unit 204 is configured to generate a target test image according to the second grouping data set, wherein the target test image is used for phase detection auto-focusing test.

[0056] In some embodiments, the phase detection array data comprises left phase detection pixel array data and right phase detection pixel array data; the preset size constraint condition is configured to constrain the size parameter of the Bayer array data to be a first height x a first width; and the size parameter of the left phase detection pixel array data and the right phase detection pixel array data to be a second height x a second width, wherein the first height is an integer multiple of the second height, and the first width is twice the second width.

[0057] In some embodiments, the Bayer grouping unit 202 is further configured to determine a grouping row number based on a ratio of the first height to the second height; divide the Bayer array data into a plurality of groups of initial data according to the grouping row number, wherein each group of initial data contains a number of rows equal to the grouping row number; and determine a set composed of the plurality of groups of initial data as the first grouping data set.

[0058] In some embodiments, the grouping replacement unit 203 is further configured to perform an iteration operation on the plurality of groups of initial data in the first grouping data set; extract target left phase detection row data and target right phase detection row data corresponding to a current grouping index value from the left phase detection pixel array data and the right phase detection pixel array data, respectively, according to the current grouping index value; perform merging processing on the target left phase detection row data and the target right phase detection row data according to a preset cross rule to obtain cross arrangement row data; replace a first row of the current grouping data with the cross arrangement row data to obtain target data; and determine a set composed of all the target data as the second grouping data set when the iteration operation ends.

[0059] In some embodiments, the grouping replacement unit 203 is further configured to extract pixel data of a row corresponding to a current grouping index value from the left phase detection pixel array data to determine as the target left phase detection row data; and extract pixel data of a row corresponding to the current grouping index value from the right phase detection pixel array data to determine as the target right phase detection row data.

[0060] In some embodiments, the packet replacing unit 203 is further configured to arrange the pixels of the row data of the target left phase detection array as odd index bits and the pixels of the row data of the target right phase detection array as even index bits, to obtain the cross-arranged row data with the same width as the Bayer array data.

[0061] In some embodiments, the image generating unit 204 is further configured to merge the target data in the second packet data set in a row order to obtain reconstructed two-dimensional array data, and perform pixel packaging on the reconstructed two-dimensional array data according to a preset image format packaging rule to obtain a target test image, wherein the preset image format packaging rule includes an Unpacked RAW10 format packaging specification; and the test image generating apparatus 20 further includes a test docking unit configured to transmit the target test image to a phase detection autofocus test module through a preset test interface.

[0062] The present application also provides a computer readable storage medium, which stores computer executable instructions or computer programs, and when the computer executable instructions or computer programs are executed by a processor, the processor will execute any step of the test image generating method provided by the present application.

[0063] In some embodiments, the computer readable storage medium can be a random access memory (RAM), a read-only memory (ROM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM), etc. The computer readable storage medium can also be various devices including one or any combination of the above storage mediums.

[0064] In some embodiments, the computer executable instructions can be in the form of programs, software, software modules, scripts or codes, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and can be deployed in any form, including being deployed as independent programs or being deployed as modules, components, subroutines or other units suitable for use in a computing environment.

[0065] In some embodiments, the computer executable instructions can but not necessarily correspond to files in a file system, can be stored in a part of a file storing other programs or data, for example, stored in one or more scripts in a HyperText Markup Language (HTML) document, stored in a single file dedicated to the program in question, or stored in multiple cooperative files (for example, files storing one or more modules, subroutines or code portions).

[0066] In some embodiments, the computer executable instructions can be deployed to execute on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected through a communication network.

[0067] As shown in Figure 3 The present application also provides an electronic device 30, comprising a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and executable on the processor, wherein the processor 320 implements any step of the test image generation method described above when executing the computer program 311.

[0068] The present application also provides a computer program product, comprising a computer program or computer executable instructions stored in a computer readable storage medium. The processor of the electronic device reads the computer program or computer executable instructions from the computer readable storage medium, and the processor executes the computer program or computer executable instructions, so that the electronic device executes any step of the test image generation method described above.

[0069] The above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for generating test images, characterized in that, include: Based on preset size constraints, the original image data is separated to obtain Bayer array data and phase detection array data; Based on the size parameters of the Bayer array data and the size parameters of the phase detection array data, the Bayer array data is grouped by row to obtain a first grouped dataset, wherein the first grouped dataset includes multiple sets of initial data. Based on the phase detection array data, the original data of the preset row of each initial data in the first group dataset is replaced to obtain the second group dataset; A target test image is generated based on the second grouped dataset, wherein the target test image is used for phase detection autofocus testing.

2. The test image generation method according to claim 1, characterized in that, The phase detection array data includes left phase detection pixel array data and right phase detection pixel array data; the preset size constraint is used for: The size parameter of the Bayer array data is constrained to be a first height × a first width; The size parameters of the left phase detection pixel array data and the right phase detection pixel array data are constrained to be a second height × a second width, wherein the first height is an integer multiple of the second height, and the first width is twice the second width.

3. The test image generation method according to claim 2, characterized in that, The Bayer array data is grouped into rows based on the size parameters of the Bayer array data and the size parameters of the phase detection array data to obtain a first grouped dataset, including: The number of group rows is determined based on the ratio of the first height to the second height; Based on the number of rows in the group, the Bayer array data is divided into multiple groups of initial data by rows, wherein the number of rows in each group of initial data is equal to the number of rows in the group; The set of the multiple initial data sets is defined as the first grouped dataset.

4. The test image generation method according to claim 3, characterized in that, The step of replacing the original data in a preset row of each initial data group in the first grouped dataset according to the phase detection array data to obtain the second grouped dataset includes: The multiple initial data sets in the first grouped dataset are traversed. Based on the current group index value traversed, target left phase detection row data and target right phase detection row data corresponding to the current group index value are extracted from the left phase detection pixel array data and the right phase detection pixel array data, respectively. The target left phase detection row data and the target right phase detection row data are merged according to a preset crossover rule to obtain crossover row data; Replace the first row of the current grouped data with the interlaced row data to obtain the target data; When the traversal operation ends, the set consisting of all the target data is determined as the second grouped dataset.

5. The test image generation method according to claim 4, characterized in that, The step of extracting the target left-phase detection row data and target right-phase detection row data corresponding to the current grouping index value from the left-phase detection pixel array data and the right-phase detection pixel array data, respectively, based on the traversed current grouping index value, includes: Pixel data corresponding to the current group index value is extracted from the left phase detection pixel array data and determined as the target left phase detection row data; Pixel data corresponding to the current group index value is extracted from the right phase detection pixel array data and determined as the target right phase detection row data.

6. The test image generation method according to claim 4, characterized in that, The step of merging the target left phase detection row data and the target right phase detection row data according to a preset crossover rule to obtain crossover row data includes: Using the pixels of the left phase detection row data of the target as odd-numbered index bits and the pixels of the right phase detection row data of the target as even-numbered index bits, the cross-arranged row data with an equal width to the Bayer array data is obtained by interleaving the rows.

7. The test image generation method according to any one of claims 1 to 6, characterized in that, The step of generating the target test image based on the second grouped dataset includes: The target data in the second grouped dataset are merged in row order to obtain the reconstructed two-dimensional array data; According to the preset image format encapsulation rules, the reconstructed two-dimensional array data is subjected to pixel encapsulation processing to obtain the target test image, wherein the preset image format encapsulation rules include the Unpacked RAW10 format encapsulation specification; The test image generation method further includes: The target test image is transmitted to the phase detection autofocus test module through a preset test interface.

8. A test image generation apparatus, characterized in that, include: The image separation unit is used to separate the original image data according to preset size constraints to obtain Bayer array data and phase detection array data; The Bayer grouping unit is used to group the Bayer array data into rows according to the size parameters of the Bayer array data and the size parameters of the phase detection array data to obtain a first grouped dataset; The grouping replacement unit is used to replace the original data of a preset row of each group of initial data in the first grouped dataset according to the phase detection array data, so as to obtain the second grouped dataset. An image generation unit is configured to generate a target test image based on the second grouped dataset, wherein the target test image is used for phase detection autofocus testing.

9. An electronic device, comprising: The memory and processor are characterized in that the processor, when executing a computer program stored in the memory, implements the steps of the test image generation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the test image generation method as described in any one of claims 1 to 7.