Data processing method, device, equipment and readable storage medium

By obtaining and processing the matrix corresponding to the initial contour points of an image in the search acceleration engine, the problems of large amount of calculation and low versatility in image processing in the prior art are solved, and more efficient circuit performance and wider application applicability are achieved.

CN117333502BActive Publication Date: 2025-04-08TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311292291.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2025-04-08
Estimated Expiration
2043-09-28

AI Technical Summary

Technical Problem

The existing search circuits such as 4 neighborhoods and 8 neighborhoods have a large amount of calculation in image processing, low circuit performance, and cannot be used for different neighborhood directions.

Method used

By obtaining the neighborhood search matrix corresponding to the initial contour points in the pixel data in the search acceleration engine, and performing row shifts and column shifts, the coordinates of N neighborhood points in the matrix are determined, and the target contour points are determined based on these coordinates until the pixel points representing the image outline in the image are traversed.

Benefits of technology

This reduces the computational amount of neighborhood search by the chip, improves circuit performance, and makes the circuit common in different neighborhood requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117333502B_ABST
    Figure CN117333502B_ABST
Patent Text Reader

Abstract

The present application discloses a data processing method, device, equipment and readable storage medium, the method comprising: obtaining a neighborhood search matrix corresponding to an initial contour point in pixel data in a search acceleration engine; performing row shifting on the neighborhood search matrix to obtain an up-conversion matrix, a center transformation matrix and a down-conversion matrix corresponding to the neighborhood search matrix, determining an up-shift row in the up-conversion matrix, determining a center shift row in the center transformation matrix, and determining a down-shift row in the down-conversion matrix; performing column shifting on the up-shift row, the center shift row and the down-shift row respectively to obtain M transformation rows, determining the coordinates of N neighborhood points in the neighborhood search matrix through the M transformation rows, and determining the neighborhood points of the N neighborhood points that have a business contour relationship with the initial contour point as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix. The present application can improve the performance and versatility of the neighborhood search circuit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data processing method, device, equipment and readable storage medium. Background Art

[0002] The existing 4-neighborhood and 8-neighborhood search circuits calculate the coordinates of the pixel points on the entire image to obtain the coordinate data of the center point and its neighborhood points. In complex image processing, the pixel points have high dimensions and large amount of calculation. The number of decoding and decoding times required to directly calculate the coordinate data is large, and the circuit performance is low. In addition, the existing technology can only be used for the neighborhood direction preset for the center point, and cannot be used between the neighborhood directions of 3, 4, 5, 8, etc., and has low versatility. Summary of the invention

[0003] The embodiments of the present application provide a data processing method, apparatus, device, and readable storage medium, which can improve the performance and versatility of a neighborhood search circuit.

[0004] On the one hand, an embodiment of the present application provides a data processing method, including:

[0005] Inputting pixel data corresponding to the target image into a search acceleration engine in the processor, obtaining a neighborhood search matrix corresponding to an initial contour point in the pixel data in the search acceleration engine; the initial contour point is a pixel point in the target image that represents the image contour, and the neighborhood search matrix is ​​a matrix with the initial contour point as the center point;

[0006] Performing row shift on the neighborhood search matrix to obtain an up-conversion matrix, a center conversion matrix and a down-conversion matrix corresponding to the neighborhood search matrix, determining an up-shift row in the up-conversion matrix, determining a center-shift row in the center conversion matrix, and determining a down-shift row in the down-conversion matrix;

[0007] The upper shift row, the center shift row and the lower shift row are respectively shifted by columns to obtain M transformation rows, and the coordinates of N neighborhood points in the neighborhood search matrix are determined through the M transformation rows. Based on the coordinates of the N neighborhood points in the neighborhood search matrix, the neighborhood points having a business contour relationship with the initial contour point among the N neighborhood points are determined as target contour points, and new target contour points are continuously traversed through the neighborhood search matrix corresponding to the target contour point until all the pixel points representing the image contour in the target image are traversed; M and N are positive integers, and N is less than or equal to M.

[0008] Among them, the neighborhood search matrix is ​​a matrix containing K rows and L columns of pixel points, the initial contour point is in the i-th row of the neighborhood search matrix, K, L and i are positive integers, the neighborhood search matrix is ​​row-shifted to obtain an up-conversion matrix, a center transformation matrix and a down-conversion matrix corresponding to the neighborhood search matrix, and based on the initial contour point, an up-shifted row is determined in the up-conversion matrix, a center-shifted row is determined in the center transformation matrix, and a down-shifted row is determined in the down-conversion matrix, including:

[0009] The K rows of the neighborhood search matrix are shifted upward by one row to obtain an up-conversion matrix, and the i-th row in the up-conversion matrix is ​​determined as the up-shifted row; the up-conversion matrix is ​​a matrix of K-1 rows and L columns of pixels;

[0010] Construct a center transformation matrix that is the same as the neighborhood search matrix, and determine the i-th row in the center transformation matrix as the center shift row;

[0011] The K rows of the neighborhood search matrix are shifted down by one row to obtain a down-conversion matrix, and the i-th row in the down-conversion matrix is ​​determined as the down-shifted row; the down-conversion matrix is ​​a matrix of pixels having K-1 rows and L columns.

[0012] The upper shift row, the center shift row and the lower shift row are respectively shifted by columns to obtain M transformed rows, including:

[0013] Shift the upper shift row to the right by one column to obtain the first transformed row, construct the second transformed row identical to the upper shift row, shift the upper shift row to the left by one column to obtain the third transformed row;

[0014] Shift the center shift row one column to the right to obtain the fourth transformed row, construct the fifth transformed row that is the same as the center shift, and shift the center shift row one column to the left to obtain the sixth transformed row;

[0015] Shift the down-shifted row right by one column to obtain the seventh transformed row, construct the eighth transformed row identical to the down-shifted row, and shift the down-shifted row left by one column to obtain the ninth transformed row.

[0016] Among them, the N domain points include upper azimuth neighboring points, center azimuth neighboring points and lower azimuth neighboring points, and the coordinates of the N neighborhood points in the neighborhood search matrix are determined by M transformation rows, including:

[0017] Determine the upper neighboring point and the coordinates of the upper neighboring point through the first transformation row, the second transformation row and the third transformation row; the upper neighboring point includes the upper left neighboring point, the upper neighboring point and the upper right neighboring point;

[0018] Determine the center orientation neighborhood point and the coordinates of the center orientation neighborhood point through the fourth transformation row, the fifth transformation row and the sixth transformation row; the center orientation neighborhood point includes the left neighborhood point, the center neighborhood point and the right neighborhood point;

[0019] The lower neighboring points and the coordinates of the lower neighboring points are determined through the seventh transformation row, the eighth transformation row and the ninth transformation row; the lower neighboring points include the lower left neighboring point, the lower neighboring point and the lower right neighboring point.

[0020] Among them, the initial contour point is in the jth column of the neighborhood search matrix, j is a positive integer, and the upper neighborhood point and the coordinates of the upper neighborhood point are determined through the first transformation row, the second transformation row, and the third transformation row, including:

[0021] The j-th column of the first transformed row is determined as the upper left neighboring point, and the column number of the j-th column and the row number of the first transformed row are determined as the coordinates of the upper left neighboring point;

[0022] The j-th column of the second transformed row is determined as the upper neighbor point, and the column number of the j-th column and the row number of the second transformed row are determined as the coordinates of the upper neighbor point;

[0023] The j-th column of the third transformed row is determined as the upper right neighbor point, and the column number of the j-th column and the row number of the third transformed row are determined as the coordinates of the upper right neighbor point.

[0024] Among them, the initial contour point is in the jth column of the neighborhood search matrix, j is a positive integer, and the center orientation neighborhood point and the coordinates of the center orientation neighborhood point are determined through the fourth transformation row, the fifth transformation row, and the sixth transformation row, including:

[0025] The j-th column of the fourth transformed row is determined as the left neighboring point, and the column number of the j-th column and the row number of the fourth transformed row are determined as the coordinates of the left neighboring point;

[0026] The j-th column of the fifth transformed row is determined as the central neighborhood point, and the column number of the j-th column and the row number of the fifth transformed row are determined as the coordinates of the central neighborhood point;

[0027] The j-th column of the sixth transformed row is determined as the right neighbor point, and the column number of the j-th column and the row number of the sixth transformed row are determined as the coordinates of the right neighbor point.

[0028] Among them, the initial contour point is in the jth column of the neighborhood search matrix, j is a positive integer, and the coordinates of the lower neighboring points and the lower neighboring points are determined through the seventh transformation row, the eighth transformation row, and the ninth transformation row, including:

[0029] The j-th column of the seventh transformed row is determined as the lower left neighboring point, and the column number of the j-th column and the row number of the seventh transformed row are determined as the coordinates of the lower left neighboring point;

[0030] The j-th column of the eighth transformed row is determined as the lower neighboring point, and the column number of the j-th column and the row number of the eighth transformed row are determined as the coordinates of the lower neighboring point;

[0031] The j-th column of the ninth transformed row is determined as the lower right neighbor point, and the column number of the j-th column and the row number of the ninth transformed row are determined as the coordinates of the lower right neighbor point.

[0032] Among them, it also includes:

[0033] Acquire a business image, and among the pixels of the business image, determine the pixels whose grayscale values ​​are greater than or equal to the business grayscale threshold as white pixels, and determine the pixels whose grayscale values ​​are less than the business grayscale threshold as black pixels;

[0034] The grayscale value of the white pixel is set to the first grayscale value, and the grayscale value of the black pixel is set to the second grayscale value, to obtain a grayscale image composed of white pixels and black pixels, and the connected domain is marked on the grayscale image to obtain a target image.

[0035] Among them, the connected domain of the grayscale image is marked to obtain the target image, including:

[0036] A seed pixel is randomly determined from the pixels of the grayscale image, and among the adjacent pixels of the seed pixel, the adjacent pixels that meet the connectivity threshold condition with the seed pixel are marked as new seed pixels, until all the pixels in the grayscale image are traversed, and the seed pixels with the same mark are determined as the same connected domain;

[0037] Continue to determine new connected domains in the unmarked pixels in the grayscale image until all the pixels in the grayscale image are marked, and then obtain the target image.

[0038] The step of inputting pixel data corresponding to the target image into a search acceleration engine in the processor and obtaining a neighborhood search matrix corresponding to the initial contour point in the pixel data in the search acceleration engine includes:

[0039] In the search acceleration engine, an initial connected domain in the target image is randomly determined, and an initial pixel point is randomly determined in the initial connected domain. If there is at least one adjacent pixel point with a different label from the initial connected domain among the N adjacent pixel points of the initial pixel point, the adjacent pixel point with a different label from the initial connected domain is determined as an initial contour point, otherwise the initial pixel point is re-determined; N is a positive integer;

[0040] A neighborhood search matrix corresponding to the initial contour point is determined based on the initial contour point, the connected domain corresponding to the adjacent pixel points having different labels from the initial connected domain, and the initial connected domain.

[0041] Wherein, based on the coordinates of the N neighborhood points in the neighborhood search matrix, a neighborhood point having a business contour relationship with the initial contour point among the N neighborhood points is determined as a target contour point, including:

[0042] Based on the coordinates of the N neighborhood points in the neighborhood search matrix, determine the traversal order of the N neighborhood points;

