Image processing method, system, device, and storage medium

By calculating the second-order differential value and prediction direction at the image boundary and dynamically adjusting the boundary filling, the problem of information loss in edge processing in image scaling is solved, and high-quality image scaling and data integrity are achieved.

WO2024193305A1PCT designated stage expired Publication Date: 2024-09-26SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/078840
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-17
Filing Date
2024-02-27
Publication Date
2024-09-26

AI Technical Summary

Technical Problem

Existing image scaling technology is prone to black, white or cluttered edges when processing image edges, resulting in a decrease in the quality of the pixel matrix, and existing methods cannot effectively process image boundaries, resulting in information loss or inapplicability.

Method used

By calculating the second-order differential value at the boundary of the pixel matrix, the image model is predicted, and the boundary filling is dynamically and adaptively adjusted, and expansion methods in multiple preset directions are used to achieve high-quality image scaling.

Benefits of technology

It achieves high-quality image scaling, ensures the integrity of image data, is suitable for a variety of interpolation schemes, and solves the problem of information loss in edge processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024078840_26092024_PF_FP
    Figure CN2024078840_26092024_PF_FP
Patent Text Reader

Abstract

An image processing method, a system, a device, and a non-volatile readable storage medium. The method comprises the steps of: selecting a plurality of rows or columns at each boundary of a pixel point matrix, and selecting a reference row or column from the plurality of rows or columns; separately calculating absolute values of second-order differential values of each pixel point in the plurality of rows or columns in a plurality of preset directions; determining a prediction direction of each pixel point in the reference row or column; and counting the number of each prediction direction among the prediction directions corresponding to all the pixel points in the reference row or column, using the prediction direction having the maximum number as a prediction direction of the corresponding boundary, and expanding the corresponding boundary according to the prediction direction of the corresponding boundary.
Need to check novelty before this filing date? Find Prior Art

Description

Image processing method, system, device and storage medium

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on March 17, 2023, with application number 202310257890.3, and application name “An image processing method, system, device and storage medium”, all contents of which are incorporated by reference into this application. Technical Field

[0003] The present application relates to the field of images, and in particular to an image processing method, system, device, and non-volatile readable storage medium. Background Art

[0004] Image resizing, part of image compression within image processing, involves adjusting the size of a pixel matrix. Image resizing involves sampling the pixel values ​​of the original matrix and then reconstructing them to create a new pixel matrix based on the desired size. As a key component of image processing, image resizing plays a vital role in enabling people to access more information.

[0005] Common methods for image scaling include the nearest neighbor method, bilinear interpolation, and bicubic interpolation. Essentially, these methods all involve finding an interpolation matrix (e.g., a 2*2, 3*3, 4*4, or 5*5 matrix) based on the scaling ratio and the original image, and then performing approximate calculations based on a specific interpolation algorithm. However, regardless of the method used, when scaling an image, it is impossible to find all nearby points in the original image for interpolation calculations for pixel values ​​at the edges (or boundaries) of the image, such as the first two rows, the last two rows, the left two columns, and the right two columns. Therefore, after interpolation, black, white, green, or cluttered image edges are likely to appear at the boundaries, seriously affecting the quality of the pixel matrix.

[0006] Therefore, when scaling an image in the prior art, there are the following disadvantages:

[0007] 1. No processing is done on the boundaries. This is only used in scenarios with low image quality requirements.

[0008] 2. Use fixed colors instead of the pixel values ​​calculated by the original algorithm, such as using black pixels (black edges) at the boundaries. This method will lose valid information pixels at the boundaries due to scaling;

[0009] 3. Use a fixed method to expand (extend) the boundary and then perform subsequent calculations, but this method is only applicable to some video image scenes and is not applicable in other scenes.

[0010] Summary of the Invention

[0011] In view of this, in order to overcome at least one aspect of the above-mentioned problems, an embodiment of the present application proposes an image processing method, comprising the following steps: selecting several rows or columns for each boundary of a pixel matrix, and selecting reference rows or columns respectively from the several rows or columns corresponding to each boundary; respectively calculating the absolute values ​​of the second-order differential values ​​of each pixel point in the several rows or columns in multiple preset directions; adding the absolute values ​​of the second-order differential values ​​of each pixel point in the reference row or column and several pixel points around it in the same preset direction and taking the preset direction corresponding to the minimum value of the sum of the absolute values ​​as the predicted direction of the corresponding pixel point in the reference row or column; counting the number of each predicted direction corresponding to all pixel points in the reference row or column, taking the predicted direction with the largest number as the predicted direction of the corresponding boundary, and expanding the corresponding boundary according to the predicted direction of the corresponding boundary.

[0012] In some embodiments, calculating the absolute value of the second-order differential value of each pixel point in a plurality of rows or columns in a plurality of preset directions includes:

[0013] Calculate the absolute value of the second-order differential in the 0° direction according to the formula D_0 = |2*P(x, y)-P(x, y-1)-P(x, y+1)|;

[0014] Calculate the absolute value of the second-order differential in the 45° direction according to the formula D_45=|2*P(x, y)-P(x+1, y-1)-P(x-1, y+1)|;

[0015] Calculate the absolute value of the second-order differential in the 90° direction according to the formula D_90=|2*P(x, y)-P(x-1, y)-P(x+1, y)|;

[0016] Calculate the absolute value of the second-order differential in the 135° direction according to the formula D_135=|2*P(x, y)-P(x-1, y-1)-P(x+1, y+1)|;

[0017] Where x and y are the row and column numbers of the pixel respectively, and P is the pixel value.

[0018] In some embodiments, the number of each prediction direction corresponding to all pixels in a reference row or column is counted, the prediction direction with the largest number is used as the prediction direction of the corresponding boundary, and the corresponding boundary is expanded according to the prediction direction of the corresponding boundary, including: in response to the prediction direction corresponding to the upper boundary being 0°, copying the first row of the pixel point matrix as the first and second rows of the upper extended row and storing them in a first dual-port RAM (Random Access Memory); in response to the prediction direction corresponding to the upper boundary being 45°, copying the first row of the pixel point matrix as the first and second rows of the upper extended row, shifting them to the right and storing them in the first dual-port RAM; in response to the prediction direction corresponding to the upper boundary being 90°, copying the first row of the pixel point matrix as the second row of the upper extended row, copying the second row of the pixel point matrix as the first row of the upper extended row and storing them in the first dual-port RAM; in response to the prediction direction corresponding to the upper boundary being 135°, copying the first row of the pixel point matrix as the first and second rows of the upper extended row, shifting them to the left and storing them in the first dual-port RAM.

[0019] In some embodiments, in response to the prediction direction corresponding to the upper boundary being 0°, copying the first row of the pixel matrix as the first and second rows of the upper extension row and saving them in the first dual-port RAM, further comprising: writing each column of data in the first row of the pixel matrix starting from the address 0 of the first port of the first dual-port RAM; writing each column of data in the first row of the pixel matrix starting from the address 0 of the second port of the first dual-port RAM.

[0020] In some embodiments, in response to the prediction direction corresponding to the upper boundary being 45°, the first row of the pixel matrix is ​​copied as the first and second rows of the upper extension row, and simultaneously shifted to the right and saved in the first dual-port RAM, including: writing each column of data in the first row of the pixel matrix except the last two columns of data starting from the address 2 of the first port of the first dual-port RAM; writing each column of data in the first row of the pixel matrix except the last column of data starting from the address 1 of the second port of the first dual-port RAM.

[0021] In some embodiments, in response to the prediction direction corresponding to the upper boundary being 90°, the first row of the pixel point matrix is ​​copied as the second row of the upper extension row, and the second row of the pixel point matrix is ​​copied as the first row of the upper extension row and saved in the first dual-port RAM, including: writing each column of data in the first row of the pixel point matrix in sequence starting from the address 0 of the second port of the first dual-port RAM; writing each column of data in the second row of the pixel point matrix in sequence starting from the address 0 of the first port of the first dual-port RAM.

[0022] In some embodiments, in response to the prediction direction corresponding to the upper boundary being 135°, the first row of the pixel matrix is ​​copied as the first row and the second row of the upper extension row, and is simultaneously shifted to the left and saved in the first dual-port RAM, including: writing each column of data in the first row of the pixel matrix except the first column of data in sequence starting from the address 0 of the first port of the first dual-port RAM; writing each column of data in the first row of the pixel matrix except the first two columns of data in sequence starting from the address 0 of the second port of the first dual-port RAM.

[0023] In some embodiments, the number of each prediction direction corresponding to all pixel points of a reference row or column is counted, the prediction direction with the largest number is used as the prediction direction of the corresponding boundary, and the corresponding boundary is expanded according to the prediction direction of the corresponding boundary, including: in response to the prediction direction corresponding to the lower boundary being 0°, copying the last row of the pixel point matrix as the first row and the second row of the lower extended row and storing them in the second dual-port RAM; in response to the prediction direction corresponding to the lower boundary being 45°, copying the last row of the pixel point matrix as the first row and the second row of the lower extended row, shifting them to the left and storing them in the second dual-port RAM; in response to the prediction direction corresponding to the lower boundary being 90°, copying the last row of the pixel point matrix as the first row of the lower extended row, copying the second to last row of the pixel point matrix as the second row of the lower extended row and storing them in the second dual-port RAM; in response to the prediction direction corresponding to the lower boundary being 135°, copying the last row of the pixel point matrix as the first row and the second row of the lower extended row, shifting them to the right and storing them in the second dual-port RAM.

