CN109035285B - Image boundary determining method and device, terminal and storage medium - Google Patents

Image boundary determining method and device, terminal and storage medium Download PDF

Info

Publication number
CN109035285B
CN109035285B CN201710437879.XA CN201710437879A CN109035285B CN 109035285 B CN109035285 B CN 109035285B CN 201710437879 A CN201710437879 A CN 201710437879A CN 109035285 B CN109035285 B CN 109035285B
Authority
CN
China
Prior art keywords
boundary
boundary points
straight line
points
image
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.)
Active
Application number
CN201710437879.XA
Other languages
Chinese (zh)
Other versions
CN109035285A (en
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.)
Shenzhen Yihua Computer Co Ltd
Shenzhen Yihua Time Technology Co Ltd
Shenzhen Yihua Financial Intelligent Research Institute
Original Assignee
Shenzhen Yihua Computer Co Ltd
Shenzhen Yihua Time Technology Co Ltd
Shenzhen Yihua Financial Intelligent Research Institute
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 Shenzhen Yihua Computer Co Ltd, Shenzhen Yihua Time Technology Co Ltd, Shenzhen Yihua Financial Intelligent Research Institute filed Critical Shenzhen Yihua Computer Co Ltd
Priority to CN201710437879.XA priority Critical patent/CN109035285B/en
Publication of CN109035285A publication Critical patent/CN109035285A/en
Application granted granted Critical
Publication of CN109035285B publication Critical patent/CN109035285B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/181Segmentation; Edge detection involving edge growing; involving edge linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07DHANDLING OF COINS OR VALUABLE PAPERS, e.g. TESTING, SORTING BY DENOMINATIONS, COUNTING, DISPENSING, CHANGING OR DEPOSITING
    • G07D7/00Testing specially adapted to determine the identity or genuineness of valuable papers or for segregating those which are unacceptable, e.g. banknotes that are alien to a currency
    • G07D7/20Testing patterns thereon
    • G07D7/2008Testing patterns thereon using pre-processing, e.g. de-blurring, averaging, normalisation or rotation

Abstract

The invention discloses an image boundary determining method and device, a terminal and a storage medium, wherein the method comprises the following steps: for each side of the image, extracting a plurality of boundary points of the image on the side; performing singular value decomposition according to the plurality of boundary points to obtain singular values; adjusting the singular value according to a preset threshold value; reconstructing boundary points by using the adjusted singular values; and performing straight line fitting according to the reconstructed boundary points to determine the boundary of the image on the side. The method can eliminate the interference of abnormal points or noise points in the boundary points on the straight line fitting, improve the accuracy of the straight line fitting and ensure that the determined image boundary is more accurate.

Description

