Two-dimensional image generation method and device, electronic equipment and storage medium
By performing multiple edge enhancement and filtering operations on the image data acquired by the line scan camera, a high-resolution two-dimensional image is generated, which solves the problem of insufficient clarity in the existing technology and realizes the improvement of the clarity of high-resolution images.
Patent Information
- Application Number
- CN202510818952.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-11-14
AI Technical Summary
In the existing technology, the high-resolution two-dimensional images generated by line scan cameras have low clarity.
A first target image is obtained by performing a first edge enhancement operation and a first filtering operation on several frames of target image data; a weight matrix and a second target image are obtained by performing a second edge enhancement operation and a second filtering operation on the first target image; and a target two-dimensional image is generated based on the weight matrix and the second target image.
While generating high-resolution 2D images, it improves image clarity and reduces the blurring effect of filtering operations.
Smart Images

Figure CN120953401A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, and in particular relates to a two-dimensional image generation method, apparatus, electronic device and storage medium. Background Technology
[0002] Line scan cameras are used to generate two-dimensional images by observing moving objects. Typically, line scan cameras synthesize high-resolution two-dimensional images using super-resolution algorithms.
[0003] However, since super-resolution algorithms synthesize multiple low-resolution images into a high-resolution image, although the resolution of the generated two-dimensional image is improved, the clarity of the synthesized high-resolution image is relatively low. Summary of the Invention
[0004] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application proposes a two-dimensional image generation method, apparatus, electronic device, and storage medium to solve the problem of low clarity in the generated high-resolution two-dimensional images.
[0005] In a first aspect, this application provides a method for generating a two-dimensional image, including:
[0006] Acquire several frames of target image data;
[0007] Perform a first edge enhancement operation and a first filtering operation on several frames of target image data to obtain a first target image;
[0008] Perform a second edge enhancement operation and a second filtering operation on the first target image to obtain a weight matrix and a second target image;
[0009] A two-dimensional image of the target is generated based on the weight matrix and the second target image.
[0010] According to the two-dimensional image generation method of this application, a first target image is obtained by performing a first edge enhancement operation and a first filtering operation on several frames of target image data; a second edge enhancement operation and a second filtering operation are performed on the first target image to obtain a weight matrix and a second target image; and a target two-dimensional image is generated based on the weight matrix and the second target image. By performing the first edge enhancement operation and the second edge enhancement operation before the first filtering operation and the second filtering operation, the blurring caused by the filtering operation to the generated two-dimensional image is reduced, thereby improving the clarity of the generated two-dimensional image while generating a high-resolution two-dimensional image.
[0011] According to one embodiment of this application, each frame of target image data in a plurality of frames includes at least two target images; performing a first edge enhancement operation and a first filtering operation on the plurality of frames of target image data to obtain a first target image includes:
[0012] For each frame of target image data, a third target image is obtained based on at least two target images;
[0013] The third target images corresponding to all frames are stitched together, and the first edge enhancement operation is performed on the stitched result to obtain the fourth target image;
[0014] Perform a first filtering operation on the fourth target image to obtain the first target image.
[0015] According to one embodiment of this application, the stitching result includes several rows of first pixel blocks, and the number of first pixel blocks in each row is at least two; the first edge enhancement operation is used to expand the upper edge or lower edge of the stitching result by one row and expand the left edge or right edge of the stitching result by one column to obtain the fourth target image.
[0016] According to one embodiment of this application, a first filtering operation is performed on a fourth target image to obtain a first target image, including:
[0017] Based on a 2*2 filtering window, the first filtering operation is performed on the fourth target image to obtain the first target image.
[0018] According to one embodiment of this application, a second edge enhancement operation and a second filtering operation are performed on a first target image to obtain a weight matrix and a second target image, including:
[0019] A second edge enhancement operation is performed on the first target image to obtain a fifth target image; the fifth target image includes several rows of second pixel blocks, and each row of second pixel blocks contains at least three blocks.
[0020] Based on a 3*3 filtering window, each second pixel block in the fifth target image is filtered to obtain the second target image, and each element in the weight matrix is obtained based on the pixel variance of each 3*3 filtering window.
[0021] According to one embodiment of this application, the first target image includes several rows of third pixel blocks, and the number of third pixel blocks in each row is at least one; the second edge enhancement operation is used to expand the upper edge and lower edge of the first target image by one row, and expand the left edge and right edge of the first target image by one column, to obtain the fifth target image.
[0022] According to one embodiment of this application, generating a target two-dimensional image based on a weight matrix and a second target image includes:
[0023] For each first pixel block in the stitching result, obtain the pixel difference between the first pixel block and the corresponding pixel block in the second target image;
[0024] Obtain the element at the corresponding position in the weight matrix for each first pixel block, and obtain the target product of the element and the pixel difference;
[0025] The sum of the product of each first pixel block and the target is obtained as each pixel block of the target 2D image.
[0026] Secondly, this application provides a two-dimensional image generation apparatus, comprising:
[0027] The first acquisition module is used to acquire several frames of target image data;
[0028] The second acquisition module is used to perform a first edge enhancement operation and a first filtering operation on several frames of target image data to acquire a first target image;
[0029] The third acquisition module is used to perform a second edge enhancement operation and a second filtering operation on the first target image to acquire a weight matrix and a second target image.
[0030] The generation module is used to generate a two-dimensional image of the target based on the weight matrix and the second target image.
[0031] According to the two-dimensional image generation apparatus of this application, a first target image is obtained by performing a first edge enhancement operation and a first filtering operation on several frames of target image data; a weight matrix and a second target image are obtained by performing a second edge enhancement operation and a second filtering operation on the first target image; and a target two-dimensional image is generated based on the weight matrix and the second target image. By performing the first edge enhancement operation and the second edge enhancement operation before the first filtering operation and the second filtering operation, the blurring caused by the filtering operation to the generated two-dimensional image is reduced, thereby improving the clarity of the generated two-dimensional image while generating a high-resolution two-dimensional image.
[0032] Thirdly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the two-dimensional image generation method described in the first aspect.
[0033] Fourthly, this application provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the two-dimensional image generation method described in the first aspect.
[0034] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0035] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0036] Figure 1 This is one of the flowcharts illustrating the two-dimensional image generation method provided in the embodiments of this application;
[0037] Figure 2 This is a second schematic flowchart of the two-dimensional image generation method provided in the embodiments of this application;
[0038] Figure 3 This is a schematic diagram of the process for obtaining a third target image provided in an embodiment of this application;
[0039] Figure 4 This is a schematic diagram of the process for obtaining the first target image provided in an embodiment of this application;
[0040] Figure 5 This is a schematic diagram of the process for obtaining a second target image provided in an embodiment of this application;
[0041] Figure 6 This is a schematic diagram of the structure of the two-dimensional image generation device provided in the embodiments of this application;
[0042] Figure 7 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0043] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0044] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0045] The two-dimensional image generation method, apparatus, electronic device, and storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0046] The two-dimensional image generation method can be applied to a terminal, specifically executed by the hardware or software within the terminal.
[0047] The terminal includes, but is not limited to, portable communication devices such as mobile phones or tablets with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads). It should also be understood that, in some embodiments, the terminal may not be a portable communication device, but rather a desktop computer with touch-sensitive surfaces (e.g., touchscreen displays and / or touchpads).
[0048] The following embodiments describe a terminal including a display and a touch-sensitive surface. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse, and joystick.
[0049] The two-dimensional image generation method provided in this application embodiment can be executed by an electronic device or a functional module or entity in an electronic device that can implement the two-dimensional image generation method. The electronic devices mentioned in this application embodiment include, but are not limited to, mobile phones, tablets, computers, cameras, and wearable devices. The two-dimensional image generation method provided in this application embodiment will be described below using an electronic device as the execution subject as an example.
[0050] like Figure 1 As shown, the two-dimensional image generation method includes steps 110, 120, 130 and 140.
[0051] Step 110: Obtain several frames of target image data.
[0052] In actual execution, each frame of target image data can be acquired using a line scan camera.
[0053] In some embodiments, each frame of target image data may include at least two target images. A line scan camera may include at least two sensors, each of which can acquire one target image, which may be an image with a first resolution (e.g., a 1*1024 resolution image).
[0054] Step 120: Perform a first edge enhancement operation and a first filtering operation on several frames of target image data to obtain a first target image.
[0055] In some embodiments, for each frame of target image data in a plurality of frames of target image data, a first edge enhancement operation can be performed first, and then a first filtering operation can be performed on the result of the first edge enhancement operation to obtain a first target image.
[0056] In some embodiments, for each frame of target image data in several frames of target image data, the target images of the target image data can be merged, a first edge enhancement operation can be performed on the merged result, and a first filtering operation can be performed on all the results generated by the first edge enhancement operation to obtain a first target image.
[0057] In actual execution, the first target image obtained through the first filtering operation can be an image with a second resolution, which is greater than the first resolution.
[0058] Step 130: Perform a second edge enhancement operation and a second filtering operation on the first target image to obtain a weight matrix and a second target image.
[0059] In actual implementation, the second filtering operation can be a filtering operation that uses a different filtering algorithm than the first filtering operation.
[0060] In actual execution, the second target image obtained through the second filtering operation can be an image with a third resolution, which is greater than or equal to the second resolution.
[0061] In some embodiments, a second edge enhancement operation can be performed on the first target image first, and then a second filtering operation can be performed on the result of the second edge enhancement operation to obtain the second target image.
[0062] In some embodiments, after performing a second edge enhancement operation on the first target image, a second filtering operation can be performed on each pixel block in the result of the second edge enhancement operation, and a weight matrix and a second target image can be obtained based on the result of each second filtering operation.
[0063] Step 140: Generate a two-dimensional image of the target based on the weight matrix and the second target image.
[0064] In actual execution, the second target image consists of several pixel blocks.
[0065] In some embodiments, a pixel block in the target two-dimensional image can be generated based on each pixel block in the second target image and the element corresponding to that pixel block in the weight matrix.
[0066] According to the two-dimensional image generation method of this application embodiment, a first target image is obtained by performing a first edge enhancement operation and a first filtering operation on all target image data using several frames of target image data; a second edge enhancement operation and a second filtering operation are performed on the first target image to obtain a weight matrix and a second target image; and a target two-dimensional image is generated based on the weight matrix and the second target image. By performing the first edge enhancement operation and the second edge enhancement operation before the first filtering operation and the second filtering operation, the blurring caused by the filtering operation to the generated two-dimensional image is reduced, thereby improving the clarity of the generated two-dimensional image while generating a high-resolution two-dimensional image.
[0067] In some embodiments, each frame of target image data in a plurality of frames includes at least two target images; for each frame of target image data, a third target image is obtained based on the at least two target images; the third target images corresponding to all frames are stitched together, and a first edge enhancement operation is performed on the stitching result to obtain a fourth target image; a first filtering operation is performed on the fourth target image to obtain a first target image.
[0068] In actual execution, each target image can include several pixel blocks.
[0069] In some embodiments, for each frame of target image data in a plurality of frames of target image data, pixel blocks of several target images in the target image data can be interleaved and output to generate a third target image for that frame of target image data. For example, the target image data includes target image A1 and target image A2, and target image A1 includes pixel block A 11 A 12 A 13 A 14 …A 1n The target image A2 includes pixel block A 21 A 22 A 23 A 24 …A 2n The pixel blocks of target image A1 and target image A2 are interleaved and output to form pixel block A. 11 A 21 A 12 A 22 A 13 A 23 A 14 …A 1n A 2n The third target image.
[0070] In some embodiments, after acquiring the third target image corresponding to each frame of target image data, all third target images can be stitched together. For example, there is a third target image 1 (with pixel blocks arranged in A...). 11 A 21 A 12 A 22 A 13 A 23 A 14 …A 1n A 2n ), Third target image 2 (pixel blocks arranged in B) 11 B 21 B 12 B 22 B 13 B 23 B 14 …B 1n B 2n ...the third target image N (with pixel blocks arranged in N...) 11 N 21 N 12 N 22 N 13 N 23 N 14 …N 1n N 2n If the third target image 1, the third target image 2, ..., the third target image N are stitched together, and the stitching result includes pixel blocks arranged in 2n*N.
[0071] In practice, the first edge enhancement operation can be used to expand the edge pixel blocks of the stitched result. After obtaining the stitched result, the first edge enhancement operation can be used to expand the pixel blocks at the edges of the stitched result to obtain the fourth target image.
[0072] In actual implementation, the first edge enhancement operation can be based on mirror expansion, replication expansion, or any other theoretically feasible expansion method.
[0073] In practice, the first filtering operation can employ any filtering method such as mean filtering, Gaussian filtering, or guided filtering, or any other theoretically feasible filtering method.
[0074] In some embodiments, the first target image can be obtained by performing a first filtering operation on the fourth target image.
[0075] According to the two-dimensional image generation method of this application embodiment, a number of frames of target image data are used; for each frame of target image data, a third target image is obtained based on at least two target images; the third target images corresponding to all frames are stitched together, and a first edge enhancement operation is performed on the stitching result to obtain a fourth target image; a first filtering operation is performed on the fourth target image to obtain a first target image; a second edge enhancement operation and a second filtering operation are performed on the first target image to obtain a weight matrix and a second target image; a target two-dimensional image is generated based on the weight matrix and the second target image. By performing the first edge enhancement operation and the second edge enhancement operation before the first filtering operation and the second filtering operation, the blurring caused by the filtering operation to the generated two-dimensional image is reduced, thereby improving the clarity of the generated two-dimensional image while generating a high-resolution two-dimensional image.
[0076] In some embodiments, the stitching result includes several rows of first pixel blocks, and the number of first pixel blocks in each row is at least two; the first edge enhancement operation is used to expand the upper or lower edge of the stitching result by one row and expand the left or right edge of the stitching result by one column to obtain the fourth target image.
[0077] In some embodiments, a first edge enhancement operation can be performed to expand the upper or lower edge of the stitching result by one row and the left or right edge of the stitching result by one column for several rows of first pixel blocks in the stitching result, thereby obtaining a fourth target image.
[0078] In some embodiments, the first edge enhancement operation may employ a mirror expansion method.
[0079] In practice, the mirror expansion method uses the image edge pixel block as the central axis and symmetrically expands the internal pixel blocks adjacent to the image edge pixel block to another adjacent position of the image edge pixel block. For example, Table 1 shows the distribution of each pixel block in the original image, and Table 2 shows the distribution of each pixel block after the edge enhancement operation on the right edge of the image is performed through mirror expansion.
[0080] 1 2 3 4 5 6 7 8 9
[0081] Table 1
[0082] 1 2 3 2 4 5 6 5 7 8 9 8
[0083] Table 2
[0084] In some embodiments, the first edge enhancement operation may employ a copy-and-expand approach.
[0085] In practice, copy expansion can copy pixel blocks from the image edge to the expanded location. For example, Table 1 above shows the distribution of pixel blocks in the original image, and Table 3 shows the distribution of pixel blocks after edge enhancement operation on the right edge of the image is performed through copy expansion.
[0086] 1 2 3 3 4 5 6 6 7 8 9 9
[0087] Table 3
[0088] According to the two-dimensional image generation method of this application embodiment, a number of frames of target image data are used; for each frame of target image data, a third target image is obtained based on at least two target images; the third target images corresponding to all frames are stitched together, and the upper or lower edge of the stitched result is expanded by one row, and the left or right edge of the stitched result is expanded by one column to obtain a fourth target image; a first filtering operation is performed on the fourth target image to obtain a first target image; a second edge enhancement operation and a second filtering operation are performed on the first target image to obtain a weight matrix and a second target image; a target two-dimensional image is generated based on the weight matrix and the second target image. By performing the first edge enhancement operation and the second edge enhancement operation before the first filtering operation and the second filtering operation, the blurring caused by the filtering operation to the generated two-dimensional image is reduced, thereby improving the clarity of the generated two-dimensional image while generating a high-resolution two-dimensional image.
[0089] In some embodiments, a first filtering operation is performed on the fourth target image based on a 2*2 filtering window to obtain a first target image.
[0090] In some embodiments, a first filtering operation can be performed on each pixel block in the fourth target image based on a 2*2 filtering window, and the result of each first filtering operation can be used as a pixel block of the first target image.
[0091] In some embodiments, for a plurality of pixel blocks in the fourth target image, starting with the pixel block at the first row and first column position of the fourth target image, a first filtering operation is performed on the pixel block at the first row and first column position of the fourth target image and its adjacent pixel blocks based on a 2*2 filtering window, and the result of this operation is used as the pixel block at the first row and first column position of the first target image. Then, the 2*2 filtering window is slid to perform the first filtering operation on the pixel block at the first row and second column position of the fourth target image and its adjacent pixel blocks, and the result of this operation is used as the pixel block at the first row and second column position of the first target image. This process is repeated until the first filtering operation is completed on all pixel blocks of the fourth target image, thereby obtaining the first target image.
[0092] According to the two-dimensional image generation method of this application embodiment, a number of frames of target image data are used; for each frame of target image data, a third target image is obtained based on at least two target images; the third target images corresponding to all frames are stitched together, and the upper or lower edge of the stitched result is expanded by one row, and the left or right edge of the stitched result is expanded by one column to obtain a fourth target image; a first filtering operation is performed on the fourth target image based on a 2*2 filtering window to obtain a first target image; a second edge enhancement operation and a second filtering operation are performed on the first target image to obtain a weight matrix and a second target image; a target two-dimensional image is generated based on the weight matrix and the second target image. By performing the first edge enhancement operation and the second edge enhancement operation respectively before the first filtering operation and the second filtering operation, the blurring caused by the filtering operation to the generated two-dimensional image is reduced, thereby improving the clarity of the generated two-dimensional image while generating a high-resolution two-dimensional image.
[0093] In some embodiments, a second edge enhancement operation is performed on the first target image to obtain a fifth target image; the fifth target image includes several rows of second pixel blocks, and the number of second pixel blocks in each row is at least three; based on a 3*3 filtering window, each second pixel block in the fifth target image is filtered to obtain the second target image, and each element in the weight matrix is obtained based on the pixel variance of each 3*3 filtering window.
[0094] In practice, the second edge enhancement operation can be used to expand the edge pixel blocks of the first target image. After acquiring the first target image, the second edge enhancement operation can be used to expand the pixel blocks at the edges of the first target image to obtain the fifth target image.
[0095] In practice, the second edge enhancement operation can be based on mirroring, replication, or any other theoretically feasible extension method.
[0096] In practice, the second filtering operation can employ any filtering method such as mean filtering, Gaussian filtering, or guided filtering, or any other theoretically feasible filtering method.
[0097] In some embodiments, a second filtering operation can be performed on each second pixel block in the fifth target image based on a 3*3 filtering window, and the result of each second filtering operation can be used as a pixel block of the second target image.
[0098] In some embodiments, for a plurality of pixel blocks in the fifth target image, starting from the pixel block at the first row and first column position of the fifth target image, a second filtering operation is performed on the pixel block at the first row and first column position of the fifth target image and its adjacent pixel blocks based on a 3*3 filtering window, and the result of this operation is used as the pixel block at the first row and first column position of the second target image. Then, the 3*3 filtering window is slid to perform a second filtering operation on the pixel block at the first row and second column position of the fifth target image and its adjacent pixel blocks, and the result of this operation is used as the pixel block at the first row and second column position of the second target image. This process is repeated until the second filtering operation is completed on all pixel blocks of the fifth target image, thereby obtaining the second target image.
[0099] In some embodiments, a second filtering operation is performed on each second pixel block in the fifth target image based on a 3*3 filtering window, and the variance of the pixel values of the nine pixel blocks within the filtering window is calculated based on the 3*3 filtering window. The weight corresponding to the position of the pixel block in the fifth target image is obtained based on the variance, and the weight is determined as the element at the same position in the weight matrix.
[0100] In some embodiments, each element in the weight matrix can be obtained based on the following formula:
[0101]
[0102] Among them, G ij S represents the element at the i-th row and j-th column of the weight matrix; ij This represents the variance of the pixel value calculated based on the second pixel block at the i-th row and j-th column position in the fifth target image through a 3*3 filtering window; a, b, and c are all empirical values.
[0103] According to the two-dimensional image generation method of this application embodiment, a first target image is obtained by performing a first edge enhancement operation and a first filtering operation on all target image data using several frames of target image data; a second edge enhancement operation is performed on the first target image to obtain a fifth target image; the fifth target image includes several rows of second pixel blocks, with each row of second pixel blocks having at least three pixels; each second pixel block in the fifth target image is filtered based on a 3*3 filtering window to obtain a second target image, and each element in the weight matrix is obtained based on the pixel value variance of each 3*3 filtering window; a target two-dimensional image is generated based on the weight matrix and the second target image. By performing the first edge enhancement operation and the second edge enhancement operation before the first filtering operation and the second filtering operation, the blurring caused by the filtering operation to the generated two-dimensional image is reduced, thereby improving the clarity of the generated two-dimensional image while generating a high-resolution two-dimensional image.
[0104] In some embodiments, the first target image includes several rows of third pixel blocks, and the number of third pixel blocks in each row is at least one; the second edge enhancement operation is used to expand the upper edge and lower edge of the first target image by one row, and expand the left edge and right edge of the first target image by one column, to obtain the fifth target image.
[0105] In some embodiments, a second edge enhancement operation can be performed to expand the upper and lower edges of the first target image by one row of pixels for several rows of third pixel blocks in the first target image, and to expand the left and right edges of the stitching result by one column of pixels to obtain a fifth target image.
[0106] In some embodiments, the second edge enhancement operation may employ a mirror expansion method or a copy expansion method.
[0107] According to the two-dimensional image generation method of this application embodiment, a first target image is obtained by performing a first edge enhancement operation and a first filtering operation on all target image data using several frames of target image data; a second edge enhancement operation is used to expand the upper and lower edges of the first target image by one row and the left and right edges of the first target image by one column to obtain a fifth target image; the fifth target image includes several rows of second pixel blocks, and the number of second pixel blocks in each row is at least three; each second pixel block in the fifth target image is filtered based on a 3*3 filtering window to obtain a second target image, and each element in the weight matrix is obtained based on the pixel value variance of each 3*3 filtering window; a target two-dimensional image is generated based on the weight matrix and the second target image. By performing the first edge enhancement operation and the second edge enhancement operation before the first filtering operation and the second filtering operation, the blurring caused by the filtering operation to the generated two-dimensional image is reduced, thereby improving the clarity of the generated two-dimensional image while generating a high-resolution two-dimensional image.
[0108] In some embodiments, for each first pixel block in the stitching result, the pixel difference between the first pixel block and the corresponding pixel block in the second target image is obtained; the element of each first pixel block at the corresponding position in the weight matrix is obtained, and the target product of the element and the pixel difference is obtained; the sum of the target product of each first pixel block is obtained as each pixel block of the target two-dimensional image.
[0109] In some embodiments, for the first pixel block A in the i-th row and j-th column of the stitching result ij Obtain the first pixel block A ij The pixel difference between the pixel block in the i-th row and j-th column of the second target image is used to obtain the element G in the i-th row and j-th column of the weight matrix. ij and obtain G ijThe first pixel block A is obtained by multiplying the target product with the pixel difference. ij The sum of the products of the target and the target is used as the pixel block in the i-th row and j-th column of the target 2D image.
[0110] In some embodiments, each pixel block in the target two-dimensional image can be obtained based on the following formula:
[0111] Z ij =A ij +G ij *(A ij X ij )
[0112] Among them, G ij Z represents the element at the i-th row and j-th column of the weight matrix; ij A represents the pixel block at the i-th row and j-th column in the target 2D image; ij X represents the pixel value of the first pixel block in the i-th row and j-th column of the stitched result. ij The pixel value of the pixel block in the i-th row and j-th column of the second target image.
[0113] According to the two-dimensional image generation method of this application embodiment, a first target image is obtained by performing a first edge enhancement operation and a first filtering operation on all target image data using several frames of target image data; a second edge enhancement operation and a second filtering operation are performed on the first target image to obtain a weight matrix and a second target image; for each first pixel block in the stitching result, the pixel difference between the first pixel block and the corresponding pixel block in the second target image is obtained; the element of each first pixel block at the corresponding position in the weight matrix is obtained, and the target product of the element and the pixel difference is obtained; the sum of the target product of each first pixel block is obtained as each pixel block of the target two-dimensional image. By performing the first edge enhancement operation and the second edge enhancement operation before the first filtering operation and the second filtering operation, the blurring caused by the filtering operation to the generated two-dimensional image is reduced, thereby improving the clarity of the generated two-dimensional image while generating a high-resolution two-dimensional image.
[0114] To better understand the two-dimensional image generation method provided in the embodiments of this application, further explanation is provided below. It should be understood that the following discussion is merely exemplary.
[0115] This application provides a method for generating a two-dimensional image, the specific steps of which are as follows: Figure 2 As shown:
[0116] Step 210: Acquire several frames of target image data; each frame of target image data includes at least two target images.
[0117] In actual execution, each frame of target image data can be acquired using a line scan camera.
[0118] In some embodiments, each frame of target image data may include at least two target images. A line scan camera may include at least two sensors, each of which can acquire one target image, which may be an image with a first resolution (e.g., a 1*1024 resolution image).
[0119] Step 220: For each frame of target image data, obtain a third target image based on at least two target images; stitch together the third target images corresponding to all frames to obtain the stitching result.
[0120] In actual execution, each target image can include several pixel blocks.
[0121] In some embodiments, for each frame of target image data in a plurality of frames of target image data, pixel blocks of several target images in the target image data can be interleaved and output to generate a third target image for that frame of target image data. For example, as Figure 3 As shown, the target image data includes target image A1 and target image A2. Target image A1 includes pixel block A. 11 A 12 A 13 A 14 …A 1n The target image A2 includes pixel block A 21 A 22 A 23 A 24 …A 2n The pixel blocks of target image A1 and target image A2 are interleaved and output to form pixel block A. 11 A 21 A 12 A 22 A 13 A 23 A 14 …A 1n A 2n The third target image.
[0122] In some embodiments, after acquiring the third target image corresponding to each frame of target image data, all third target images can be stitched together. For example, there is a third target image 1 (with pixel blocks arranged in A...). 11 A 21 A 12 A 22 A 13 A 23 A 14 …A 1n A 2n ), Third target image 2 (pixel blocks arranged in B) 11B 21 B 12 B 22 B 13 B 23 B 14 …B 1n B 2n ...the third target image N (with pixel blocks arranged in N...) 11 N 21 N 12 N 22 N 13 N 23 N 14 …N 1n N 2n If the third target image 1, the third target image 2, ..., the third target image N are stitched together, and the stitching result includes pixel blocks arranged in 2n*N.
[0123] Step 230: Expand the top or bottom edge of the stitched result by one row, and expand the left or right edge of the stitched result by one column to obtain the fourth target image.
[0124] In some embodiments, a first edge enhancement operation can be performed to expand the upper or lower edge of the stitching result by one row and the left or right edge of the stitching result by one column for several rows of first pixel blocks in the stitching result, thereby obtaining a fourth target image.
[0125] In some embodiments, the first edge enhancement operation may employ a mirror expansion method or a copy expansion method.
[0126] Step 240: Based on the 2*2 filtering window, perform the first filtering operation on the fourth target image to obtain the first target image.
[0127] In some embodiments, a first filtering operation can be performed on each pixel block in the fourth target image based on a 2*2 filtering window, and the result of each first filtering operation can be used as a pixel block of the first target image.
[0128] In some embodiments, such as Figure 4As shown, for several pixel blocks in the fourth target image, starting from the pixel block at the first row and first column position of the fourth target image, a first filtering operation is performed on the pixel block at the first row and first column position of the fourth target image and its adjacent pixel blocks based on a 2*2 filtering window. The result of this operation is then used as the pixel block at the first row and first column position of the first target image. Next, the 2*2 filtering window is slid to perform the first filtering operation on the pixel block at the first row and second column position of the fourth target image and its adjacent pixel blocks, and the result of this operation is then used as the pixel block at the first row and second column position of the first target image. This process is repeated until the first filtering operation is completed on all pixel blocks of the fourth target image, thus obtaining the first target image.
[0129] Step 250: Expand the top and bottom edges of the first target image by one row, and expand the left and right edges of the first target image by one column to obtain the fifth target image.
[0130] In some embodiments, a second edge enhancement operation can be performed to expand the upper and lower edges of the first target image by one row of pixels for several rows of third pixel blocks in the first target image, and to expand the left and right edges of the stitching result by one column of pixels to obtain a fifth target image.
[0131] In some embodiments, the second edge enhancement operation may employ a mirror expansion method or a copy expansion method.
[0132] Step 260: Based on the 3*3 filtering window, filter each second pixel block in the fifth target image to obtain the second target image, and obtain each element in the weight matrix based on the pixel variance of each 3*3 filtering window.
[0133] In practice, the second filtering operation can employ any filtering method such as mean filtering, Gaussian filtering, or guided filtering, or any other theoretically feasible filtering method.
[0134] In some embodiments, a second filtering operation can be performed on each second pixel block in the fifth target image based on a 3*3 filtering window, and the result of each second filtering operation can be used as a pixel block of the second target image.
[0135] In some embodiments, such as Figure 5As shown, for several pixel blocks in the fifth target image, starting from the pixel block at the first row and first column position of the fifth target image, a second filtering operation is performed on the pixel block at the first row and first column position of the fifth target image and its adjacent pixel blocks based on a 3*3 filtering window. The result of this operation is then used as the pixel block at the first row and first column position of the second target image. Next, the 3*3 filtering window is slid to perform a second filtering operation on the pixel block at the first row and second column position of the fifth target image and its adjacent pixel blocks, and the result of this operation is used as the pixel block at the first row and second column position of the second target image. This process is repeated until the second filtering operation is completed on all pixel blocks of the fifth target image, thus obtaining the second target image.
[0136] In some embodiments, a second filtering operation is performed on each second pixel block in the fifth target image based on a 3*3 filtering window, and the variance of the pixel values of the nine pixel blocks within the filtering window is calculated based on the 3*3 filtering window. The weight corresponding to the position of the pixel block in the fifth target image is obtained based on the variance, and the weight is determined as the element at the same position in the weight matrix.
[0137] In some embodiments, each element in the weight matrix can be obtained based on the following formula:
[0138]
[0139] Among them, G ij S represents the element at the i-th row and j-th column of the weight matrix; ij This represents the variance of the pixel value calculated based on the second pixel block at the i-th row and j-th column position in the fifth target image through a 3*3 filtering window; a, b, and c are all empirical values.
[0140] Step 270: For each first pixel block in the stitching result, obtain the pixel difference between the first pixel block and the corresponding pixel block in the second target image; obtain the element of the corresponding position of each first pixel block in the weight matrix, and obtain the target product of the element and the pixel difference; obtain the sum of the target product of each first pixel block and the first pixel block, as each pixel block of the target two-dimensional image.
[0141] In some embodiments, for the first pixel block A in the i-th row and j-th column of the stitching result ij Obtain the first pixel block A ij The pixel difference between the pixel block in the i-th row and j-th column of the second target image is used to obtain the element G in the i-th row and j-th column of the weight matrix. ij and obtain G ij The first pixel block A is obtained by multiplying the target product with the pixel difference. ij The sum of the products of the target and the target is used as the pixel block in the i-th row and j-th column of the target 2D image.
[0142] In some embodiments, each pixel block in the target two-dimensional image can be obtained based on the following formula:
[0143] Z ij =A ij +G ij *(A ij -X ij )
[0144] Among them, G ij Z represents the element at the i-th row and j-th column of the weight matrix; ij A represents the pixel block at the i-th row and j-th column in the target 2D image; ij X represents the pixel value of the first pixel block in the i-th row and j-th column of the stitched result. ij The pixel value of the pixel block in the i-th row and j-th column of the second target image.
[0145] This application also provides a two-dimensional image generation apparatus.
[0146] like Figure 6 As shown, the two-dimensional image generation device 600 includes: a first acquisition module 610, a second acquisition module 610, a third acquisition module 610, and a generation module 620.
[0147] The first acquisition module 610 is used to acquire several frames of target image data;
[0148] The second acquisition module 620 is used to perform a first edge enhancement operation and a first filtering operation on several frames of target image data to acquire a first target image;
[0149] The third acquisition module 630 is used to perform a second edge enhancement operation and a second filtering operation on the first target image to acquire a weight matrix and a second target image.
[0150] The generation module 640 is used to generate a target two-dimensional image based on the weight matrix and the second target image.
[0151] According to the two-dimensional image generation apparatus of this application, by acquiring the target detection parameter type preset for the link of the target physical layer chip, and in the case of abnormality of the target detection parameter corresponding to the preset target detection parameter type, the link abnormality of the target physical layer chip is determined, so as to accurately determine the target detection parameter type that causes the link abnormality of the target physical layer chip after determining the link abnormality of the target physical layer chip, thereby solving the problem of not being able to accurately locate the cause of the link abnormality of the physical layer chip.
[0152] In some embodiments, each frame of target image data in a plurality of frames of target image data includes at least two target images; the second acquisition module 620 includes:
[0153] The first acquisition unit is used to acquire a third target image for each frame of target image data, based on at least two target images;
[0154] The second acquisition unit is used to stitch together the third target images corresponding to all frames, and to perform a first edge enhancement operation on the stitching result to acquire the fourth target image;
[0155] The third acquisition unit is used to perform a first filtering operation on the fourth target image to acquire the first target image.
[0156] In some embodiments, the stitching result includes several rows of first pixel blocks, and the number of first pixel blocks in each row is at least two; the first edge enhancement operation is used to expand the upper or lower edge of the stitching result by one row and expand the left or right edge of the stitching result by one column to obtain the fourth target image.
[0157] In some embodiments, the third acquisition unit is used to perform a first filtering operation on the fourth target image based on a 2*2 filtering window to acquire the first target image.
[0158] In some embodiments, the third acquisition module 630 includes:
[0159] The fourth acquisition unit is used to perform a second edge enhancement operation on the first target image to acquire a fifth target image; the fifth target image includes several rows of second pixel blocks, and the number of second pixel blocks in each row is at least three.
[0160] The fifth acquisition unit is used to filter each second pixel block in the fifth target image based on a 3*3 filtering window to obtain the second target image, and to obtain each element in the weight matrix based on the pixel variance of each 3*3 filtering window.
[0161] In some embodiments, the first target image includes several rows of third pixel blocks, and the number of third pixel blocks in each row is at least one; the second edge enhancement operation is used to expand the upper edge and lower edge of the first target image by one row, and expand the left edge and right edge of the first target image by one column, to obtain the fifth target image.
[0162] In some embodiments, the generation module 640 includes:
[0163] The sixth acquisition unit is used to acquire the pixel difference between each first pixel block in the stitching result and the corresponding pixel block in the second target image.
[0164] The seventh acquisition unit is used to acquire the element of each first pixel block at the corresponding position in the weight matrix, and to acquire the target product of the element and the pixel difference;
[0165] The eighth acquisition unit is used to acquire the sum of the product of each first pixel block and the target, as each pixel block of the target two-dimensional image.
[0166] The two-dimensional image generation device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.
[0167] The two-dimensional image generation device in this application embodiment can be a device with an operating system. This operating system can be a Microsoft (Windows) operating system, an Android operating system, an iOS operating system, or other possible operating systems; this application embodiment does not specifically limit the specific operating system.
[0168] The two-dimensional image generation device 600 provided in this application embodiment can achieve... Figures 1 to 5 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0169] In some embodiments, such as Figure 7 As shown, this application embodiment also provides an electronic device 400, including a processor 701, a memory 702, and a computer program stored in the memory 702 and executable on the processor 701. When the program is executed by the processor 701, it implements the various processes of the above-described two-dimensional image generation method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0170] It should be noted that the computer equipment in this application embodiment includes the mobile electronic equipment and non-mobile electronic equipment described above.
[0171] This application also provides a non-transitory computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described two-dimensional image generation method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0172] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0173] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described two-dimensional image generation method.
[0174] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0175] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described two-dimensional image generation method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0176] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0177] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0178] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0179] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
[0180] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0181] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.
Claims
1. A method for generating a two-dimensional image, characterized in that, include: Acquire several frames of target image data; A first edge enhancement operation and a first filtering operation are performed on the plurality of frames of target image data to obtain a first target image; A second edge enhancement operation and a second filtering operation are performed on the first target image to obtain a weight matrix and a second target image; A target two-dimensional image is generated based on the weight matrix and the second target image.
2. The two-dimensional image generation method according to claim 1, characterized in that, Each frame of target image data in the plurality of frames includes at least two target images; Performing a first edge enhancement operation and a first filtering operation on the aforementioned several frames of target image data to obtain a first target image includes: For each frame of the target image data, a third target image is obtained based on the at least two target images; The third target image corresponding to all frames is stitched together, and the stitching result is subjected to a first edge enhancement operation to obtain the fourth target image; A first filtering operation is performed on the fourth target image to obtain the first target image.
3. The two-dimensional image generation method according to claim 2, characterized in that, The stitching result includes several rows of first pixel blocks, with each row containing at least two first pixel blocks; the first edge enhancement operation is used to expand the upper or lower edge of the stitching result by one row and the left or right edge of the stitching result by one column to obtain the fourth target image.
4. The two-dimensional image generation method according to claim 2, characterized in that, Performing a first filtering operation on the fourth target image to obtain a first target image includes: Based on a 2*2 filtering window, a first filtering operation is performed on the fourth target image to obtain a first target image.
5. The two-dimensional image generation method according to claim 1, characterized in that, Performing a second edge enhancement operation and a second filtering operation on the first target image to obtain a weight matrix and a second target image includes: A second edge enhancement operation is performed on the first target image to obtain a fifth target image; the fifth target image includes several rows of second pixel blocks, and the number of second pixel blocks in each row is at least three. Based on a 3*3 filtering window, each second pixel block in the fifth target image is filtered to obtain the second target image, and each element in the weight matrix is obtained based on the pixel variance of each 3*3 filtering window.
6. The two-dimensional image generation method according to claim 5, characterized in that, The first target image includes several rows of third pixel blocks, and the number of third pixel blocks in each row is at least one; the second edge enhancement operation is used to expand the upper edge and lower edge of the first target image by one row, and expand the left edge and right edge of the first target image by one column, to obtain the fifth target image.
7. The two-dimensional image generation method according to any one of claims 2-6, characterized in that, Based on the weight matrix and the second target image, a target two-dimensional image is generated, including: For each first pixel block in the stitching result, obtain the pixel difference between the first pixel block and the corresponding pixel block in the second target image; Obtain the element at the corresponding position in the weight matrix for each of the first pixel blocks, and obtain the target product of the element and the pixel difference; The sum of the products of each first pixel block and the target is obtained as each pixel block of the target two-dimensional image.
8. A two-dimensional image generation device, characterized in that, include: The first acquisition module is used to acquire several frames of target image data; The second acquisition module is used to perform a first edge enhancement operation and a first filtering operation on the plurality of frames of target image data to acquire a first target image; The third acquisition module is used to perform a second edge enhancement operation and a second filtering operation on the first target image to acquire a weight matrix and a second target image. The generation module is used to generate a target two-dimensional image based on the weight matrix and the second target image.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the two-dimensional image generation method as described in any one of claims 1-7.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the two-dimensional image generation method as described in any one of claims 1-7.