[0024] In some embodiments, in response to the prediction direction corresponding to the lower boundary being 0°, copying the last row of the pixel matrix as the first and second rows of the lower extension row and saving them in the second dual-port RAM, further comprising: writing each column of data of the last row of the pixel matrix in sequence starting from the address 0 of the first port of the second dual-port RAM; writing each column of data of the last row of the pixel matrix in sequence starting from the address 0 of the second port of the second dual-port RAM.

[0025] In some embodiments, in response to the prediction direction corresponding to the lower boundary being 45°, the last row of the pixel matrix is ​​copied as the first and second rows of the lower extension row, and simultaneously shifted to the left and saved in the second dual-port RAM, including: writing each column of data except the first column of data in the last row of the pixel matrix in sequence starting from the address 0 of the first port of the second dual-port RAM; writing each column of data except the first two columns of data in the last row of the pixel matrix in sequence starting from the address 0 of the second port of the second dual-port RAM.

[0026] In some embodiments, in response to the prediction direction corresponding to the lower boundary being 90°, the last row of the pixel matrix is ​​copied as the first row of the lower extension row, and the second-to-last row of the pixel matrix is ​​copied as the second row of the lower extension row and saved in the second dual-port RAM, including: writing each column of data in the last row of the pixel matrix in sequence starting from the address 0 of the second port of the second dual-port RAM; writing each column of data in the second-to-last row of the pixel matrix in sequence starting from the address 0 of the first port of the second dual-port RAM.

[0027] In some embodiments, in response to the prediction direction corresponding to the lower boundary being 135°, the last row of the pixel matrix is ​​copied as the first and second rows of the lower extension row, and is simultaneously shifted to the right and saved in the second dual-port RAM, including: writing each column of data except the last two columns of data in the last row of the pixel matrix in sequence starting from the address 2 of the first port of the second dual-port RAM; writing each column of data except the last column of data in the last row of the pixel matrix in sequence starting from the address 1 of the second port of the second dual-port RAM.

[0028] In some embodiments, the number of each prediction direction corresponding to all pixels in a reference row or column is counted, the prediction direction with the largest number is used as the prediction direction of the corresponding boundary, and the corresponding boundary is expanded according to the prediction direction of the corresponding boundary, including: in response to the prediction direction corresponding to the left boundary being 0°, copying the first column of the pixel point matrix as the second column of the left extended column, copying the second column of the pixel point matrix as the first column of the left extended column and saving it in a third dual-port RAM; in response to the prediction direction corresponding to the left boundary being 45°, copying the first column of the pixel point matrix as the first and second columns of the left extended column, shifting downward at the same time and saving it in the third dual-port RAM; in response to the prediction direction corresponding to the left boundary being 90°, copying the first column of the pixel point matrix as the first and second columns of the left extended column and saving it in the third dual-port RAM; in response to the prediction direction corresponding to the left boundary being 135°, copying the first column of the pixel point matrix as the first and second columns of the left extended column, shifting upward at the same time and saving it in the third dual-port RAM.

[0029] In some embodiments, in response to the prediction direction corresponding to the left boundary being 0°, the first column of the pixel matrix is ​​copied as the second column of the left extended column, the second column of the pixel matrix is ​​copied as the first column of the left extended column and saved in the third dual-port RAM, and also includes: writing each row of data in the first column of the pixel matrix starting from the address 0 of the first port of the third dual-port RAM; writing each row of data in the second column of the pixel matrix starting from the address 0 of the second port of the third dual-port RAM.

[0030] In some embodiments, in response to the prediction direction corresponding to the left boundary being 45°, the first column of the pixel matrix is ​​copied as the first and second columns of the left extended column, and simultaneously shifted downward and saved in the third dual-port RAM, further comprising: writing each row of data except the last two rows of data in the first column of the pixel matrix in sequence starting from the address 2 of the first port of the third dual-port RAM; and writing each row of data except the last row of data in the first column of the pixel matrix in sequence starting from the address 1 of the second port of the third dual-port RAM.

[0031] In some embodiments, in response to the prediction direction corresponding to the left boundary being 90°, copying the first column of the pixel matrix as the first and second columns of the left extended column and saving them in the third dual-port RAM, further comprising: writing each row of data in the first column of the pixel matrix starting from the address 0 of the first port of the third dual-port RAM; writing each row of data in the first column of the pixel matrix starting from the address 0 of the second port of the third dual-port RAM.

[0032] In some embodiments, in response to the prediction direction corresponding to the left boundary being 135°, the first column of the pixel matrix is ​​copied and used as the first and second columns of the left extended column, and is simultaneously shifted upward and stored in the third dual-port RAM, further comprising: writing each row of data in the first column of the pixel matrix except the first two rows of data starting from the address 0 of the first port of the third dual-port RAM; writing each row of data in the first column of the pixel matrix except the first row of data starting from the address 0 of the second port of the third dual-port RAM.

[0033] In some embodiments, the number of each prediction direction corresponding to all pixel points in a reference row or column is counted, the prediction direction with the largest number is used as the prediction direction of the corresponding boundary, and the corresponding boundary is expanded according to the prediction direction of the corresponding boundary, including: in response to the prediction direction corresponding to the right boundary being 0°, copying the last column of the pixel point matrix as the second column of the right extended column, copying the second to last column of the pixel point matrix as the first column of the right extended column and saving it in a fourth dual-port RAM; in response to the prediction direction corresponding to the right boundary being 45°, copying the last column of the pixel point matrix as the first and second columns of the right extended column, and shifting upward and saving it in the fourth dual-port RAM; in response to the prediction direction corresponding to the right boundary being 90°, copying the last column of the pixel point matrix as the first and second columns of the right extended column and saving it in the fourth dual-port RAM; in response to the prediction direction corresponding to the right boundary being 135°, copying the last column of the pixel point matrix as the first and second columns of the right extended column, and shifting downward and saving it in the fourth dual-port RAM.

[0034] In some embodiments, in response to the prediction direction corresponding to the right boundary being 0°, the last column of the pixel matrix is ​​copied as the second column of the right extended column, and the penultimate column of the pixel matrix is ​​copied as the first column of the right extended column and saved in the fourth dual-port RAM, and also includes: writing each row of data of the last column of the pixel matrix in sequence starting from the address 0 of the first port of the fourth dual-port RAM; writing each row of data of the penultimate column of the pixel matrix in sequence starting from the address 0 of the second port of the fourth dual-port RAM.

[0035] In some embodiments, in response to the prediction direction corresponding to the right boundary being 45°, the last column of the pixel matrix is ​​copied as the first and second columns of the right extended column, and simultaneously shifted upward and saved in the fourth dual-port RAM, further comprising: writing each row of data except the first two rows of data in the last column of the pixel matrix in sequence starting from the address 0 of the first port of the fourth dual-port RAM; writing each row of data except the first row of data in the last column of the pixel matrix in sequence starting from the address 0 of the second port of the fourth dual-port RAM.

[0036] In some embodiments, in response to the prediction direction corresponding to the right boundary being 90°, copying the last column of the pixel matrix as the first and second columns of the right extended column and saving them in the fourth dual-port RAM, further comprising: writing each row of data of the first column of the pixel matrix in sequence starting from the address 0 of the first port of the fourth dual-port RAM; writing each row of data of the first column of the pixel matrix in sequence starting from the address 0 of the second port of the fourth dual-port RAM.

[0037] In some embodiments, in response to the prediction direction corresponding to the right boundary being 135°, the last column of the pixel matrix is ​​copied as the first and second columns of the right extended column, and simultaneously shifted downward and saved in the fourth dual-port RAM, further comprising: writing each row of data except the last two rows of data in the last column of the pixel matrix in sequence starting from the address 2 of the first port of the fourth dual-port RAM; writing each row of data except the last row of data in the last column of the pixel matrix in sequence starting from the address 1 of the second port of the fourth dual-port RAM.

[0038] Based on the same inventive concept, according to another aspect of the present application, an embodiment of the present application further provides an image boundary processing system, comprising: a selection module, configured to select several rows or columns for each boundary of a pixel matrix, and respectively select reference rows or columns from the several rows or columns corresponding to each boundary; a calculation module, configured to respectively calculate the absolute values ​​of the second-order differential values ​​of each pixel point in the several rows or columns in multiple preset directions; a prediction direction determination module, configured to add the absolute values ​​of the second-order differential values ​​of each pixel point in the reference row or column and several pixel points around it in the same preset direction, and use the preset direction corresponding to the minimum value of the sum of the absolute values ​​as the prediction direction of the corresponding pixel point in the reference row or column; an expansion module, configured to count the number of each prediction direction corresponding to all pixel points in the reference row or column, use the prediction direction with the largest number as the prediction direction of the corresponding boundary, and expand the corresponding boundary according to the prediction direction of the corresponding boundary.