[0043] The grayscale values ​​of N neighborhood points are obtained, and based on the traversal order of the N neighborhood points, the neighborhood point that is traversed first and has the same grayscale value as the initial contour point is determined as the target contour point.

[0044] On the one hand, an embodiment of the present application provides a data processing device, including:

[0045] An initial processing module is used to input pixel data corresponding to the target image into a search acceleration engine in the processor, and obtain a neighborhood search matrix corresponding to an initial contour point in the pixel data in the search acceleration engine; the initial contour point is a pixel point in the target image that represents the image contour, and the neighborhood search matrix is ​​a matrix with the initial contour point as the center point;

[0046] A row shift module is used to perform row shift on the neighborhood search matrix to obtain an up-conversion matrix, a center conversion matrix and a down-conversion matrix corresponding to the neighborhood search matrix, determine an up-shift row in the up-conversion matrix, determine a center-shift row in the center conversion matrix, and determine a down-shift row in the down-conversion matrix;

[0047] A neighborhood processing module is used to perform column shifting on the upper shift row, the center shift row and the lower shift row respectively to obtain M transformation rows, determine the coordinates of N neighborhood points in the neighborhood search matrix through the M transformation rows, determine the neighborhood points having a business contour relationship with the initial contour point among the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continue to traverse new target contour points through the neighborhood search matrix corresponding to the target contour point until all the pixel points representing the image contour in the target image are traversed; M and N are positive integers, and N is less than or equal to M.

[0048] The neighborhood search matrix is ​​a matrix containing K rows and L columns of pixel points, the initial contour point is in the i-th row of the neighborhood search matrix, K, L and i are positive integers, and the row shift module includes:

[0049] The first matrix transformation unit is used to shift K rows of the neighborhood search matrix upward by one row to obtain an up-transformation matrix, and determine the i-th row in the up-transformation matrix as an up-shifted row; the up-transformation matrix is ​​a matrix of K-1 rows and L columns of pixels;

[0050] A second matrix transformation unit is used to construct a center transformation matrix that is the same as the neighborhood search matrix, and determine the i-th row in the center transformation matrix as the center shift row;

[0051] The third matrix transformation unit is used to shift the K rows of the neighborhood search matrix downward by one row to obtain a down-transformation matrix, and determine the i-th row in the down-transformation matrix as the down-shifted row; the down-transformation matrix is ​​a matrix of pixels of K-1 rows by L columns.

[0052] Among them, the neighborhood processing module includes:

[0053] A first row transformation unit is used to shift the upper shift row to the right by one column to obtain a first transformation row, construct a second transformation row that is the same as the upper shift row, and shift the upper shift row to the left by one column to obtain a third transformation row;

[0054] The second row transformation unit is used to shift the center shift row to the right by one column to obtain a fourth transformation row, construct a fifth transformation row with the same center shift, and shift the center shift row to the left by one column to obtain a sixth transformation row;

[0055] The third row transformation unit is used to shift the down-shifted row to the right by one column to obtain a seventh transformation row, construct an eighth transformation row that is the same as the down-shifted row, and shift the down-shifted row to the left by one column to obtain a ninth transformation row.

[0056] Among them, the neighborhood processing module includes:

[0057] An upper position transformation unit, used to determine an upper position neighbor point and the coordinates of the upper position neighbor point through the first transformation line, the second transformation line and the third transformation line; the upper position neighbor point includes an upper left neighbor point, an upper neighbor point and an upper right neighbor point;

[0058] A center orientation transformation unit, used to determine the center orientation neighborhood point and the coordinates of the center orientation neighborhood point through the fourth transformation line, the fifth transformation line and the sixth transformation line; the center orientation neighborhood point includes a left neighborhood, a center neighborhood and a right neighborhood;

[0059] The lower position transformation unit is used to determine the lower position neighboring points and the coordinates of the lower position neighboring points through the seventh transformation line, the eighth transformation line and the ninth transformation line; the lower position neighboring points include the lower left neighboring point, the lower neighboring point and the lower right neighboring point.

[0060] Wherein, the upper position transformation unit includes:

[0061] A first neighborhood determination subunit is used to determine the j-th column of the first transformed row as the upper left neighborhood point, and determine the column number of the j-th column and the row number of the first transformed row as the coordinates of the upper left neighborhood point;

[0062] A second neighborhood determination subunit is used to determine the j-th column of the second transformed row as an upper neighborhood point, and determine the column number of the j-th column and the row number of the second transformed row as coordinates of the upper neighborhood point;

[0063] The third neighborhood determination subunit is used to determine the jth column of the third transformed row as the upper right neighborhood point, and determine the column number of the jth column and the row number of the third transformed row as the coordinates of the upper right neighborhood point.

[0064] Wherein, the center orientation transformation unit includes:

[0065] A fourth neighborhood determination subunit, used to determine the j-th column of the fourth transformed row as the left neighborhood point, and determine the column number of the j-th column and the row number of the fourth transformed row as the coordinates of the left neighborhood point;

[0066] a fifth neighborhood determination subunit, configured to determine the j-th column of the fifth transformed row as the central neighborhood point, and determine the column number of the j-th column and the row number of the fifth transformed row as the coordinates of the central neighborhood point;

[0067] The sixth neighborhood determination subunit is used to determine the j-th column of the sixth transformed row as the right neighborhood point, and determine the column number of the j-th column and the row number of the sixth transformed row as the coordinates of the right neighborhood point.

[0068] The lower position transformation unit includes:

[0069] The seventh neighborhood determination subunit is used to determine the jth column of the seventh transformed row as the lower left neighborhood point, and determine the column number of the jth column and the row number of the seventh transformed row as the coordinates of the lower left neighborhood point.

[0070] an eighth neighborhood determination subunit, configured to determine the j-th column of the eighth transformed row as a lower neighborhood point, and determine the column number of the j-th column and the row number of the eighth transformed row as coordinates of the lower neighborhood point;

[0071] The ninth neighborhood determination subunit is used to determine the jth column of the ninth transformed row as the lower right neighborhood point, and determine the column number of the jth column and the row number of the ninth transformed row as the coordinates of the lower right neighborhood point.

[0072] Among them, it also includes:

[0073] A binarization processing module is used to obtain a business image, and among the pixels of the business image, determine the pixels whose grayscale values ​​are greater than or equal to the business grayscale threshold as white pixels, and determine the pixels whose grayscale values ​​are less than the business grayscale threshold as black pixels;

[0074] The binarization processing module is also used to set the grayscale value of the white pixel to the first grayscale value and the grayscale value of the black pixel to the second grayscale value, to obtain a grayscale image composed of white pixels and black pixels, to mark the connected domain of the grayscale image, and to obtain a target image.

[0075] Among them, the binary processing module includes:

[0076] A seed determination unit is used to randomly determine a seed pixel point among the pixels of the grayscale image, and mark the adjacent pixel points that meet the connectivity threshold condition with the seed pixel point as new seed pixels among the adjacent pixel points of the seed pixel point, until all the pixels in the grayscale image are traversed, and the seed pixels with the same mark are determined as the same connected domain;

[0077] The connected domain marking unit is used to continue to determine new connected domains in the unmarked pixel points in the grayscale image until all the pixel points in the grayscale image are marked to obtain the target image.

[0078] The initial processing module includes:

[0079] The initial contour determination unit is used to randomly determine an initial connected domain in the target image in the search acceleration engine, and randomly determine an initial pixel point in the initial connected domain. If there is at least one adjacent pixel point with a different label from the initial connected domain among the N adjacent pixel points of the initial pixel point, the adjacent pixel point with a different label from the initial connected domain is determined as an initial contour point, otherwise the initial pixel point is re-determined; N is a positive integer;

[0080] The initial matrix determination unit is used to determine the neighborhood search matrix corresponding to the initial contour point based on the initial contour point, the connected domain corresponding to the adjacent pixel points with different labels from the initial connected domain, and the initial connected domain.

[0081] Among them, the neighborhood processing module is specifically used to determine the traversal order of N neighborhood points based on the coordinates of the N neighborhood points in the neighborhood search matrix; obtain the grayscale values ​​of the N neighborhood points, and based on the traversal order of the N neighborhood points, determine the neighborhood point that is traversed first and has the same grayscale value as the initial contour point as the target contour point.

[0082] On the one hand, an embodiment of the present application provides a computer device, including: a processor, a memory, and a network interface;

[0083] The processor is connected to the memory and the network interface, wherein the network interface is used to provide a data communication function, and the memory is used to store a computer program. When the computer program is executed by the processor, the computer device executes the method provided in the embodiment of the present application.

[0084] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the method provided by the embodiment of the present application.

[0085] In one aspect, an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the method provided in the embodiment of the present application.

[0086] In the embodiment of the present application, pixel data corresponding to the target image is input into a search acceleration engine in a processor, and a neighborhood search matrix corresponding to an initial contour point in the pixel data is obtained in the search acceleration engine; the initial contour point is a pixel point in the target image that represents the image contour, and the neighborhood search matrix is ​​a matrix with the initial contour point as the center point; the neighborhood search matrix is ​​row-shifted to obtain an up-conversion matrix, a center-conversion matrix, and a down-conversion matrix corresponding to the neighborhood search matrix, and an up-shift row is determined in the up-conversion matrix, a center-shift row is determined in the center-conversion matrix, and a down-conversion matrix is ​​obtained. The method comprises the following steps: determining a down-shifted row in the matrix; performing column shifting on the up-shifted row, the center-shifted row and the down-shifted row respectively to obtain M transformed rows, determining the coordinates of N neighborhood points in the neighborhood search matrix through the M transformed rows, determining the neighborhood points having a business contour relationship with the initial contour points among the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuing to traverse new target contour points through the neighborhood search matrix corresponding to the target contour points until all the pixel points representing the image contour in the target image are traversed; M and N are positive integers, and N is less than or equal to M. It can be seen that the embodiment of the present application can generate a neighborhood search matrix after determining the initial contour point. The dimension of the neighborhood search matrix is ​​much smaller than the pixel dimension of the entire image, thereby reducing the amount of calculation required for the chip to perform neighborhood search. By transforming the rows and columns where the initial contour point is located, the neighborhood points in various directions are obtained, which can reduce the steps of calculating the decoding and decoding of the neighborhood point coordinate data, and improve the performance of the neighborhood search circuit. Among the neighborhood points in various directions obtained by the row and column transformation, all neighborhood directions on the plane are covered, allowing the neighborhood search circuit to be used in different neighborhood requirements. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0088] Figure 1 This is a schematic diagram of a network architecture provided by an embodiment of the present application;

[0089] Figure 2 It is a schematic diagram of a data processing scenario provided by an embodiment of the present application;

[0090] Figure 3 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 1 ;

[0091] Figure 4 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 2 ;

[0092] Figure 5 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 3 ;

[0093] Figure 6 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 4 ;

[0094] Figure 7 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 5 ;

[0095] Figure 8 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;

[0096] Fig. 9 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0097] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0098] See also Figure 1 , Figure 1 This is a network architecture diagram provided by an embodiment of the present application. The network architecture diagram may include a business server 100 and a terminal device cluster, and the terminal device cluster may include: terminal device 200a, terminal device 200b, ..., terminal device 200n, wherein any terminal device in the terminal device cluster may be respectively connected to the business server 100 in a communication manner. The above-mentioned communication connection does not limit the connection method, and may be directly or indirectly connected through a wired communication method, or directly or indirectly connected through a wireless communication method, or through other methods, which are not limited by the present application.

[0099] Specifically, Figure 1Each terminal device in the terminal cluster shown can send a business image processing request to the business server 100, and the business image processing request may include a business image. The business server 100 can perform binarization processing on the business image, and through the business grayscale threshold, the business server 100 can set the grayscale value of the pixel in the business image to 0 or 255 to obtain a grayscale image of the business image. Among them, the business grayscale threshold can be set according to business needs or specific business images, and the embodiment of the present application is not limited here.

[0100] The business server 100 can mark the connected domain of the grayscale image of the business image, mark the pixels with the same grayscale value and adjacent pixel positions as a connected domain, and obtain the target image. The business server 100 can input the pixel data of the target image into the search acceleration engine in the processor, and determine the initial contour points in the pixel points of the target image. Among them, the initial contour points can be the pixel points that represent the image contour in the target image, and the way in which the business server 100 determines the initial contour points can be the boundary points of the connected domain, which is not limited in the embodiment of the present application.

[0101] The service server 100 may determine the pixel points of K rows and L columns around the initial contour point as the neighborhood search matrix corresponding to the initial contour point. The service server 100 may perform row shifting on the neighborhood search matrix to obtain an up-conversion matrix, a center transformation matrix, and a down-conversion matrix, respectively. The service server 100 may determine the up-shifted rows in the up-conversion matrix, determine the center-shifted rows in the center transformation matrix, and determine the down-shifted rows in the down-conversion matrix. Wherein, K and L are positive integers, K and L may be preset according to service requirements, and the embodiment of the present application does not limit the method for determining K and L.

[0102] The business server 100 can perform column shift on the upper shift row to obtain the first transformation row, the second transformation row and the third transformation row, perform column shift on the center shift row to obtain the fourth transformation row, the fifth transformation row and the sixth transformation row, and perform column shift on the lower shift row to obtain the seventh transformation row, the eighth transformation row and the ninth transformation row.

[0103] Taking the business server 100 as an example of performing an 8-neighborhood search, the 8 neighborhoods may refer to the positional relationship of the 8 directions of upper left, left, lower left, upper, lower, upper right, right and lower right around the center point. The business server 100 may determine the coordinates of the upper left neighborhood point in the neighborhood search matrix through the first transformation row, and the upper left neighborhood point may represent the upper left neighborhood. The coordinates of the upper neighborhood point in the neighborhood search matrix are determined through the second transformation row, and the upper neighborhood point may represent the upper neighborhood. The coordinates of the upper right neighborhood point in the neighborhood search matrix are determined through the third transformation row, and the upper right neighborhood point may represent the upper right neighborhood. The coordinates of the left neighborhood point in the neighborhood search matrix are determined through the fourth transformation row, and the left neighborhood point may represent the left neighborhood. The coordinates of the central neighborhood point in the neighborhood search matrix are determined through the fifth transformation row, and the central neighborhood point may represent the center point. The coordinates of the right neighborhood point in the neighborhood search matrix are determined through the sixth transformation row, and the right neighborhood point may represent the right neighborhood. The coordinates of the lower left neighbor point in the neighborhood search matrix are determined by the seventh transformation row, and the lower left neighbor point can represent the lower left neighborhood. The coordinates of the lower neighbor point in the neighborhood search matrix are determined by the eighth transformation row, and the lower neighbor point can represent the lower neighborhood. The coordinates of the lower right neighbor point in the neighborhood search matrix are determined by the ninth transformation row, and the lower right neighbor point can represent the lower right neighborhood.

[0104] The service server 100 determines the neighborhood point having a business contour relationship with the initial contour point (also referred to as the central neighborhood point) as the target contour point through the coordinates of the upper left neighborhood point, the upper neighborhood point, the upper right neighborhood point, the left neighborhood point, the right neighborhood point, the lower left neighborhood point, the lower neighborhood point and the lower right neighborhood point in the neighborhood search matrix. The target contour point is also a pixel point representing the image contour in the target image. The service server 100 can continue to perform the above steps through the neighborhood search matrix corresponding to the target contour point, and continue to traverse and determine the next target contour point until the pixel points representing the image contour in the target image are traversed (or until the pixel points representing the image contour have been traversed and determined as the target contour point or the initial contour point).

[0105] The service server 100 may determine the image contour in the target image through the initial contour points and the target contour points, and the service server 100 may send the processed image contour to the terminal device 200a to complete the image contour processing of the service image.

[0106] It can be understood that the N-neighborhood search (such as 8-neighborhood search) performed in the business server 100 can be applied to the circuit control method of the chip (chip used for computer system calculation, control, information processing, and program running). By dividing the neighborhood in the circuit and using the N-neighborhood search algorithm for optimization, the circuit performance of the chip can be improved.

[0107] See also Figure 2 , Figure 2This is a data processing scenario provided by the embodiment of the present application. Figure 1 .

[0108] like Figure 2 As shown, the terminal device 200a can send a business image processing request and send the business image 210 to the business server 100. The business server 100 can perform binarization processing on the business image 210. In the scene 110, taking the image area 211 in the business image 210 as an example, the business server 100 can perform binarization processing on the pixel area 111 corresponding to the image area 211 by the business grayscale threshold, and determine the pixel points with grayscale values ​​greater than or equal to the business grayscale threshold as black pixel points, and set the grayscale value of the black pixel points to 255. For example, the black pixel points can be the pixel points 112 in the scene 110. The business server 100 can determine the pixel points with grayscale values ​​less than the business grayscale threshold as white pixel points, and set the grayscale value of the white pixel points to 0. For example, the white pixel points can be the pixel points 113 in the scene 110, and obtain the grayscale image of the business image 210.

[0109] The business server 100 can mark the connected domain of the grayscale image of the business image 210, and mark the pixels with the same grayscale value and adjacent pixel positions as the same connected domain. For example, in the scene 120, the business server can mark the pixels corresponding to the pixel area 111 with a grayscale value of 0 and adjacent pixel positions as 1, and obtain a connected domain 1. The pixels in another area with a grayscale value of 0 and adjacent pixel positions are marked as 3, and a connected domain 3 is obtained. The pixels with a grayscale value of 255 and adjacent pixel positions are marked as 2, and a connected domain 2 is obtained, until the business server can complete the marking of all the pixels in the grayscale image of the business image 210 to obtain the target image. The business server 100 can input the pixel data of the target image into the search acceleration engine in the processor, and determine the initial contour points in the pixel points of the target image. Among them, the initial contour points can be the pixel points in the target image that represent the image contour, and the way in which the business server 100 determines the initial contour points can be the boundary points of the connected domain (for example, it can be pixel point 121), which is not limited in the embodiment of the present application.

[0110] The service server 100 may determine the pixel points of K rows and L columns around the initial contour point as the neighborhood search matrix corresponding to the initial contour point. The service server 100 may perform row shifting on the neighborhood search matrix to obtain an up-conversion matrix, a center transformation matrix, and a down-conversion matrix, respectively. The service server 100 may determine the up-shifted rows in the up-conversion matrix, determine the center-shifted rows in the center transformation matrix, and determine the down-shifted rows in the down-conversion matrix. Wherein, K and L are positive integers, K and L may be preset according to service requirements, and the embodiment of the present application does not limit the method for determining K and L.

[0111] The business server 100 can perform column shift on the upper shift row to obtain the first transformation row, the second transformation row and the third transformation row, perform column shift on the center shift row to obtain the fourth transformation row, the fifth transformation row and the sixth transformation row, and perform column shift on the lower shift row to obtain the seventh transformation row, the eighth transformation row and the ninth transformation row.

[0112] Taking the business server 100 as an example of performing an 8-neighborhood search, the 8 neighborhoods may refer to the positional relationship of the 8 directions of upper left, left, lower left, upper, lower, upper right, right and lower right around the center point. The business server 100 may determine the coordinates of the upper left neighborhood point in the neighborhood search matrix through the first transformation row, and the upper left neighborhood point may represent the upper left neighborhood. The coordinates of the upper neighborhood point in the neighborhood search matrix are determined through the second transformation row, and the upper neighborhood point may represent the upper neighborhood. The coordinates of the upper right neighborhood point in the neighborhood search matrix are determined through the third transformation row, and the upper right neighborhood point may represent the upper right neighborhood. The coordinates of the left neighborhood point in the neighborhood search matrix are determined through the fourth transformation row, and the left neighborhood point may represent the left neighborhood. The coordinates of the central neighborhood point in the neighborhood search matrix are determined through the fifth transformation row, and the central neighborhood point may represent the center point. The coordinates of the right neighborhood point in the neighborhood search matrix are determined through the sixth transformation row, and the right neighborhood point may represent the right neighborhood. The coordinates of the lower left neighbor point in the neighborhood search matrix are determined by the seventh transformation row, and the lower left neighbor point can represent the lower left neighborhood. The coordinates of the lower neighbor point in the neighborhood search matrix are determined by the eighth transformation row, and the lower neighbor point can represent the lower neighborhood. The coordinates of the lower right neighbor point in the neighborhood search matrix are determined by the ninth transformation row, and the lower right neighbor point can represent the lower right neighborhood.

[0113] The service server 100 determines the neighborhood point having a business contour relationship with the initial contour point (also referred to as the central neighborhood point) as the target contour point through the coordinates of the upper left neighborhood point, the upper neighborhood point, the upper right neighborhood point, the left neighborhood point, the right neighborhood point, the lower left neighborhood point, the lower neighborhood point and the lower right neighborhood point in the neighborhood search matrix. The target contour point is also a pixel point representing the image contour in the target image. The service server 100 can continue to perform the above steps through the neighborhood search matrix corresponding to the target contour point, and continue to traverse and determine the next target contour point until the pixel points representing the image contour in the target image are traversed (or until the pixel points representing the image contour have been traversed and determined as the target contour point or the initial contour point).

[0114] The business server 100 can determine the image contour in the target image through the initial contour points and the target contour points to obtain the image contour 131 and the image contour 132 in the scene 130. The business server 100 can send the processed image contour to the terminal device 200a to complete the image contour processing of the business image 210.

[0115] In the embodiment of the present application, pixel data corresponding to the target image is input into a search acceleration engine in a processor, and a neighborhood search matrix corresponding to an initial contour point in the pixel data is obtained in the search acceleration engine; the initial contour point is a pixel point in the target image that represents the image contour, and the neighborhood search matrix is ​​a matrix with the initial contour point as the center point; the neighborhood search matrix is ​​row-shifted to obtain an up-conversion matrix, a center-conversion matrix, and a down-conversion matrix corresponding to the neighborhood search matrix, and an up-shift row is determined in the up-conversion matrix, a center-shift row is determined in the center-conversion matrix, and a down-conversion matrix is ​​obtained. The method comprises the following steps: determining a down-shifted row in the matrix; performing column shifting on the up-shifted row, the center-shifted row and the down-shifted row respectively to obtain M transformed rows, determining the coordinates of N neighborhood points in the neighborhood search matrix through the M transformed rows, determining the neighborhood points having a business contour relationship with the initial contour points among the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuing to traverse new target contour points through the neighborhood search matrix corresponding to the target contour points until all the pixel points representing the image contour in the target image are traversed; M and N are positive integers, and N is less than or equal to M. It can be seen that the embodiment of the present application can generate a neighborhood search matrix after determining the initial contour point. The dimension of the neighborhood search matrix is ​​much smaller than the pixel dimension of the entire image, thereby reducing the amount of calculation required for the chip to perform neighborhood search. By transforming the rows and columns where the initial contour point is located, the neighborhood points in various directions are obtained, which can reduce the steps of calculating the decoding and decoding of the neighborhood point coordinate data, and improve the performance of the neighborhood search circuit in the chip. Among the neighborhood points in various directions obtained by the row and column transformation, all neighborhood directions on the plane are covered, allowing the neighborhood search circuit to be used in different neighborhood requirements.

[0116] See also Figure 3 , Figure 3 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 1 The data processing method may be executed by a computer device, which may include Figure 1 The terminal device shown (which may be terminal device 200a, terminal device 200b, ..., terminal device 200n) or service server 100. Figure 3 As shown, the method may include:

[0117] Step S101, inputting pixel data corresponding to the target image into a search acceleration engine in a processor, and obtaining a neighborhood search matrix corresponding to an initial contour point in the pixel data in the search acceleration engine; the initial contour point is a pixel point in the target image that represents the image contour, and the neighborhood search matrix is ​​a matrix with the initial contour point as the center point;

[0118] Specifically, the computer device may input pixel data corresponding to the target image into the search acceleration engine in the processor. The target image may be an image that has been binarized and marked with connected domains. For the content of the target image, please refer to Figure 6 The specific description of steps S201 to S203 in the corresponding embodiment. The search acceleration engine can be a component in a computer device for performing neighborhood search on a target image, or can be a hardware unit of a chip in a neighborhood search circuit.

[0119] The computer device can obtain the initial contour points in the target image pixel data and the neighborhood search matrix corresponding to the initial turn point in the search acceleration engine. The computer device can determine the initial contour points as boundary points of a connected domain, which is not limited in the embodiments of the present application.

[0120] The initial contour point may be a pixel point representing the image contour in the target image, and the neighborhood search matrix is ​​a matrix with the initial contour point as the center point and including K rows and L columns of pixel points around the initial contour point. K and L are positive integers, and K and L may be preset according to business requirements. The embodiment of the present application does not limit the method for determining K and L.

[0121] Step S102, shifting rows of the neighborhood search matrix to obtain an up-conversion matrix, a center conversion matrix, and a down-conversion matrix corresponding to the neighborhood search matrix, determining an up-shifted row in the up-conversion matrix, determining a center-shifted row in the center conversion matrix, and determining a down-shifted row in the down-conversion matrix;

[0122] Specifically, the computer device may perform row shift on the neighborhood search matrix to obtain an up-conversion matrix, a center conversion matrix, and a down-conversion matrix corresponding to the neighborhood search matrix.

[0123] The specific process of the computer device shifting the rows of the neighborhood search matrix can be: shifting the K rows of the neighborhood search matrix upward by one row to obtain an up-conversion matrix, and determining the i-th row in the up-conversion matrix as the up-shifted row; the up-conversion matrix is ​​a matrix of K-1 rows and L columns of pixel points; constructing a center transformation matrix that is the same as the neighborhood search matrix, and determining the i-th row in the center transformation matrix as the center shifted row; shifting the K rows of the neighborhood search matrix downward by one row to obtain a down-conversion matrix, and determining the i-th row in the down-conversion matrix as the down-shifted row; the down-conversion matrix is ​​a matrix of K-1 rows and L columns of pixel points.

[0124] Please also refer to Figure 4 , Figure 4 A data processing method provided in the present application is shown in FIG. Figure 2 ,like Figure 4As shown, the neighborhood search matrix with the initial contour point A as the center point may include K rows by L columns. Taking the search acceleration engine performing an 8-neighborhood search as an example, the 8 neighborhoods may refer to the positional relationships in the 8 directions of upper left, left, lower left, top, bottom, upper right, right, and lower right around the center point.

[0125] Specifically, the neighborhood search matrix may include the 1st row, the 2nd row, the i-1th row, the i-th row, the i+1th row, ..., the Kth row, and the initial contour point A is in the i-th row in the neighborhood search matrix, where i is a positive integer less than K.

[0126] The computer device may shift K rows in the neighborhood search matrix upward by one row to obtain an up-conversion matrix, and the up-conversion matrix may include the 1st row, the 2nd row, the i-1th row, the i-th row, ..., the K-1th row corresponding to the neighborhood search matrix, that is, the up-conversion matrix is ​​a matrix of pixels including K-1 rows and L columns. The computer device may determine the i-th row in the up-conversion matrix as the up-shifted row. The i-th row in the up-conversion matrix may correspond to the i-1th row in the neighborhood search matrix.

[0127] The computer device may construct a center transformation matrix that is the same as the neighborhood search matrix, and the center transformation matrix may include the first row, the second row, the i-th row, ..., the K-th row corresponding to the neighborhood search matrix. The computer device may determine the i-th row in the center transformation matrix as the center shift row. The i-th row in the center transformation matrix may correspond to the i-th row in the neighborhood search matrix.

[0128] The computer device may shift the K rows in the neighborhood search matrix downward by one row to obtain a down-conversion matrix, and the down-conversion matrix may include the 2nd row, the 3rd row, the i-th row, the i+1th row, ..., the Kth row corresponding to the neighborhood search matrix, that is, the down-conversion matrix is ​​a matrix of pixels including K-1 rows and L columns. The computer device may determine the i-th row in the down-conversion matrix as the down-shifted row. The i-th row in the down-conversion matrix may correspond to the i+1th row in the neighborhood search matrix.

[0129] Step S103, respectively perform column shifts on the upper shift row, the center shift row and the lower shift row to obtain M transformation rows, determine the coordinates of N neighborhood points in the neighborhood search matrix through the M transformation rows, and based on the coordinates of the N neighborhood points in the neighborhood search matrix, determine the neighborhood points among the N neighborhood points that have a business contour relationship with the initial contour point as the target contour point, and continue to traverse new target contour points through the neighborhood search matrix corresponding to the target contour point until all the pixel points representing the image contour in the target image are traversed; M and N are positive integers, and N is less than or equal to M.

[0130] For details, please refer to Figure 5 , Figure 5 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 3 ,like Figure 5 As shown, the computer device can perform column shifting on the upper shift row, the center shift row and the lower shift row respectively to obtain M transformation rows, where M can be nine. The upper shift row, the center shift row and the lower shift row each include L columns, and the initial contour point A can be in the jth column of the neighborhood search matrix, where j is a positive integer less than L.

[0131] The specific process of column shifting by a computer device can be: shifting the upper shift row to the right by one column to obtain the first transformation row, constructing the second transformation row identical to the upper shift row, shifting the upper shift row to the left by one column to obtain the third transformation row; shifting the center shift row to the right by one column to obtain the fourth transformation row, constructing the fifth transformation row identical to the center shift, shifting the center shift row to the left by one column to obtain the sixth transformation row; shifting the lower shift row to the right by one column to obtain the seventh transformation row, constructing the eighth transformation row identical to the lower shift row, and shifting the lower shift row to the left by one column to obtain the ninth transformation row.

[0132] Specifically, the computer device may shift the upper shifted row to the right by one column to obtain a first transformed row, the first transformed row including the 1st column, the 2nd column, the jth column, ..., the L-1th column corresponding to the upper shifted row, that is, the first transformed row includes the L-1th column;

[0133] The computer device may construct a second transformed row identical to the upper shifted row, the second transformed row including the 1st column, the 2nd column, the jth column, ..., the Lth column corresponding to the upper shifted row;

[0134] The computer device may shift the upper shifted row to the left by one column to obtain a third transformed row, the third transformed row including the second column, the third column, the jth column, ..., the Lth column corresponding to the upper shifted row, that is, the third transformed row includes L-1 columns;

[0135] The computer device may shift the center shift row to the right by one column to obtain a fourth transformation row, the fourth transformation row including the 1st column, the 2nd column, the jth column, ..., the L-1th column corresponding to the center shift row, that is, the fourth transformation row includes the L-1 column;

[0136] The computer device may construct a fifth transformed row that is identical to the center shifted row, the fifth transformed row including the 1st column, the 2nd column, the jth column, ..., the Lth column corresponding to the center shifted row;

[0137] The computer device may shift the center shift row to the left by one column to obtain a sixth transformation row, the sixth transformation row including the second column, the third column, the jth column, ..., the Lth column corresponding to the center shift row, that is, the sixth transformation row includes L-1 columns;

[0138] The computer device may shift the down-shifted row to the right by one column to obtain a seventh transformed row, the seventh transformed row including the 1st column, the 2nd column, the jth column, ..., the L-1th column corresponding to the down-shifted row, that is, the seventh transformed row includes the L-1th column;

[0139] The computer device may construct an eighth transformed row that is identical to the down-shifted row, the eighth transformed row including the 1st column, the 2nd column, the jth column, ..., the Lth column corresponding to the down-shifted row;

[0140] The computer device may shift the down-shifted row to the left by one column to obtain a ninth transformed row, which includes the 2nd column, the 3rd column, the jth column, ..., the Lth column corresponding to the down-shifted row, that is, the ninth transformed row includes L-1 columns.

[0141] The computer device can determine the coordinates of N neighborhood points in the neighborhood search matrix through M transformation rows, where N is a positive integer less than or equal to M. For example, if the business demand is to perform a 4-neighborhood search, the 4 neighborhoods may refer to the positional relationship of the upper, left, right and lower directions around the center point. Then, the computer device can determine the coordinates of 5 neighborhood points (which may be upper neighborhood points, left neighborhood points, right neighborhood points, lower neighborhood points and central neighborhood points) in the neighborhood search matrix in 9 transformation rows. If the business demand is to perform an 8-neighborhood search, the 8 neighborhoods may refer to the positional relationship of the upper left, left, lower left, upper, lower, upper right, right and lower right directions around the center point. Then, the computer device can determine the coordinates of 9 neighborhood points (which may be upper neighborhood points, left neighborhood points, right neighborhood points, lower neighborhood points and central neighborhood points) in the neighborhood search matrix in 9 transformation rows. N can be determined by business demand, or it can be the same as the number of neighborhoods when the connected domain is marked, and the embodiment of the present application is not limited here.

[0142] The specific process of the computer device determining the coordinates of the neighborhood points in the neighborhood search matrix can be: determining the upper orientation neighborhood points and the coordinates of the upper orientation neighborhood points through the first transformation row, the second transformation row and the third transformation row; the upper orientation neighborhood points include the upper left neighborhood, the upper neighborhood and the upper right neighborhood; determining the center orientation neighborhood points and the coordinates of the center orientation neighborhood points through the fourth transformation row, the fifth transformation row and the sixth transformation row; the center orientation neighborhood points include the left neighborhood, the center neighborhood and the right neighborhood; determining the lower orientation neighborhood points and the coordinates of the lower orientation neighborhood points through the seventh transformation row, the eighth transformation row and the ninth transformation row; the lower orientation neighborhood points include the lower left neighborhood, the lower neighborhood and the lower right neighborhood.

[0143] Specifically, the computer device can determine the upper orientation neighbor point and the coordinates of the upper orientation neighbor point by using the transformation row obtained by performing column shifting on the upper shift row, determine the center orientation neighbor point and the coordinates of the center orientation neighbor point by using the transformation row obtained by performing column shifting on the center shift row, and determine the lower orientation neighbor point and the coordinates of the lower orientation neighbor point by using the transformation row obtained by performing column shifting on the lower shift row.