Image boundary determining method and device, terminal and storage medium
Technical Field
The present invention relates to image processing technologies, and in particular, to an image boundary determining method and apparatus, a terminal, and a storage medium.
Background
The banknote recognition process requires preprocessing of the banknote image including denoising, brightness compensation, edge detection and skew correction. In the edge detection process, the boundary points of the paper currency are searched, the edge of the paper currency can be obtained by utilizing the discrete boundary points to perform straight line fitting, the central point and the inclination angle of the paper currency can be further calculated, and then the paper currency image is corrected in a rotating mode, so that the position of the image is normalized.
However, the banknotes are torn, wrinkled, folded, and stained during the circulation process, and noise or abnormal points occur when the boundary points are searched, and the noise or abnormal points affect the accuracy of the fitted straight line, further affect the processing of the banknote image, and even affect the recognition of the banknotes.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The invention provides an image boundary determining method and device, a terminal and a storage medium, which can effectively eliminate abnormal points in boundary points, avoid the influence of the abnormal points on the straight line fitting precision and enable the fitted image boundary to be more accurate.
In a first aspect, an embodiment of the present invention provides an image boundary determining method, including:
for each side of an image, extracting a plurality of boundary points of the image on the side;
performing singular value decomposition according to the plurality of boundary points to obtain singular values;
adjusting the singular value according to a preset threshold value;
reconstructing boundary points by using the adjusted singular values;
and performing straight line fitting according to the reconstructed boundary points to determine the boundary of the image on the side.
Preferably, the adjusting the singular value according to a preset threshold includes: respectively comparing the singular values with the preset threshold value; and if the singular value is smaller than the preset threshold value, adjusting the singular value to be 0.
Preferably, reconstructing the boundary points by using the adjusted singular values includes: and calculating a new boundary point by using a singular value decomposition formula and the adjusted singular value.
Preferably, the performing singular value decomposition according to the plurality of boundary points includes: forming a boundary point matrix by the coordinate data of the plurality of boundary points; and carrying out singular value decomposition on the boundary point matrix.
Preferably, before the singular value decomposition according to the plurality of boundary points, the method further comprises:
segmenting the plurality of boundary points;
determining a best fit straight line according to the boundary points of the segments and the corresponding fit straight lines;
respectively acquiring a deviation value of each boundary point in the plurality of boundary points and the best fitting straight line;
deleting boundary points with deviation values larger than a preset deviation threshold value;
performing singular value decomposition according to the plurality of boundary points, including: forming a boundary point matrix by using the coordinate data of the rest boundary points; and carrying out singular value decomposition on the boundary point matrix.
Preferably, determining a best fit straight line according to the boundary points of the segments and the corresponding fit straight lines comprises:
step A, performing straight line fitting according to the boundary point of the first section to obtain a primary fitting straight line;
b, respectively calculating a deviation value of each boundary point of the plurality of boundary points and the preliminary fitting straight line, and calculating the number of the boundary points of which the deviation values are less than or equal to the preset deviation threshold;
step C, comparing the number of the boundary points with the preset number;
step D, if the number of the boundary points exceeds the preset number, determining the current straight line as a best fit straight line;
step E, if the number of the boundary points does not exceed the preset number, performing straight line fitting according to the boundary points of the next section, taking the obtained straight line as a primary fitting straight line, and executing the step B until the boundary points meeting the preset number are found;
and F, if the number of the boundary points calculated by the preliminary fitting according to each section of boundary points does not exceed the preset number, determining a straight line corresponding to the maximum number of the boundary points as a best fitting straight line.
Preferably, the deviation value D between the boundary point and the straight line is calculated by the following formula:
D=|kxi+b-yi|,
wherein the linear equation is that y is kx + b, k and b are linear constants, and k is not equal to 0; the boundary point i has the coordinate of (x)i,yi)。
In a second aspect, an embodiment of the present invention further provides an image boundary determining apparatus, including:
the device comprises a boundary point extraction module, a boundary point extraction module and a boundary point extraction module, wherein the boundary point extraction module is used for extracting a plurality of boundary points of each side of an image;
the singular value decomposition module is used for carrying out singular value decomposition according to the plurality of boundary points to obtain singular values;
the singular value adjusting module is used for adjusting the singular value according to a preset threshold value;
the boundary point reconstruction module is used for reconstructing boundary points by using the adjusted singular values;
and the boundary determining module is used for performing straight line fitting according to the reconstructed boundary points and determining the boundary of the image on the side.
In a third aspect, an embodiment of the present invention further provides a terminal, where the terminal includes:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement an image boundary determination method as in any embodiment of the invention.
In a fourth aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the image boundary determining method according to any embodiment of the present invention.
According to the method, the singular value decomposition is carried out on the boundary points, the singular value is adjusted by using the preset threshold value, and then the boundary points are reconstructed by using the adjusted singular value, so that the interference of the abnormal points (or noise points) in the boundary points to the linear fitting can be eliminated, the accuracy of the linear fitting is improved, the determined image boundary is more accurate, and the subsequent image processing and image identification processes are facilitated.
Drawings
FIG. 1 is a flowchart of an image boundary determining method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of prior art boundary points and their fitted straight lines;
FIG. 3 is a schematic diagram of a reconstructed boundary point and a fitted straight line thereof according to an embodiment of the present invention;
FIG. 4 is a flowchart of an image boundary determining method according to a second embodiment of the present invention;
FIG. 5 is a flowchart for determining a best-fit straight line according to a second embodiment of the present invention;
fig. 6 is a block diagram of an image boundary determining apparatus according to a third embodiment of the present invention;
fig. 7 is a schematic structural diagram of a terminal according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an image boundary determining method according to an embodiment of the present invention, which is applicable to determining an image boundary, especially to an image with a straight boundary and an abnormal boundary, for example, an image with a shape of a triangle, a rectangle, a polygon, or the like, and specifically, to determining a boundary of a banknote image in a banknote image recognition process. The method may be performed by an image boundary determining apparatus, such as a terminal having a calculation processing function. As shown in fig. 1, the method specifically includes the following steps:
step 110, for each side of the image, extracting a plurality of boundary points of the image on the side.
The method for extracting the image boundary points may use an existing method, which is not limited in the present invention. For example, searching is performed row by row or column by column, taking extracting the left boundary point of the image as an example, finding the midpoint in the vertical direction of the image, starting scanning from left to right, finding the left boundary point of the row, moving a fixed number of rows (e.g., 4 rows) downward or upward, finding the left boundary point of the row, and continuing moving until a preset number of left boundary points, e.g., 40 boundary points, are found. Whether the pixel point is a boundary point can be determined through the change of the gray values of the pixel point and the surrounding pixel points, and because the background of the general image is black, the boundary between the image boundary and the background is obvious.
And 120, performing singular value decomposition according to the plurality of boundary points to obtain singular values.
Wherein the performing of the singular value decomposition according to the plurality of boundary points may be to construct coordinate data of the plurality of boundary points into a boundary point matrix, and then perform the singular value decomposition on the boundary point matrix. The coordinates of the boundary points are (x)i,yi) N, N represents the number of boundary points. The way the boundary point matrix is constructed is as follows: (1) the number of rows of the boundary point matrix may be the number of boundary points, and the number of columns may be 2 (i.e., two-dimensional coordinates), that is, the first column of data in the matrix is the abscissa of each boundary point, and the second column of data is the ordinate of each boundary point; or, (2) the number of rows of the boundary point matrix is 2 (i.e., two-dimensional coordinates), and the number of columns is the number of boundary points, that is, the first row of data in the matrix is the abscissa of each boundary point, and the second row of data is the ordinate of each boundary point.
The singular value decomposition formula is: a is U ∑ V ', U is an m × m order unitary matrix, Σ is a half positive definite m × n order diagonal matrix, V ' is an n × n order unitary matrix, V ' represents the transpose of the matrix V. Element sigma on sigma diagonaliiI.e. the singular values of the matrix a. The specific calculation process of the singular value decomposition is known to those skilled in the art and will not be described in detail herein.
And step 130, adjusting the singular value according to a preset threshold value.
For the same image, the predetermined threshold may be a suitable value selected by a large number of sample experiments. Specifically, a large number of singular values may be obtained through a sample experiment, and then a suitable value is selected as a preset threshold according to the singular values, for example, for a banknote image, 1000 singular values are obtained through 500 banknote image samples, the singular values may be divided into two categories (for example, the categories are classified through a K-nearest neighbor (KNN) classification algorithm), the center of each category is calculated, and the average value of the two categories of centers is taken as the preset threshold.
And step 140, reconstructing boundary points by using the adjusted singular values.
For the singular value decomposition formula, the adjusted singular value is used as a known condition in the step, and a boundary point matrix is obtained in a reverse mode, so that the coordinate data of the reconstructed boundary point can be obtained. If the boundary points are substantially distributed around a straight line, a larger value and a smaller value will appear after the singular value decomposition. The size of the singular value can reflect the importance degree of the corresponding part in the original matrix, and the noise data in the original matrix can be eliminated by adjusting the singular value and reconstructing the matrix data.
And 150, performing straight line fitting according to the reconstructed boundary points, and determining the boundary of the image on the side.
However, the existing line fitting method may be used, for example, the most common least square method is used to fit the line to the reconstructed boundary points, and other line fitting methods may be used. And the straight line obtained by fitting is the image boundary.
The method determines the boundary of each side of the image by executing the steps for each side, so that the boundaries of all sides of the image can be obtained.
According to the technical scheme, the singular value decomposition is carried out on the boundary points, the singular value is adjusted by using the preset threshold value, then the boundary points are reconstructed by using the adjusted singular value, the interference of the singular points (or noise points) in the boundary points to the linear fitting can be eliminated, the accuracy of the linear fitting is improved, the determined image boundary is more accurate, and the subsequent image processing and image recognition processes are facilitated.
On the basis of the above technical solution, preferably, the singular value may be adjusted by the following steps: respectively comparing the singular values with a preset threshold value; and if the singular value is smaller than the preset threshold value, adjusting the singular value to be 0. The singular value is smaller than a preset threshold value, which indicates that the importance of the corresponding part of the singular value in the original matrix is not high, and may be an abnormal point, the singular value smaller than the preset threshold value is adjusted to 0, and the noise data in the original matrix can be eliminated through the boundary point reconstruction.
Preferably, reconstructing the boundary points using the adjusted singular values may include: and calculating a new boundary point by using a singular value decomposition formula and the adjusted singular value. Specifically, the matrix formed by the adjusted singular values is sigma1Using the formula A1=U∑1V' solving a new boundary point matrix A1According to matrix A1The coordinate data of each boundary point therein can be known. The resulting boundary points may exclude noise interference.
Furthermore, before the method for reconstructing boundary points by singular value decomposition shown in fig. 1 is performed, the extracted boundary points may be subjected to preliminary preprocessing: firstly, performing straight line fitting (a least square method can be used) on the extracted boundary points to obtain a straight line, eliminating the boundary points with larger deviation by utilizing the deviation of the points and the straight line to finish primary abnormal data elimination, and then finishing the processes of boundary point reconstruction and straight line fitting by utilizing singular value decomposition based on the rest boundary points to eliminate the interference of abnormal data.
Fig. 2 is a schematic diagram of boundary points and their fitted straight lines in the prior art, in which the horizontal axis is x-axis and the vertical axis is y-axis, the value of the straight line equation k in fig. 2 is 2.0783, the value of b is 0.01842, and the difference between the sample point and the straight line distance is 0.50291. The sample point and straight line distance difference is the sum of the distances of the boundary points to the straight line. The singular value decomposition of the boundary point data shown in fig. 2 is performed to obtain singular values 6.0397 and 0.2187, it can be seen that the first singular value is much larger than the second singular value, the data contains some noise, and the second singular value is negligible in the corresponding part of the original matrix decomposition. The boundary points and the schematic diagram of the fitting straight line thereof obtained after reconstructing the boundary point data through singular value decomposition are shown in fig. 3, the value of the straight line equation k shown in fig. 3 is 2.0953, and the value of b is 1.4129e-16The difference between the sample point and the straight line distance is 1.289e-15The main sample points are retained, and noise is eliminated.
Example two
On the basis of the first embodiment, the present embodiment provides a preferred implementation manner of screening the boundary points before step 120, so that all boundary points with large deviation can be excluded more accurately. As shown in fig. 4, the image boundary determining method of the present embodiment includes the following steps:
for each side of the image, a plurality of boundary points of the image on the side are extracted, step 410.
And 420, segmenting the plurality of boundary points.
The specific segmentation may be determined according to actual conditions, for example, for an upper boundary, a lower boundary, or a boundary in a similar direction, the segmentation may be performed according to an X coordinate value; segmentation may be performed in terms of Y-coordinate values for left boundaries, right boundaries, or boundaries of similar directions. The segments can be divided equally, for example, 10 boundary points are one segment and are divided into 10 segments; the number of the boundary points of each segment may be, for example, 8, 9, 10, 9, or the like.
And 430, determining the best fit straight line according to the boundary points of the segments and the corresponding fit straight lines. For example, a straight line may be fitted to each segment of boundary points, and a straight line including the most boundary points may be used as a best-fit straight line.
Step 440, obtaining a deviation value of each boundary point of the plurality of boundary points and the best fit straight line respectively.
Specifically, the best-fit straight-line equation can be expressed as y ═ kx + b, k and b are constants for a straight line, and k ≠ 0. For the boundary point (x)i,yi) The deviation D between the boundary point and the straight line can be calculated by the following formula: d ═ kxi+b-yiL. In practical applications, if the deviation value between the boundary point and the straight line is calculated in step 430 when determining the best fit straight line, the corresponding data that has been calculated can be directly obtained here without recalculation.
And step 450, deleting the boundary points with the deviation values larger than the preset deviation threshold value. The preset deviation threshold value may be set according to actual conditions, for example, set to 3. The deviation value is larger than the preset threshold value, which means that the deviation between the boundary point and the best fit straight line is larger and needs to be eliminated.
Step 460, forming a boundary point matrix from the coordinate data of the remaining boundary points, and performing singular value decomposition on the boundary point matrix to obtain singular values.
And 470, adjusting the singular value according to a preset threshold value, and reconstructing the boundary point by using the adjusted singular value. Specifically, the boundary points that initially constitute the boundary point matrix, that is, the boundary points that remain after the boundary points with large deviation are deleted from the extracted boundary points, are reconstructed.
And step 480, performing straight line fitting according to the reconstructed boundary points to determine the boundary of the image on the side.
According to the method, the boundary points are segmented to determine the best fit straight line, then the boundary points with large deviation with the best fit straight line are eliminated, the interference of the points on boundary fitting can be accurately eliminated, and the accuracy of subsequently determining the image boundary is improved; and boundary point reconstruction is performed by using singular value decomposition, so that the accuracy of the final fitting boundary can be further improved.
Preferably, as shown in FIG. 5, step 430 may determine the best-fit straight line by:
and 510, performing straight line fitting according to the boundary points of the first section to obtain a primary fitting straight line.
The sequence numbers of the segments may be sorted from small to large (or from large to small) according to the X-coordinate value or the Y-coordinate value, or may be randomly sorted. The straight line fitting in this step may be a least squares method or other methods. The linear equation obtained in this step can be expressed as y ═ kx + b, k and b are linear constants, and k ≠ 0.
Step 520, calculating a deviation value between each boundary point of the plurality of boundary points and the preliminary fitting straight line, and calculating the number of boundary points with deviation values less than or equal to a preset deviation threshold.
In this step, if the deviation value of the boundary point and the straight line is less than or equal to the preset deviation threshold, it is determined that the boundary point is on the straight line, otherwise, it is determined that the boundary point is not on the straight line, and the deviation is large. To pairAt the boundary point (x)i,yi) The deviation D from the straight line can be calculated by the following formula: d ═ kxi+b-yi|。
Step 530, comparing the number of the boundary points with a preset number. The preset number may be set according to an actual situation, and may be three-fourths of the total number of boundary points, for example.
And 540, if the number of the boundary points exceeds the preset number, determining the current straight line as a best fit straight line, and terminating the algorithm.
And 550, if the number of the boundary points does not exceed the preset number, performing straight line fitting according to the boundary points of the next section, taking the obtained straight line as a primary fitting straight line, then returning to the step 520 to count the number of the boundary points with the deviation values less than or equal to the preset deviation threshold value until the boundary points meeting the preset number are found, and taking the corresponding straight lines as the best fitting straight lines.
And 560, if the number of the boundary points calculated by the preliminary fitting according to each section of the boundary points does not exceed the preset number, determining the straight line corresponding to the maximum number of the boundary points as the best fitting straight line. For example, the extracted boundary points are divided into 10 segments in total, and according to the above steps 510 to 550, if the number of the boundary points calculated in the 10 segments does not exceed the preset number, the straight line corresponding to the maximum number of the boundary points is determined as the best fit straight line.
The preferred embodiment provides the step of determining the best fit straight line, the best fit straight line is found out according to the deviation of the boundary points and the straight line by segmenting the boundary points and fitting the straight line according to the segmentation, and the method is simple, reliable and easy to implement.
Furthermore, the following steps may also be employed to determine the best-fit straight line:
(1) and respectively performing linear fitting on each section of boundary points to obtain corresponding fitting straight lines.
For example, if the boundary points are divided into j segments in total, corresponding j fitting straight lines are obtained. The straight line fitting in this step may be a least squares method or other methods.
(2) For eachThe strip fitting straight line y is kjx+bjRespectively calculating the deviation value D of each boundary point and the fitted straight lineji=|kjxi+bj-yiAnd calculating a deviation value D of the fitted straight linejiThe number of boundary points less than or equal to a preset deviation threshold.
Wherein j represents the number of the fitted straight line, kjAnd bjAre constants, k, of a fitted straight line jjNot equal to 0; i denotes the number of the boundary points, and the coordinates of the boundary points i are (x)i,yi);DjiThe deviation of the boundary point i from the fitted line j is shown. Likewise, the preset deviation threshold may be set according to actual conditions, for example, to 3.
(3) And judging whether the number of the boundary points corresponding to each fitting straight line exceeds a preset number. The preset number may be set according to an actual situation, and may be three-fourths of the total number of boundary points, for example.
(4) And if the number of the boundary points exceeds the preset number, determining that the fitting straight line corresponding to the number of the boundary points is the best fitting straight line. Specifically, if the number of the groups exceeds the preset number, determining the fitting straight line corresponding to the maximum number of the boundary points as the best fitting straight line; if the number of the boundary points is more than the maximum number, fitting a straight line according to the boundary points, and taking the fitting result as a best fitting straight line.
(5) And if the number of the boundary points calculated according to each fitting straight line does not exceed the preset number, determining the fitting straight line corresponding to the maximum number of the boundary points as the best fitting straight line.
EXAMPLE III
This embodiment provides an image boundary determining apparatus, which can be used to implement the image boundary determining methods described in the first and second embodiments. As shown in fig. 6, the apparatus includes: a boundary point extraction module 610, a singular value decomposition module 620, a singular value adjustment module 630, a boundary point reconstruction module 640, and a boundary determination module 650.
A boundary point extracting module 610, configured to, for each side of the image, extract a plurality of boundary points of the image on the side;
a singular value decomposition module 620, configured to perform singular value decomposition according to the multiple boundary points to obtain singular values;
a singular value adjusting module 630, configured to adjust a singular value according to a preset threshold;
a boundary point reconstructing module 640, configured to reconstruct boundary points by using the adjusted singular values;
and a boundary determining module 650, configured to perform straight line fitting according to the reconstructed boundary points, and determine a boundary of the image on the side.
According to the technical scheme, the singular value decomposition is carried out on the boundary points, the singular value is adjusted by using the preset threshold value, then the boundary points are reconstructed by using the adjusted singular value, the interference of the singular points (or noise points) in the boundary points to the linear fitting can be eliminated, the accuracy of the linear fitting is improved, the determined image boundary is more accurate, and the subsequent image processing and image recognition processes are facilitated.
Preferably, the singular value adjusting module 630 may include: the singular value comparison unit is used for respectively comparing each singular value with the preset threshold value; and the singular value adjusting unit is used for adjusting the singular value to be 0 under the condition that the singular value is smaller than a preset threshold value.
Preferably, the boundary point reconstructing module 640 is specifically configured to calculate a new boundary point by using a singular value decomposition formula and the adjusted singular value.
The singular value decomposition module 620 is specifically configured to: forming a boundary point matrix by the coordinate data of the plurality of boundary points; and carrying out singular value decomposition on the boundary point matrix.
The boundary determination module 650 may specifically be configured to perform a straight line fitting on the reconstructed boundary points by using a least squares method.
Preferably, the apparatus may further include:
a boundary point segmentation module for segmenting the plurality of boundary points;
the optimal straight line determining module is used for determining an optimal fitting straight line according to the boundary points of the segments and the fitting straight lines corresponding to the boundary points;
the deviation value acquisition module is used for respectively acquiring the deviation value of each boundary point in the plurality of boundary points and the best fitting straight line;
and the boundary point deleting module is used for deleting the boundary points with the deviation values larger than the preset deviation threshold.
On the basis of the above scheme of excluding the boundary points with large deviation, the singular value decomposition module 620 is specifically configured to: forming a boundary point matrix by using the coordinate data of the rest boundary points; and carrying out singular value decomposition on the boundary point matrix.
The optimal straight line determining module is specifically configured to perform the following steps:
step A, performing straight line fitting according to the boundary point of the first section to obtain a primary fitting straight line;
b, respectively calculating a deviation value of each boundary point of the plurality of boundary points and the preliminary fitting straight line, and calculating the number of the boundary points of which the deviation values are less than or equal to the preset deviation threshold;
step C, comparing the number of the boundary points with the preset number;
step D, if the number of the boundary points exceeds the preset number, determining the current straight line as a best fit straight line;
step E, if the number of the boundary points does not exceed the preset number, performing straight line fitting according to the boundary points of the next section, taking the obtained straight line as a primary fitting straight line, and executing the step B until the boundary points meeting the preset number are found;
and F, if the number of the boundary points calculated by the preliminary fitting according to each section of boundary points does not exceed the preset number, determining a straight line corresponding to the maximum number of the boundary points as a best fitting straight line.
Preferably, the optimal straight line determining module calculates the deviation value D between the boundary point and the straight line by using the following formula:
D=|kxi+b-yi|,
wherein the linear equation is that y is kx + b, k and b are linear constants, and k is not equal to 0; the boundary point i has the coordinate of (x)i,yi)。
The image boundary determining device provided by the embodiment of the invention can execute the image boundary determining method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the executing method.
Example four
Fig. 7 is a schematic structural diagram of a terminal according to a fourth embodiment of the present invention, and as shown in fig. 7, the terminal includes: a processor 710, a memory 720, an input device 730, and an output device 740. The number of the processors 710 in the terminal may be one or more, and one processor 710 is taken as an example in fig. 7; the processor 710, the memory 720, the input device 730 and the output device 740 in the terminal may be connected by a bus or other means, for example, in fig. 7.
The memory 720, which is a computer-readable storage medium, may be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the image boundary determination method in the embodiments of the present invention (e.g., the boundary point extraction module 610, the singular value decomposition module 620, the singular value adjustment module 630, the boundary point reconstruction module 640, and the boundary determination module 650 in the image boundary determination apparatus). The processor 710 executes various functional applications of the terminal and data processing, i.e., implements the image boundary determining method described above, by executing software programs, instructions, and modules stored in the memory 720.
The memory 720 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 720 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 720 may further include memory located remotely from the processor 710, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 730 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the terminal. The output device 740 may include a display device such as a display screen, for example, to display images.
EXAMPLE five
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program (also referred to as computer-executable instructions) is stored, when the program is executed by a processor, for performing an image boundary determining method, where the method includes:
for each side of the image, extracting a plurality of boundary points of the image on the side;
performing singular value decomposition according to the plurality of boundary points to obtain singular values;
adjusting the singular value according to a preset threshold value;
reconstructing boundary points by using the adjusted singular values;
and performing straight line fitting according to the reconstructed boundary points to determine the boundary of the image on the side.
Of course, the stored program of the computer-readable storage medium provided by the embodiments of the present invention is not limited to the method operations described above, and may also perform related operations in the image boundary determining method provided by any embodiments of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the image boundary determining apparatus, the included units and modules are only divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (9)