[0039] Based on the same inventive concept, according to another aspect of the present application, an embodiment of the present application further provides a computer device, including:

[0040] at least one processor; and

[0041] The memory stores a computer program that can be run on the processor, and the processor executes the steps of any one of the above image processing methods when executing the program.

[0042] Based on the same inventive concept, according to another aspect of the present application, an embodiment of the present application further provides a computer non-volatile readable storage medium, which stores a computer program, and when the computer program is executed by a processor, it performs the steps of any one of the above image processing methods.

[0043] The present application has one of the following beneficial technical effects: the solution proposed in the present application predicts the image model at the boundary by calculating the second-order differential, and then realizes a dynamic adaptive adjustment boundary filling solution, and finally achieves high-quality image scaling, ensuring the integrity of the image data. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying any creative work.

[0045] FIG1 is a flow chart of an image processing method according to an embodiment of the present application;

[0046] FIG2 is a schematic diagram of calculating the second-order differential when the preset direction is 0° according to an embodiment of the present application;

[0047] FIG3 is a schematic diagram of calculating the second-order differential when the preset direction is 45° according to an embodiment of the present application;

[0048] FIG4 is a schematic diagram of calculating the second-order differential when the preset direction is 90° according to an embodiment of the present application;

[0049] FIG5 is a schematic diagram of calculating the second-order differential when the preset direction is 135° according to an embodiment of the present application;

[0050] FIG6 is a schematic diagram of an original image after boundary expansion according to an embodiment of the present application;

[0051] FIG7 is a schematic diagram of the structure of an image processing system provided in an embodiment of the present application;

[0052] FIG8 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application;

[0053] FIG9 is a schematic diagram of the structure of a computer non-volatile readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] In order to make the objectives, technical solutions and advantages of this application more clear, the embodiments of this application are described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0055] It should be noted that all expressions using "first" and "second" in the embodiments of this application are for the purpose of distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of this application. Subsequent embodiments will not explain this one by one.

[0056] In an embodiment of the present application, the boundaries of the pixel matrix of the image refer to the rows or columns of the edges, for example, they can be the first few rows (the first 2 rows, the first 3 rows, etc.), the last few rows (the last 2 rows, the last 3 rows, etc.), the leftmost columns (the leftmost 2 columns, the 3 columns, etc.), and the rightmost columns (the rightmost 2 columns, the 3 columns, etc.).

[0057] According to one aspect of the present application, an embodiment of the present application provides an image processing method, as shown in FIG1 , which may include the following steps:

[0058] S1, selecting a number of rows or columns for each boundary of the pixel matrix of the image, and selecting a reference row or column from the rows or columns corresponding to each boundary;

[0059] S2, respectively calculating the absolute value of the second-order differential value of each pixel point in a plurality of rows or columns in a plurality of preset directions;

[0060] S3, adding the absolute values ​​of the second-order differential values ​​of each pixel in the reference row or column and several surrounding pixels in the same preset direction, and taking the preset direction corresponding to the minimum value of the sum of the absolute values ​​as the predicted direction of the corresponding pixel in the reference row or column;

[0061] S4, counting the number of each prediction direction among the prediction directions corresponding to all pixels in the reference row or column, taking the prediction direction with the largest number as the prediction direction of the corresponding boundary, and expanding the corresponding boundary according to the prediction direction of the corresponding boundary.

[0062] The solution proposed in this application predicts the image model at the boundary by calculating the second-order differential, and then realizes a dynamic and adaptive adjustment of the boundary filling solution, ultimately achieving high-quality image scaling and ensuring the integrity of the image data.

[0063] In some embodiments, in step S1, several rows or columns are selected for each boundary of the pixel matrix of the image, and reference rows or columns are selected from the several rows or columns corresponding to each boundary. Optionally, the 2nd row and the 3rd row can be selected for the upper boundary, and any row can be used as a reference row; the 2nd to last row and the 3rd to last row can be selected for the lower boundary, and any row can be used as a reference row; the 2nd column and the 3rd column can be selected for the left boundary, and any column can be used as a reference column; the 2nd to last column and the 3rd to last column can be selected for the right boundary, and any column can be used as a reference column.

[0064] It should be noted that, since the calculation of the second-order differential value of each pixel in step S2 requires the calculation of surrounding pixels, when selecting several rows or columns, rows or columns that are in the second row or column and close to the boundary can be selected.

[0065] In some embodiments, in step S2, the absolute value of the second-order differential value of each pixel point in a plurality of rows or columns in a plurality of preset directions is calculated, including:

[0066] Calculate the absolute value of the second-order differential in the 0° direction according to the formula D_0 = |2*P(x, y)-P(x, y-1)-P(x, y+1)|;

[0067] Calculate the absolute value of the second-order differential in the 45° direction according to the formula D_45=|2*P(x, y)-P(x+1, y-1)-P(x-1, y+1)|;

[0068] Calculate the absolute value of the second-order differential in the 90° direction according to the formula D_90=|2*P(x, y)-P(x-1, y)-P(x+1, y)|;

[0069] Calculate the absolute value of the second-order differential in the 135° direction according to the formula D_135=|2*P(x, y)-P(x-1, y-1)-P(x+1, y+1)|;

[0070] Where x and y are the row and column numbers of the pixel respectively, and P is the pixel value.

[0071] Optionally, the first-order differential is equivalent to calculating the slope, and the second-order differential is equivalent to calculating the slope of the first-order differential. Therefore, when obtaining the second-order differential of a pixel point in a preset direction, it is necessary to use the two pixel points adjacent to the pixel point in the preset direction, that is, the pixel value of the pixel point - the pixel value of the first adjacent pixel point to obtain the first first-order differential, and the pixel value of the second adjacent pixel point - the pixel value of the pixel point to obtain the second first-order differential. The second-order differential can be obtained by subtracting the two first-order differentials, which is simplified to multiplying the pixel value of the pixel point by 2 and subtracting the pixel values ​​of the two points adjacent to the pixel point in the preset direction.

[0072] For example, as shown in Figures 2 to 5, each circle in the figure represents a pixel point, and the number represents the row or column number. It should be noted that the direction of the arrows in Figures 2 to 5 represents the preset direction (for example, the preset direction represented by the arrow direction in Figure 2 is 0°). Therefore, the second-order differentials of pixel point (2, 2), pixel point (2, 3), pixel point (3, 2), and pixel point (3, 3) in each preset direction can be calculated according to the following formula:

[0073] Second-order differential values ​​at 0°: D_0_1 = |2*P(2,2)-P(2,1)-P(2,3)|; D_0_2 = |2*P(2,3)-P(2,2)-P(2,4)|; D_0_3 = |2*P(3,2)-P(3,1)-P(3,3)|; D_0_4 = |2*P(3,3)-P(3,2)-P(3,4|;

[0074] Second-order differential values ​​at 45°: D_45_1 = |2*P(2,2)-P(3,1)-P(1,3)|; D_45_2 = |2*P(2,3)-P(3,2)-P(1,4)|; D_45_3 = |2*P(3,2)-P(4,1)-P(2,3)|; D_45_4 = |2*P(3,3)-P(2,4)-P(4,2)|;

[0075] Second-order differential values ​​at 90°: D_90_1 = |2*P(2,2)-P(1,2)-P(3,2)|; D_90_2 = |2*P(2,3)-P(1,3)-P(3,3)|; D_90_3 = |2*P(3,2)-P(2,2)-P(4,2)|; D_90_4 = |2*P(3,3)-P(2,3)-P(4,3)|;

[0076] The second-order differential value at 135°: D_135_1 = |2*P(2,2)-P(1,1)-P(3,3)|; D_135_2 = |2*P(2,3)-P(1,2)-P(3,4)|; D_135_3 = |2*P(3,2)-P(2,1)-P(4,3)|; D_135_4 = |2*P(3,3)-P(2,2)-P(4,4)|.

[0077] In some embodiments, in step S3, the absolute values ​​of the second-order differential values ​​of each pixel point in the reference row or column and several pixel points around it in the same preset direction are added, and the preset direction corresponding to the minimum value of the sum of the absolute values ​​is used as the predicted direction of the corresponding pixel point in the reference row or column. Optionally, when selecting adjacent pixel points to calculate the sum of the absolute values, the adjacent points are all points whose second-order differential values ​​have been calculated, that is, these adjacent points are either points on the reference row or column, or points on other rows selected in step S1.

[0078] When the reference row is above other rows / the reference column is to the left of other columns, points on the right and bottom can be selected. For example, in Figures 2-5, the second row or the second column is selected as the reference row / reference column (the other row is the third row or the other column is the third column). When calculating the predicted direction of the pixel point (2, 3), (2, 4), (3, 4) on its right and (3, 3) below it can be selected as the surrounding points.

[0079] In some embodiments, since there are fewer pixels around the pixels at both ends of a reference row or column when determining a preset direction, the predicted direction of the pixels at both ends in the reference row can be directly fixed to 0°, and the predicted direction of the pixels at both ends in the reference column can be directly fixed to 90°.

[0080] In some embodiments, counting the number of each prediction direction among the prediction directions corresponding to all pixels in the reference row or column, taking the prediction direction with the largest number as the prediction direction of the corresponding boundary, and extending the corresponding boundary according to the prediction direction of the corresponding boundary includes:

[0081] In response to the prediction direction corresponding to the upper boundary being 0°, copying the first row of the pixel matrix as the first row and the second row of the upper extended row and storing them in the first dual-port RAM;

[0082] In response to the prediction direction corresponding to the upper boundary being 45°, copying the first row of the pixel matrix as the first and second rows of the upper extended row, shifting rightward, and storing the copied pixels in the first dual-port RAM;

[0083] In response to the prediction direction corresponding to the upper boundary being 90°, copying the first row of the pixel matrix as the second row of the upper extended row, copying the second row of the pixel matrix as the first row of the upper extended row and storing the copies in the first dual-port RAM;

[0084] In response to the prediction direction corresponding to the upper boundary being 135°, the first row of the copied pixel matrix is ​​used as the first row and the second row of the upper extended row, and is shifted leftward and stored in the first dual-port RAM.

[0085] Optionally, when filling the upper boundary, when 0° is the prediction direction, select copy the first row and use them as the first and second rows of the upper extension row. This method is referred to as "copy" in this application; when 90° is the prediction direction, select copy the first row as the second row of the upper extension row, and select copy the second row as the first row of the upper extension row. This method is referred to as "mirroring" in this application; when 45° is the prediction direction, select copy the first row and use them as the first and second rows of the upper extension row, and shift them to the right at the same time. This method is referred to as "copy and shift to the right" in this application; when 135° is the prediction direction, select copy the first row and use them as the first and second rows of the upper extension row, and shift them to the left at the same time. This method is referred to as "copy and shift to the left" in this application.

[0086] As shown in FIG6 , during upper boundary processing, the first dual-port RAM can be used as an extension row, wherein the first upper extension row is written into the first port up_ext_1 of the first dual-port RAM, and the second upper extension row is written into the second port up_ext_2 of the first dual-port RAM.

[0087] The RAM width (RAM_width) is the pixel depth (pixel_d) (the number of bits required to store a pixel. For example, in the common RGB888 (Red Green Blue 888) format, each component occupies 8 bits, resulting in a pixel depth of 24 bits). The RAM depth (RAM_depth) is the number of pixels in an image row (image_row). The extended rows are stored differently for different prediction directions.

[0088] In some embodiments, in response to the prediction direction corresponding to the upper boundary being 0°, copying the first row of the pixel matrix as the first and second rows of the upper extended row and storing them in the first dual-port RAM further includes:

[0089] Write each column of data of the first row of the pixel matrix in sequence starting from the address 0 of the first port of the first dual-port RAM;

[0090] The data of each column of the first row of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the second port of the first dual-port RAM.

[0091] Optionally, the prediction direction is 0° and the expansion method is copying, and the storage method is to synchronously write the first row data row_1 of the original pixel matrix into up_ext_2 and up_ext_1, that is, the first column data of row_1 is written into the position of up_ext_2 corresponding to the RAM address 0, and the second column data is written into the position of up_ext_2 corresponding to the RAM address 1, and so on. The writing method of up_ext_1 is the same as above.

[0092] In some embodiments, in response to the prediction direction corresponding to the upper boundary being 45°, copying the first row of the pixel matrix as the first and second rows of the upper extended row, shifting rightward, and storing the copied rows in the first dual-port RAM includes:

[0093] Each column of data except the last two columns of data in the first row of the pixel matrix is ​​written sequentially starting from the address 2 of the first port of the first dual-port RAM;

[0094] Each column of data except the last column of data in the first row of the pixel matrix is ​​written in sequence starting from the position where the address is 1 of the second port of the first dual-port RAM.

[0095] Optionally, the prediction direction is 45° and the expansion method is to copy and shift to the right. The storage method is to write the first row data row_1 of the original pixel matrix into up_ext_2 and up_ext_1. When writing, the first column data of row_1 is written into the position where the address of up_ext_2 corresponds to the RAM address 1, and the second column data is written into the position where the address of up_ext_2 corresponds to the RAM address 2, and so on to write the complete row data, and the last data of row_1 is not processed; the first column data of row_1 is written into the position where the address of up_ext_1 corresponds to the RAM address 2, and the second column data is written into the position where the address of up_ext_1 corresponds to the RAM address 3, and so on to write the complete row data, and the last two data of row_1 are not processed.

[0096] In some embodiments, in response to the prediction direction corresponding to the upper boundary being 90°, copying the first row of the pixel matrix as the second row of the upper extended row, copying the second row of the pixel matrix as the first row of the upper extended row and storing the copied rows in the first dual-port RAM includes:

[0097] Write each column of data of the first row of the pixel matrix in sequence starting from the address 0 of the second port of the first dual-port RAM;

[0098] The data of each column of the second row of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the first port of the first dual-port RAM.

[0099] Optionally, the prediction direction is 90° and the expansion method is "mirror" processing. The storage method is to write the first row data row_1 of the original pixel matrix into up_ext_2 in sequence, that is, the first column data of row_1 is written into the position where the address of up_ext_2 corresponds to RAM address 0, and the second column data is written into the position where the address of up_ext_2 corresponds to RAM address 1, and so on; the second row data row_2 of the original pixel matrix is ​​written into up_ext_1 in sequence, and the writing method is the same as above.

[0100] In some embodiments, in response to the prediction direction corresponding to the upper boundary being 135°, copying the first row of the pixel matrix as both the first row and the second row of the upper extended row, shifting the pixels leftward, and storing the pixels in the first dual-port RAM includes:

[0101] Writing each column of data except the first column of data in the first row of the pixel matrix sequentially starting from the address 0 of the first port of the first dual-port RAM;

[0102] Each column of data except the first two columns of data in the first row of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the second port of the first dual-port RAM.

[0103] Optionally, the prediction direction is 135° and the expansion method is to copy and shift to the left. The storage method is to write the first row data row_1 of the original pixel matrix into up_ext_2 and up_ext_1. When writing, the second column data of row_1 is written into the position where the address of up_ext_1 corresponds to RAM is 0, and the third column data is written into the position where the address of up_ext_1 corresponds to RAM is 1, and so on to write the complete row data, and the first data of row_1 is not processed; the third column data of row_1 is written into the position where the address of up_ext_2 corresponds to RAM is 0, and the fourth column data is written into the position where up_ext_2 corresponds to RAM address 1, and so on to write the complete row data, and the first two data of row_1 are not processed.

[0104] In some embodiments, counting the number of each prediction direction among the prediction directions corresponding to all pixels in the reference row or column, taking the prediction direction with the largest number as the prediction direction of the corresponding boundary, and extending the corresponding boundary according to the prediction direction of the corresponding boundary includes:

[0105] In response to the prediction direction corresponding to the lower boundary being 0°, copying the last row of the pixel matrix as the first and second rows of the lower extended row and storing them in the second dual-port RAM;

[0106] In response to the prediction direction corresponding to the lower boundary being 45°, copying the last row of the pixel matrix as the first and second rows of the lower extended row, shifting leftward, and storing in the second dual-port RAM;

[0107] In response to the prediction direction corresponding to the lower boundary being 90°, copying the last row of the pixel matrix as the first row of the lower extended row, copying the second to last row of the pixel matrix as the second row of the lower extended row and storing them in the second dual-port RAM;

[0108] In response to the prediction direction corresponding to the lower boundary being 135°, the last row of the pixel matrix is ​​copied as the first row and the second row of the lower extended row, and is shifted rightward and stored in the second dual-port RAM.

[0109] Optionally, when filling the lower boundary, when 0° is the prediction direction, select copy the last row and use it as the first and second rows of the lower extension row. This method is referred to as "copy" in this application; when 90° is the prediction direction, select copy the last row and use it as the first row of the lower extension row, and select copy the second-to-last row as the second row of the lower extension row. This method is referred to as "mirror" in this application; when 45° is the prediction direction, select copy the last row and use it as the first and second rows of the lower extension row, and shift it to the left at the same time. This method is referred to as "copy and shift it to the left" in this application; when 135° is the prediction direction, select copy the last row and use it as the first and second rows of the lower extension row, and shift it to the right at the same time. This method is referred to as "copy and shift it to the right" in this application.

[0110] As shown in FIG6 , during lower boundary processing, the second dual-port RAM can be used as an extension row, wherein the first extension row below is written into the first port down_ext_1 of the second dual-port RAM, and the second extension row below is written into the second port down_ext_2 of the second dual-port RAM.

[0111] The RAM width (RAM_width) is the pixel depth (pixel_d) (the number of bits required to store a pixel. For example, in the common RGB888 format, each component occupies 8 bits, so the pixel depth is 24 bits). The RAM depth (RAM_depth) is the number of pixels in an image row (image_row). The extended row storage method varies for different prediction directions.

[0112] In some embodiments, in response to the prediction direction corresponding to the lower boundary being 0°, copying the last row of the pixel matrix as the first and second rows of the lower extended row and storing them in the second dual-port RAM further includes:

[0113] Write each column of data of the last row of the pixel matrix in sequence starting from the address 0 of the first port of the second dual-port RAM;

[0114] The data of each column of the last row of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the second port of the second dual-port RAM.

[0115] Optionally, the prediction direction is 0° and the expansion method is copy processing. The storage method is to synchronously write the last row data row_last_1 of the original pixel matrix into down_ext_2 and down_ext_1, that is, the first column data of row_last_1 is written into the RAM address 0 corresponding to down_ext_2, and the second column data is written into the RAM address 1 corresponding to down_ext_2, and so on. The writing method of down_ext_1 is the same as above.

[0116] In some embodiments, in response to the prediction direction corresponding to the lower boundary being 45°, copying the last row of the pixel matrix as the first and second rows of the lower extended row, shifting leftward, and storing the copied rows in the second dual-port RAM includes:

[0117] Writing each column of data except the first column of data in the last row of the pixel matrix sequentially starting from the address 0 of the first port of the second dual-port RAM;

[0118] Each column of data except the first two columns of data in the last row of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the second port of the second dual-port RAM.

[0119] Optionally, the prediction direction is 45° and the expansion mode is "copy and shift left". The storage method is to write the last row data row_last_1 of the original pixel matrix into down_ext_2 and down_ext_1. When writing, the second column data of row_last_1 is written into the position where the address of down_ext_1 corresponds to RAM is 0, and the third column data is written into the position where the address of down_ext_1 corresponds to RAM is 1, and so on to write the complete row data, and the first data of row_last_1 is not processed; the third column data of row_last_1 is written into the position where the address of down_ext_2 corresponds to RAM is 0, and the fourth column data is written into the position where down_ext_2 corresponds to RAM address 1, and so on to write the complete row data, and the first two data of row_last_1 are not processed.

[0120] In some embodiments, in response to the prediction direction corresponding to the lower boundary being 90°, copying the last row of the pixel matrix as the first row of the lower extended row, copying the second-to-last row of the pixel matrix as the second row of the lower extended row and storing them in the second dual-port RAM, includes:

[0121] Write each column of data of the last row of the pixel matrix in sequence starting from the address 0 of the second port of the second dual-port RAM;

[0122] The data of each column of the second to last row of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the first port of the second dual-port RAM.

[0123] Optionally, the prediction direction is 90° and the expansion mode is "mirror", and the storage method is to write the last row data row_last_1 of the original pixel matrix into down_ext_2 in sequence, that is, the first column data of row_last_1 is written into the position where the address of down_ext_2 corresponds to RAM address 0, and the second column data is written into the position where the address of down_ext_2 corresponds to RAM address 1, and so on; the second to last row data row_last_2 of the original pixel matrix is ​​written into down_ext_1 in sequence, and the writing method is the same as above.

[0124] In some embodiments, in response to the prediction direction corresponding to the lower boundary being 135°, copying the last row of the pixel matrix as both the first and second rows of the lower extended row, shifting rightward, and storing the copied rows in the second dual-port RAM includes:

[0125] Each column of data except the last two columns of data in the last row of the pixel matrix is ​​written sequentially starting from the address 2 of the first port of the second dual-port RAM;

[0126] Each column of data except the last column of data in the last row of the pixel matrix is ​​written in sequence starting from the position where the address is 1 of the second port of the second dual-port RAM.

[0127] Optionally, the prediction direction is 135° and the expansion mode is "copy and shift right". The storage mode writes the last row data row_last_1 of the original pixel matrix into down_ext_2 and down_ext_1. When writing, the first column data of row_last_1 is written into the RAM address 1 corresponding to down_ext_1, and the second column data is written into the RAM address 2 corresponding to down_ext_1. Similarly, the complete row data is written, and the last data of row_last_1 is not processed; the first column data of row_last_1 is written into the RAM address 2 corresponding to down_ext_2, and the second column data is written into the RAM address 3 corresponding to down_ext_2. Similarly, the complete row data is written, and the last two data of row_last_1 are not processed.

[0128] In some embodiments, counting the number of each prediction direction among the prediction directions corresponding to all pixels in the reference row or column, taking the prediction direction with the largest number as the prediction direction of the corresponding boundary, and extending the corresponding boundary according to the prediction direction of the corresponding boundary includes:

[0129] In response to the prediction direction corresponding to the left boundary being 0°, copying the first column of the pixel matrix as the second column of the left extended column, copying the second column of the pixel matrix as the first column of the left extended column and storing them in the third dual-port RAM;

[0130] In response to the prediction direction corresponding to the left boundary being 45°, copying the first column of the pixel matrix as the first and second columns of the left extended column, shifting downward, and storing in the third dual-port RAM;

[0131] In response to the prediction direction corresponding to the left boundary being 90°, copying the first column of the pixel matrix as the first column and the second column of the left extended column and storing them in the third dual-port RAM;

[0132] In response to the prediction direction corresponding to the left boundary being 135°, the first column of the copied pixel matrix is ​​used as the first column and the second column of the left extended column, and is shifted upward and stored in the third dual-port RAM.

[0133] Optionally, when filling the left boundary, when 0° is the prediction direction, select copying the first column as the second column of the left extended column, and select copying the second column as the first column of the left extended column. This method is referred to as "mirroring" in this application; when 90° is the prediction direction, select copying the first column as the first and second columns of the left extended column. This method is referred to as "copying" in this application; when 45° is the prediction direction, select copying the first column as the first and second columns of the left extended column, and shifting downward at the same time. This method is referred to as "copying and shifting downward" in this application; when 135° is the prediction direction, select copying the first column as the first and second columns of the left extended column, and shifting upward at the same time. This method is referred to as "copying and shifting upward" in this application.

[0134] As shown in FIG6 , when processing the left boundary, the third dual-port RAM can be used as an extension row, wherein the first extension column on the left is written into the first port left_ext_1 of the third dual-port RAM, and the second extension column is written into the second port left_ext_2 of the third dual-port RAM;

[0135] The RAM width (RAM_width) is the pixel depth (pixel_d) (the number of bits required to store a pixel. For example, in the common RGB888 format, each component occupies 8 bits, so the pixel depth is 24 bits). The RAM depth (RAM_depth) is the number of pixels in an image row (image_row). The extended columns are stored differently for different prediction directions.

[0136] In some embodiments, in response to the prediction direction corresponding to the left boundary being 0°, copying the first column of the pixel matrix as the second column of the left extended column, copying the second column of the pixel matrix as the first column of the left extended column and storing the result in the third dual-port RAM, further comprising:

[0137] Writing each row of data in the first column of the pixel matrix sequentially starting from the address 0 of the first port of the third dual-port RAM;

[0138] The data of each row of the second column of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the second port of the third dual-port RAM.

[0139] Optionally, the prediction direction is 0° and the expansion method is "mirror", and the storage method is to write the first column data col_1 of the original pixel matrix into left_ext_2 in sequence, that is, the data of the first row of col_1 is written into the position where the address of left_ext_2 corresponds to RAM address 0, and the data of the second row is written into the position where the address of left_ext_2 corresponds to RAM address 1, and so on; the second column data col_2 of the original pixel matrix is ​​written into left_ext_1 in sequence, and the writing method is the same as above.

[0140] In some embodiments, in response to the prediction direction corresponding to the left boundary being 45°, copying the first column of the pixel matrix as the first and second columns of the left extended column, shifting downward, and storing the copies in the third dual-port RAM further includes:

[0141] Each row of data except the last two rows of data in the first column of the pixel matrix is ​​written sequentially starting from the address 2 of the first port of the third dual-port RAM;

[0142] Each row of data except the last row of data in the first column of the pixel matrix is ​​written in sequence starting from the position where the address is 1 of the second port of the third dual-port RAM.

[0143] Optionally, the prediction direction is 45° and the expansion mode is "copy and shift downward", and the storage method is to write the first column data col_1 of the original pixel matrix into left_ext_2 and left_ext_1. When writing, the first row data of col_1 is written to the position where the address of left_ext_2 corresponds to the RAM address 1, and the second row data is written to the position where the address of left_ext_2 corresponds to the RAM address 2, and so on, to write the complete column data, and the last (bottom) 1 data of col_1 is not processed; the first row data of col_1 is written to the position where the address of left_ext_1 corresponds to the RAM address 2, and the second row data is written to the position where the address of left_ext_1 corresponds to the RAM address 3, and so on, to write the complete column data, and the last (bottom) 2 data of col_1 are not processed.

[0144] In some embodiments, in response to the prediction direction corresponding to the left boundary being 90°, copying the first column of the pixel matrix as the first and second columns of the left extended column and storing them in a third dual-port RAM further includes:

[0145] Writing each row of data in the first column of the pixel matrix sequentially starting from the address 0 of the first port of the third dual-port RAM;

[0146] The data of each row of the first column of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the second port of the third dual-port RAM.

[0147] Optionally, the prediction direction is 90° and the expansion method is "copy", and the storage method is to synchronously write the first column data col_1 of the original pixel matrix into left_ext_2 and left_ext_1, that is, the first row of col_1 data is written to the position where the address of left_ext_2 corresponds to RAM is 0, and the second row of data is written to the position where the address of left_ext_2 corresponds to RAM is 1, and so on. The writing method of left_ext_1 is the same as above.

[0148] In some embodiments, in response to the prediction direction corresponding to the left boundary being 135°, copying the first column of the pixel matrix as both the first column and the second column of the left extended column, shifting upward, and storing the copied pixels in the third dual-port RAM further includes:

[0149] Each row of data except the first two rows of data in the first column of the pixel matrix is ​​written sequentially starting from the address 0 of the first port of the third dual-port RAM;

[0150] Each row of data except the first row of data in the first column of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the second port of the third dual-port RAM.

[0151] Optionally, the prediction direction is 90° and the expansion mode is "copy and shift upwards". The storage method is to write the first column data col_1 of the original pixel matrix into left_ext_2 and left_ext_1. When writing, the second row of data of col_1 is written into the position where the address of left_ext_2 corresponds to the RAM address 0, and the third row of data is written into the position where the address of left_ext_2 corresponds to the RAM address 1, and so on to write the complete column data, and the first data of col_1 is not processed; the third row of data of col_1 is written into the position where the address of left_ext_1 corresponds to the RAM address 0, and the fourth row of data is written into the position where the address of left_ext_1 corresponds to the RAM address 1, and so on to write the complete column data, and the first two data of col_1 are not processed.

[0152] In some embodiments, counting the number of each prediction direction among the prediction directions corresponding to all pixels in the reference row or column, taking the prediction direction with the largest number as the prediction direction of the corresponding boundary, and extending the corresponding boundary according to the prediction direction of the corresponding boundary includes:

[0153] In response to the prediction direction corresponding to the right boundary being 0°, copying the last column of the pixel matrix as the second column of the right extended column, copying the second to last column of the pixel matrix as the first column of the right extended column and storing them in the fourth dual-port RAM;

[0154] In response to the prediction direction corresponding to the right boundary being 45°, copying the last column of the pixel matrix as the first and second columns of the right extension column, shifting upward, and storing in the fourth dual-port RAM;

[0155] In response to the prediction direction corresponding to the right boundary being 90°, copying the last column of the pixel matrix as the first and second columns of the right extension column and storing them in the fourth dual-port RAM;

[0156] In response to the prediction direction corresponding to the right boundary being 135°, the last column of the pixel matrix is ​​copied as the first and second columns of the right extension column, and is shifted downward and stored in the fourth dual-port RAM.

[0157] Optionally, when filling the right border, when 0° is the prediction direction, select copy the last column as the first column of the right extended column, and select copy the second to last column as the second column of the right extended column. This method is referred to as "mirroring" in this application; when 90° is the prediction direction, select copy the last column as the first and second columns of the right extended column at the same time. This method is referred to as "copy" in this application; when 45° is the prediction direction, select copy the last column as the first and second columns of the right extended column at the same time, and shift upward at the same time. This method is referred to as "copy and shift upward" in this application; when 135° is the prediction direction, select copy the first column as the first and second columns of the right extended column at the same time, and shift downward at the same time. This method is referred to as "copy and shift downward" in this application.

[0158] As shown in FIG6 , when processing the right boundary, the fourth dual-port RAM can be used as an extension row, wherein the first extension column on the right is written into the first port right_ext_1 of the fourth dual-port RAM, and the second extension column on the right is written into the second port right_ext_2 of the fourth dual-port RAM;

[0159] The RAM width (RAM_width) is the pixel depth (pixel_d) (the number of bits required to store a pixel. For example, in the common RGB888 format, each component occupies 8 bits, so the pixel depth is 24 bits). The RAM depth (RAM_depth) is the number of pixels in an image row (image_row). The extended columns are stored differently for different prediction directions.

[0160] In some embodiments, in response to the prediction direction corresponding to the right boundary being 0°, copying the last column of the pixel matrix as the second column of the right extended column, copying the second to last column of the pixel matrix as the first column of the right extended column and storing them in the fourth dual-port RAM, further comprising:

[0161] Writing each row of data in the last column of the pixel matrix sequentially starting from the address 0 of the first port of the fourth dual-port RAM;

[0162] The data of each row of the second to last column of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the second port of the fourth dual-port RAM.

[0163] Optionally, the prediction direction is 0° and the expansion mode is "mirror", and the storage method is to write the last column data col_last_1 of the original pixel matrix into right_ext_1 in sequence, that is, the data of the first row of col_last_1 is written into the RAM address 0 corresponding to right_ext_1, and the data of the second row is written into the RAM address 1 corresponding to right_ext_1, and so on; the second-to-last column data col_last_2 of the original pixel matrix is ​​written into right_ext_2 in sequence, and the writing method is the same as above.

[0164] In some embodiments, in response to the prediction direction corresponding to the right boundary being 45°, copying the last column of the pixel matrix as the first and second columns of the right extended column, shifting upward, and storing the copied columns in the fourth dual-port RAM further includes:

[0165] Writing each row of data except the first two rows of data in the last column of the pixel matrix sequentially starting from the address 0 of the first port of the fourth dual-port RAM;

[0166] Each row of data except the first row of data in the last column of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the second port of the fourth dual-port RAM.

[0167] Optionally, the prediction direction is 45° and the expansion mode is "copy and shift upwards". The storage method is to write the last column data col_last_1 of the original pixel matrix into right_ext_2 and right_ext_1. When writing, the second row of col_last_1 data is written into the RAM address 0 corresponding to right_ext_1, and the third row of data is written into the RAM address 1 corresponding to right_ext_1. Similarly, the complete column data is written, and the first data of the pixel matrix is ​​not processed; the third row of col_last_1 data is written into the RAM address 0 corresponding to right_ext_1, and the fourth row of data is written into the RAM address 1 corresponding to right_ext_1. Similarly, the complete row data is written, and the first two data of the pixel matrix are not processed.

[0168] In some embodiments, in response to the prediction direction corresponding to the right boundary being 90°, copying the last column of the pixel matrix as the first and second columns of the right extended column and storing them in the fourth dual-port RAM further includes:

[0169] Writing each row of data in the first column of the pixel matrix sequentially starting from the address 0 of the first port of the fourth dual-port RAM;

[0170] The data of each row of the first column of the pixel matrix is ​​written in sequence starting from the position where the address is 0 of the second port of the fourth dual-port RAM.

[0171] Optionally, the prediction direction is 90° and the expansion mode is "copy". The storage method is to synchronously write the last column data col_last_1 of the original pixel matrix into right_ext_2 and right_ext_1, that is, the first row of col_1 data is written into the RAM address 0 corresponding to right_ext_2, and the second row of data is written into the RAM address 1 corresponding to right_ext_2, and so on. The writing method of right_ext_1 is the same as above.

[0172] In some embodiments, in response to the prediction direction corresponding to the right boundary being 135°, copying the last column of the pixel matrix as the first and second columns of the right extended column, shifting downward, and storing the copied columns in the fourth dual-port RAM further includes:

[0173] Writing each row of data except the last two rows of data in the last column of the pixel matrix sequentially starting from the address 2 of the first port of the fourth dual-port RAM;

[0174] Each row of data except the last row of data in the last column of the pixel matrix is ​​written in sequence starting from the position where the address is 1 of the second port of the fourth dual-port RAM.

[0175] Optionally, the prediction direction is 135° and the expansion mode is "copy and shift downward". The storage method is to write the last column data col_last_1 of the original pixel matrix into right_ext_2 and right_ext_1. When writing, the first row of col_last_1 data is written to the address 1 of the RAM corresponding to right_ext_2, and the second row of data is written to the address 2 of the RAM corresponding to right_ext_2, and so on. The complete column data is written, and the last data of col_last_1 is not processed; the first row of col_last_1 data is written to the address 2 of the RAM corresponding to right_ext_1, and the second row of data is written to the address 3 of the RAM corresponding to right_ext_1, and so on. The complete row data is written, and the last two data of col_last_1 are not processed.

[0176] The proposed solution predicts the image model at the boundary by synchronously calculating the second-order differential, thereby implementing a dynamic and adaptive boundary filling solution. This ultimately achieves high-quality image scaling and ensures the integrity of the image data. Furthermore, this solution has broad applicability, including bilinear interpolation, bicubic interpolation, and other interpolation schemes.

[0177] Based on the same inventive concept, according to another aspect of the present application, an embodiment of the present application further provides an image processing system 400, as shown in FIG7 , comprising:

[0178] A selection module 401 is configured to select a number of rows or columns for each boundary of the pixel matrix of the image, and select a reference row or column from the rows or columns corresponding to each boundary;

[0179] A calculation module 402 is configured to calculate the absolute value of the second-order differential value of each pixel point in a plurality of rows or columns in a plurality of preset directions;

[0180] The prediction direction determination module 403 is configured to sum the absolute values ​​of the second-order differential values ​​of each pixel in the reference row or column and a number of surrounding pixels in the same preset direction and use the preset direction corresponding to the minimum value of the sum of the absolute values ​​as the prediction direction of the corresponding pixel in the reference row or column;

[0181] The expansion module 404 is configured to count the number of each prediction direction in the prediction directions corresponding to all pixels in the reference row or column, take the prediction direction with the largest number as the prediction direction of the corresponding boundary, and expand the corresponding boundary according to the prediction direction of the corresponding boundary.

[0182] Based on the same inventive concept, according to another aspect of the present application, as shown in FIG8 , an embodiment of the present application further provides a computer device 501, including:

[0183] at least one processor 520; and

[0184] The memory 510 stores a computer program 511 that can be run on the processor. When the processor 520 executes the program, the steps of any one of the above image processing methods are performed.

[0185] Based on the same inventive concept, according to another aspect of the present application, as shown in Figure 9, an embodiment of the present application also provides a computer non-volatile readable storage medium 601, and the computer non-volatile readable storage medium 601 stores a computer program 610. When the computer program 610 is executed by the processor, the steps of any one of the above image processing methods are performed.

[0186] Finally, it should be noted that a person skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer non-volatile readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods.

[0187] Furthermore, it should be understood that the computer non-volatile readable storage medium (eg, memory) herein can be either volatile memory or non-volatile memory, or can include both volatile memory and non-volatile memory.

[0188] Those skilled in the art will also appreciate that, in conjunction with the disclosed various exemplary logic blocks, modules, circuits and algorithmic steps described herein, can be implemented as electronic hardware, computer software or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, a general description has been given of the functions of various schematic components, blocks, modules, circuits and steps. Whether this function is implemented as software or implemented as hardware depends on specific applications and the design constraints imposed on whole systems. Those skilled in the art can implement the function in a variety of ways for every specific application, but this realization decision should not be interpreted as causing departure from the disclosed scope of the application's embodiments.

[0189] The above are exemplary embodiments disclosed in the present application, but it should be noted that various changes and modifications may be made without departing from the scope of the present application embodiment as defined in the claims. The functions, steps, and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present application may be described or required in individual form, they may also be understood as multiple unless expressly limited to the singular.

[0190] It should be understood that, as used herein, the singular forms "a" and "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" is intended to include any and all possible combinations of one or more of the associated listed items.

[0191] The serial numbers of the embodiments disclosed in the above embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.

[0192] Those skilled in the art will understand that all or part of the steps for implementing the above embodiments may be accomplished by hardware, or may be accomplished by instructing the relevant hardware through a program, and the program may be stored in a computer non-volatile readable storage medium, and the above-mentioned non-volatile readable storage medium may be a read-only memory, a disk or an optical disk, etc.

[0193] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the disclosure of the embodiments of the present application (including the claims) is limited to these examples; based on the ideas of the embodiments of the present application, the technical features of the above embodiments or different embodiments can also be combined, and there are many other variations of different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the embodiments of the present application.

Claims

1. An image processing method, characterized in that: The following steps are involved: Selecting a number of rows or columns for each boundary of the pixel matrix of the image, and selecting reference rows or columns respectively from the number of rows or columns corresponding to each of the boundaries; Calculating the absolute value of the second-order differential value of each pixel point in the plurality of rows or columns in a plurality of preset directions respectively; Adding the absolute values ​​of the second-order differential values ​​of each pixel point in the reference row or column and several surrounding pixels in the same preset direction and taking the preset direction corresponding to the minimum value of the sum of the absolute values ​​as the prediction direction of the corresponding pixel point in the reference row or column; The number of each prediction direction in the prediction directions corresponding to all the pixels in the reference row or column is counted, the prediction direction with the largest number is used as the prediction direction of the corresponding boundary, and the corresponding boundary is expanded according to the prediction direction of the corresponding boundary.

2. The method according to claim 1, characterized in that Counting the number of each prediction direction in the prediction directions corresponding to all the pixels of the reference row or column, taking the prediction direction with the largest number as the prediction direction of the corresponding boundary, and extending the corresponding boundary according to the prediction direction of the corresponding boundary, further comprising: In response to the prediction direction corresponding to the upper boundary being 0°, copying the first row of the pixel matrix as the first row and the second row of the upper extended row and storing them in a first dual-port random access memory (RAM); In response to the prediction direction corresponding to the upper boundary being 45°, copying the first row of the pixel matrix as the first row and the second row of the upper extended row, shifting rightwards and storing in the first dual-port RAM; In response to the prediction direction corresponding to the upper boundary being 90°, copying the first row of the pixel matrix as the second row of the upper extended row, copying the second row of the pixel matrix as the first row of the upper extended row and storing them in the first dual-port RAM; In response to the prediction direction corresponding to the upper boundary being 135°, the first row of the pixel matrix is ​​copied as the first row and the second row of the upper extended row, and is shifted leftward and stored in the first dual-port RAM.

3. The method according to claim 2, characterized in that In response to the prediction direction corresponding to the upper boundary being 0°, copying the first row of the pixel matrix as the first row and the second row of the upper extended row and storing them in the first dual-port RAM, further comprising: Writing each column of data of the first row of the pixel matrix in sequence starting from the position where the address of the first port of the first dual-port RAM is 0; Each column of data in the first row of the pixel matrix is ​​written in sequence starting from the address 0 of the second port of the first dual-port RAM.

4. The method according to claim 2, characterized in that In response to the prediction direction corresponding to the upper boundary being 45°, copying the first row of the pixel matrix as the first row and the second row of the upper extended row, shifting rightward and storing in the first dual-port RAM, further comprising: Writing each column of data except the last two columns of data in the first row of the pixel matrix in sequence starting from the address 2 of the first port of the first dual-port RAM; Each column of data except the last column of data in the first row of the pixel matrix is ​​written in sequence starting from the position where the address of the second port of the first dual-port RAM is 1.

5. The method according to claim 2, characterized in that In response to the prediction direction corresponding to the upper boundary being 90°, copying the first row of the pixel matrix as the second row of the upper extended row, copying the second row of the pixel matrix as the first row of the upper extended row and storing it in the first dual-port RAM, further comprising: Writing each column of data of the first row of the pixel matrix in sequence starting from the position where the address of the second port of the first dual-port RAM is 0; Each column of data in the second row of the pixel matrix is ​​written in sequence starting from the address 0 of the first port of the first dual-port RAM.

6. The method according to claim 2, characterized in that In response to the prediction direction corresponding to the upper boundary being 135°, copying the first row of the pixel matrix as the first row and the second row of the upper extended row, shifting leftward and storing in the first dual-port RAM, further comprising: Writing each column of data except the first column of data in the first row of the pixel matrix in sequence starting from the position where the address of the first port of the first dual-port RAM is 0; Each column of data except the first two columns of data in the first row of the pixel matrix is ​​written in sequence starting from the address 0 of the second port of the first dual-port RAM.

7. The method according to claim 1, characterized in that Counting the number of each prediction direction in the prediction directions corresponding to all the pixels of the reference row or column, taking the prediction direction with the largest number as the prediction direction of the corresponding boundary, and extending the corresponding boundary according to the prediction direction of the corresponding boundary, further comprising: In response to the prediction direction corresponding to the lower boundary being 0°, copying the last row of the pixel matrix as the first row and the second row of the lower extended row and storing them in the second dual-port RAM; In response to the prediction direction corresponding to the lower boundary being 45°, copying the last row of the pixel matrix as the first row and the second row of the lower extended row, shifting to the left and storing in the second dual-port RAM; In response to the prediction direction corresponding to the lower boundary being 90°, copying the last row of the pixel matrix as the first row of the lower extended row, copying the second to last row of the pixel matrix as the second row of the lower extended row and storing them in the second dual-port RAM; In response to the prediction direction corresponding to the lower boundary being 135°, the last row of the pixel matrix is ​​copied as the first row and the second row of the lower extended row, and is shifted rightward and stored in the second dual-port RAM.

8. The method according to claim 7, characterized in that In response to the prediction direction corresponding to the lower boundary being 0°, copying the last row of the pixel matrix as the first row and the second row of the lower extended row and storing them in the second dual-port RAM, further comprising: Writing each column of data of the last row of the pixel matrix in sequence starting from the position where the address of the first port of the second dual-port RAM is 0; Each column of data in the last row of the pixel matrix is ​​written in sequence starting from the position where the address of the second port of the second dual-port RAM is 0.

9. The method according to claim 7, characterized in that In response to the prediction direction corresponding to the lower boundary being 45°, copying the last row of the pixel matrix as the first row and the second row of the lower extended row, shifting leftward and storing in the second dual-port RAM, further comprising: Writing each column of data except the first column of data in the last row of the pixel matrix in sequence starting from the position where the address of the first port of the second dual-port RAM is 0; Each column of data except the first two columns of data in the last row of the pixel matrix is ​​written in sequence starting from the position where the address of the second port of the second dual-port RAM is 0.

10. The method according to claim 7, characterized in that In response to the prediction direction corresponding to the lower boundary being 90°, copying the last row of the pixel matrix as the first row of the lower extended row, copying the second to last row of the pixel matrix as the second row of the lower extended row and storing it in the second dual-port RAM, further comprising: Writing each column of data of the last row of the pixel matrix in sequence starting from the position where the address of the second port of the second dual-port RAM is 0; Each column of data of the second to last row of the pixel matrix is ​​written in sequence starting from the position where the address of the first port of the second dual-port RAM is 0.

11. The method according to claim 7, characterized in that In response to the prediction direction corresponding to the lower boundary being 135°, copying the last row of the pixel matrix as the first row and the second row of the lower extended row, shifting rightward and storing in the second dual-port RAM, further comprising: Writing each column of data except the last two columns of data in the last row of the pixel matrix in sequence starting from the address 2 of the first port of the second dual-port RAM; Each column of data except the last column of data in the last row of the pixel matrix is ​​written in sequence starting from the position where the address of the second port of the second dual-port RAM is 1.

12. The method according to claim 1, characterized in that Counting the number of each prediction direction in the prediction directions corresponding to all the pixels of the reference row or column, taking the prediction direction with the largest number as the prediction direction of the corresponding boundary, and extending the corresponding boundary according to the prediction direction of the corresponding boundary, further comprising: In response to the prediction direction corresponding to the left boundary being 0°, copying the first column of the pixel matrix as the second column of the left extended column, copying the second column of the pixel matrix as the first column of the left extended column and storing them in the third dual-port RAM; In response to the prediction direction corresponding to the left boundary being 45°, copying the first column of the pixel matrix as the first column and the second column of the left extended column, and shifting downward and storing them in the third dual-port RAM; In response to the prediction direction corresponding to the left boundary being 90°, copying the first column of the pixel matrix as the first column and the second column of the left extended column and storing them in the third dual-port RAM; In response to the prediction direction corresponding to the left boundary being 135°, the first column of the pixel matrix is ​​copied and used as the first column and the second column of the left extended column, and is shifted upward and stored in the third dual-port RAM.

13. The method according to claim 12, characterized in that In response to the prediction direction corresponding to the left boundary being 0°, copying the first column of the pixel matrix as the second column of the left extended column, copying the second column of the pixel matrix as the first column of the left extended column and storing it in the third dual-port RAM, further comprising: Writing each row of data of the first column of the pixel matrix in sequence starting from the position where the address of the first port of the third dual-port RAM is 0; Each row of data in the second column of the pixel matrix is ​​written in sequence starting from the position where the address of the second port of the third dual-port RAM is 0.

14. The method according to claim 12, characterized in that In response to the prediction direction corresponding to the left boundary being 45°, copying the first column of the pixel matrix as the first column and the second column of the left extended column, shifting downward and storing in the third dual-port RAM, further comprising: Writing each row of data except the last two rows of data in the first column of the pixel matrix in sequence starting from the address 2 of the first port of the third dual-port RAM; Each row of data except the last row of data in the first column of the pixel matrix is ​​written in sequence starting from the position where the address of the second port of the third dual-port RAM is 1.

15. The method according to claim 12, characterized in that In response to the prediction direction corresponding to the left boundary being 90°, copying the first column of the pixel matrix as the first column and the second column of the left extended column and storing them in the third dual-port RAM, further comprising: Writing each row of data of the first column of the pixel matrix in sequence starting from the position where the address of the first port of the third dual-port RAM is 0; Each row of data in the first column of the pixel matrix is ​​written in sequence starting from the address 0 of the second port of the third dual-port RAM.

16. The method according to claim 12, characterized in that In response to the prediction direction corresponding to the left boundary being 135°, copying the first column of the pixel matrix as the first column and the second column of the left extended column, shifting upward and storing in the third dual-port RAM, further comprising: Writing each row of data except the first two rows of data in the first column of the pixel matrix in sequence starting from the address 0 of the first port of the third dual-port RAM; Each row of data except the first row of data in the first column of the pixel matrix is ​​written in sequence starting from the address 0 of the second port of the third dual-port RAM.

17. The method according to claim 1, wherein: Counting the number of each prediction direction in the prediction directions corresponding to all the pixels of the reference row or column, taking the prediction direction with the largest number as the prediction direction of the corresponding boundary, and extending the corresponding boundary according to the prediction direction of the corresponding boundary, further comprising: In response to the prediction direction corresponding to the right boundary being 0°, copying the last column of the pixel matrix as the second column of the right extended column, copying the second to last column of the pixel matrix as the first column of the right extended column and storing them in the fourth dual-port RAM; In response to the prediction direction corresponding to the right boundary being 45°, the last column of the pixel matrix is ​​copied as the right extension The first and second columns of the column are simultaneously shifted upward and stored in the fourth dual-port RAM; In response to the prediction direction corresponding to the right boundary being 90°, copying the last column of the pixel matrix as the first and second columns of the right extended columns and storing them in the fourth dual-port RAM; In response to the prediction direction corresponding to the right boundary being 135°, the last column of the pixel matrix is ​​copied as the first column and the second column of the right extension column, and is shifted downward and stored in the fourth dual-port RAM.

18. The method according to claim 17, characterized in that In response to the prediction direction corresponding to the right boundary being 0°, copying the last column of the pixel matrix as the second column of the right extended column, copying the second to last column of the pixel matrix as the first column of the right extended column and storing it in the fourth dual-port RAM, further comprising: Writing each row of data of the last column of the pixel matrix in sequence starting from the position where the address of the first port of the fourth dual-port RAM is 0; Each row of data of the second to last column of the pixel matrix is ​​written in sequence starting from the position where the address of the second port of the fourth dual-port RAM is 0.

19. The method according to claim 17, characterized in that In response to the prediction direction corresponding to the right boundary being 45°, copying the last column of the pixel matrix as the first column and the second column of the right extension column, shifting upward and storing in the fourth dual-port RAM, further comprising: Writing each row of data except the first two rows of data in the last column of the pixel matrix in sequence starting from the address 0 of the first port of the fourth dual-port RAM; Each row of data except the first row of data in the last column of the pixel matrix is ​​written in sequence starting from the position where the address of the second port of the fourth dual-port RAM is 0.

20. The method of claim 17, wherein: In response to the prediction direction corresponding to the right boundary being 90°, copying the last column of the pixel matrix as the first and second columns of the right extended column and storing them in the fourth dual-port RAM, further comprising: Writing each row of data of the first column of the pixel matrix in sequence starting from the position where the address of the first port of the fourth dual-port RAM is 0; Each row of data in the first column of the pixel matrix is ​​written in sequence starting from the address 0 of the second port of the fourth dual-port RAM.

21. The method of claim 17, wherein: In response to the prediction direction corresponding to the right boundary being 135°, copying the last column of the pixel matrix as the first column and the second column of the right extension column, shifting downward and storing in the fourth dual-port RAM, further comprising: Writing each row of data except the last two rows of data in the last column of the pixel matrix in sequence starting from the address 2 of the first port of the fourth dual-port RAM; Each row of data except the last row of data in the last column of the pixel matrix is ​​written in sequence starting from the position where the address of the second port of the fourth dual-port RAM is 1.

22. The method of claim 1, wherein: Calculating the absolute value of the second-order differential value of each pixel point in the plurality of rows or columns in a plurality of preset directions respectively, further comprising: Calculate the absolute value of the second-order differential value in the 0° direction according to the formula D_0=|2*P(x, y)-P(x, y-1)-P(x, y+1)|; Calculate the absolute value of the second-order differential value in the 45° direction according to the formula D_45=|2*P(x, y)-P(x+1, y-1)-P(x-1, y+1)|; The absolute value of the second-order differential value in the 90° direction is calculated according to the formula D_90=|2*P(x, y)-P(x-1, y)-P(x+1, y)|; The absolute value of the second-order differential value in the 135° direction is calculated according to the formula D_135=|2*P(x, y)-P(x-1, y-1)-P(x+1, y+1)|; Among them, x, y are the row number and column number of the pixel point respectively, and P is the pixel value.

23. An image boundary processing system, characterized in that: include: The selection module is configured to select a number of rows or columns for each boundary of the pixel matrix of the image, and Select reference rows or columns from a plurality of rows or columns corresponding to the boundaries; A calculation module, configured to respectively calculate the absolute value of the second-order differential value of each pixel point in the plurality of rows or columns in a plurality of preset directions; A prediction direction determination module is configured to add the absolute values ​​of the second-order differential values ​​of each pixel point in the reference row or column and a number of surrounding pixels in the same preset direction and use the preset direction corresponding to the minimum value of the sum of the absolute values ​​as the prediction direction of the corresponding pixel point in the reference row or column; The expansion module is configured to count the number of each prediction direction in the prediction directions corresponding to all pixel points of the reference row or column, take the prediction direction with the largest number as the prediction direction of the corresponding boundary, and expand the corresponding boundary according to the prediction direction of the corresponding boundary.

24. A computer device comprising: at least one processor; as well as A memory storing a computer program executable on the processor, wherein the processor executes the steps of the method according to any one of claims 1 to 22 when executing the program.

25. A computer non-volatile readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 22 are performed.

Citation Information

Patent Citations

  • Interference image edge extending method based on directions

    CN104484872A

  • Ultrasound image processing method and ultrasound imaging device

    CN111329585A

  • Image amplification method and device, storage medium and terminal equipment

    CN111476718A

  • Image zooming method, storage medium and electronic equipment

    CN112053283A

  • Image edge filling method and device

    CN114913193A