[0144] Among them, the process of the computer device determining the upper neighbor point can be: determining the j-th column of the first transformation row as the upper left neighbor point, and determining the column number of the j-th column and the row number of the first transformation row as the coordinates of the upper left neighbor point; determining the j-th column of the second transformation row as the upper neighbor point, and determining the column number of the j-th column and the row number of the second transformation row as the coordinates of the upper neighbor point; determining the j-th column of the third transformation row as the upper right neighbor point, and determining the column number of the j-th column and the row number of the third transformation row as the coordinates of the upper right neighbor point.

[0145] Specifically, the computer device can determine the j-th column of the first transformed row as the upper-left neighbor point, determine the j-1-th column of the neighborhood search matrix corresponding to the upper-left neighbor point as the column number, determine the i-1-th row of the neighborhood search matrix corresponding to the first transformed row or the upper-left neighbor point as the row number, and determine the coordinates of the upper-left neighbor point through the row number and the column number. The coordinates of the upper-left neighbor point can be expressed as (i-1, j-1), and the upper-left neighbor point can represent the upper-left neighborhood of the initial contour point.

[0146] The computer device can determine the j-th column of the second transformed row as the upper neighbor point, determine the j-th column of the neighborhood search matrix corresponding to the upper neighbor point as the column number, determine the i-1-th row of the neighborhood search matrix corresponding to the second transformed row or the upper neighbor point as the row number, and determine the coordinates of the upper neighbor point through the row number and the column number. The coordinates of the upper neighbor point can be expressed as (i-1, j), and the upper neighbor point can represent the upper neighborhood of the initial contour point.

[0147] The computer device can determine the j-th column of the third transformed row as the upper right neighbor point, determine the j+1-th column of the neighborhood search matrix corresponding to the upper right neighbor point as the column number, determine the i-1-th row of the neighborhood search matrix corresponding to the third transformed row or the upper right neighbor point as the row number, and determine the coordinates of the upper right neighbor point through the row number and the column number. The coordinates of the upper right neighbor point can be expressed as (i-1, j+1), and the upper right neighbor point can represent the upper right neighborhood of the initial contour point.

[0148] Among them, the process of the computer device determining the central orientation neighborhood point can be: determining the j-th column of the fourth transformed row as the left neighbor point, and determining the column number of the j-th column and the row number of the fourth transformed row as the coordinates of the left neighbor point; determining the j-th column of the fifth transformed row as the central neighborhood point, and determining the column number of the j-th column and the row number of the fifth transformed row as the coordinates of the central neighborhood point; determining the j-th column of the sixth transformed row as the right neighbor point, and determining the column number of the j-th column and the row number of the sixth transformed row as the coordinates of the right neighbor point.

[0149] Specifically, the computer device can determine the j-th column of the fourth transformed row as the left neighbor point, determine the j-1-th column of the neighborhood search matrix corresponding to the left neighbor point as the column number, determine the i-th row of the neighborhood search matrix corresponding to the fourth transformed row or the left neighbor point as the row number, and determine the coordinates of the left neighbor point through the row number and the column number. The coordinates of the left neighbor point can be expressed as (i, j-1), and the left neighbor point can represent the left neighborhood of the initial contour point.

[0150] The computer device can determine the j-th column of the fifth transformed row as the central neighborhood point, determine the j-th column of the neighborhood search matrix corresponding to the central neighborhood point as the column number, determine the i-th row of the neighborhood search matrix corresponding to the fifth transformed row or the central neighborhood point as the row number, and determine the coordinates of the central neighborhood point through the row number and the column number. The coordinates of the central neighborhood point can be expressed as (i, j), and the central neighborhood point can represent the central neighborhood of the initial contour point.

[0151] The computer device can determine the j-th column of the sixth transformed row as the right neighbor point, determine the j+1-th column of the neighborhood search matrix corresponding to the right neighbor point as the column number, determine the i-th row of the neighborhood search matrix corresponding to the sixth transformed row or the right neighbor point as the row number, and determine the coordinates of the right neighbor point through the row number and the column number. The coordinates of the right neighbor point can be expressed as (i, j+1), and the right neighbor point can represent the right neighborhood of the initial contour point.

[0152] Among them, the process of the computer device determining the right-hand neighbor point can be: determining the j-th column of the seventh transformation row as the lower-left neighbor point, and determining the column number of the j-th column and the row number of the seventh transformation row as the coordinates of the lower-left neighbor point; determining the j-th column of the eighth transformation row as the lower neighbor point, and determining the column number of the j-th column and the row number of the eighth transformation row as the coordinates of the lower neighbor point; determining the j-th column of the ninth transformation row as the lower-right neighbor point, and determining the column number of the j-th column and the row number of the ninth transformation row as the coordinates of the lower-right neighbor point.

[0153] Specifically, the computer device can determine the j-th column of the seventh transformation row as the lower-left neighborhood point, determine the j-1-th column of the neighborhood search matrix corresponding to the lower-left neighborhood point as the column number, determine the i+1-th row of the neighborhood search matrix corresponding to the seventh transformation row or the lower-left neighborhood point as the row number, and determine the coordinates of the lower-left neighborhood point through the row number and the column number. The coordinates of the lower-left neighborhood point can be expressed as (i+1, j-1), and the lower-left neighborhood point can represent the lower-left neighborhood of the initial contour point.

[0154] The computer device can determine the j-th column of the eighth transformed row as the lower neighborhood point, determine the j-th column of the neighborhood search matrix corresponding to the lower neighborhood point as the column number, determine the i-th row of the neighborhood search matrix corresponding to the eighth transformed row or the lower neighborhood point as the row number, and determine the coordinates of the lower neighborhood point through the row number and the column number. The coordinates of the lower neighborhood point can be expressed as (i+1, j), and the lower neighborhood point can represent the lower neighborhood of the initial contour point.

[0155] The computer device can determine the j-th column of the ninth transformed row as the lower-right neighborhood point, determine the j+1-th column of the neighborhood search matrix corresponding to the lower-right neighborhood point as the column number, determine the i+1-th row of the neighborhood search matrix corresponding to the ninth transformed row or the lower-right neighborhood point as the row number, and determine the coordinates of the lower-right neighborhood point through the row number and the column number. The coordinates of the lower-right neighborhood point can be expressed as (i+1, j+1), and the lower-right neighborhood point can represent the lower-right neighborhood of the initial contour point.

[0156] The computer device can determine the neighborhood point having a business contour relationship with the initial contour point (also referred to as the central neighborhood point) among the above neighborhood points through the coordinates of the upper left neighborhood point, the upper neighborhood point, the upper right neighborhood point, the left neighborhood point, the right neighborhood point, the lower left neighborhood point, the lower neighborhood point, and the lower right neighborhood point in the neighborhood search matrix as the target contour point. The target contour point is also a pixel point representing the image contour in the target image. The computer device can continue to perform the above steps S101 to S103 through the neighborhood search matrix corresponding to the target contour point, and continue to traverse and determine the next target contour point until the pixel points representing the image contour in the target image are traversed (or until the pixel points representing the image contour have been traversed and determined as the target contour point or the initial contour point).

[0157] The computer device can determine the initial contour points and the target contour points as the image contour in the target image, and complete the image contour processing of the business image.

[0158] It should be understood that the directions such as "upper left", "upper", "upper right", and the representation of coordinates such as "(i-1, j)", "(i, j)", "(i+1, j)" in the embodiments of the present application may change due to differences in coordinate systems and relative positional relationships. In the "i-th row" and "j-th column", changes may also occur due to different ordinal numbers. The embodiments of the present application are not limited here.

[0159] It can be understood that the N-neighborhood search (such as 8-neighborhood search, 4-neighborhood search) performed by computer equipment can be applied to the circuit control method of chips (chips used for computer system operations, control, information processing, and program running). By dividing the neighborhood in the circuit and using the N-neighborhood search algorithm for optimization, the circuit performance of the chip can be improved.

[0160] In the embodiment of the present application, pixel data corresponding to the target image is input into a search acceleration engine in a processor, and a neighborhood search matrix corresponding to an initial contour point in the pixel data is obtained in the search acceleration engine; the initial contour point is a pixel point in the target image that represents the image contour, and the neighborhood search matrix is ​​a matrix with the initial contour point as the center point; the neighborhood search matrix is ​​row-shifted to obtain an up-conversion matrix, a center-conversion matrix, and a down-conversion matrix corresponding to the neighborhood search matrix, and an up-shift row is determined in the up-conversion matrix, a center-shift row is determined in the center-conversion matrix, and a down-conversion matrix is ​​obtained. The method comprises the following steps: determining a down-shifted row in the matrix; performing column shifting on the up-shifted row, the center-shifted row and the down-shifted row respectively to obtain M transformed rows, determining the coordinates of N neighborhood points in the neighborhood search matrix through the M transformed rows, determining the neighborhood points having a business contour relationship with the initial contour points among the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuing to traverse new target contour points through the neighborhood search matrix corresponding to the target contour points until all the pixel points representing the image contour in the target image are traversed; M and N are positive integers, and N is less than or equal to M. It can be seen that the embodiment of the present application can generate a neighborhood search matrix after determining the initial contour point. The dimension of the neighborhood search matrix is ​​much smaller than the pixel dimension of the entire image, thereby reducing the amount of calculation of the chip for neighborhood search. By transforming the rows and columns where the initial contour points are located, the neighborhood points in various directions are obtained, which can reduce the decoding steps of calculating the coordinate data of the neighborhood points and improve the performance of the neighborhood search circuit in the chip. Among the neighborhood points in various directions obtained by the row and column transformation, all neighborhood directions on the plane are covered, which allows the neighborhood search circuit to be used in different neighborhood requirements.

[0161] See also Figure 6 , Figure 6 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 4 The data processing method may be executed by a computer device, which may include Figure 1The terminal device shown (which may be terminal device 200a, terminal device 200b, ..., terminal device 200n) or service server 100. Figure 6 As shown, the method may include:

[0162] Step S201, obtain a business image, and among the pixels of the business image, determine the pixels whose grayscale values ​​are greater than or equal to the business grayscale threshold as white pixels, and determine the pixels whose grayscale values ​​are less than the business grayscale threshold as black pixels; set the grayscale values ​​of the white pixels to the first grayscale value, and set the grayscale values ​​of the black pixels to the second grayscale value, to obtain a grayscale image consisting of white pixels and black pixels.

[0163] Specifically, the computer device can obtain a business image, and through the business grayscale threshold, determine the pixel points whose grayscale value is greater than or equal to the business grayscale threshold as white pixels, and set the grayscale value of the white pixels to a first grayscale value, which can be a grayscale value of 255.

[0164] The computer device may determine a pixel whose grayscale value is less than the business grayscale threshold as a black pixel, and set the grayscale value of the black pixel to a second grayscale value, where the second grayscale value may be a grayscale value of 0, to obtain a grayscale image composed of white pixels and black pixels. The business grayscale threshold may be set according to business requirements or specific business images, and the embodiments of the present application are not limited thereto.

[0165] Step S202, randomly determine a seed pixel point among the pixels of the grayscale image, and among the adjacent pixels of the seed pixel point, mark the adjacent pixel points that meet the connectivity threshold condition with the seed pixel point as new seed pixel points, until all the pixels in the grayscale image are traversed, and the seed pixel points with the same mark are determined as the same connected domain; continue to determine new connected domains among the unmarked pixels in the grayscale image until all the pixels in the grayscale image are marked, and obtain the target image.

[0166] Specifically, the computer device can obtain a grayscale image of the business image, randomly determine a seed pixel in the grayscale image, and mark the adjacent pixel points that meet the connectivity threshold condition with the seed pixel point as new seed pixels among the adjacent pixel points of the seed pixel point. The connectivity threshold condition can be that the grayscale values ​​of the two pixels are the same, which is not limited in the embodiments of the present application.

[0167] The computer device can continue to traverse the adjacent pixels that meet the connectivity threshold condition among the adjacent pixels of the new seed pixel and make the same mark until all the adjacent pixels of the seed pixel are traversed, or when the grayscale values ​​of the adjacent pixels are all different, the pixels with the same mark are determined as a connected domain.

[0168] The computer device can continue to determine another seed pixel point among the unlabeled pixels, and obtain another new connected domain with a different label through the above method, until all the pixels in the grayscale image have the label of the connected domain, and obtain a target image composed of several connected domains.

[0169] Step S203, randomly determine an initial connected domain in the target image in the search acceleration engine, randomly determine an initial pixel point in the initial connected domain, if there is at least one adjacent pixel point with a different label from the initial connected domain among the N adjacent pixel points of the initial pixel point, then the adjacent pixel point with a different label from the initial connected domain is determined as the initial contour point, otherwise the initial pixel point is re-determined; N is a positive integer; based on the initial contour point, the connected domain corresponding to the adjacent pixel point with a different label from the initial connected domain, and the initial connected domain, determine the neighborhood search matrix corresponding to the initial contour point.

[0170] Specifically, the computer device may randomly determine an initial connected domain in the target image in the search acceleration engine, and randomly determine an initial pixel point in the initial connected domain. Taking the 8-neighborhood search as an example, the 8-neighborhood may refer to the positional relationship in 8 directions of upper left, left, lower left, upper, lower, upper right, right and lower right around the center point.

[0171] The computer device can determine 8 adjacent pixels adjacent to the initial pixel, and the 8 adjacent pixels can respectively represent the positional relationship in 8 directions of upper left, left, lower left, upper, lower, upper right, right and lower right around the initial pixel.

[0172] If there is at least one neighboring pixel point with a different label from the initial connected domain among the 8 neighboring pixel points of the initial pixel point, the computer device can determine the neighboring pixel point with a different label from the initial connected domain as the initial contour point. The initial contour point can be a pixel point representing the image contour in the target image, and the method for determining the initial contour point can be to determine the boundary point of the connected domain as the initial contour point in the above method, or to determine it according to business needs, which is not limited in the embodiments of the present application.

[0173] If the labels of the eight neighboring pixels of the initial pixel are all the initial connected domains, the computer device can re-determine the initial pixel.

[0174] The computer device can determine the neighborhood search matrix corresponding to the initial contour point through the initial contour point, the dimension size of the connected domain corresponding to the adjacent pixel points with different marks from the initial connected domain (i.e., another connected domain adjacent to the initial pixel point), and the dimension size of the initial connected domain. The neighborhood search matrix can be a matrix centered on the initial contour point and including K rows and L columns of pixel points, where K and L are positive integers, and K and L can be determined by the size of the connected domain where the initial contour point is located. The embodiment of the present application does not limit the method for determining K and L.

[0175] Step S204, performing row shifting on the neighborhood search matrix to obtain an up-conversion matrix, a center conversion matrix, and a down-conversion matrix corresponding to the neighborhood search matrix, determining an up-shifted row in the up-conversion matrix, determining a center-shifted row in the center conversion matrix, and determining a down-shifted row in the down-conversion matrix;

[0176] For details, please refer to the above Figure 3 The description of the row shift in S102 in the corresponding embodiment will not be repeated here.

[0177] Step S205, respectively perform column shift on the upper shift row, the center shift row and the lower shift row to obtain M transformation rows, determine the coordinates of N neighborhood points in the neighborhood search matrix through the M transformation rows, and based on the coordinates of the N neighborhood points in the neighborhood search matrix, determine the neighborhood points among the N neighborhood points that have a business contour relationship with the initial contour point as the target contour point, and continue to traverse new target contour points through the neighborhood search matrix corresponding to the target contour point until all the pixel points representing the image contour in the target image are traversed; M and N are positive integers, and N is less than or equal to M.

[0178] Specifically, the computer device performs column shifting to obtain the neighborhood points and the coordinates of the neighborhood points in the neighborhood search matrix can be found in the above Figure 3 The specific description of S103 in the corresponding embodiment will not be repeated here.

[0179] The process by which a computer device determines a neighborhood point having a business contour relationship with an initial contour point as a target contour point can be: based on the coordinates of the N neighborhood points in a neighborhood search matrix, determining a traversal order of the N neighborhood points; obtaining the grayscale values ​​of the N neighborhood points, and based on the traversal order of the N neighborhood points, determining the neighborhood point that is traversed first and has the same grayscale value as the initial contour point as the target contour point.

[0180] Specifically, the computer device can determine the grayscale values ​​corresponding to the neighborhood points and the relative position relationship between the neighborhood points and the initial contour points through the coordinates of the neighborhood points in the neighborhood search matrix.

[0181] The computer device can determine the traversal order of N neighborhood points through the relative position relationship between the neighborhood points and the initial contour points, that is, determine the first neighborhood point for neighborhood search and the search direction of subsequent traversal cycles, such as forward search or reverse search.

[0182] The computer device can determine the first neighborhood point traversed among the N neighborhood points and having the same grayscale value as the initial contour point as the target contour point, and the target contour point is also a pixel point representing the image contour in the target image. The computer device can also determine the point having a business contour relationship with the initial contour point as the target contour point by other means, and the business contour relationship can be determined by business needs, which is not limited in the embodiments of the present application.

[0183] The computer device can continue to execute the above steps through the neighborhood search matrix corresponding to the target contour point, and continue to traverse to determine the next target contour point until all the pixel points representing the image contour in the target image are traversed (or until the pixel points representing the image contour have been traversed and have been determined as target contour points or initial contour points).

[0184] The computer device can determine the initial contour points and the target contour points as the image contour in the target image, and complete the image contour processing of the business image.

[0185] It can be understood that the N-neighborhood search (such as 8-neighborhood search, 4-neighborhood search) performed by computer equipment can be applied to the circuit control method of chips (chips used for computer system operations, control, information processing, and program running). By dividing the neighborhood in the circuit and using the N-neighborhood search algorithm for optimization, the circuit performance of the chip can be improved.

[0186] The embodiment of the present application obtains a business image, and among the pixels of the business image, the pixels whose grayscale values ​​are greater than or equal to the business grayscale threshold are determined as white pixels, and the pixels whose grayscale values ​​are less than the business grayscale threshold are determined as black pixels; the grayscale values ​​of the white pixels are set to the first grayscale value, and the grayscale values ​​of the black pixels are set to the second grayscale value, so as to obtain a grayscale image composed of white pixels and black pixels. The seed pixels are randomly determined among the pixels of the grayscale image, and among the adjacent pixels of the seed pixels, the adjacent pixels that meet the connectivity threshold condition with the seed pixels are marked as new seed pixels, until the pixels in the grayscale image are traversed, and the seed pixels with the same mark are determined as the same connected domain; the new connected domains are continuously determined among the unmarked pixels in the grayscale image, until all the pixels in the grayscale image are marked, and the target image is obtained. An initial connected domain in a target image is randomly determined in a search acceleration engine, and an initial pixel point is randomly determined in the initial connected domain. If there is at least one adjacent pixel point with a different label from the initial connected domain among the N adjacent pixel points of the initial pixel point, the adjacent pixel point with a label different from the initial connected domain is determined as an initial contour point, otherwise the initial pixel point is re-determined; N is a positive integer; based on the initial contour point, the connected domain corresponding to the adjacent pixel point with a label different from the initial connected domain, and the initial connected domain, a neighborhood search matrix corresponding to the initial contour point is determined. Perform row shift on the neighborhood search matrix to obtain an up-conversion matrix, a center conversion matrix and a down-conversion matrix corresponding to the neighborhood search matrix, determine the up-shift row in the up-conversion matrix, determine the center-shift row in the center conversion matrix, and determine the down-shift row in the down-conversion matrix; perform column shift on the up-shift row, the center-shift row and the down-shift row respectively to obtain M transformation rows, determine the coordinates of N neighborhood points in the neighborhood search matrix through the M transformation rows, determine the neighborhood points of the N neighborhood points that have a business contour relationship with the initial contour point as the target contour point based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continue to traverse new target contour points through the neighborhood search matrix corresponding to the target contour point until all the pixel points representing the image contour in the target image are traversed; M and N are positive integers, and N is less than or equal to M. It can be seen that the embodiment of the present application can generate a neighborhood search matrix after determining the initial contour point. The dimension of the neighborhood search matrix is ​​much smaller than the pixel dimension of the entire image, thereby reducing the amount of calculation of the chip for neighborhood search. By transforming the rows and columns where the initial contour points are located, the neighborhood points in various directions are obtained, which can reduce the decoding steps of calculating the coordinate data of the neighborhood points and improve the performance of the neighborhood search circuit in the chip. Among the neighborhood points in various directions obtained by the row and column transformation, all neighborhood directions on the plane are covered, which allows the neighborhood search circuit to be used in different neighborhood requirements.

[0187] See also Figure 7 , Figure 7 This is a flow diagram of a data processing method provided in an embodiment of the present application. Figure 5 The data processing method may be executed by a computer device, which may include Figure 1 The terminal device shown (which may be terminal device 200a, terminal device 200b, ..., terminal device 200n) or service server 100. Figure 7 As shown, the method may include:

[0188] The computer device can input the business image into the task scheduling engine, and the task scheduling engine can split the task, for example, the business image can be split into image regions, and the task scheduling engine can load balance by the number of other engines, and allocate the split image regions to multiple binarization engines, search acceleration engines, etc. for parallel processing. The embodiment of the present application does not limit the way of splitting the business image.

[0189] The computer device can input the business image into the binarization engine, and the binarization engine can perform binarization processing on the business image to obtain a grayscale image of the business image. The content of the binarization processing can be referred to above. Figure 6 The specific description of S201 in the corresponding embodiment will not be repeated here.

[0190] The computer device can use the connected domain marking engine to mark the grayscale image obtained by binary processing to obtain the target image. The content of the connected domain marking can be found in the above Figure 6 The specific description of S202 in the corresponding embodiment will not be repeated here.

[0191] The computer device can input the target image into the search acceleration engine, perform a neighborhood search on the target image, and obtain the image contour in the target image. The content of the neighborhood search can be found in the above Figure 3 The specific description of S101 to S103 in the corresponding embodiment will not be repeated here.

[0192] The computer device can post-process the image contours in the target image through a post-processing engine. The post-processing may include screening, merging, sorting and packaging. Screening can be to filter out image contours required for business from multiple image contours in the target image. Merging can be to classify image contours that meet certain business conditions, such as size and resolution. Sorting can sort the merged business contours according to business conditions such as size and resolution. Packaging is to package the output results of the image contours so that users can call them in an easier way.

[0193] Among them, the task scheduling engine, binarization engine, search acceleration engine and post-processing engine can all be components in a computer device for performing neighborhood search on a target image, or can be a hardware unit of a chip in a neighborhood search circuit.

[0194] It can be understood that the N-neighborhood search (such as 8-neighborhood search, 4-neighborhood search) performed by computer equipment can be applied to the circuit control method of chips (chips used for computer system operations, control, information processing, and program running). By dividing the neighborhood in the circuit and using the N-neighborhood search algorithm for optimization, the circuit performance of the chip can be improved.

[0195] See also Figure 8 , Figure 8 Schematic diagram of a data processing device provided in an embodiment of the present application. Figure 8 As shown, the data processing device 1 includes an initial processing module 800, a row shift module 810, a neighborhood processing module 820 and a binarization processing module 860. The initial processing module 800 may include an initial contour determination unit 801 and an initial matrix determination unit 802, the row shift module 810 includes a first matrix transformation unit 811, a second matrix transformation unit 812 and a third matrix transformation unit 813, the neighborhood processing module 820 includes a first row transformation unit 821, a second row transformation unit 822, a third row transformation unit 823, an upper orientation transformation unit 830, a center orientation transformation unit 840 and a lower orientation transformation unit 850, and the binarization processing module 860 includes a seed determination unit 861 and a connected domain marking unit 862. Among them, the upper orientation transformation unit 830 includes a first neighborhood determination subunit 831, a second neighborhood determination subunit 832 and a third neighborhood determination subunit 833, the central orientation transformation unit 840 includes a fourth neighborhood determination subunit 841, a fifth neighborhood determination subunit 842 and a sixth neighborhood determination subunit 843, and the lower orientation transformation unit 850 includes a seventh neighborhood determination subunit 851, an eighth neighborhood determination subunit 852 and a ninth neighborhood determination subunit 853.

[0196] The initial processing module 800 is used to input the pixel data corresponding to the target image into the search acceleration engine in the processor, and obtain the neighborhood search matrix corresponding to the initial contour point in the pixel data in the search acceleration engine; the initial contour point is a pixel point representing the image contour in the target image, and the neighborhood search matrix is ​​a matrix with the initial contour point as the center point;

[0197] The initial contour determining unit 801 is used to randomly determine an initial connected domain in the target image in the search acceleration engine, and randomly determine an initial pixel point in the initial connected domain. If there is at least one adjacent pixel point with a different label from the initial connected domain among the N adjacent pixel points of the initial pixel point, the adjacent pixel point with a different label from the initial connected domain is determined as an initial contour point, otherwise the initial pixel point is re-determined; N is a positive integer;

[0198] The initial matrix determining unit 802 is used to determine a neighborhood search matrix corresponding to the initial contour point based on the initial contour point, the connected domain corresponding to the adjacent pixel points having different labels from the initial connected domain, and the initial connected domain.

[0199] A row shift module 810 is used to perform row shift on the neighborhood search matrix to obtain an up-conversion matrix, a center conversion matrix and a down-conversion matrix corresponding to the neighborhood search matrix, determine an up-shift row in the up-conversion matrix, determine a center-shift row in the center conversion matrix, and determine a down-shift row in the down-conversion matrix;

[0200] The first matrix transformation unit 811 is used to shift the K rows of the neighborhood search matrix upward by one row to obtain an up-transformation matrix, and determine the i+1th row in the up-transformation matrix as the up-shifted row; the up-transformation matrix is ​​a matrix of K-1 rows and L columns of pixels;

[0201] A second matrix transformation unit 812 is used to construct a center transformation matrix that is the same as the neighborhood search matrix, and determine the i-th row in the center transformation matrix as the center shift row;

[0202] The third matrix transformation unit 813 is used to shift the K rows of the neighborhood search matrix downward by one row to obtain a down-transformation matrix, and determine the i-1th row in the down-transformation matrix as the down-shifted row; the down-transformation matrix is ​​a matrix of K-1 rows and L columns of pixels.

[0203] The neighborhood processing module 820 is used to perform column shifting on the upper shift row, the center shift row and the lower shift row respectively to obtain M transformation rows, determine the coordinates of N neighborhood points in the neighborhood search matrix through the M transformation rows, and based on the coordinates of the N neighborhood points in the neighborhood search matrix, determine the neighborhood points among the N neighborhood points that have a business contour relationship with the initial contour point as the target contour point, and continue to traverse new target contour points through the neighborhood search matrix corresponding to the target contour point until the pixel points representing the image contour in the target image are traversed; M and N are positive integers, and N is less than or equal to M.

[0204] The neighborhood processing module 820 is specifically used to determine the traversal order of the N neighborhood points based on the coordinates of the N neighborhood points in the neighborhood search matrix; obtain the grayscale values ​​of the N neighborhood points, and based on the traversal order of the N neighborhood points, determine the neighborhood point that is traversed first and has the same grayscale value as the initial contour point as the target contour point.

[0205] A first row transformation unit 821 is used to shift the upper shifted row to the right by one column to obtain a first transformed row, construct a second transformed row that is the same as the upper shifted row, and shift the upper shifted row to the left by one column to obtain a third transformed row;

[0206] The second row transformation unit 822 is used to shift the center shift row to the right by one column to obtain a fourth transformed row, construct a fifth transformed row with the same center shift, and shift the center shift row to the left by one column to obtain a sixth transformed row;

[0207] The third row transform unit 823 is used to shift the down-shifted row rightward by one column to obtain a seventh transform row, construct an eighth transform row identical to the down-shifted row, and shift the down-shifted row leftward by one column to obtain a ninth transform row.

[0208] An upper position transformation unit 830 is used to determine an upper position neighbor point and the coordinates of the upper position neighbor point through the first transformation line, the second transformation line and the third transformation line; the upper position neighbor point includes an upper left neighbor point, an upper neighbor point and an upper right neighbor point;

[0209] A first neighborhood determination subunit 831 is used to determine the j-th column of the first transformed row as the upper left neighborhood point, and determine the column number of the j-th column and the row number of the first transformed row as the coordinates of the upper left neighborhood point;

[0210] A second neighborhood determination subunit 832 is used to determine the j-th column of the second transformed row as an upper neighborhood point, and determine the column number of the j-th column and the row number of the second transformed row as coordinates of the upper neighborhood point;

[0211] The third neighborhood determination subunit 833 is used to determine the jth column of the third transformed row as the upper right neighborhood point, and determine the column number of the jth column and the row number of the third transformed row as the coordinates of the upper right neighborhood point.

[0212] The center orientation transformation unit 840 is used to determine the center orientation neighborhood point and the coordinates of the center orientation neighborhood point through the fourth transformation line, the fifth transformation line and the sixth transformation line; the center orientation neighborhood point includes a left neighborhood point, a center neighborhood point and a right neighborhood point;

[0213] The fourth neighborhood determination subunit 841 is used to determine the j-th column of the fourth transformed row as the left neighborhood point, and determine the column number of the j-th column and the row number of the fourth transformed row as the coordinates of the left neighborhood point;

[0214] A fifth neighborhood determination subunit 842 is used to determine the j-th column of the fifth transformed row as the central neighborhood point, and determine the column number of the j-th column and the row number of the fifth transformed row as the coordinates of the central neighborhood point;

[0215] The sixth neighborhood determination subunit 843 is used to determine the j-th column of the sixth transformed row as the right neighborhood point, and determine the column number of the j-th column and the row number of the sixth transformed row as the coordinates of the right neighborhood point.

[0216] The lower position transformation unit 850 is used to determine the lower position neighboring points and the coordinates of the lower position neighboring points through the seventh transformation line, the eighth transformation line and the ninth transformation line; the lower position neighboring points include the lower left neighboring point, the lower neighboring point and the lower right neighboring point.

[0217] The seventh neighborhood determination subunit 851 is used to determine the j-th column of the seventh transformed row as the lower left neighborhood point, and determine the column number of the j-th column and the row number of the seventh transformed row as the coordinates of the lower left neighborhood point;

[0218] An eighth neighborhood determination subunit 852, configured to determine the j-th column of the eighth transformed row as a lower neighborhood point, and determine the column number of the j-th column and the row number of the eighth transformed row as coordinates of the lower neighborhood point;

[0219] The ninth neighborhood determination subunit 853 is used to determine the jth column of the ninth transformed row as the lower right neighborhood point, and determine the column number of the jth column and the row number of the ninth transformed row as the coordinates of the lower right neighborhood point.

[0220] A binarization processing module 860 is used to obtain a business image, and among the pixels of the business image, determine the pixels whose grayscale values ​​are greater than or equal to the business grayscale threshold as white pixels, and determine the pixels whose grayscale values ​​are less than the business grayscale threshold as black pixels;

[0221] The binarization processing module 860 is also used to set the grayscale value of the white pixel to the first grayscale value and the grayscale value of the black pixel to the second grayscale value, to obtain a grayscale image composed of white pixels and black pixels, to mark the connected domain of the grayscale image, and to obtain a target image.

[0222] The seed determination unit 861 is used to randomly determine a seed pixel point among the pixels of the grayscale image, and mark the adjacent pixel points that meet the connectivity threshold condition with the seed pixel point as new seed pixels among the adjacent pixel points of the seed pixel point, until all the pixels in the grayscale image are traversed, and the seed pixels with the same mark are determined as the same connected domain;

[0223] The connected domain marking unit 862 is used to continue to determine new connected domains in the unmarked pixels in the grayscale image until all the pixels in the grayscale image are marked, thereby obtaining a target image.

[0224] See also Fig. 9 , Fig. 9 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig. 9As shown, the computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Fig. 9 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.

[0225] In such Fig. 9 In the computer device 1000 shown, the network interface 1004 can provide a network communication network element; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:

[0226] Inputting pixel data corresponding to the target image into a search acceleration engine in the processor, obtaining a neighborhood search matrix corresponding to an initial contour point in the pixel data in the search acceleration engine; the initial contour point is a pixel point in the target image that represents the image contour, and the neighborhood search matrix is ​​a matrix with the initial contour point as the center point;

[0227] Performing row shift on the neighborhood search matrix to obtain an up-conversion matrix, a center conversion matrix and a down-conversion matrix corresponding to the neighborhood search matrix, determining an up-shift row in the up-conversion matrix, determining a center-shift row in the center conversion matrix, and determining a down-shift row in the down-conversion matrix;

[0228] The upper shift row, the center shift row and the lower shift row are respectively shifted by columns to obtain M transformation rows, and the coordinates of N neighborhood points in the neighborhood search matrix are determined through the M transformation rows. Based on the coordinates of the N neighborhood points in the neighborhood search matrix, the neighborhood points having a business contour relationship with the initial contour point among the N neighborhood points are determined as target contour points, and new target contour points are continuously traversed through the neighborhood search matrix corresponding to the target contour point until all the pixel points representing the image contour in the target image are traversed; M and N are positive integers, and N is less than or equal to M.

[0229] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the above Figure 3 and Figure 6 The description of the data processing method in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here.

[0230] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program, and when the processor executes the computer program, it can execute the above Figure 3 and Figure 6 The description of the above data processing method in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0231] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the computer device. Further, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been displayed or is to be displayed.

[0232] In addition, it should be noted that: the embodiment of the present application also provides a computer program product, the computer program product includes a computer program, the computer program is stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above Figure 3 and Figure 6 A method provided by any corresponding embodiment.

[0233] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but optionally includes steps or modules that are not listed, or optionally includes other step units inherent to these processes, methods, devices, products, or equipment.

[0234] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of network elements in the above description. Whether these network elements are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described network elements for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0235] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A data processing method, characterized in that: include: Inputting pixel data corresponding to the target image into a search acceleration engine in a processor, and obtaining a neighborhood search matrix corresponding to an initial contour point in the pixel data in the search acceleration engine; the initial contour point is a pixel point in the target image that represents an image contour, and the neighborhood search matrix is ​​a matrix with the initial contour point as a center point; Performing row shifting on the neighborhood search matrix to obtain an up-conversion matrix, a center conversion matrix, and a down-conversion matrix corresponding to the neighborhood search matrix, determining an up-shift row in the up-conversion matrix, determining a center-shift row in the center conversion matrix, and determining a down-shift row in the down-conversion matrix; Shift the upper shifted row rightward by one column to obtain a first transformed row, construct a second transformed row identical to the upper shifted row, shift the upper shifted row leftward by one column to obtain a third transformed row; Shifting the center shift row to the right by one column to obtain a fourth transformed row, constructing a fifth transformed row identical to the center shift, and shifting the center shift row to the left by one column to obtain a sixth transformed row; Shifting the down-shifted row to the right by one column to obtain a seventh transformed row, constructing an eighth transformed row identical to the down-shifted row, and shifting the down-shifted row to the left by one column to obtain a ninth transformed row; The upper azimuth neighbor point and the coordinates of the upper azimuth neighbor point are determined by the first transformation row, the second transformation row and the third transformation row, the center azimuth neighbor point and the coordinates of the center azimuth neighbor point are determined by the fourth transformation row, the fifth transformation row and the sixth transformation row, and the lower azimuth neighbor point and the coordinates of the lower azimuth neighbor point are determined by the seventh transformation row, the eighth transformation row and the ninth transformation row; Based on the coordinates of N neighborhood points in the neighborhood search matrix, a neighborhood point among the N neighborhood points that has a business contour relationship with the initial contour point is determined as a target contour point, and new target contour points are continuously traversed through the neighborhood search matrix corresponding to the target contour point until all pixel points representing the image contour in the target image are traversed; M and N are positive integers, and N is less than or equal to M; wherein the N neighborhood points include the upper azimuth neighborhood point, the center azimuth neighborhood point, and the lower azimuth neighborhood point.

2. The method according to claim 1, characterized in that The neighborhood search matrix is ​​a matrix containing K rows and L columns of pixel points, the initial contour point is in the i-th row of the neighborhood search matrix, K, L and i are positive integers, the row shifting of the neighborhood search matrix is ​​performed to obtain an up-conversion matrix, a center transformation matrix and a down-conversion matrix corresponding to the neighborhood search matrix, and based on the initial contour point, an up-shifted row is determined in the up-conversion matrix, a center-shifted row is determined in the center transformation matrix, and a down-shifted row is determined in the down-conversion matrix, including: The K rows of the neighborhood search matrix are shifted upward by one row to obtain an up-conversion matrix, and the i-th row in the up-conversion matrix is ​​determined as an up-shifted row; the up-conversion matrix is ​​a matrix of pixels having K-1 rows and L columns; Constructing a center transformation matrix identical to the neighborhood search matrix, and determining the i-th row in the center transformation matrix as the center shift row; The K rows of the neighborhood search matrix are shifted downward by one row to obtain a down-conversion matrix, and the i-th row in the down-conversion matrix is ​​determined as the down-shifted row; the down-conversion matrix is ​​a matrix of pixels having K-1 rows and L columns.

3. The method according to claim 1, characterized in that The upper neighborhood points include an upper left neighborhood point, an upper neighborhood point, and an upper right neighborhood point; the initial contour point is in the jth column of the neighborhood search matrix, where j is a positive integer, and the upper neighborhood points and the coordinates of the upper neighborhood points are determined by the first transformation row, the second transformation row, and the third transformation row, including: Determine the jth column of the first transformed row as the upper left neighboring point, and determine the column number of the jth column and the row number of the first transformed row as the coordinates of the upper left neighboring point; Determine the j-th column of the second transformed row as the upper neighboring point, and determine the column number of the j-th column and the row number of the second transformed row as the coordinates of the upper neighboring point; The j-th column of the third transformed row is determined as the upper right neighboring point, and the column number of the j-th column and the row number of the third transformed row are determined as the coordinates of the upper right neighboring point.

4. The method according to claim 1, characterized in that: The center orientation neighborhood point includes a left neighborhood point, a center neighborhood point, and a right neighborhood point; the initial contour point is in the jth column of the neighborhood search matrix, where j is a positive integer, and the center orientation neighborhood point and the coordinates of the center orientation neighborhood point are determined by the fourth transformation row, the fifth transformation row, and the sixth transformation row, including: Determine the j-th column of the fourth transformed row as the left neighboring point, and determine the column number of the j-th column and the row number of the fourth transformed row as the coordinates of the left neighboring point; Determine the j-th column of the fifth transformed row as the central neighborhood point, and determine the column number of the j-th column and the row number of the fifth transformed row as the coordinates of the central neighborhood point; The j-th column of the sixth transformed row is determined as the right neighboring point, and the column number of the j-th column and the row number of the sixth transformed row are determined as the coordinates of the right neighboring point.

5. The method according to claim 1, characterized in that The lower position neighborhood points include a lower left neighborhood point, a lower neighborhood point, and a lower right neighborhood point; the initial contour point is in the jth column of the neighborhood search matrix, where j is a positive integer, and the lower position neighborhood points and the coordinates of the lower position neighborhood points are determined by the seventh transformation row, the eighth transformation row, and the ninth transformation row, including: Determine the j-th column of the seventh transformed row as the lower left neighboring point, and determine the column number of the j-th column and the row number of the seventh transformed row as the coordinates of the lower left neighboring point; Determine the j-th column of the eighth transformed row as a lower neighboring point, and determine the column number of the j-th column and the row number of the eighth transformed row as coordinates of the lower neighboring point; The j-th column of the ninth transformed row is determined as the lower right neighboring point, and the column number of the j-th column and the row number of the ninth transformed row are determined as the coordinates of the lower right neighboring point.

6. The method according to claim 1, characterized in that Also includes: Acquire a business image, and among the pixels of the business image, determine the pixels whose grayscale values ​​are greater than or equal to the business grayscale threshold as white pixels, and determine the pixels whose grayscale values ​​are less than the business grayscale threshold as black pixels; The grayscale value of the white pixel is set to a first grayscale value, and the grayscale value of the black pixel is set to a second grayscale value, to obtain a grayscale image composed of the white pixel and the black pixel, and to perform connected domain marking on the grayscale image to obtain a target image.

7. The method according to claim 6, characterized in that The step of marking the connected domain of the grayscale image to obtain a target image includes: A seed pixel is randomly determined from the pixels of the grayscale image, and among the adjacent pixels of the seed pixel, the adjacent pixels that meet the connectivity threshold condition with the seed pixel are marked as new seed pixels, until all the pixels in the grayscale image are traversed, and the seed pixels with the same mark are determined as the same connected domain; New connected domains are continuously determined in the unmarked pixels in the grayscale image until all the pixels in the grayscale image are marked, thereby obtaining a target image.

8. The method according to claim 1, characterized in that The step of inputting pixel data corresponding to the target image into a search acceleration engine in a processor, and obtaining a neighborhood search matrix corresponding to an initial contour point in the pixel data in the search acceleration engine, comprises: In the search acceleration engine, an initial connected domain in the target image is randomly determined, and an initial pixel point is randomly determined in the initial connected domain. If there is at least one adjacent pixel point with a different label from the initial connected domain among the N adjacent pixel points of the initial pixel point, the adjacent pixel point with a different label from the initial connected domain is determined as an initial contour point, otherwise the initial pixel point is re-determined; N is a positive integer; A neighborhood search matrix corresponding to the initial contour point is determined based on the initial contour point, a connected domain corresponding to adjacent pixels having different labels from the initial connected domain, and the initial connected domain.

9. The method according to claim 1, characterized in that: The determining, based on the coordinates of the N neighborhood points in the neighborhood search matrix, a neighborhood point having a service contour relationship with the initial contour point among the N neighborhood points as a target contour point comprises: Determine a traversal order of the N neighborhood points based on the coordinates of the N neighborhood points in the neighborhood search matrix; The grayscale values ​​of the N neighborhood points are obtained, and based on the traversal order of the N neighborhood points, the neighborhood point that is traversed first and has the same grayscale value as the initial contour point is determined as the target contour point.

10. A data processing device, characterized in that: include: An initial processing module is used to input pixel data corresponding to the target image into a search acceleration engine in a processor, and obtain a neighborhood search matrix corresponding to an initial contour point in the pixel data in the search acceleration engine; the initial contour point is a pixel point in the target image that represents an image contour, and the neighborhood search matrix is ​​a matrix with the initial contour point as a center point; A row shift module, used to perform row shift on the neighborhood search matrix to obtain an up-conversion matrix, a center transformation matrix and a down-conversion matrix corresponding to the neighborhood search matrix, determine an up-shift row in the up-conversion matrix, determine a center-shift row in the center transformation matrix, and determine a down-shift row in the down-conversion matrix; A neighborhood processing module, used for shifting the upper shifted row to the right by one column to obtain a first transformed row, constructing a second transformed row identical to the upper shifted row, and shifting the upper shifted row to the left by one column to obtain a third transformed row; The neighborhood processing module is further used to shift the center shift row to the right by one column to obtain a fourth transformed row, construct a fifth transformed row that is the same as the center shift, and shift the center shift row to the left by one column to obtain a sixth transformed row; The neighborhood processing module is further used to shift the down-shifted row to the right by one column to obtain a seventh transformed row, construct an eighth transformed row that is the same as the down-shifted row, and shift the down-shifted row to the left by one column to obtain a ninth transformed row; The neighborhood processing module is further used to determine the upper azimuth neighborhood point and the coordinates of the upper azimuth neighborhood point through the first transformation line, the second transformation line and the third transformation line, determine the center azimuth neighborhood point and the coordinates of the center azimuth neighborhood point through the fourth transformation line, the fifth transformation line and the sixth transformation line, and determine the lower azimuth neighborhood point and the coordinates of the lower azimuth neighborhood point through the seventh transformation line, the eighth transformation line and the ninth transformation line; The neighborhood processing module is also used to determine the neighborhood point having a business contour relationship with the initial contour point among the N neighborhood points as the target contour point based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continue to traverse new target contour points through the neighborhood search matrix corresponding to the target contour point until all the pixel points representing the image contour in the target image are traversed; M and N are positive integers, N is less than or equal to M; wherein the N neighborhood points include the upper azimuth neighborhood point, the center azimuth neighborhood point and the lower azimuth neighborhood point.

11. A computer device, characterized in that: include: Processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide a data communication function, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method described in any one of claims 1-9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 9.

13. A computer program product, characterized in that The computer program product comprises a computer program, which is stored in a computer-readable storage medium and is suitable for being read and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Ship object self-organizing cluster method based on distance search

    CN105243360A

  • Neighborhood search scheduling method and device applied to replacement flow shop

    CN111652412A