1. An image boundary determining method, comprising:
for each side of an image, extracting a plurality of boundary points of the image on the side;
segmenting the plurality of boundary points;
determining a best fit straight line according to the boundary points of the segments and the corresponding fit straight lines;
respectively acquiring a deviation value of each boundary point in the plurality of boundary points and the best fitting straight line;
deleting boundary points with deviation values larger than a preset deviation threshold value;
performing singular value decomposition according to the plurality of boundary points to obtain singular values, wherein the performing singular value decomposition according to the plurality of boundary points includes: forming a boundary point matrix by using the coordinate data of the rest boundary points; performing singular value decomposition on the boundary point matrix;
adjusting the singular value according to a preset threshold value;
reconstructing boundary points by using the adjusted singular values;
and performing straight line fitting according to the reconstructed boundary points to determine the boundary of the image on the side.
2. The method of claim 1, wherein adjusting the singular values according to a preset threshold comprises:
respectively comparing the singular values with the preset threshold value;
and if the singular value is smaller than the preset threshold value, adjusting the singular value to be 0.
3. The method of claim 1, wherein reconstructing boundary points using the adjusted singular values comprises:
and calculating a new boundary point by using a singular value decomposition formula and the adjusted singular value.
4. The method of claim 1, wherein performing a singular value decomposition based on the plurality of boundary points comprises:
forming a boundary point matrix by the coordinate data of the plurality of boundary points;
and carrying out singular value decomposition on the boundary point matrix.
5. The method of claim 4, wherein determining a best fit line from the boundary points of the segments and their corresponding fit lines comprises:
step A, performing straight line fitting according to the boundary point of the first section to obtain a primary fitting straight line;
b, respectively calculating a deviation value of each boundary point of the plurality of boundary points and the preliminary fitting straight line, and calculating the number of the boundary points of which the deviation values are less than or equal to the preset deviation threshold;
step C, comparing the number of the boundary points with the preset number;
step D, if the number of the boundary points exceeds the preset number, determining the current straight line as a best fit straight line;
step E, if the number of the boundary points does not exceed the preset number, performing straight line fitting according to the boundary points of the next section, taking the obtained straight line as a primary fitting straight line, and executing the step B until the boundary points meeting the preset number are found;
and F, if the number of the boundary points calculated by the preliminary fitting according to each section of boundary points does not exceed the preset number, determining a straight line corresponding to the maximum number of the boundary points as a best fitting straight line.
6. The method of claim 5, wherein the deviation D between the boundary point and the straight line is calculated using the following formula:
D=|kxi+b-yi|,
wherein the linear equation is that y is kx + b, k and b are linear constants, and k is not equal to 0; the boundary point i has the coordinate of (x)i,yi)。
7. An image boundary determining apparatus, comprising:
the device comprises a boundary point extraction module, a segmentation module and a segmentation module, wherein the boundary point extraction module is used for extracting a plurality of boundary points of an image at each side of the image and segmenting the boundary points;
the best fitting straight line determining module is used for determining a best fitting straight line according to the boundary points of the segments and the corresponding fitting straight lines;
the boundary point determining module is used for respectively obtaining a deviation value of each boundary point of the plurality of boundary points and the best fitting straight line and deleting the boundary points of which the deviation values are greater than a preset deviation threshold value;
the singular value decomposition module is used for carrying out singular value decomposition according to the plurality of boundary points to obtain singular values;
the singular value adjusting module is used for adjusting the singular value according to a preset threshold value;
the boundary point reconstruction module is used for reconstructing boundary points by using the adjusted singular values;
and the boundary determining module is used for performing straight line fitting according to the reconstructed boundary points and determining the boundary of the image on the side.
8. A terminal, characterized in that the terminal comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the image boundary determination method of any one of claims 1-6.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the image border determination method as claimed in any one of claims 1 to 6.
CN201710437879.XA 2017-06-12 2017-06-12 Image boundary determining method and device, terminal and storage medium Active CN109035285B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710437879.XA CN109035285B (en) 2017-06-12 2017-06-12 Image boundary determining method and device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710437879.XA CN109035285B (en) 2017-06-12 2017-06-12 Image boundary determining method and device, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN109035285A CN109035285A (en) 2018-12-18
CN109035285B true CN109035285B (en) 2021-05-11

Family

ID=64630072

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710437879.XA Active CN109035285B (en) 2017-06-12 2017-06-12 Image boundary determining method and device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN109035285B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110182578B (en) * 2019-06-14 2021-02-02 上海洪海实业发展有限公司 Method, device and equipment for correcting material deviation by calculating material deviation in segmentation mode
CN110361717B (en) * 2019-07-31 2021-03-12 苏州玖物互通智能科技有限公司 Laser radar-camera combined calibration target and combined calibration method
CN114459482B (en) * 2021-12-30 2023-11-21 广州极飞科技股份有限公司 Boundary simplification method, path planning method, device, equipment and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102609938A (en) * 2012-01-16 2012-07-25 浙江大学 Method for detecting vanishing points of road based on single image
US8952333B2 (en) * 2009-11-02 2015-02-10 Virginia Tech Intellectual Properties, Inc. Methods for improved single photon emission computed tomography using exact and stable region of interest reconstructions
KR101514152B1 (en) * 2013-11-28 2015-04-21 한양대학교 산학협력단 Method and apparatus for improving image quality using singular value decomposition
US9127998B1 (en) * 2012-09-04 2015-09-08 University Of South Florida Active ultrasonic method of quantifying bolt tightening and loosening
CN105957088A (en) * 2016-05-12 2016-09-21 广东电网有限责任公司云浮供电局 Method and system for monitoring transformer composite insulator sleeve based on computer vision

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8952333B2 (en) * 2009-11-02 2015-02-10 Virginia Tech Intellectual Properties, Inc. Methods for improved single photon emission computed tomography using exact and stable region of interest reconstructions
CN102609938A (en) * 2012-01-16 2012-07-25 浙江大学 Method for detecting vanishing points of road based on single image
US9127998B1 (en) * 2012-09-04 2015-09-08 University Of South Florida Active ultrasonic method of quantifying bolt tightening and loosening
KR101514152B1 (en) * 2013-11-28 2015-04-21 한양대학교 산학협력단 Method and apparatus for improving image quality using singular value decomposition
CN105957088A (en) * 2016-05-12 2016-09-21 广东电网有限责任公司云浮供电局 Method and system for monitoring transformer composite insulator sleeve based on computer vision

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于边缘信息的图像质量评价研究;王春哲 等;《长春大学学报》;20141031;第24卷(第10期);第1330-1333页 *
增强现实中的直线边缘对象位姿跟踪;潘绍松 等;《南京航空航天大学学报》;20111231;第43卷(第6期);第744-748页 *

Also Published As

Publication number Publication date
CN109035285A (en) 2018-12-18

Similar Documents

Publication Publication Date Title
CN110569721B (en) Recognition model training method, image recognition method, device, equipment and medium
US10896349B2 (en) Text detection method and apparatus, and storage medium
CN110414507B (en) License plate recognition method and device, computer equipment and storage medium
CN107871319B (en) Method and device for detecting beam limiter area, X-ray system and storage medium
WO2013148566A1 (en) Image blur detection
WO2014026483A1 (en) Character identification method and relevant device
CN109492642B (en) License plate recognition method, license plate recognition device, computer equipment and storage medium
CN110765857A (en) Fingerprint identification method, chip and electronic device
US11074443B2 (en) Method and device for acquiring slant value of slant image, terminal and storage medium
CN109035285B (en) Image boundary determining method and device, terminal and storage medium
WO2017041488A1 (en) Fingerprint ridge point recognition method and apparatus
CN108520214A (en) A kind of finger vein identification method based on multiple dimensioned HOG and SVM
WO2017161636A1 (en) Fingerprint-based terminal payment method and device
CN109447117B (en) Double-layer license plate recognition method and device, computer equipment and storage medium
WO2019119919A1 (en) Image recognition method and electronic device
US10740590B2 (en) Skin information processing method, skin information processing device, and non-transitory computer-readable medium
CN110570418A (en) Woven label defect detection method and device
CN112036232B (en) Image table structure identification method, system, terminal and storage medium
CN111612083B (en) Finger vein recognition method, device and equipment
CN116434071B (en) Determination method, determination device, equipment and medium for normalized building mask
US11080551B2 (en) Proposal region filter for digital image processing
CN109871779B (en) Palm print identification method and electronic equipment
CN108647680B (en) Image positioning frame detection method and device
CN106650719B (en) Method and device for identifying picture characters
CN111767916A (en) Image detection method, device, equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant