CN117333502A - Data processing method, device, equipment and readable storage medium - Google Patents

Data processing method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN117333502A
CN117333502A CN202311292291.1A CN202311292291A CN117333502A CN 117333502 A CN117333502 A CN 117333502A CN 202311292291 A CN202311292291 A CN 202311292291A CN 117333502 A CN117333502 A CN 117333502A
Authority
CN
China
Prior art keywords
neighborhood
point
determining
line
matrix
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311292291.1A
Other languages
Chinese (zh)
Inventor
李嘉昕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202311292291.1A priority Critical patent/CN117333502A/en
Publication of CN117333502A publication Critical patent/CN117333502A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Mathematical Physics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The application discloses a data processing method, a device, equipment and a readable storage medium, wherein the method comprises the following steps: acquiring a neighborhood search matrix corresponding to an initial contour point in pixel data from a search acceleration engine; 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 up-shift rows in the up-conversion matrix, determining center shift rows in the center conversion matrix and determining down-shift rows in the down-conversion matrix; and respectively performing column displacement on the up-displacement row, the center-displacement row and the down-displacement row to obtain M transformation rows, determining coordinates of N neighborhood points in a neighborhood search matrix through the M transformation rows, and determining the neighborhood points with business contour relations with the initial contour points in the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix. By adopting the method and the device, the performance and the universality of the neighborhood search circuit can be improved.

Description

Data processing method, device, equipment and readable storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a data processing method, apparatus, device, and readable storage medium.
Background
The existing 4-neighborhood, 8-neighborhood and other search circuits calculate the coordinates of pixel points on the whole image, so that coordinate data of a center point and neighborhood points are obtained, in complex image processing, the pixel points are high in dimensionality, large in calculation amount, more in decoding and decoding times are required for directly calculating the coordinate data, and the circuit performance is low. In addition, the prior art can only aim at the neighborhood direction preset by the central point, can not be used commonly among the neighborhood directions of 3 neighborhood, 4 neighborhood, 5 neighborhood, 8 neighborhood and the like, and has low universality.
Disclosure of Invention
The embodiment of the application provides a data processing method, a device, equipment and a readable storage medium, which can improve the performance and the universality of a neighborhood search circuit.
In one aspect, an embodiment of the present application provides a data processing method, including:
inputting pixel data corresponding to the target image into a search acceleration engine in a processor, and acquiring 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 representing the image contour in the target image, and the neighborhood search matrix is a matrix taking 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 up-shift rows in the up-conversion matrix, determining center shift rows in the center conversion matrix and determining down-shift rows in the down-conversion matrix;
Respectively performing column displacement on the up-shift line, the center-shift line and the down-shift line to obtain M transformation lines, determining coordinates of N neighborhood points in a neighborhood search matrix through the M transformation lines, determining the neighborhood points with business contour relations with the initial contour points in the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuously traversing new target contour points through the neighborhood search matrix corresponding to the target contour points until pixel points representing image contours in the target image are traversed; m and N are positive integers, and N is less than or equal to M.
The method comprises the steps of performing row shifting on a 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 up-conversion rows in the up-conversion matrix, determining center-conversion rows in the center conversion matrix and determining down-conversion rows in the down-conversion matrix based on initial contour points, wherein the neighborhood search matrix is a matrix containing pixel points of K rows and L columns, initial contour points are in an ith row of the neighborhood search matrix, K, L and i are positive integers, and the method comprises the following steps:
moving K rows of the neighborhood search matrix upwards by one row to obtain an up-conversion matrix, and determining an ith row in the up-conversion matrix as an up-shift row; the up-conversion matrix is a matrix of pixel points of K-1 rows by L columns;
Constructing a central transformation matrix which is the same as the neighborhood search matrix, and determining the ith row in the central transformation matrix as a central shift row;
the K rows of the neighborhood search matrix are downwards moved by one row to obtain a down-conversion matrix, and the ith row in the down-conversion matrix is determined to be a downwards-shifted row; the down-conversion matrix is a matrix of pixels of K-1 rows by L columns.
The method comprises the steps of respectively performing column shifting on an up-shift line, a center-shift line and a down-shift line to obtain M transformation lines, and comprises the following steps:
shifting the up-shift line one column to the right to obtain a first conversion line, constructing a second conversion line identical to the up-shift line, and shifting the up-shift line one column to the left to obtain a third conversion line;
shifting the center shift line to the right by one column to obtain a fourth conversion line, constructing a fifth conversion line identical to the center shift line, and shifting the center shift line to the left by one column to obtain a sixth conversion line;
and moving the downward shift line one column to the right to obtain a seventh conversion line, constructing an eighth conversion line which is the same as the downward shift line, and moving the downward shift line one column to the left to obtain a ninth conversion line.
The N field points comprise an upper azimuth neighborhood point, a central azimuth neighborhood point and a lower azimuth neighborhood point, and the coordinates of the N neighborhood points in a neighborhood search matrix are determined through M transformation rows, and the method comprises the following steps:
Determining the coordinates of an upper position neighborhood point and the upper position neighborhood point through the first transformation line, the second transformation line and the third transformation line; the upper azimuth neighborhood point comprises an upper left neighborhood point, an upper neighborhood point and an upper right neighborhood point;
determining a central azimuth neighborhood point and coordinates of the central azimuth neighborhood point through a fourth transformation line, a fifth transformation line and a sixth transformation line; the central azimuth neighborhood point comprises a left neighborhood point, a central neighborhood point and a right neighborhood point;
determining the coordinates of a lower position neighborhood point and the lower position neighborhood point through a seventh transformation line, an eighth transformation line and a ninth transformation line; the lower-azimuth neighborhood points comprise a lower-left neighborhood point, a lower-neighborhood point and a lower-right neighborhood point.
The method for determining the coordinates of the upper position neighborhood point and the upper position neighborhood point comprises the following steps of:
determining the j-th column of the first transformation line as an upper left neighborhood point, and determining the column sequence number of the j-th column and the line sequence number of the first transformation line as coordinates of the upper left neighborhood point;
determining a j-th column of the second transformation line as an upper neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the second transformation line as coordinates of the upper neighborhood point;
And determining the j-th column of the third transformation line as an upper right neighborhood point, and determining the column sequence number of the j-th column and the line sequence number of the third transformation line as coordinates of the upper right neighborhood point.
The initial contour point is in the j-th column of the neighborhood search matrix, j is a positive integer, and the coordinates of the center azimuth neighborhood point and the center azimuth neighborhood point are determined through a fourth transformation line, a fifth transformation line and a sixth transformation line, and the method comprises the following steps:
determining a j-th column of the fourth transformation line as a left neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the fourth transformation line as coordinates of the left neighborhood point;
determining a j-th column of the fifth transformation line as a central neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the fifth transformation line as coordinates of the central neighborhood point;
and determining the j-th column of the sixth transformation line as a right neighborhood point, and determining the column sequence number of the j-th column and the line sequence number of the sixth transformation line as coordinates of the right neighborhood point.
The initial contour point is in the j-th column of the neighborhood search matrix, j is a positive integer, and the coordinates of the lower neighborhood point and the lower neighborhood point are determined through the seventh transformation line, the eighth transformation line and the ninth transformation line, including:
Determining a j-th column of the seventh transformation line as a left lower neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the seventh transformation line as coordinates of the left lower neighborhood point;
determining a j-th column of the eighth transformation line as a next neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the eighth transformation line as coordinates of the next neighborhood point;
and determining the j-th column of the ninth transformation line as a lower right neighborhood point, and determining the column sequence number of the j-th column and the line sequence number of the ninth transformation line as coordinates of the lower right neighborhood point.
Wherein, still include:
acquiring a service image, wherein among the pixel points of the service image, the pixel point with the gray value larger than or equal to the service gray threshold value is determined as a white pixel point, and the pixel point with the gray value smaller than the service gray threshold value is determined as a black pixel point;
setting the gray value of the white pixel point as a first gray value, setting the gray value of the black pixel point as a second gray value, obtaining a gray image composed of the white pixel point and the black pixel point, and marking the connected domain of the gray image to obtain a target image.
The method for marking the connected domain of the gray level image to obtain the target image comprises the following steps:
randomly determining seed pixel points in pixel points of the gray level image, marking adjacent pixel points meeting a communication threshold condition with the seed pixel points as new seed pixel points in adjacent pixel points of the seed pixel points until the pixel points in the gray level image are traversed, and determining the seed pixel points with the same mark as the same communication domain;
And continuously determining a new connected domain in the unmarked pixel points in the gray level graph until the pixel points in the gray level graph are marked, so as to obtain a target image.
Inputting the pixel data corresponding to the target image into a search acceleration engine in a processor, and acquiring a neighborhood search matrix corresponding to an initial contour point in the pixel data in the search acceleration engine, wherein the neighborhood search matrix comprises:
randomly determining an initial connected domain in a target image in a search acceleration engine, randomly determining initial pixel points in the initial connected domain, determining adjacent pixel points which are different from the marks of the initial connected domain as initial contour points if at least one adjacent pixel point which is different from the marks of the initial connected domain exists in N adjacent pixel points of the initial pixel points, otherwise, re-determining the initial pixel points; n is a positive integer;
and determining 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 with different marks of the initial connected domain and the initial connected domain.
The method for determining the neighbor points with business contour relation with the initial contour point in the N neighbor points as target contour points based on the coordinates of the N neighbor points in the neighbor search matrix comprises the following steps:
Determining the traversing sequence of N neighborhood points based on the coordinates of the N neighborhood points in the neighborhood search matrix;
and acquiring gray values of N neighborhood points, and determining the neighborhood point which is traversed to the first time and has the same gray value as the initial contour point as a target contour point based on the traversing sequence of the N neighborhood points.
An aspect of an embodiment of the present application provides a data processing apparatus, including:
the initial processing module is used for inputting the pixel data corresponding to the target image into a search acceleration engine in the processor, and acquiring a 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 taking the initial contour point as a center point;
the line shifting module is used for carrying out line 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, wherein the up-conversion matrix is used for determining up-shift lines, the center conversion matrix is used for determining center shift lines, and the down-conversion matrix is used for determining down-shift lines;
the neighborhood processing module is used for respectively carrying out column displacement on the up-shift row, the center-shift row and the down-shift row to obtain M conversion rows, determining the coordinates of N neighborhood points in a neighborhood search matrix through the M conversion rows, determining the neighborhood points with business contour relations with the initial contour points in the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuously traversing the new target contour points through the neighborhood search matrix corresponding to the target contour points until the pixel points representing the image contours in the target image are traversed; m and N are positive integers, and N is less than or equal to M.
The neighborhood search matrix is a matrix containing pixel points of K rows by L columns, the initial contour points are in the ith row of the neighborhood search matrix, K, L and i are positive integers, and the row shift module comprises:
the first matrix transformation unit is used for upwards moving K rows of the neighborhood search matrix by one row to obtain an up-conversion matrix, and determining an ith row in the up-conversion matrix as an up-shift row; the up-conversion matrix is a matrix of pixel points of K-1 rows by L columns;
the second matrix transformation unit is used for constructing a central transformation matrix which is the same as the neighborhood search matrix, and determining the ith row in the central transformation matrix as a central shift row;
a third matrix transformation unit, configured to move K rows of the neighborhood search matrix downward by one row to obtain a down-conversion matrix, and determine an ith row in the down-conversion matrix as a down-shift row; the down-conversion matrix is a matrix of pixels of K-1 rows by L columns.
Wherein, the neighborhood processing module includes:
a first line transformation unit, configured to shift the up-shift line one column to the right to obtain a first transformation line, construct a second transformation line identical to the up-shift line, and shift the up-shift line one column to the left to obtain a third transformation line;
the second line transformation unit is used for moving the center shift line to the right by one column to obtain a fourth transformation line, constructing a fifth transformation line which is the same as the center shift line, and moving the center shift line to the left by one column to obtain a sixth transformation line;
And the third line transformation unit is used for moving the downward shift line to the right by one column to obtain a seventh transformation line, constructing an eighth transformation line which is the same as the downward shift line, and moving the downward shift line to the left by one column to obtain a ninth transformation line.
Wherein, the neighborhood processing module includes:
the upper azimuth transformation unit is used for determining an upper azimuth neighborhood point and coordinates of the upper azimuth neighborhood point through the first transformation line, the second transformation line and the third transformation line; the upper azimuth neighborhood point comprises an upper left neighborhood point, an upper neighborhood point and an upper right neighborhood point;
the central azimuth transformation unit is used for determining a central azimuth neighborhood point and coordinates of the central azimuth neighborhood point through a fourth transformation line, a fifth transformation line and a sixth transformation line; the central azimuth neighborhood point comprises a left neighborhood, a central neighborhood and a right neighborhood;
the lower azimuth transformation unit is used for determining a lower azimuth neighborhood point and coordinates of the lower azimuth neighborhood point through a seventh transformation line, an eighth transformation line and a ninth transformation line; the lower-azimuth neighborhood points comprise a lower-left neighborhood point, a lower-neighborhood point and a lower-right neighborhood point.
Wherein, the upper direction conversion unit includes:
a first neighborhood determining subunit, configured to determine a j-th column of the first converted line as an upper left neighborhood point, and determine a column sequence number of the j-th column and a line sequence number of the first converted line as coordinates of the upper left neighborhood point;
A second neighborhood determining subunit, configured to determine a j-th column of the second transformed line as an upper neighborhood point, and determine a column sequence number of the j-th column and a line sequence number of the second transformed line as coordinates of the upper neighborhood point;
and the third neighborhood determining subunit is used for determining the j-th column of the third transformation line as an upper right neighborhood point and determining the column sequence number of the j-th column and the line sequence number of the third transformation line as coordinates of the upper right neighborhood point.
Wherein the center orientation converting unit includes:
a fourth neighbor determination subunit, configured to determine a j-th column of the fourth transformation line as a left neighbor point, and determine a column sequence number of the j-th column and a line sequence number of the fourth transformation line as coordinates of the left neighbor point;
a fifth neighborhood determining subunit, configured to determine a j-th column of the fifth transformation line as a central neighborhood point, and determine a column sequence number of the j-th column and a line sequence number of the fifth transformation line as coordinates of the central neighborhood point;
and the sixth neighborhood determining subunit is configured to determine a j-th column of the sixth transformation line as a right neighborhood point, and determine a column sequence number of the j-th column and a line sequence number of the sixth transformation line as coordinates of the right neighborhood point.
Wherein the lower direction conversion unit includes:
a seventh neighborhood determining subunit, configured to determine a j-th column of the seventh transformed line as a lower left neighborhood point, and determine a column number of the j-th column and a line number of the seventh transformed line as coordinates of the lower left neighborhood point
An eighth neighborhood determining subunit, configured to determine a j-th column of the eighth transform line as a lower neighborhood point, and determine a column sequence number of the j-th column and a line sequence number of the eighth transform line as coordinates of the lower neighborhood point;
and the ninth neighborhood determining subunit is configured to determine a j-th column of the ninth transformed line as a lower right neighborhood point, and determine a column sequence number of the j-th column and a line sequence number of the ninth transformed line as coordinates of the lower right neighborhood point.
Wherein, still include:
the binarization processing module is used for acquiring a service image, determining a pixel with a gray value larger than or equal to a service gray threshold value as a white pixel, and determining a pixel with a gray value smaller than the service gray threshold value as a black pixel in the pixels of the service image;
the binarization processing module is also used for setting the gray value of the white pixel point as a first gray value, setting the gray value of the black pixel point as a second gray value, obtaining a gray image composed of the white pixel point and the black pixel point, and marking the connected domain of the gray image to obtain a target image.
Wherein, binarization processing module includes:
the seed determining unit is used for randomly determining seed pixel points in the pixel points of the gray level image, marking the adjacent pixel points meeting the condition of the communication threshold value with the seed pixel points as new seed pixel points in the adjacent pixel points of the seed pixel points until the pixel points in the gray level image are traversed, and determining the seed pixel points with the same mark as the same communication domain;
And the connected domain marking unit is used for continuously determining a new connected domain in the pixel points which are not marked in the gray level graph until the pixel points in the gray level graph are marked, so as to obtain a target image.
Wherein, initial processing module includes:
the initial contour determining unit is used for randomly determining an initial connected domain in the target image in the search acceleration engine, randomly determining initial pixel points in the initial connected domain, determining adjacent pixel points which are different from the marks of the initial connected domain as initial contour points if at least one adjacent pixel point which is different from the marks of the initial connected domain exists in N adjacent pixel points of the initial pixel points, otherwise, re-determining the initial pixel points; n is a positive integer;
an initial matrix determining unit, configured 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 point with a different sign from the initial connected domain, and the initial connected domain.
The neighborhood processing module is specifically used for determining the traversal sequence of the N neighborhood points based on the coordinates of the N neighborhood points in the neighborhood search matrix; and acquiring gray values of N neighborhood points, and determining the neighborhood point which is traversed to the first time and has the same gray value as the initial contour point as a target contour point based on the traversing sequence of the N neighborhood points.
In one aspect, a computer device is provided, including: a processor, a memory, and a network interface;
the processor is connected with the memory and the network interface, wherein the network interface is used for providing a data communication function, the memory is used for storing a computer program, and when the computer program is executed by the processor, the computer device is caused to execute the method provided by the embodiment of the application.
In one aspect, the present application provides a computer readable storage medium storing a computer program adapted to be loaded and executed by a processor, so that a computer device having the processor performs the method provided in the embodiments of the present application.
In one aspect, the present application provides a computer program product comprising a computer program stored on 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 method provided in the embodiment of the present application.
According to the embodiment of the application, through inputting the pixel data corresponding to the target image into a search acceleration engine in a processor, 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 representing the image contour in the target image, and the neighborhood search matrix is a matrix taking 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 up-shift rows in the up-conversion matrix, determining center shift rows in the center conversion matrix and determining down-shift rows in the down-conversion matrix; respectively performing column displacement on the up-shift line, the center-shift line and the down-shift line to obtain M transformation lines, determining coordinates of N neighborhood points in a neighborhood search matrix through the M transformation lines, determining the neighborhood points with business contour relations with the initial contour points in the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuously traversing new target contour points through the neighborhood search matrix corresponding to the target contour points until pixel points representing image contours in the target image are traversed; m and N are positive integers, and N is less than or equal to M. Therefore, in the embodiment of the application, the neighborhood search matrix is generated after the initial contour point is determined, the dimension of the neighborhood search matrix is far smaller than the dimension of the pixel point of the whole image, so that the calculation amount of the neighborhood search by the chip is reduced, the neighborhood points in all directions are obtained by transforming the rows and columns where the initial contour point is located, the steps of decoding and decoding coordinate data of the calculated neighborhood points can be reduced, the performance of the neighborhood search circuit is improved, all the neighborhood directions on a plane are covered in the neighborhood points in all directions obtained by row and column transformation, and the neighborhood search circuit can be commonly used in different neighborhood demands.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of a network architecture according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a data processing scenario provided in an embodiment of the present application;
FIG. 3 is a flowchart illustrating a data processing method according to an embodiment of the present application;
FIG. 4 is a second flow chart of a data processing method according to an embodiment of the present disclosure;
fig. 5 is a flowchart illustrating a data processing method according to an embodiment of the present application;
fig. 6 is a flowchart of a data processing method according to an embodiment of the present application;
fig. 7 is a flowchart fifth of a data processing method according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a data processing apparatus according to an embodiment of the present application;
Fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
Referring to fig. 1, fig. 1 is a schematic diagram of a network architecture according to an embodiment of the present application. The network architecture diagram may include a service server 100 and a terminal device cluster, where the terminal device cluster may include: terminal device 200a, terminal devices 200b, … …, terminal device 200n, wherein any terminal device in the terminal device cluster may have a communication connection with the service server 100, respectively. The communication connection is not limited to a connection manner, and may be directly or indirectly connected through a wired communication manner, may be directly or indirectly connected through a wireless communication manner, or may be other manners, which is not limited herein.
Specifically, each terminal device in the terminal cluster shown in fig. 1 may send a service image processing request to the service server 100, where the service image processing request may include a service image. The service server 100 may perform binarization processing on the service image, and through a service gray threshold, the service server 100 may set a gray value of a pixel point in the service image to 0 or 255, to obtain a gray map of the service image. The service gray threshold may be set by a service requirement or a specific service image, which is not limited herein in the embodiments of the present application.
The service server 100 may perform connected domain labeling on the gray level image of the service image, and label the pixel points with the same gray level value and adjacent pixel points as one connected domain, so as to obtain the target image. The business server 100 may input the pixel data of the target image into a search acceleration engine in the processor, which determines an initial contour point among the pixel points of the target image. The initial contour point may be a pixel point representing an image contour in the target image, and the manner in which the service server 100 determines the initial contour point may be a boundary point of the connected domain.
The service server 100 may determine the pixel points with the initial contour point as the center and the surrounding K rows by L columns as the neighborhood search matrix corresponding to the initial contour point, the service server 100 may perform a row shift on the neighborhood search matrix to obtain an up-conversion matrix, a center conversion matrix and a down-conversion matrix, and the service server 100 may determine an up-conversion row in the up-conversion matrix, determine a center shift row in the center conversion matrix and determine a down-conversion row in the down-conversion matrix. K and L are positive integers, and K and L can be preset according to service requirements, and the determining mode of K and L is not limited in the embodiment of the application.
The service server 100 may shift the upper shift line to obtain a first shift line, a second shift line, and a third shift line, shift the center shift line to obtain a fourth shift line, a fifth shift line, and a sixth shift line, and shift the lower shift line to obtain a seventh shift line, an eighth shift line, and a ninth shift line.
Taking the service server 100 as an example of performing 8-neighborhood search, 8-neighborhood may refer to the positional relationship of 8 directions of upper left, lower left, upper left, lower right, upper right, lower right, and around the center point. The business server 100 may determine the coordinates of the upper left neighbor in the neighbor search matrix through the first transformation line, which may characterize the upper left neighbor. The coordinates of the upper neighborhood point in the neighborhood search matrix are determined by the second transformation line, and the upper neighborhood point can characterize the upper neighborhood. And determining the coordinates of the upper right neighborhood point in the neighborhood search matrix through a third transformation line, wherein the upper right neighborhood point can represent the upper right neighborhood. And determining the coordinates of the left neighborhood point in the neighborhood search matrix through the fourth transformation line, wherein the left neighborhood point can represent the left neighborhood. And determining the coordinates of the central neighborhood point in the neighborhood search matrix through a fifth transformation line, wherein the central neighborhood point can represent the central point. And determining the coordinates of the right neighborhood point in the neighborhood search matrix through a sixth change line, wherein the right neighborhood point can represent the right neighborhood. And determining the coordinates of the left lower neighborhood point in the neighborhood search matrix through a seventh transformation line, wherein the left lower neighborhood point can represent the left lower neighborhood. The coordinates of the lower neighborhood point in the neighborhood search matrix are determined through the eighth transformation line, and the lower neighborhood point can represent the lower neighborhood. And determining the coordinates of the lower right neighborhood point in the neighborhood search matrix through a ninth transformation line, wherein the lower right neighborhood point can represent the lower right neighborhood.
The service server 100 determines a neighborhood point having a service profile relationship with an initial profile point (which may also be referred to as a center neighborhood point) as a target profile point by coordinates of an upper left neighborhood point, an upper right neighborhood point, an upper left neighborhood point, a right neighborhood point, a lower left neighborhood point, a lower neighborhood point, and a lower right neighborhood point in a neighborhood search matrix. The target contour point is also a pixel point representing the image contour in the target image, and the service server 100 may continue to perform 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 the pixel point representing the image contour in the target image is traversed (or until the pixel point representing the image contour is traversed to be determined as the target contour point or the initial contour point).
The service server 100 may determine an image contour in the target image through the initial contour point and the target contour point, and the service server 100 may transmit the processed image contour to the terminal device 200a to complete image contour processing of the service image.
It will be appreciated that the N-neighborhood search (e.g., 8-neighborhood search) performed in the service server 100 may be applied to a circuit control method of a chip (chip for computer system operation, control, information processing, program operation), and the circuit performance of the chip may be improved by dividing the neighborhood in the circuit and optimizing using the N-neighborhood search algorithm.
Referring to fig. 2, fig. 2 is a schematic diagram of a data processing scenario provided in an embodiment of the present application.
As shown in fig. 2, the terminal device 200a may send a service image processing request, send a service image 210 to the service server 100, where the service server 100 may perform binarization processing on the service image 210, and in the scene 110, taking an image area 211 in the service image 210 as an example, the service server 100 may perform binarization processing on a pixel area 111 corresponding to the image area 211 through a service gray threshold, determine a pixel having a gray value greater than or equal to the service gray threshold as a black pixel, and set a gray value of the black pixel as 255, for example, the black pixel may be the pixel 112 in the scene 110. The service server 100 may determine a pixel having a gray value smaller than the service gray threshold as a white pixel, and set the gray value of the white pixel to 0, for example, the white pixel may be the pixel 113 in the scene 110, to obtain the gray map of the service image 210.
The service server 100 may label the gray scale map of the service image 210 with a connected domain, and label the pixels with the same gray scale value and adjacent pixel positions as the same connected domain, for example, in the scene 120, the service server may label the pixel with the gray scale value of 0 and adjacent pixel positions as 1 in the pixel points corresponding to the pixel point region 111, so as to obtain the connected domain 1. And marking the pixel point adjacent to the pixel point with the gray value of 0 in the other region as 3 to obtain a connected region 3. And marking the adjacent pixel points with the gray value of 255 and the pixel points as 2 to obtain a connected domain 2 until the service server can finish marking the pixel points in the gray image of the service image 210 to obtain a target image. The business server 100 may input the pixel data of the target image into a search acceleration engine in the processor, which determines an initial contour point among the pixel points of the target image. The manner in which the service server 100 determines the initial contour point may be a boundary point (for example, may be the pixel point 121) of the connected domain, which is not limited herein.
The service server 100 may determine the pixel points with the initial contour point as the center and the surrounding K rows by L columns as the neighborhood search matrix corresponding to the initial contour point, the service server 100 may perform a row shift on the neighborhood search matrix to obtain an up-conversion matrix, a center conversion matrix and a down-conversion matrix, and the service server 100 may determine an up-conversion row in the up-conversion matrix, determine a center shift row in the center conversion matrix and determine a down-conversion row in the down-conversion matrix. K and L are positive integers, and K and L can be preset according to service requirements, and the determining mode of K and L is not limited in the embodiment of the application.
The service server 100 may shift the upper shift line to obtain a first shift line, a second shift line, and a third shift line, shift the center shift line to obtain a fourth shift line, a fifth shift line, and a sixth shift line, and shift the lower shift line to obtain a seventh shift line, an eighth shift line, and a ninth shift line.
Taking the service server 100 as an example of performing 8-neighborhood search, 8-neighborhood may refer to the positional relationship of 8 directions of upper left, lower left, upper left, lower right, upper right, lower right, and around the center point. The business server 100 may determine the coordinates of the upper left neighbor in the neighbor search matrix through the first transformation line, which may characterize the upper left neighbor. The coordinates of the upper neighborhood point in the neighborhood search matrix are determined by the second transformation line, and the upper neighborhood point can characterize the upper neighborhood. And determining the coordinates of the upper right neighborhood point in the neighborhood search matrix through a third transformation line, wherein the upper right neighborhood point can represent the upper right neighborhood. And determining the coordinates of the left neighborhood point in the neighborhood search matrix through the fourth transformation line, wherein the left neighborhood point can represent the left neighborhood. And determining the coordinates of the central neighborhood point in the neighborhood search matrix through a fifth transformation line, wherein the central neighborhood point can represent the central point. And determining the coordinates of the right neighborhood point in the neighborhood search matrix through a sixth change line, wherein the right neighborhood point can represent the right neighborhood. And determining the coordinates of the left lower neighborhood point in the neighborhood search matrix through a seventh transformation line, wherein the left lower neighborhood point can represent the left lower neighborhood. The coordinates of the lower neighborhood point in the neighborhood search matrix are determined through the eighth transformation line, and the lower neighborhood point can represent the lower neighborhood. And determining the coordinates of the lower right neighborhood point in the neighborhood search matrix through a ninth transformation line, wherein the lower right neighborhood point can represent the lower right neighborhood.
The service server 100 determines a neighborhood point having a service profile relationship with an initial profile point (which may also be referred to as a center neighborhood point) as a target profile point by coordinates of an upper left neighborhood point, an upper right neighborhood point, an upper left neighborhood point, a right neighborhood point, a lower left neighborhood point, a lower neighborhood point, and a lower right neighborhood point in a neighborhood search matrix. The target contour point is also a pixel point representing the image contour in the target image, and the service server 100 may continue to perform 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 the pixel point representing the image contour in the target image is traversed (or until the pixel point representing the image contour is traversed to be determined as the target contour point or the initial contour point).
The service server 100 may determine the image contour in the target image through the initial contour point and the target contour point to obtain the image contour 131 and the image contour 132 in the scene 130, 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 210.
According to the embodiment of the application, through inputting the pixel data corresponding to the target image into a search acceleration engine in a processor, 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 representing the image contour in the target image, and the neighborhood search matrix is a matrix taking 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 up-shift rows in the up-conversion matrix, determining center shift rows in the center conversion matrix and determining down-shift rows in the down-conversion matrix; respectively performing column displacement on the up-shift line, the center-shift line and the down-shift line to obtain M transformation lines, determining coordinates of N neighborhood points in a neighborhood search matrix through the M transformation lines, determining the neighborhood points with business contour relations with the initial contour points in the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuously traversing new target contour points through the neighborhood search matrix corresponding to the target contour points until pixel points representing image contours in the target image are traversed; m and N are positive integers, and N is less than or equal to M. Therefore, in the embodiment of the application, the neighborhood search matrix can be generated after the initial contour point is determined, the dimension of the neighborhood search matrix is far smaller than the dimension of the pixel point of the whole image, so that the calculation amount of the neighborhood search by the chip is reduced, the neighborhood points in all directions are obtained by transforming the rows and columns where the initial contour point is positioned, the steps of decoding and decoding the coordinate data of the calculated neighborhood points can be reduced, the performance of the neighborhood search circuit in the chip is improved, all the neighborhood directions on the plane are covered in the neighborhood points in all directions obtained by the row and column transformation, and the neighborhood search circuit can be universal in different neighborhood demands.
Referring to fig. 3, fig. 3 is a schematic flow chart of a data processing method provided in the embodiment of the present application, where the data processing method may be performed by a computer device, and the computer device may include a terminal device (may be the terminal device 200a, the terminal device 200b, … …, or the terminal device 200 n) or the service server 100 shown in fig. 1. As shown in fig. 3, the method may include:
step S101, inputting pixel data corresponding to a target image into a search acceleration engine in a processor, and acquiring 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 representing the image contour in the target image, and the neighborhood search matrix is a matrix taking the initial contour point as a center point;
specifically, the computer device may input the pixel data corresponding to the target image into the search acceleration engine in the processor, where the target image may be an image that is binarized and marked with the connected domain, and for the content of the target image, please refer to the specific description of steps S201 to S203 in the corresponding embodiment of fig. 6. The search acceleration engine may be a component in the computer device for performing a neighborhood search on the target image, or may be a hardware unit of a chip in the neighborhood search circuit.
The computer device may obtain an initial contour point in the target image pixel data and a neighborhood search matrix corresponding to the initial round-trip point in the search acceleration engine, and the manner in which the computer device determines the initial contour point may be a boundary point of the connected domain, which is not limited in the embodiment of the present application.
The initial contour point may be a pixel point representing an image contour in the target image, and the neighborhood search matrix is a matrix taking the initial contour point as a center point and including K rows by L columns of pixel points around the initial contour point. K and L are positive integers, and K and L can be preset according to service requirements, and the determining mode of K and L is not limited in the embodiment of the application.
Step S102, carrying out row shift on a 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 up-shift rows in the up-conversion matrix, determining center-shift rows in the center conversion matrix and determining down-shift rows in the down-conversion matrix;
specifically, the computer device may perform a 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.
The specific process of the computer device performing the row shift on the neighborhood search matrix may be: moving K rows of the neighborhood search matrix upwards by one row to obtain an up-conversion matrix, and determining an ith row in the up-conversion matrix as an up-shift row; the up-conversion matrix is a matrix of pixel points of K-1 rows by L columns; constructing a central transformation matrix which is the same as the neighborhood search matrix, and determining the ith row in the central transformation matrix as a central shift row; the K rows of the neighborhood search matrix are downwards moved by one row to obtain a down-conversion matrix, and the ith row in the down-conversion matrix is determined to be a downwards-shifted row; the down-conversion matrix is a matrix of pixels of K-1 rows by L columns.
Referring to fig. 4 again, as shown in fig. 4, a neighborhood search matrix using an initial contour point a as a center point may include K rows by L columns, and 8 neighborhood search is performed by a search acceleration engine as an example, where 8 neighborhood may refer to a positional relationship of 8 directions around the center point.
Specifically, the neighborhood search matrix may include a 1 st row, a 2 nd row, an i-1 st row, an i th row, an i+1th row, a … … th row, and a K th row, where the initial contour point a is the i th row in the neighborhood search matrix, and i is a positive integer less than K.
The computer device may move the K rows in the neighborhood search matrix up one row to obtain an up-conversion matrix, where the up-conversion matrix may include the 1 st row, the 2 nd row, the i-1 st row, the i-th row, the … … th row, and the K-1 st row corresponding to the neighborhood search matrix, that is, the up-conversion matrix is a matrix including pixels of K-1 rows by L columns. The computer device may determine the ith row in the up-conversion matrix as the up-shift row. The ith row in the up-conversion matrix may correspond to the ith-1 row in the neighborhood search matrix.
The computer device may construct a central transformation matrix that is the same as the neighborhood search matrix, and the central transformation matrix may include row 1, row 2, row i, … …, row K corresponding to the neighborhood search matrix. The computer device may determine an ith row in the center shift matrix as a center shifted row. The ith row in the center transform matrix may correspond to the ith row in the neighborhood search matrix.
The computer device may move K rows in the neighborhood search matrix downward by one row to obtain a down-conversion matrix, where the down-conversion matrix may include a 2 nd row, a 3 rd row, an i-th row, an i+1th row, a … … th row, and a K-th row corresponding to the neighborhood search matrix, that is, the down-conversion matrix is a matrix including pixels of K-1 rows by L columns. The computer device may determine an ith row in the down-conversion matrix as a down-shifted row. The ith row in the down-conversion matrix may correspond to the (i+1) th row in the neighborhood search matrix.
Step S103, respectively performing column displacement on the up-displacement row, the center-displacement row and the down-displacement row to obtain M transformation rows, determining coordinates of N neighborhood points in a neighborhood search matrix through the M transformation rows, determining the neighborhood points with business contour relations with the initial contour points in the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuously traversing new target contour points through the neighborhood search matrix corresponding to the target contour points 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.
Specifically, referring to fig. 5 again, fig. 5 is a schematic flow chart III of a data processing method provided in the embodiment of the present application, as shown in fig. 5, a computer device may perform column shifting on an up-shift line, a center-shift line, and a down-shift line, to obtain M conversion lines, where M may be nine. The up-shift row, the center-shift row, and the down-shift row each include L columns, and the initial contour point a may be in a j-th column of the neighborhood search matrix, j being a positive integer less than L.
The specific process of the computer device performing the column shift may be: shifting the up-shift line one column to the right to obtain a first conversion line, constructing a second conversion line identical to the up-shift line, and shifting the up-shift line one column to the left to obtain a third conversion line; shifting the center shift line to the right by one column to obtain a fourth conversion line, constructing a fifth conversion line identical to the center shift line, and shifting the center shift line to the left by one column to obtain a sixth conversion line; and moving the downward shift line one column to the right to obtain a seventh conversion line, constructing an eighth conversion line which is the same as the downward shift line, and moving the downward shift line one column to the left to obtain a ninth conversion line.
Specifically, the computer device may shift the shifted up row one column to the right to obtain a first transformed row, where the first transformed row includes a 1 st column, a 2 nd column, a j-th column, … …, and a L-1 st column corresponding to the shifted up row, that is, the first transformed row includes a L-1 column;
the computer device may construct a second transformed row identical to the up-shifted row, the second transformed row comprising a 1 st column, a 2 nd column, a j-th column, … …, an L-th column corresponding to the up-shifted row;
the computer equipment can move the up-shift row one column to the left to obtain a third conversion row, wherein the third conversion row comprises a 2 nd column, a 3 rd column, a j-th column, … … and an L-th column corresponding to the up-shift row, namely the third conversion row comprises an L-1 column;
the computer equipment can move the center shift row by one column to the right to obtain a fourth transformation row, wherein the fourth transformation row comprises a 1 st column, a 2 nd column, a j-th column, … … and a L-1 st column corresponding to the center shift row, namely the fourth transformation row comprises a L-1 column;
the computer device may construct a fifth transformed row identical to the center-shifted row, the fifth transformed row comprising a 1 st column, a 2 nd column, a j-th column, … …, an L-th column corresponding to the center-shifted row;
the computer equipment can move the center shift row to the left by one column to obtain a sixth transformation row, wherein the sixth transformation row comprises a 2 nd column, a 3 rd column, a j-th column, … … and an L-th column corresponding to the center shift row, namely the sixth transformation row comprises an L-1 column;
The computer equipment can move the downward shift row by one column to the right to obtain a seventh conversion row, wherein the seventh conversion row comprises a 1 st column, a 2 nd column, a j-th column, … … and a L-1 th column corresponding to the downward shift row, namely the seventh conversion row comprises a L-1 column;
the computer device may construct an eighth transformed row identical to the downshifted row, the eighth transformed row comprising a 1 st column, a 2 nd column, a j-th column, … …, an L-th column corresponding to the downshifted row;
the computer device may shift the downshifted row one column to the left to obtain a ninth transformed row, where the ninth transformed row includes a 2 nd column, a 3 rd column, a j-th column, … …, and an L-th column corresponding to the downshifted row, that is, the ninth transformed row includes an L-1 column.
The computer device may determine coordinates of N neighborhood points in the neighborhood search matrix by M transform rows, N being a positive integer less than or equal to M. For example, if the traffic demand is to perform a 4-neighborhood search, the 4-neighborhood may refer to the positional relationship of the upper, left, right, and lower 4 directions around the center point. Then, the computer device may determine the coordinates of 5 neighborhood points (which may be an upper neighborhood point, a left neighborhood point, a right neighborhood point, a lower neighborhood point, and a center neighborhood point) in the neighborhood search matrix in the 9 transform rows. If the service requirement is to perform 8-neighborhood search, the 8-neighborhood may refer to the positional relationship of 8 directions of upper left, lower left, upper left, lower right, upper right, lower right around the center point. Then, the computer device may determine the coordinates of 9 neighborhood points (which may be an upper neighborhood point, a left neighborhood point, a right neighborhood point, a lower neighborhood point, and a center neighborhood point) in the neighborhood search matrix in the 9 transform rows. N can be determined by service requirements and can be the same as the number of the neighborhoods when the domain is marked, and the embodiment of the application is not limited.
The specific process of the computer device determining the coordinates of the neighborhood points in the neighborhood search matrix may be: determining the coordinates of an upper position neighborhood point and the upper position neighborhood point through the first transformation line, the second transformation line and the third transformation line; the upper azimuth neighborhood point comprises an upper left neighborhood, an upper neighborhood and an upper right neighborhood; determining a central azimuth neighborhood point and coordinates of the central azimuth neighborhood point through a fourth transformation line, a fifth transformation line and a sixth transformation line; the central azimuth neighborhood point comprises a left neighborhood, a central neighborhood and a right neighborhood; determining the coordinates of a lower position neighborhood point and the lower position neighborhood point through a seventh transformation line, an eighth transformation line and a ninth transformation line; the lower bit neighborhood points include a lower left neighborhood, a lower right neighborhood, and a lower right neighborhood.
Specifically, the computer device may determine coordinates of an upper azimuth neighborhood point and an upper azimuth neighborhood point through a transformation line obtained by shifting an upper shift line, determine coordinates of a central azimuth neighborhood point and a central azimuth neighborhood point through a transformation line obtained by shifting a central shift line, and determine coordinates of a lower azimuth neighborhood point and a lower azimuth neighborhood point through a transformation line obtained by shifting a lower shift line.
Wherein, the process of determining the upper direction neighborhood point by the computer equipment can be as follows: determining the j-th column of the first transformation line as an upper left neighborhood point, and determining the column sequence number of the j-th column and the line sequence number of the first transformation line as coordinates of the upper left neighborhood point; determining a j-th column of the second transformation line as an upper neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the second transformation line as coordinates of the upper neighborhood point; and determining the j-th column of the third transformation line as an upper right neighborhood point, and determining the column sequence number of the j-th column and the line sequence number of the third transformation line as coordinates of the upper right neighborhood point.
Specifically, the computer device may determine the j-th column of the first transformation line as an upper left neighbor point, determine the j-1-th column of the neighbor search matrix corresponding to the upper left neighbor point as a column sequence number, determine the i-1-th line of the neighbor search matrix corresponding to the first transformation line or the upper left neighbor point as a line sequence number, determine the coordinates of the upper left neighbor point through the line sequence number and the column sequence number, and the coordinates of the upper left neighbor point may be represented as (i-1, j-1), and the upper left neighbor point may represent the upper left neighbor of the initial contour point.
The computer device may determine the j-th column of the second transformation row as an upper neighborhood point, determine the j-th column of the upper neighborhood point corresponding to the neighborhood search matrix as a column sequence number, determine the i-1-th row of the second transformation row or the upper neighborhood point corresponding to the neighborhood search matrix as a row sequence number, determine the coordinates of the upper neighborhood point by the row sequence number and the column sequence number, and the coordinates of the upper neighborhood point may be represented as (i-1, j), and the upper neighborhood point may represent the upper neighborhood of the initial contour point.
The computer device may determine a j-th column of the third transformation row as an upper right neighbor point, a j+1-th column of the neighbor search matrix corresponding to the upper right neighbor point as a column number, an i-1-th row of the neighbor search matrix corresponding to the third transformation row or the upper right neighbor point as a row number, and determine coordinates of the upper right neighbor point by the row number and the column number, the coordinates of the upper right neighbor point may be represented as (i-1, j+1), and the upper right neighbor point may represent an upper right neighbor of the initial contour point.
Wherein, the process of determining the central azimuth neighborhood point by the computer equipment can be as follows: determining a j-th column of the fourth transformation line as a left neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the fourth transformation line as coordinates of the left neighborhood point; determining a j-th column of the fifth transformation line as a central neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the fifth transformation line as coordinates of the central neighborhood point; and determining the j-th column of the sixth transformation line as a right neighborhood point, and determining the column sequence number of the j-th column and the line sequence number of the sixth transformation line as coordinates of the right neighborhood point.
Specifically, the computer device may determine the j-th column of the fourth transformation line as a left neighboring point, determine the j-1-th column of the neighboring search matrix corresponding to the left neighboring point as a column sequence number, determine the i-th line of the neighboring search matrix corresponding to the fourth transformation line or the left neighboring point as a line sequence number, determine the coordinates of the left neighboring point through the line sequence number and the column sequence number, and the coordinates of the left neighboring point may be represented as (i, j-1), where the left neighboring point may represent the left neighboring of the initial contour point.
The computer device may determine the jth column of the fifth transformation row as a central neighborhood point, determine the jth column of the neighborhood search matrix corresponding to the central neighborhood point as a column sequence number, determine the ith row of the neighborhood search matrix corresponding to the fifth transformation row or the central neighborhood point as a row sequence number, determine the coordinates of the central neighborhood point by the row sequence number and the column sequence number, and the coordinates of the central neighborhood point may be represented as (i, j), and the central neighborhood point may represent the central neighborhood of the initial contour point.
The computer device may determine a j-th column of the sixth transformed row as a right neighbor point, a j+1-th column of the neighbor search matrix corresponding to the right neighbor point as a column number, an i-th row of the neighbor search matrix corresponding to the sixth transformed row or the right neighbor point as a row number, and determine coordinates of the right neighbor point through the row number and the column number, the coordinates of the right neighbor point may be represented as (i, j+1), and the right neighbor point may represent a right neighbor of the initial contour point.
Wherein, the process of determining the right direction neighborhood point by the computer device can be: determining a j-th column of the seventh transformation line as a left lower neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the seventh transformation line as coordinates of the left lower neighborhood point; determining a j-th column of the eighth transformation line as a next neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the eighth transformation line as coordinates of the next neighborhood point; and determining the j-th column of the ninth transformation line as a lower right neighborhood point, and determining the column sequence number of the j-th column and the line sequence number of the ninth transformation line as coordinates of the lower right neighborhood point.
Specifically, the computer device may determine the j-th column of the seventh transformation line as a lower left neighbor point, determine the j-1-th column of the neighbor search matrix corresponding to the lower left neighbor point as a column sequence number, determine the i+1-th row of the neighbor search matrix corresponding to the seventh transformation line or the lower left neighbor point as a row sequence number, determine the coordinates of the lower left neighbor point through the row sequence number and the column sequence number, and the coordinates of the lower left neighbor point may be represented as (i+1, j-1), and the lower left neighbor point may represent the lower left neighbor of the initial contour point.
The computer device may determine the jth column of the eighth transformation row as a lower neighborhood point, determine the jth column of the neighborhood search matrix corresponding to the lower neighborhood point as a column sequence number, determine the ith row of the neighborhood search matrix corresponding to the eighth transformation row or the lower neighborhood point as a row sequence number, determine the coordinates of the lower neighborhood point by the row sequence number and the column sequence number, the coordinates of the lower neighborhood point may be represented as (i+1, j), and the lower neighborhood point may represent the lower neighborhood of the initial contour point.
The computer device may determine a j-th column of the ninth transformed row as a lower right neighborhood point, determine a j+1-th column of the neighborhood search matrix corresponding to the lower right neighborhood point as a column sequence number, determine an i+1-th row of the neighborhood search matrix corresponding to the ninth transformed row or the lower right neighborhood point as a row sequence number, determine coordinates of the lower right neighborhood point by the row sequence number and the column sequence number, and the coordinates of the lower right neighborhood point may be represented as (i+1, j+1), and the lower right neighborhood point may represent a lower right neighborhood of the initial contour point.
The computer device may determine, as the target contour point, a neighborhood point having a business contour relationship with the initial contour point (also referred to as a center neighborhood point) among the above neighborhood points by coordinates of the upper left neighborhood point, the upper right neighborhood point, the upper left neighborhood point, the right neighborhood point, the lower left neighborhood point, the lower right 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, and the computer device may continue to perform the steps S101 to S103 through the neighborhood search matrix corresponding to the target contour point, and continue to traverse to determine the next target contour point until the pixel point representing the image contour in the target image is traversed (or until the pixel point representing the image contour is traversed to be determined as the target contour point or the initial contour point).
The computer device can determine the initial contour point and the target contour point as the image contour in the target image, and complete the image contour processing of the business image.
It should be understood that the directions of "upper left", "upper right", and the like, and the expressions of the coordinates of "(i-1, j)", "(i, j)", "(i+1, j)", and the like in the embodiments of the present application may be changed according to the coordinate system and the relative positional relationship. In the "ith row" and the "jth column", the order of ordinal numbers is also changed. The embodiments of the present application are not limited herein.
It will be appreciated that N-neighborhood searches (e.g., 8-neighborhood search, 4-neighborhood search) performed by a computer device may be applied to a circuit control method of a chip (chip for computer system operation, control, information processing, program operation), and by dividing the neighborhood in a circuit and optimizing using an N-neighborhood search algorithm, the circuit performance of the chip may be improved.
According to the embodiment of the application, through inputting the pixel data corresponding to the target image into a search acceleration engine in a processor, 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 representing the image contour in the target image, and the neighborhood search matrix is a matrix taking 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 up-shift rows in the up-conversion matrix, determining center shift rows in the center conversion matrix and determining down-shift rows in the down-conversion matrix; respectively performing column displacement on the up-shift line, the center-shift line and the down-shift line to obtain M transformation lines, determining coordinates of N neighborhood points in a neighborhood search matrix through the M transformation lines, determining the neighborhood points with business contour relations with the initial contour points in the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuously traversing new target contour points through the neighborhood search matrix corresponding to the target contour points until pixel points representing image contours in the target image are traversed; m and N are positive integers, and N is less than or equal to M. Therefore, the embodiment of the application can generate the neighborhood search matrix after determining the initial contour point, the dimension of the neighborhood search matrix is far smaller than the dimension of the pixel point of the whole image, so that the calculation amount of the chip for neighborhood search is reduced, the neighborhood points in all directions are obtained by transforming the rows and columns where the initial contour point is positioned, the steps of decoding and decoding coordinate data of the calculated neighborhood points can be reduced, the performance of a neighborhood search circuit in the chip is improved, all neighborhood directions on a plane are covered in the neighborhood points in all directions obtained by row and column transformation, and the neighborhood search circuit can be commonly used in different neighborhood demands.
Referring to fig. 6, fig. 6 is a flowchart of a data processing method provided in the embodiment of the present application, where the data processing method may be performed by a computer device, and the computer device may include a terminal device (may be the terminal device 200a, the terminal devices 200b, … …, or the terminal device 200 n) or the service server 100 shown in fig. 1. As shown in fig. 6, the method may include:
step S201, obtaining a service image, wherein among pixels of the service image, pixels with gray values larger than or equal to a service gray threshold are determined as white pixels, and pixels with gray values smaller than the service gray threshold are determined as black pixels; setting the gray value of the white pixel point as a first gray value, and setting the gray value of the black pixel point as a second gray value, so as to obtain a gray image composed of the white pixel point and the black pixel point.
Specifically, the computer device may acquire a service image, through a service gray level threshold, may determine a pixel point with a gray level value greater than or equal to the service gray level threshold as a white pixel point, and set the gray level value of the white pixel point as a first gray level value, where the first gray level value may be a gray level value of 255.
The computer device may determine the pixel having a gray value smaller than the service gray threshold as a black pixel, and set the gray value of the black pixel as a second gray value, where the second gray value may be a gray value of 0, to obtain a gray map composed of the white pixel and the black pixel. The service gray threshold may be set by a service requirement or a specific service image, which is not limited herein in the embodiments of the present application.
Step S202, randomly determining seed pixel points in pixel points of the gray level image, marking adjacent pixel points meeting a connection threshold condition with the seed pixel points as new seed pixel points in adjacent pixel points of the seed pixel points until the pixel points in the gray level image are traversed, and determining the seed pixel points with the same mark as the same connection domain; and continuously determining a new connected domain in the unmarked pixel points in the gray level graph until the pixel points in the gray level graph are marked, so as to obtain a target image.
Specifically, the computer device may obtain a gray level map of the service image, randomly determine a seed pixel point in the gray level map, and mark, as a new seed pixel point, an adjacent pixel point that meets a connection threshold condition with the seed pixel point among adjacent pixel points of the seed pixel point. The connection threshold condition may be that the gray values of the two pixel points are the same, which is not limited herein.
The computer equipment can continuously traverse the adjacent pixel points meeting the condition of the communication threshold value in the adjacent pixel points of the new seed pixel points to make the same mark until the adjacent pixel points of the seed pixel points are traversed or the gray values of the adjacent pixel points are different, and the pixel points with the same mark are determined to be a communication domain.
The computer equipment can continue to determine another seed pixel point in the unmarked pixel point, and obtain a new connected domain of another different mark by the method until the pixel points in the gray level image all have the marks of the connected domain, so as to obtain a target image consisting of a plurality of connected domains.
Step S203, randomly determining an initial connected domain in the target image in the search acceleration engine, randomly determining initial pixel points in the initial connected domain, if at least one adjacent pixel point with different marks from the initial connected domain exists in N adjacent pixel points of the initial pixel points, determining the adjacent pixel point with different marks from the initial connected domain as an initial contour point, otherwise, re-determining the initial pixel point; n is a positive integer; and determining 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 with different marks of the initial connected domain and the initial connected domain.
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 8 neighborhood search as an example, 8 neighborhood may refer to the positional relationship of 8 directions of upper left, lower left, upper left, lower right, upper right, lower right around the center point.
The computer device may determine 8 adjacent pixel points adjacent to the initial pixel point, and the 8 adjacent pixel points may represent positional relationships in 8 directions of upper left, lower left, upper right, lower right, upper right, and lower right around the initial pixel point, respectively.
If there is at least one adjacent pixel point different from the sign of the initial connected domain among the 8 adjacent pixel points of the initial pixel point, the computer device may determine the adjacent pixel point different from the sign of the initial connected domain as the initial contour point. The initial contour point may be a pixel point representing an image contour in the target image, and the mode of determining the initial contour point may be that the boundary point of the connected domain is determined as the initial contour point in the above mode, or may be that the boundary point is determined by service requirements, which is not limited in the embodiment of the present application.
If the labels of the 8 adjacent pixels of the initial pixel are all initial connected domains, the computer device can redetermine the initial pixel.
The computer device may determine a neighborhood search matrix corresponding to the initial contour point by the dimension size of the initial contour point, a connected domain corresponding to an adjacent pixel point having a different sign than 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 may be a matrix centered on the initial contour point and including K rows by L columns of pixel points, where K and L are positive integers, where K and L may be determined by the size of the connected domain where the initial contour point is located, and the determining manner of K and L in the embodiment of the present application is not limited herein.
Step S204, 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, wherein the up-conversion matrix is used for determining up-shift rows, the center conversion matrix is used for determining center-shift rows, and the down-conversion matrix is used for determining down-shift rows;
specifically, reference may be made to the description of the row shift in S102 in the corresponding embodiment of fig. 3, and the description is not repeated here.
Step S205, respectively performing column displacement on the up-shift row, the center shift row and the down-shift row to obtain M conversion rows, determining coordinates of N neighborhood points in a neighborhood search matrix through the M conversion rows, determining the neighborhood point with a business contour relation with the initial contour point in the N neighborhood points as a target contour point based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuously traversing the new target contour point 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.
Specifically, the computer device performs column shifting to obtain the neighborhood point and the content of the coordinates of the neighborhood point in the neighborhood search matrix, which can be referred to the specific description of S103 in the corresponding embodiment of fig. 3, and will not be described herein.
The process of the computer device determining a neighborhood point having a business contour relationship with the initial contour point as a target contour point may be: determining the traversing sequence of N neighborhood points based on the coordinates of the N neighborhood points in the neighborhood search matrix; and acquiring gray values of N neighborhood points, and determining the neighborhood point which is traversed to the first time and has the same gray value as the initial contour point as a target contour point based on the traversing sequence of the N neighborhood points.
Specifically, the computer equipment can determine the gray values corresponding to the neighborhood points respectively and the relative position relation between the neighborhood points and the initial contour points through the coordinates of the neighborhood points in the neighborhood search matrix.
The computer device may determine the traversal order of the N neighborhood points by the relative positional relationship between the neighborhood points and the initial contour point, i.e., determine the first neighborhood point to perform the neighborhood search, and the search direction of the subsequent traversal cycle, for example, forward search or reverse search.
The computer device may determine, as the target contour point, a neighborhood point, among the N neighborhood points, that is traversed to first and has the same gray value as the initial contour point, the target contour point being also a pixel point in the target image that characterizes the image contour. The computer device may also determine, by other means, a point having a service profile relationship with the initial profile point as the target profile point, where the service profile relationship may be determined by a service requirement, and the embodiment of the present application is not limited herein.
The computer device may continue to perform the above steps by searching the matrix in the neighborhood corresponding to the target contour point, and continue to traverse to determine the next target contour point until the pixel points in the target image that characterize the image contour are traversed (or until the pixel points that characterize the image contour are traversed to be determined as the target contour point or the initial contour point).
The computer device can determine the initial contour point and the target contour point as the image contour in the target image, and complete the image contour processing of the business image.
It will be appreciated that N-neighborhood searches (e.g., 8-neighborhood search, 4-neighborhood search) performed by a computer device may be applied to a circuit control method of a chip (chip for computer system operation, control, information processing, program operation), and by dividing the neighborhood in a circuit and optimizing using an N-neighborhood search algorithm, the circuit performance of the chip may be improved.
According to the embodiment of the application, the service image is acquired, the pixel with the gray value larger than or equal to the service gray threshold value is determined to be the white pixel, and the pixel with the gray value smaller than the service gray threshold value is determined to be the black pixel; setting the gray value of the white pixel point as a first gray value, and setting the gray value of the black pixel point as a second gray value, so as to obtain a gray image composed of the white pixel point and the black pixel point. Randomly determining seed pixel points in pixel points of the gray level image, marking adjacent pixel points meeting a communication threshold condition with the seed pixel points as new seed pixel points in adjacent pixel points of the seed pixel points until the pixel points in the gray level image are traversed, and determining the seed pixel points with the same mark as the same communication domain; and continuously determining a new connected domain in the unmarked pixel points in the gray level graph until the pixel points in the gray level graph are marked, so as to obtain a target image. Randomly determining an initial connected domain in a target image in a search acceleration engine, randomly determining initial pixel points in the initial connected domain, determining adjacent pixel points which are different from the marks of the initial connected domain as initial contour points if at least one adjacent pixel point which is different from the marks of the initial connected domain exists in N adjacent pixel points of the initial pixel points, otherwise, re-determining the initial pixel points; n is a positive integer; and determining 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 with different marks of the initial connected domain and the initial connected domain. 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 up-shift rows in the up-conversion matrix, determining center shift rows in the center conversion matrix and determining down-shift rows in the down-conversion matrix; respectively performing column displacement on the up-shift line, the center-shift line and the down-shift line to obtain M transformation lines, determining coordinates of N neighborhood points in a neighborhood search matrix through the M transformation lines, determining the neighborhood points with business contour relations with the initial contour points in the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuously traversing new target contour points through the neighborhood search matrix corresponding to the target contour points until pixel points representing image contours in the target image are traversed; m and N are positive integers, and N is less than or equal to M. Therefore, the embodiment of the application can generate the neighborhood search matrix after determining the initial contour point, the dimension of the neighborhood search matrix is far smaller than the dimension of the pixel point of the whole image, so that the calculation amount of the chip for neighborhood search is reduced, the neighborhood points in all directions are obtained by transforming the rows and columns where the initial contour point is positioned, the steps of decoding and decoding coordinate data of the calculated neighborhood points can be reduced, the performance of a neighborhood search circuit in the chip is improved, all neighborhood directions on a plane are covered in the neighborhood points in all directions obtained by row and column transformation, and the neighborhood search circuit can be commonly used in different neighborhood demands.
Referring to fig. 7, fig. 7 is a flowchart of a data processing method provided in the embodiment of the present application, where the data processing method may be performed by a computer device, and the computer device may include a terminal device (may be the terminal device 200a, the terminal devices 200b, … …, or the terminal device 200 n) or the service server 100 shown in fig. 1. As shown in fig. 7, the method may include:
the computer equipment can input the business image to the task scheduling engine, the task scheduling engine can split the task, for example, the business image can be split into image areas, the task scheduling engine can balance the load through the number of other engines, and the split image areas are allocated to a plurality of binarization engines, search acceleration engines and the like for parallel processing. The splitting manner of the business image is not limited in the embodiment of the application.
The computer device may input the service image to the binarization engine, and the binarization engine may perform binarization processing on the service image to obtain a gray scale image of the service image, where the content of the binarization processing may be referred to the specific description of S201 in the corresponding embodiment of fig. 6, and no further description is given here.
The computer device may perform the connected domain labeling on the gray scale map obtained by the binarization processing through the connected domain labeling engine to obtain the target image, and the content of the connected domain labeling may be referred to the specific description of S202 in the corresponding embodiment of fig. 6, which is not described herein.
The computer device may input the target image to the search acceleration engine, and perform a neighborhood search on the target image to obtain an image contour in the target image, where the content of the neighborhood search may be referred to in the specific description of S101 to S103 in the corresponding embodiment of fig. 3, which is not described herein.
The computer device may perform post-processing on the image contours in the target image by the post-processing engine, where the post-processing may include screening, merging, sorting, and packaging, where the screening may be to screen the image contours required by the service from multiple image contours in the target image, the merging may be to sort the image contours meeting a certain service condition, for example, size, resolution, and the sorting may be to sort the merged service contours by the service condition, for example, size, resolution, and the packaging may be to package the output result of the image contours, so that the user may call in a simpler manner.
The task scheduling engine, the binarization engine, the search acceleration engine, the post-processing engine and the like can be components used for carrying out neighborhood search on the target image in the computer equipment, and can also be a hardware unit of a chip in a neighborhood search circuit.
It will be appreciated that N-neighborhood searches (e.g., 8-neighborhood search, 4-neighborhood search) performed by a computer device may be applied to a circuit control method of a chip (chip for computer system operation, control, information processing, program operation), and by dividing the neighborhood in a circuit and optimizing using an N-neighborhood search algorithm, the circuit performance of the chip may be improved.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application. As shown in fig. 8, the data processing apparatus 1 includes an initial processing module 800, a line shift module 810, a neighborhood processing module 820, and a binarization processing module 860. The initial processing module 800 may include an initial contour determining unit 801 and an initial matrix determining unit 802, the row shifting module 810 includes a first matrix transforming unit 811, a second matrix transforming unit 812 and a third matrix transforming unit 813, the neighborhood processing module 820 includes a first row transforming unit 821, a second row transforming unit 822, a third row transforming unit 823, an up-direction transforming unit 830, a center-direction transforming unit 840 and a down-direction transforming unit 850, and the binarization processing module 860 includes a seed determining unit 861 and a connected domain marking unit 862. Wherein the up-direction transforming unit 830 includes a first neighborhood determining subunit 831, a second neighborhood determining subunit 832, and a third neighborhood determining subunit 833, the center direction transforming unit 840 includes a fourth neighborhood determining subunit 841, a fifth neighborhood determining subunit 842, and a sixth neighborhood determining subunit 843, and the down-direction transforming unit 850 includes a seventh neighborhood determining subunit 851, an eighth neighborhood determining subunit 852, and a ninth neighborhood determining subunit 853.
The initial processing module 800 is configured to input pixel data corresponding to a 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 representing the image contour in the target image, and the neighborhood search matrix is a matrix taking the initial contour point as a center point;
an initial contour determining unit 801, configured to randomly determine an initial connected domain in a target image in a search acceleration engine, randomly determine an initial pixel in the initial connected domain, determine, if at least one adjacent pixel having a different sign from the initial connected domain exists in N adjacent pixels of the initial pixel, the adjacent pixel having the different sign from the initial connected domain as an initial contour point, and otherwise, redetermine the initial pixel; n is a positive integer;
an initial matrix determining unit 802, configured 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 point with a different sign from the initial connected domain, and the initial connected domain.
A row shifting module 810, configured to perform 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, 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;
A first matrix transformation unit 811, configured to move up K rows of the neighborhood search matrix by one row to obtain an up-conversion matrix, and determine an i+1th row in the up-conversion matrix as an up-shift row; the up-conversion matrix is a matrix of pixel points of K-1 rows by L columns;
a second matrix transformation unit 812, configured to construct a central transformation matrix that is the same as the neighborhood search matrix, and determine an ith row in the central transformation matrix as a center shift row;
a third matrix transforming unit 813, configured to move K rows of the neighborhood search matrix downward by one row to obtain a down-conversion matrix, and determine an i-1 th row in the down-conversion matrix as a down-shift row; the down-conversion matrix is a matrix of pixels of K-1 rows by L columns.
The neighborhood processing module 820 is configured to perform column shifting on the up-shift line, the center-shift line, and the down-shift line to obtain M transform lines, determine coordinates of N neighborhood points in the neighborhood search matrix through the M transform lines, determine, based on the coordinates of the N neighborhood points in the neighborhood search matrix, a neighborhood point having a business contour relationship with an initial contour point in the N neighborhood points as a target contour point, and continuously traverse a new target contour point through the neighborhood search matrix corresponding to the target contour point until traversing pixel points representing image contours in the target image; m and N are positive integers, and N is less than or equal to M.
The neighborhood processing module 820 is specifically configured to determine a traversal order of the N neighborhood points based on coordinates of the N neighborhood points in the neighborhood search matrix; and acquiring gray values of N neighborhood points, and determining the neighborhood point which is traversed to the first time and has the same gray value as the initial contour point as a target contour point based on the traversing sequence of the N neighborhood points.
A first line transformation unit 821 configured to move the up-shift line one column to the right to obtain a first transformation line, construct a second transformation line identical to the up-shift line, and move the up-shift line one column to the left to obtain a third transformation line;
a second line transforming unit 822, configured to shift the center shift line by one column to the right to obtain a fourth transformed line, construct a fifth transformed line identical to the center shift line, and shift the center shift line by one column to the left to obtain a sixth transformed line;
and a third line transforming unit 823, configured to shift the down-shifted line by one column to the right to obtain a seventh transformed line, construct an eighth transformed line identical to the down-shifted line, and shift the down-shifted line by one column to the left to obtain a ninth transformed line.
An upper direction transforming unit 830, configured to determine an upper direction neighborhood point and coordinates of the upper direction neighborhood point through the first transformation line, the second transformation line, and the third transformation line; the upper azimuth neighborhood point comprises an upper left neighborhood point, an upper neighborhood point and an upper right neighborhood point;
A first neighborhood determining subunit 831, configured to determine a j-th column of the first converted line as an upper left neighborhood point, and determine a column sequence number of the j-th column and a line sequence number of the first converted line as coordinates of the upper left neighborhood point;
a second neighborhood determining subunit 832, configured to determine a j-th column of the second transformed line as an upper neighborhood point, and determine a column sequence number of the j-th column and a line sequence number of the second transformed line as coordinates of the upper neighborhood point;
and a third neighborhood determining subunit 833, configured to determine the j-th column of the third transformed line as an upper right neighborhood point, and determine the column number of the j-th column and the line number of the third transformed line as coordinates of the upper right neighborhood point.
A central azimuth transforming unit 840 for determining the coordinates of the central azimuth neighborhood point and the central azimuth neighborhood point through the fourth transformation line, the fifth transformation line and the sixth transformation line; the central azimuth neighborhood point comprises a left neighborhood point, a central neighborhood point and a right neighborhood point;
a fourth neighboring domain determining sub-unit 841, configured to determine a j-th column of the fourth transformed line as a left neighboring domain point, and determine a column sequence number of the j-th column and a line sequence number of the fourth transformed line as coordinates of the left neighboring domain point;
a fifth neighborhood determining subunit 842, configured to determine a j-th column of the fifth transformed line as a central neighborhood point, and determine a column number of the j-th column and a line number of the fifth transformed line as coordinates of the central neighborhood point;
A sixth neighborhood determining subunit 843, configured to determine a j-th column of the sixth transformed line as a right neighborhood point, and determine a column number of the j-th column and a line number of the sixth transformed line as coordinates of the right neighborhood point.
A lower position transformation unit 850, configured to determine, through the seventh transformation line, the eighth transformation line, and the ninth transformation line, a lower position neighborhood point and coordinates of the lower position neighborhood point; the lower-azimuth neighborhood points comprise a lower-left neighborhood point, a lower-neighborhood point and a lower-right neighborhood point.
A seventh neighborhood determining subunit 851, configured to determine a j-th column of the seventh transformed line as a lower left neighborhood point, and determine a column sequence number of the j-th column and a line sequence number of the seventh transformed line as coordinates of the lower left neighborhood point;
an eighth neighborhood determining subunit 852, configured to determine a j-th column of the eighth transformed line as a next neighborhood point, and determine a column sequence number of the j-th column and a line sequence number of the eighth transformed line as coordinates of the next neighborhood point;
a ninth neighborhood determining subunit 853, configured to determine a j-th column of the ninth transformed line as a lower right neighborhood point, and determine a column number of the j-th column and a line number of the ninth transformed line as coordinates of the lower right neighborhood point.
The binarization processing module 860 is configured to obtain a service image, determine, as a white pixel, a pixel having a gray value greater than or equal to a service gray threshold, and determine, as a black pixel, a pixel having a gray value less than the service gray threshold, from among pixels of the service image;
The binarization processing module 860 is further configured to set a gray value of a white pixel point to a first gray value, set a gray value of a black pixel point to a second gray value, obtain a gray map composed of the white pixel point and the black pixel point, and perform connected domain labeling on the gray map to obtain a target image.
A seed determining unit 861, configured to randomly determine seed pixel points in pixel points of the gray level map, mark, among adjacent pixel points of the seed pixel points, adjacent pixel points that satisfy a connection threshold condition with the seed pixel points as new seed pixel points, until the pixel points in the gray level map are traversed, and determine seed pixel points with the same mark as the same connection domain;
and a connected domain marking unit 862, configured to continuously determine a new connected domain in the pixels that are not marked in the gray scale map until the pixels in the gray scale map are marked, so as to obtain a target image.
Referring to fig. 9, fig. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 9, the computer device 1000 may include: processor 1001, network interface 1004, and memory 1005, and in addition, the above-described computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display (Display), a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface, among others. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may also optionally be at least one storage device located remotely from the processor 1001. As shown in fig. 9, an operating system, a network communication module, a user interface module, and a device control application may be included in a memory 1005, which is one type of computer-readable storage medium.
In the computer device 1000 shown in fig. 9, the network interface 1004 may provide a network communication network element; while user interface 1003 is primarily used as an interface for providing input to a user; and the processor 1001 may be used to invoke a device control application stored in the memory 1005 to implement:
inputting pixel data corresponding to the target image into a search acceleration engine in a processor, and acquiring 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 representing the image contour in the target image, and the neighborhood search matrix is a matrix taking 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 up-shift rows in the up-conversion matrix, determining center shift rows in the center conversion matrix and determining down-shift rows in the down-conversion matrix;
respectively performing column displacement on the up-shift line, the center-shift line and the down-shift line to obtain M transformation lines, determining coordinates of N neighborhood points in a neighborhood search matrix through the M transformation lines, determining the neighborhood points with business contour relations with the initial contour points in the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuously traversing new target contour points through the neighborhood search matrix corresponding to the target contour points until pixel points representing image contours in the target image are traversed; m and N are positive integers, and N is less than or equal to M.
It should be understood that the computer device 1000 described in the embodiments of the present application may perform the description of the data processing method in any of the foregoing embodiments corresponding to fig. 3 and fig. 6, which is not repeated herein. In addition, the description of the beneficial effects of the same method is omitted.
Furthermore, it should be noted here that: the embodiment of the present application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program, when the processor executes the computer program, the description of the data processing method in any one of the corresponding embodiments of fig. 3 and fig. 6 can be executed, and therefore, a detailed description will not be given here. In addition, the description of the beneficial effects of the same method is omitted. For technical details not disclosed in the embodiments of the computer-readable storage medium according to the present application, please refer to the description of the method embodiments of the present application.
The computer readable storage medium may be the data processing apparatus provided in any one of the foregoing embodiments or an internal storage unit of the computer device, for example, a hard disk or a 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 Media Card (SMC), a Secure Digital (SD) card, a flash card (flash card) or the like, which are provided on the computer device. Further, the computer-readable storage medium may also include both internal storage units and external storage devices of the computer 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 or is to be displayed.
Furthermore, it should be noted here that: embodiments of the present application also provide a computer program product comprising a computer program stored in a computer readable storage medium. The processor of the computer device reads the computer program from the computer readable storage medium and executes the computer program to cause the computer device to perform the method provided by the corresponding embodiment of any of the previous figures 3 and 6.
The terms first, second and the like in the description and in the claims and drawings of the embodiments of the present application are used for distinguishing between different objects and not for describing a particular sequential order. Furthermore, the term "include" and any variations thereof is intended to cover a non-exclusive inclusion. For example, a process, method, apparatus, article, or device that comprises a list of steps or elements is not limited to the list of steps or modules but may, in the alternative, include other steps or modules not listed or inherent to such process, method, apparatus, article, or device.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied as electronic hardware, as a computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of network elements in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether these network elements are implemented in hardware or software depends on the specific application and design constraints of the solution. The skilled person may use different methods for implementing the described network elements for each specific application, but such implementation should not be considered beyond the scope of the present application.
The foregoing disclosure is only illustrative of the preferred embodiments of the present application and is not intended to limit the scope of the claims herein, as the equivalent of the claims herein shall be construed to fall within the scope of the claims herein.

Claims (15)

1. A method of data processing, comprising:
inputting pixel data corresponding to a target image into a search acceleration engine in a processor, and acquiring 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 representing an image contour in the target image, and the neighborhood search matrix is a matrix taking 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 up-shift rows in the up-conversion matrix, determining center shift rows in the center conversion matrix and determining down-shift rows in the down-conversion matrix;
respectively performing column displacement on the up-shift row, the center-shift row and the down-shift row to obtain M transformation rows, determining coordinates of N neighborhood points in the neighborhood search matrix through the M transformation rows, determining a neighborhood point with a business contour relation with the initial contour point in the N neighborhood points as a target contour point based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuously traversing 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.
2. The method of claim 1, wherein the neighborhood search matrix is a matrix comprising K rows by L columns of pixel points, the initial contour points are positive integers in an ith row of the neighborhood search matrix, the 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-conversion row in the up-conversion matrix, determining a center conversion row in the center conversion matrix and determining a down-conversion row in the down-conversion matrix based on the initial contour points, and the method comprises:
moving the K rows of the neighborhood search matrix upwards by one row to obtain an up-conversion matrix, and determining the ith row in the up-conversion matrix as an up-shift row; the up-conversion matrix is a matrix of pixel points of K-1 rows by L columns;
constructing a central transformation matrix which is the same as the neighborhood search matrix, and determining the ith row in the central transformation matrix as a central shift row;
the K rows of the neighborhood search matrix are downwards moved by one row, a down-conversion matrix is obtained, and the ith row in the down-conversion matrix is determined to be a downwards-moved row; the down-conversion matrix is a matrix of pixel points of K-1 rows by L columns.
3. The method of claim 1, wherein the column shifting the up-shifted row, the center-shifted row, and the down-shifted row, respectively, results in M transform rows, comprising:
shifting the up-shift line by one column to the right to obtain a first conversion line, constructing a second conversion line identical to the up-shift line, and shifting the up-shift line by one column to the left to obtain a third conversion line;
shifting the center shift line to the right by one column to obtain a fourth conversion line, constructing a fifth conversion line which is the same as the center shift line, and shifting the center shift line to the left by one column to obtain a sixth conversion line;
and moving the downward shift line to the right by one column to obtain a seventh conversion line, constructing an eighth conversion line which is the same as the downward shift line, and moving the downward shift line to the left by one column to obtain a ninth conversion line.
4. The method of claim 3, wherein the N domain points include an upper azimuth neighborhood point, a center azimuth neighborhood point, and a lower azimuth neighborhood point; the determining coordinates of the N neighborhood points in the neighborhood search matrix through the M transform rows includes:
determining coordinates of the upper azimuth neighborhood point and the upper azimuth neighborhood point through the first transformation line, the second transformation line and the third transformation line; the upper azimuth neighborhood point comprises an upper left neighborhood point, an upper neighborhood point and an upper right neighborhood point;
Determining coordinates of the central azimuth neighborhood point and the central azimuth neighborhood point through the fourth transformation line, the fifth transformation line and the sixth transformation line; the central azimuth neighborhood point comprises a left neighborhood point, a central neighborhood point and a right neighborhood point;
determining coordinates of the lower position neighborhood point and the lower position neighborhood point through the seventh transformation line, the eighth transformation line and the ninth transformation line; the lower azimuth neighborhood points comprise lower left neighborhood points, lower neighborhood points and lower right neighborhood points.
5. The method of claim 4, wherein the initial contour point is in a j-th column of the neighborhood search matrix, j being a positive integer, wherein the determining the coordinates of the upper neighbor point and the upper neighbor point by the first transform line, the second transform line, and the third transform line comprises:
determining a j-th column of the first transformation line as an upper left neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the first transformation line as coordinates of the upper left neighborhood point;
determining a j-th column of the second transformation line as an upper neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the second transformation line as coordinates of the upper neighborhood point;
And determining the j-th column of the third transformation line as an upper right neighborhood point, and determining the column sequence number of the j-th column and the line sequence number of the third transformation line as coordinates of the upper right neighborhood point.
6. The method of claim 4, wherein the initial contour point is in a j-th column of the neighborhood search matrix, j being a positive integer, wherein the determining the coordinates of the center orientation neighborhood point and the center orientation neighborhood point by the fourth transform row, the fifth transform row, and the sixth transform row comprises:
determining a j-th column of the fourth transformation line as a left neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the fourth transformation line as coordinates of the left neighborhood point;
determining a j-th column of the fifth transformation line as a central neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the fifth transformation line as coordinates of the central neighborhood point;
and determining the j-th column of the sixth transformation line as a right neighborhood point, and determining the column sequence number of the j-th column and the line sequence number of the sixth transformation line as coordinates of the right neighborhood point.
7. The method of claim 4, wherein the initial contour point is in a j-th column of the neighborhood search matrix, j being a positive integer, wherein the determining the coordinates of the lower neighborhood point and the lower neighborhood point by the seventh transform line, the eighth transform line, and the ninth transform line comprises:
Determining a j-th column of the seventh transformation line as a left lower neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the seventh transformation line as coordinates of the left lower neighborhood point;
determining a j-th column of the eighth transformation line as a next neighborhood point, and determining a column sequence number of the j-th column and a line sequence number of the eighth transformation line as coordinates of the next neighborhood point;
and determining the j-th column of the ninth converted row as a right lower neighborhood point, and determining the column sequence number of the j-th column and the row sequence number of the ninth converted row as coordinates of the right lower neighborhood point.
8. The method as recited in claim 1, further comprising:
acquiring a service image, wherein among the pixel points of the service image, the pixel point with the gray value larger than or equal to the service gray threshold value is determined as a white pixel point, and the pixel point with the gray value smaller than the service gray threshold value is determined as a black pixel point;
setting the gray value of the white pixel point as a first gray value, setting the gray value of the black pixel point as a second gray value, obtaining a gray map composed of the white pixel point and the black pixel point, and carrying out connected domain marking on the gray map to obtain a target image.
9. The method according to claim 8, wherein the performing connected domain labeling on the gray scale map to obtain a target image includes:
randomly determining seed pixel points in the pixel points of the gray level image, marking the adjacent pixel points meeting the condition of a communication threshold value with the seed pixel points as new seed pixel points in the adjacent pixel points of the seed pixel points until the pixel points in the gray level image are traversed, and determining the seed pixel points with the same mark as the same communication domain;
and continuously determining a new connected domain in the unmarked pixel points in the gray level graph until the pixel points in the gray level graph are marked, so as to obtain a target image.
10. The method according to claim 1, wherein inputting the 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:
randomly determining an initial connected domain in the target image in the search acceleration engine, randomly determining initial pixel points in the initial connected domain, if at least one adjacent pixel point which is different from the mark of the initial connected domain exists in N adjacent pixel points of the initial pixel points, determining the adjacent pixel point which is different from the mark of the initial connected domain as an initial contour point, otherwise, re-determining the initial pixel point; n is a positive integer;
And determining a neighborhood search matrix corresponding to the initial contour point based on the initial contour point, a connected domain corresponding to an adjacent pixel point with different marks from the initial connected domain and the initial connected domain.
11. The method of claim 1, wherein the determining, based on coordinates of the N neighboring points in the neighborhood search matrix, a neighboring point of the N neighboring points having a business contour relationship with the initial contour point as a target contour point comprises:
determining the traversal sequence of N neighborhood points based on the coordinates of the N neighborhood points in the neighborhood search matrix;
and acquiring gray values of the N neighborhood points, and determining the neighborhood point which is traversed to the first time and has the same gray value as the initial contour point as a target contour point based on the traversing sequence of the N neighborhood points.
12. A data processing apparatus, comprising:
the initial processing module is used for inputting the pixel data corresponding to the target image into a search acceleration engine in the processor, and acquiring a neighborhood search matrix corresponding to the initial contour point in the pixel data from the search acceleration engine; the initial contour point is a pixel point representing an image contour in the target image, and the neighborhood search matrix is a matrix taking the initial contour point as a center point;
The line shifting module is used for carrying out line shifting on the neighborhood search matrix to obtain an up-conversion matrix, a central conversion matrix and a down-conversion matrix corresponding to the neighborhood search matrix, wherein the up-conversion matrix is used for determining up-shift lines, the central conversion matrix is used for determining central shift lines, and the down-conversion matrix is used for determining down-shift lines;
the neighborhood processing module is used for respectively carrying out column displacement on the up-shift row, the center shift row and the down-shift row to obtain M conversion rows, determining the coordinates of N neighborhood points in the neighborhood search matrix through the M conversion rows, determining the neighborhood points with business contour relation with the initial contour point in the N neighborhood points as target contour points based on the coordinates of the N neighborhood points in the neighborhood search matrix, and continuously traversing new target contour points through the neighborhood search matrix corresponding to the target contour points 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.
13. A computer device, comprising: a processor, a memory, and a network interface;
the processor is connected to the memory, the network interface for providing data communication functions, the memory for storing a computer program, the processor for invoking the program code to cause the computer device to perform the method of any of claims 1-11.
14. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program adapted to be loaded and executed by a processor to cause a computer device having the processor to perform the method of any of claims 1-11.
15. A computer program product, characterized in that the computer program product comprises a computer program stored in a computer readable storage medium and adapted to be read and executed by a processor to cause a computer device with the processor to perform the method of any of claims 1-11.
CN202311292291.1A 2023-09-28 2023-09-28 Data processing method, device, equipment and readable storage medium Pending CN117333502A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311292291.1A CN117333502A (en) 2023-09-28 2023-09-28 Data processing method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311292291.1A CN117333502A (en) 2023-09-28 2023-09-28 Data processing method, device, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN117333502A true CN117333502A (en) 2024-01-02

Family

ID=89291281

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311292291.1A Pending CN117333502A (en) 2023-09-28 2023-09-28 Data processing method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN117333502A (en)

Similar Documents

Publication Publication Date Title
CN107944450B (en) License plate recognition method and device
CN105631486A (en) image character recognition method and device
CN102171723B (en) Method for red-eye detection
CN109389110B (en) Region determination method and device
CN111160140A (en) Image detection method and device
CN111598076B (en) Method and device for detecting and processing date in label image
CN112132216A (en) Vehicle type recognition method and device, electronic equipment and storage medium
CN110399760A (en) A kind of batch two dimensional code localization method, device, electronic equipment and storage medium
CN110210480A (en) Character recognition method, device, electronic equipment and computer readable storage medium
CN110610170B (en) Document comparison method based on image accurate correction
CN115440159A (en) Image correction method, and correction method and device for LED display screen image
CN115272691A (en) Training method, recognition method and equipment for steel bar binding state detection model
CN111639523B (en) Target detection method, device, computer equipment and storage medium
CN111127592B (en) Picture color filling method and device, electronic equipment and readable storage medium
CN112862703A (en) Image correction method and device based on mobile photographing, electronic equipment and medium
CN112200004A (en) Training method and device of image detection model and terminal equipment
CN117333502A (en) Data processing method, device, equipment and readable storage medium
CN111222558A (en) Image processing method and storage medium
CN116976372A (en) Picture identification method, device, equipment and medium based on square reference code
CN110659343A (en) Extraction method, device and equipment of geo-fence data
CN112766256B (en) Grating phase diagram processing method and device, electronic equipment and storage medium
CN113537392B (en) Method and device for identifying similar images, computing equipment and computer storage medium
CN113160126B (en) Hardware Trojan detection method, hardware Trojan detection device, computer equipment and storage medium
CN114694159A (en) Engineering drawing BOM identification method and device, electronic equipment and storage medium
CN110991050B (en) CAD (computer-aided design) image stacking method and related product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination