CN109460745B - Linear filtering method, device, equipment and storage medium - Google Patents

Linear filtering method, device, equipment and storage medium Download PDF

Info

Publication number
CN109460745B
CN109460745B CN201811469354.5A CN201811469354A CN109460745B CN 109460745 B CN109460745 B CN 109460745B CN 201811469354 A CN201811469354 A CN 201811469354A CN 109460745 B CN109460745 B CN 109460745B
Authority
CN
China
Prior art keywords
line segment
straight line
straight
target
filtering
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
CN201811469354.5A
Other languages
Chinese (zh)
Other versions
CN109460745A (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.)
iFlytek Co Ltd
Original Assignee
iFlytek 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 iFlytek Co Ltd filed Critical iFlytek Co Ltd
Priority to CN201811469354.5A priority Critical patent/CN109460745B/en
Publication of CN109460745A publication Critical patent/CN109460745A/en
Application granted granted Critical
Publication of CN109460745B publication Critical patent/CN109460745B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/414Extracting the geometrical structure, e.g. layout tree; Block segmentation, e.g. bounding boxes for graphics or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components

Abstract

The application provides a straight line filtering method, a straight line filtering device, straight line filtering equipment and a storage medium, wherein the method comprises the following steps: acquiring at least one target straight-line segment set comprising a plurality of straight-line segments from a target image; pairing a plurality of straight line segments to obtain paired straight line segment groups, wherein one paired straight line segment group comprises a target straight line segment and a paired straight line segment of the target straight line segment, and one paired straight line segment group corresponds to a straight line segment to be filtered in a target image; determining the line width of the straight line segment to be filtered corresponding to the paired straight line segment group based on the paired straight line segment group; and filtering the straight line segments to be filtered in the target image based on the line width of the straight line segments to be filtered. But this application dynamic estimation treats the linewidth of filtering straightway and treats the filtering straightway based on this linewidth and filters, and this application not only is applicable to the filtering of the straightway that distributes evenly, thickness unanimity, is applicable to the filtering of the straightway that distributes irregularly, thickness inconsistent moreover, and application scope is wider and the filtering effect is better.

Description

Linear filtering method, device, equipment and storage medium
Technical Field
The present application relates to the field of document image recognition technologies, and in particular, to a method, an apparatus, a device, and a storage medium for filtering a straight line.
Background
With the development of internet technology, document image recognition is rapidly rising and developing, and the application of the document image recognition is popularized in various corners of national economy and social life, so that the production mode, the working mode and the life mode of human beings are greatly changed, and the field of education and teaching is also deeply influenced. However, due to different application scenarios and requirements, document images have various formats, for example, some document images only contain plain text, some document images include text and also include ruled lines or even grid lines designed to limit the standardization of writing, and these ruled lines and grid lines bring difficulties to the identification of the document images.
Disclosure of Invention
In view of this, the present application provides a method, an apparatus, a device and a storage medium for filtering a straight line affecting document identification in a document image, and the technical solution is as follows:
a line filtering method, comprising:
acquiring at least one target straight-line segment set comprising a plurality of straight-line segments from a target image;
pairing the plurality of straight line segments to obtain paired straight line segment groups, wherein one paired straight line segment group comprises a target straight line segment and paired straight line segments of the target straight line segment, one paired straight line segment group corresponds to a straight line segment to be filtered in the target image, and the straight line segments included in one paired straight line segment group are edge lines which are paired with each other on the corresponding straight line segment to be filtered;
determining the line width of the straight line segment to be filtered corresponding to the paired straight line segment group based on the paired straight line segment group;
and filtering the straight line segments to be filtered in the target image based on the line width of the straight line segments to be filtered.
Wherein the acquiring at least one target straight-line segment set comprising a plurality of straight-line segments from the target image comprises:
detecting straight line segments existing in the target image to obtain a first straight line segment set;
determining straight line segments which do not meet the filtering requirement in the first straight line segment set based on the length and/or angle of each straight line segment in the first straight line segment set;
and forming at least one second straight-line segment set based on angles of the straight-line segments, wherein the straight-line segments meeting the filtering requirement are used as the at least one target straight-line segment set.
Wherein the determining, based on the length and/or angle of each straight-line segment in the first straight-line segment set, the straight-line segment in the first straight-line segment set that does not meet the filtering requirement includes:
determining the straight line segment with an angle not in the first angle range and/or an angle not in the second angle range in the first straight line segment set as the straight line segment which does not meet the filtering requirement;
and/or the presence of a gas in the gas,
determining the straight line segment with the angle within the first angle range and the length smaller than a first threshold value as the straight line segment which does not meet the filtering requirement, and/or determining the straight line segment with the angle within the second angle range and the length smaller than a second threshold value as the straight line segment which does not meet the filtering requirement;
and the straight line segments meeting the filtering requirement and having the angles within the first angle range form the second straight line segment set, and/or the straight line segments meeting the filtering requirement and having the angles within the second angle range form the second straight line segment set.
Wherein, the acquiring at least one target set from the target image further comprises:
acquiring a candidate false detection straight line segment set from the straight line segments which do not meet the filtering requirement;
determining false detection straight line segments from the candidate false detection straight line segment set;
adding the false detection straight line segment into the corresponding second straight line segment set based on the angle of the false detection straight line segment; and adding a second straight line segment set after the false detection straight line segment as the target straight line segment set.
Wherein the determining false positive line segments from the set of candidate false positive line segments comprises:
for each candidate false detection straight-line segment in the candidate false detection straight-line segment set, if the straight-line segment meeting the filtering requirement exists in the area near the candidate false detection straight-line segment, and the straight-line segment meeting the filtering requirement is a straight-line segment collinear with the candidate false detection straight-line segment, determining that the candidate false detection straight-line segment is the false detection straight-line segment;
wherein, two straightway collineations satisfy: the difference value of the angles of every two of the straight line segments formed by the four endpoints of the two straight line segments is smaller than the preset angle.
Wherein the pairing the plurality of straight line segments to obtain a paired straight line segment group comprises:
for each target straight-line segment set, determining the average line width of straight-line segments to be filtered corresponding to the target straight-line segment set, and pairing the straight-line segments in the target straight-line segment set based on the average line width to obtain paired straight-line segment groups, wherein the same straight-line segments do not exist in any two paired straight-line segment groups.
Wherein paired straight-line segments of the target straight-line segment in the paired straight-line segment group satisfy:
the distance between the target straight line segment and the target straight line segment is smaller than a third threshold value set on the basis of the average line width, the relative position between the target straight line segment and the target straight line segment meets a preset position relation, and the ratio of the area occupied by the foreground point in a target area formed by the target straight line segment to the area of the target area is larger than a fourth threshold value;
the target area is an area formed by four points, wherein the four points comprise two end points of a paired straight line segment of the target straight line segment, and two points which are respectively perpendicular to the target straight line segment from the two end points of the paired straight line segment of the target straight line segment and intersect with the target straight line segment.
Wherein, the determining the average line width of the straight line segments to be filtered corresponding to the target straight line segment set comprises:
for each straight line segment in the target straight line segment set, if the straight line segment is an edge of a specified position corresponding to the straight line segment to be filtered, taking the straight line segment as a target edge line, and determining the line width corresponding to each point on the target edge line to obtain the line width corresponding to each point on each target edge line in the target straight line segment set;
and determining the average line width of the straight line segments to be filtered corresponding to the target straight line segment set based on the line width corresponding to each point on each target edge line in the target straight line segment set.
Wherein, the determining the line width corresponding to each point on the target edge line includes:
and for each point on the target edge line, determining the total number of foreground points of the point in a preset first direction and a preset second direction, and determining the total number of the foreground points as the line width corresponding to the point to obtain the line width corresponding to each point on the target edge line, wherein the first direction is opposite to the second direction.
The determining the average line width of the straight line segments to be filtered corresponding to the target straight line segment set based on the line width corresponding to each point on each target edge line in the target straight line segment set includes:
and determining the line width with the maximum occurrence frequency in the line widths corresponding to the target edge lines in the target straight line segment set as the average line width of the straight line segments to be filtered corresponding to the target straight line segment set.
Wherein, the determining the line width of the straight line segment to be filtered out corresponding to the paired straight line segment group based on the paired straight line segment group includes:
for any one paired straight line segment group, respectively calculating the distance from each paired straight line segment of the target straight line segment in the paired straight line segment group to the corresponding target straight line segment to obtain a plurality of distances, and calculating the average value of the distances to be used as the line width of the straight line segment to be filtered corresponding to the paired straight line segment group so as to obtain the line width of the straight line segment to be filtered corresponding to each paired straight line segment group;
the straight line filtering method further comprises the following steps: and if a target straight-line segment without the matched straight-line segment exists after the plurality of straight-line segments are matched, determining the average line width of the straight-line segments to be filtered corresponding to the target straight-line segment set to which the target straight-line segment belongs as the line width of the target straight-line segment.
The straight line filtering method further comprises the following steps:
acquiring a candidate false detection straight-line segment set from the straight-line segments, wherein the candidate false detection straight-line segment set comprises at least one first candidate false detection straight-line segment and/or at least one second candidate false detection straight-line segment, the first candidate false detection straight-line segment has a straight-line segment collinear with the first candidate false detection straight-line segment, and the second candidate false detection straight-line segment is detected as an edge of a specified position corresponding to a straight-line segment to be filtered;
and determining false detection straight-line segments from the candidate false detection straight-line segment set, and removing the false detection straight-line segments from the target straight-line segment set.
Wherein, the filtering out the straight line segments to be filtered out in the target image based on the line width of the straight line segments to be filtered out comprises:
acquiring a set of straight line segments to be processed, wherein the set of straight line segments to be processed at least comprises target straight line segments in the paired straight line segment groups;
and determining a filtering height corresponding to each point on each straight line segment to be processed in the straight line segment set to be processed, determining whether the point can be filtered or not based on the filtering height corresponding to the point and the line width corresponding to the straight line segment to be processed, and if the point can be filtered, performing filtering operation based on the filtering height corresponding to the point, wherein the line width corresponding to the target straight line segment is the line width of the straight line segment to be filtered corresponding to the paired straight line segment group where the target straight line segment is located.
Wherein, the line width based on the straight line segment to be filtered out is used for filtering the straight line segment to be filtered out in the target image, and the method further comprises the following steps:
and for each point on each linear segment to be processed in the linear segment set to be processed, when the point is determined to be filterable based on the corresponding filtering height of the point and the corresponding line width of the linear segment to be processed, taking the point as a candidate point, further determining whether the candidate point is filterable based on the candidate point and the variation of the filtering heights corresponding to preset points near the candidate point, and if the candidate point is determined to be filterable, executing the filtering height based on the point to be filtered to perform filtering operation.
Wherein, the line width based on the straight line segment to be filtered out is used for filtering the straight line segment to be filtered out in the target image, and the method further comprises the following steps:
forming straight line segments to be processed in the straight line segment sets to be processed into at least one collinear set, wherein all the straight line segments in one collinear set are collinear;
for each collinear set, determining the filtering heights corresponding to all points of all the straight line segments to be processed in the collinear set, and determining a target filtering height as a common filtering height corresponding to the collinear set based on the filtering heights corresponding to all the points of all the straight line segments to be processed in the collinear set so as to obtain the common filtering heights corresponding to the collinear sets respectively;
the determining the filtered height corresponding to the point comprises: and acquiring the common filtering height corresponding to the collinear set to which the to-be-processed straight line segment of the point belongs as the filtering height corresponding to the point.
A linear filtering device comprising: the device comprises an acquisition module, a pairing module, a line width determination module and a straight line filtering module;
the acquisition module is used for acquiring at least one target straight-line segment set comprising a plurality of straight-line segments from a target image;
the matching module is used for matching the plurality of straight-line segments to obtain matching straight-line segment groups, wherein one matching straight-line segment group comprises a target straight-line segment and a matching straight-line segment of the target straight-line segment, one matching straight-line segment group corresponds to a straight-line segment to be filtered in the target image, and the straight-line segment included in one matching straight-line segment group is an edge line which is matched with the corresponding straight-line segment to be filtered;
the line width determining module is used for determining the line width of the straight line segment to be filtered, which corresponds to the paired straight line segment group, based on the paired straight line segment group;
and the straight line filtering module is used for filtering the straight line segments to be filtered in the target image based on the line width of the straight line segments to be filtered.
A linear filtering apparatus comprising: a memory and a processor;
the memory is used for storing programs;
the processor is configured to execute the program, and the program is specifically configured to:
acquiring at least one target straight-line segment set comprising a plurality of straight-line segments from a target image;
pairing the plurality of straight line segments to obtain paired straight line segment groups, wherein one paired straight line segment group comprises a target straight line segment and paired straight line segments of the target straight line segment, one paired straight line segment group corresponds to a straight line segment to be filtered in the target image, and the straight line segments included in one paired straight line segment group are edge lines which are paired with each other on the corresponding straight line segment to be filtered;
determining the line width of the straight line segment to be filtered corresponding to the paired straight line segment group based on the paired straight line segment group;
and filtering the straight line segments to be filtered in the target image based on the line width of the straight line segments to be filtered.
A readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the line filtering method.
According to the scheme, the straight line filtering method, the straight line filtering device, the straight line filtering equipment and the storage medium can obtain a plurality of straight line segments from a target image, a matched straight line segment group can be obtained by matching the plurality of straight line segments, and the straight line segments in the matched straight line segment group are two edges corresponding to the straight line segments to be filtered, so that the line width of the corresponding straight line to be filtered can be determined based on the straight line segments in the matched straight line segment group, and then the straight line segments to be filtered in the target image are filtered based on the determined line width of the straight line to be filtered, therefore, the method can dynamically estimate the line width of the straight line segments to be filtered and filter the straight line segments to be filtered based on the dynamically estimated line width, is not only suitable for filtering straight lines with uniform distribution and uniform thickness, but also suitable for filtering straight line segments with irregular distribution and nonuniform thickness, the application range is wider and the filtering effect is better.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flowchart of a straight line filtering method according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart illustrating a process of obtaining at least one target straight-line segment set from a target image in the straight-line filtering method according to the embodiment of the present application;
FIG. 3 is a schematic diagram of an example of a target image;
fig. 4 is a schematic diagram illustrating two straight lines being collinear in the straight line filtering method according to the embodiment of the present application;
fig. 5 is a schematic flow chart illustrating a process of determining an average line width of straight line segments to be filtered, which correspond to a target straight line segment set in the straight line filtering method according to the embodiment of the present application;
FIG. 6 is a schematic diagram of an example of a pair of straight line segment groups provided by an embodiment of the present application;
fig. 7 is a schematic diagram of an example of a false detection straight line segment provided in an embodiment of the present application;
fig. 8 is a schematic flow chart illustrating filtering of a to-be-filtered straight line segment in a target image based on a line width of the to-be-filtered straight line segment in the straight line filtering method according to the embodiment of the present application;
fig. 9a and 9b are schematic diagrams of a target image containing horizontal line segments to be filtered and an image obtained by filtering the horizontal line segments to be filtered in the target image by using the line filtering method provided in the embodiment of the present application, respectively;
fig. 10 is a schematic structural diagram of a linear filtering apparatus according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of a linear filtering apparatus according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The inventor finds out in the process of realizing the invention: in the prior art, some schemes for performing linear filtering on document images exist, and the existing linear filtering schemes mainly include two schemes: firstly, when printing paper, designing a straight line with special color, so that the straight line can be directly filtered by using hardware technology (such as removing red part by using a scanner's own red filtering function) or designing a color filtering algorithm; secondly, according to the geometric properties of the straight line, firstly, a straight line detection algorithm is designed, then the line width of the straight line is given, and finally, straight line filtering operation is carried out based on the given line width.
Both of the above solutions have some problems, which are specifically shown in the following: the first scheme is narrow in application range (for example, a hardware mode is only suitable for a scanning situation), or is not high in compatibility with a photographing situation, and requires high photographing quality to ensure that effective color information can be extracted, but due to the influence of illumination, photographing equipment and photographing technology in an actual situation, a photographed image is easy to generate color deviation, so that color information is extracted inaccurately, and an algorithm fails; in the second scheme, since the line width is set by human experience and is generally on the same scene or the same paper, the value is fixed, which may not be well suitable for various practical situations, because there may be straight lines with different line widths in the same scene, and it is troublesome to manually set the line width.
In view of the problems existing in the conventional straight line filtering scheme, the embodiment of the present application provides a straight line filtering method, which may be applied to a terminal or a server, so that after the terminal or the server acquires a target image, a straight line segment to be filtered in the target image may be filtered, and then subsequent document content identification may be performed based on the image with the straight line segment filtered, or the image with the straight line segment filtered is provided to a subsequent document content identification device for document content identification, please refer to fig. 1, which shows a flow diagram of the straight line filtering method, and may include:
step S101: at least one target straight-line segment set comprising a plurality of straight-line segments is acquired from a target image.
The target image is a document image comprising straight line segments to be filtered, and the document image can be obtained through various modes such as scanning and photographing.
One target straight line segment set can correspond to a straight line segment to be filtered in a specific direction in a target image, and the directions of the straight line segments to be filtered corresponding to different target straight line segment sets are different.
In this embodiment, a linear segment existing in a target image can be detected by using an existing linear detection algorithm, because a document image usually contains contents such as characters, numbers and the like, some linear segments also exist in the contents, for example, a vertical linear segment exists in a character d, a horizontal linear segment and a vertical linear segment exist in a character t, and when linear detection is performed, the linear segments are also detected and do not need to be filtered, therefore, after the linear segments existing in the target image are detected, linear segments which do not meet the filtering requirement need to be determined, so that linear segments which meet the filtering requirement are obtained, and the linear segments which meet the filtering requirement form at least one target linear segment set.
Step S102: and pairing the straight line segments in the target straight line segment set to obtain a paired straight line segment group.
It can be understood that, if the straight line segment to be filtered is not very thin, when the straight line detection is performed, the straight line segment is detected at both edges of the straight line segment to be filtered, and the purpose of this step is to pair together the two edges of the straight line segment to be filtered.
The target image processing method comprises the following steps that one paired straight line segment group corresponds to a straight line segment to be filtered in a target image, the straight line segment included in one paired straight line segment group is an edge line which is paired with the corresponding straight line segment to be filtered, one paired straight line segment group includes a target straight line segment and the paired straight line segment of the target straight line segment, the target straight line segment is one edge of the straight line segment to be filtered, the paired straight line segment of the target straight line segment is the other edge of the straight line segment to be filtered, for example, the target straight line segment is the upper edge of the straight line to be filtered, and the paired straight line of the target. It should be noted that there may be one or more paired straight line segments of the target straight line segment.
Step S103: and determining the line width of the straight line segment to be filtered corresponding to the paired straight line segment group based on the paired straight line segment group.
It can be understood that if two edge lines of the straight line segments to be filtered are obtained, the line width of the straight line segments to be filtered can be determined, and based on this, the line width of the straight line segments to be filtered corresponding to the paired straight line segment groups is determined based on the paired straight line segment groups in the embodiment.
Illustratively, a straight line to be filtered corresponding to a paired straight line segment group is L1, L1 is a horizontal straight line segment, the paired straight line segment group includes paired straight line segments L12 and L13 of target straight line segments L11 and L11, and assuming that the target straight line segment L11 is the lower edge of the straight line L1 to be filtered and the paired straight line segments L12 and L13 of L11 are the upper edge of the straight line segment L1 to be filtered, the line width of the straight line segment L1 to be filtered can be determined through L1, L12, and L13.
Step S104: and filtering the straight line segments to be filtered in the target image based on the line width of the straight line segments to be filtered.
The straight line filtering method provided by the embodiment of the application can obtain a plurality of straight line segments from a target image, can obtain a matched straight line segment group by matching the plurality of straight line segments, and can dynamically estimate the line width of the straight line segment to be filtered based on the straight line segments in the matched straight line segment group and filter the straight line segment to be filtered in the target image based on the determined line width of the straight line segment to be filtered, so that the straight line filtering method provided by the embodiment of the application can be used for dynamically estimating the line width of the straight line segment to be filtered and filtering the straight line segment to be filtered based on the line width without manually setting the line width, is not only suitable for filtering the straight line segments with uniform distribution and uniform thickness, but also suitable for filtering the straight line segments with irregular distribution and nonuniform thickness, wide application range and good filtering effect. In addition, the straight line filtering method provided by the embodiment of the application is not based on image color to realize image filtering, so that the method is applicable to both the scanned image and the photographed image, and does not need to have higher photographing quality.
In another embodiment of the present application, for step S101 in the above embodiment: at least one target straight-line segment set comprising a plurality of straight-line segments is acquired from a target image for introduction.
Referring to fig. 2, a flow diagram of one implementation of obtaining at least one set of target straight-line segments from a target image is shown, which may include:
step S201: and detecting straight line segments existing in the target image to obtain a first straight line segment set.
In this embodiment, a straight line detection algorithm may be used to detect straight line segments existing in the target image, and obtain a first set of straight line segments. The line detection algorithm may be an existing line detection algorithm, such as lsd (line Segment detection) algorithm.
Step S202: and determining the straight line segments which do not meet the filtering requirement in the first straight line segment set based on the length and/or angle of each straight line segment in the first straight line segment set.
Since some straight line segments which do not satisfy the filtering requirement exist in the straight line segments detected in step S201, for example, some straight line segments exist in characters, numbers, and the like in the image, in order to avoid false filtering, it is necessary to determine those straight line segments which do not need to be filtered, that is, which do not satisfy the filtering requirement. In this embodiment, the straight line segments in the first straight line segment set that do not meet the filtering requirement may be determined based on the length and/or angle of each straight line segment in the first straight line segment set.
Specifically, the straight line segments of which the angles are not in the first angle range and/or the angles are not in the second angle range in the first straight line segment set are determined as straight line segments which do not meet the filtering requirement; and/or determining straight lines with the length smaller than a first threshold value as straight lines which do not meet the filtering requirement in straight line segments with the angles within a first angle range, and/or determining straight lines with the length smaller than a second threshold value as straight lines which do not meet the filtering requirement in straight line segments with the angles within a second angle range.
The first angle range is different from the second angle range, the first threshold may be a fixed threshold set based on experience, and is preferably an average of lengths of all straight-line segments in the first straight-line segment set, the angles of which are within the first angle range, and similarly, the second threshold may be a fixed threshold set based on experience, and is preferably an average of lengths of all straight-line segments in the first straight-line segment set, the angles of which are within the second angle range.
It should be noted that the first straight line segment set may include straight line segments in multiple directions, and the straight line segment to be filtered is generally a straight line segment in a specific direction in the target image, such as a horizontal straight line segment and a vertical straight line segment, based on which, an angle range is set based on the straight line segment to be filtered in the specific direction in the present application, if the straight line segment is not within the set angle range, the straight line segment is considered not to satisfy the filtering requirement, and if the straight line segment is within the set angle range, the straight line segment may be considered to satisfy the filtering requirement.
Step S203: and forming at least one second straight-line segment set based on angles of the straight-line segments, wherein the straight-line segments meeting the filtering requirement serve as at least one target straight-line segment set.
And/or, the straight lines meeting the filtering requirement and having the angles within the second angle range form a second straight line section set. And a second straight line segment set consisting of straight line segments with angles within the first angle range corresponds to a straight line segment to be filtered in a specific direction in the target image, and a second straight line segment set consisting of straight line segments with angles within the second angle range corresponds to a straight line segment to be filtered in another specific direction in the target image.
The above process of acquiring at least one set of straight line segments of a target from a target image is described below with an embodiment.
As shown in fig. 3, the target image includes a horizontal scale line and a vertical frame line, where the horizontal scale line and the vertical frame line are straight line segments to be filtered, that is, straight line segments to be filtered in the target image include a horizontal straight line segment and a vertical straight line segment, based on which a first angle range (e.g., [0, 30 °) is set for the horizontal straight line segment to be filtered in advance, and a second angle range (e.g., [60 °, 90 °) is set for the vertical straight line segment to be filtered, a process of acquiring at least one target straight line segment set from the target image includes: firstly, detecting straight lines existing in a target image, obtaining a first straight line segment set, and then executing the following steps for each straight line segment in the first straight line segment set: if the straight line segment is not within a first angular range (e.g., [0, 30 ° ]) or a second angular range (e.g., [60 °, 90 ° ]), the straight line segment is considered not to meet the filtering requirement; if the straight-line segment is in the first angle range, further judging whether the length of the straight-line segment is smaller than a first threshold (such as the average value of the lengths of all straight-line segments with angles in the first angle range), and if the length of the straight-line segment is smaller than the first threshold, judging that the straight-line segment does not meet the filtering requirement; if the straight-line segment is within the second angle range, further determining whether the length of the straight-line segment is smaller than a second threshold (for example, the average of the lengths of all straight-line segments with angles within the second angle range), and if the length of the straight-line segment is smaller than the second threshold, determining that the straight-line segment does not meet the filtering requirement. The straight-line segments which do not meet the filtering requirements in the first straight-line segment set are obtained through the process, so that the straight-line segments which meet the filtering requirements can be obtained, the straight-line segments of the straight-line segments which meet the filtering requirements and are positioned in a first angle range (such as [0, 30 degrees ]) form a target straight-line segment set (corresponding to the horizontal straight-line segments to be filtered), and the straight-line segments of the straight-line segments which meet the filtering requirements and are positioned in a second angle range (such as [60 degrees ], 90 degrees ]) form another target straight-line segment set (corresponding to the vertical straight-line segments.
It should be noted that, if there are fewer horizontal straight line segments in the text content in the target image, the straight line segment with the angle within the first angle range may not be further determined based on the length of the straight line segment (that is, as long as the angle of the straight line segment is within the first angle range, it is determined that the straight line segment meets the filtering requirement), and only the straight line segment with the angle within the second angle range is determined based on the length of the straight line segment. Similarly, if there are fewer vertical straight line segments in the text content in the target image, the straight line segments with angles within the second angle range may not be further determined based on the lengths of the straight line segments, and only the straight line segments with angles within the first angle range may be determined based on the lengths of the straight line segments.
It can be understood that some target images may only include straight line segments to be filtered in a certain direction, for example, only include horizontal scale lines, that is, the straight line segments to be filtered only include horizontal scale lines, at this time, a first angle range (for example, [0, 30 °) is set for the horizontal straight line segments to be filtered in advance, and after the first straight line segment set is acquired, for each straight line segment in the first straight line segment set: if the straight line segment is not within a first angular range (e.g., [0, 30 ° ]), the straight line segment is considered not to meet the filtering requirement; if the straight-line segment is in the first angle range, further determining whether the length of the straight-line segment is smaller than a first threshold, and if the length of the straight-line segment is smaller than the average of the lengths of all straight-line segments within the first threshold (for example, the angle is [0, 30 °), determining that the straight-line segment does not meet the filtering requirement. The straight-line segments which do not meet the filtering requirement in the first straight-line segment set are obtained through the process, so that the straight-line segments which meet the filtering requirement can be obtained, and the straight-line segments which meet the filtering requirement form a target straight-line segment set (corresponding to the horizontal straight-line segments to be filtered).
Similarly, in some target images, only the vertical frame line may be included, that is, the straight-line segment to be filtered includes only the vertical straight-line segment, and at this time, a second angle range (for example, [60 °, 90 °) is set for the vertical straight-line segment to be filtered in advance, and after the first set of straight-line segments is acquired, for each straight-line segment in the first set of straight-line segments: if the straight line segment is not within a second angular range (e.g., [60 °, 90 ° ]), the straight line segment is considered not to meet the filtering requirement; if the straight-line segment is in the second angle range, further determining whether the length of the straight-line segment is smaller than the average value of the lengths of all straight-line segments within a second threshold (for example, the angle is [60 degrees ], 90 degrees ]), and if the length of the straight-line segment is smaller than the second threshold, determining that the straight-line segment does not meet the filtering requirement. The straight-line segments which do not meet the filtering requirement in the first straight-line segment set are obtained through the process, so that the straight-line segments which meet the filtering requirement can be obtained, and the straight-line segments which meet the filtering requirement form a target straight-line segment set (corresponding to the vertical straight-line segments to be filtered).
It should be noted that, when a straight line existing in a target image is detected by using a straight line detection algorithm, a problem that one straight line segment is broken into a plurality of short straight line segments with different lengths may exist, and based on this, when straight line segments which do not meet the filtering requirements are determined based on the lengths of the straight line segments, some short straight line segments which meet the filtering requirements may be mistakenly detected as short straight line segments which do not meet the filtering requirements.
In order to avoid the above situation, in this embodiment of the application, the process of acquiring at least one target set from a target image may further include: acquiring a candidate false detection straight line segment set from straight line segments which do not meet the filtering requirement; determining false detection straight line segments from the candidate false detection straight line segment set; adding the false detection straight line segment into the corresponding second straight line segment set based on the angle of the false detection straight line segment; and adding a second straight-line segment set after the false detection straight-line segment as a target straight-line segment set.
The candidate false detection set may be a set composed of straight-line segments with angles within a first angle range from among straight-line segments that do not meet the filtering requirement, may also be a set composed of straight-line segments with angles within a second angle range from among straight-line segments that do not meet the filtering requirement, and may also be a set composed of all straight-line segments that do not meet the filtering requirement.
In this embodiment, the process of determining the false detection straight-line segment from the set of candidate false detection straight-line segments includes: and aiming at each candidate false detection straight-line segment in the candidate false detection straight-line segment set, if a straight-line segment meeting the filtering requirement exists in the vicinity of the candidate false detection straight-line segment, and the straight-line segment meeting the filtering requirement is a straight-line segment collinear with the candidate false detection straight-line segment, determining the candidate false detection straight-line segment as a false detection straight-line segment. Wherein, two straightway collineations satisfy: the difference value of the angles of every two straight lines in a plurality of straight lines formed by four end points of the two straight lines is smaller than a preset angle.
It should be noted that the two linear segments being collinear means that the two linear segments are detected on the same linear segment. If two straightways that two straightways detected out on for same straightway, then, the inclination of arbitrary two straight lines in the many straight lines that four endpoints of these two straightways formed all is closer, and this application sets for the condition that two straightways collineation needs satisfy based on this, and the difference of two liang of straight lines' angle all is less than predetermineeing the angle in the many straight lines that four endpoints of two straight lines formed promptly. For example, referring to fig. 4, the angle difference between any two straight line segments L12, L34, L23, and L14 formed by two end points 1 and 2 of a straight line segment L12 and two end points 3 and 4 of a straight line segment L34 is less than 5 °, so that it is determined that the straight line segment L12 and the straight line segment L34 are collinear.
In another embodiment of the present application, for step S102 in the above embodiment: and pairing the plurality of straight line segments to obtain a paired straight line segment group for introduction.
In one possible implementation, pairing a plurality of straight line segments, and obtaining a paired straight line segment group may include: and for each target straight line segment set, determining the average line width of the straight line segments to be filtered corresponding to the target straight line segment set, and pairing the straight line segments in the target straight line segment set based on the average line width to obtain a paired straight line segment group. When a plurality of paired straight-line segment groups are provided, the same straight-line segment does not exist in any two paired straight-line segment groups.
Referring to fig. 5, a flow chart illustrating an implementation process of determining an average line width of a to-be-filtered straight line corresponding to a target straight line segment set may include:
step S501: and for each straight line segment in the target straight line segment set, if the straight line segment is the edge line of the specified position corresponding to the straight line segment to be filtered, taking the straight line segment as a target edge line, and determining the line width corresponding to each point on the target edge line so as to obtain the line width corresponding to each point on each target edge line in the target straight line segment set.
The determining of the line width corresponding to each point on the target edge line includes: and for each point on the target edge line, determining the total number of foreground points of the point in a preset first direction and a preset second direction, and determining the total number of the foreground points as the line width corresponding to the point to obtain the line width corresponding to each point on the target edge line. Wherein the first direction and the second direction are opposite.
The following describes a process for determining line widths corresponding to respective target edge lines in a target straight-line segment set by using a specific example:
assuming that the target straight line segment set corresponds to a horizontal straight line segment to be filtered in a target image, namely the angle of the straight line segment in the target straight line segment set is within a corresponding angle range such as [0, 30 ° ], for each straight line segment in the target straight line set, firstly determining whether the straight line segment is an appointed position edge (more than the following edge) corresponding to the horizontal straight line segment to be filtered, if the straight line is the appointed position edge corresponding to the horizontal straight line segment to be filtered, taking the straight line segment as a target edge line, counting the total number of upward and downward foreground points of each point on the target edge line, determining the total number of the counted foreground points as the line width corresponding to the point to obtain the line width corresponding to each point on the target edge line, and further obtaining the line width corresponding to each point on the straight line segments which are all used as the target edge line in the target straight line segment set.
The process of determining whether the straight line segment is the edge of the designated position corresponding to the horizontal straight line segment to be filtered out may include: and detecting the total number of the foreground points in a preset range above and/or below the linear section, and determining whether the linear section is the designated position edge of the horizontal linear section to be filtered based on the total number of the foreground points in the preset range above and/or below the linear section.
Specifically, if the edge of the designated position is the lower edge, the total number of the foreground points in the preset range above the linear segment can be detected, the total number of the foreground points in the preset range below the linear segment can be detected, if the total number of the foreground points above the linear segment is detected to be greater than the total number of the foreground points below the linear segment, the linear segment is determined to be the lower edge corresponding to the horizontal linear segment to be filtered, in addition, the total number of the foreground points in the preset range above the linear segment can be detected only, and if the total number of the foreground points above the linear segment is detected to be greater than the preset number, the linear segment is determined to be the lower edge corresponding to the horizontal linear. Certainly, the edge of the designated position can also be an upper edge, at this time, the total number of the foreground points in the preset range above the linear segment is also detected, the total number of the foreground points in the preset range below the linear segment is detected, if the total number of the foreground points below the linear segment is detected to be greater than the total number of the foreground points above the linear segment, the linear segment is determined to be the upper edge corresponding to the horizontal linear segment to be filtered, in addition, the total number of the foreground points in the preset range below the linear segment can also be detected, and if the total number of the foreground points below the linear segment is detected to be greater than the preset number, the linear segment is determined to be the upper edge corresponding to the horizontal linear.
It should be noted that, when the target straight-line segment set corresponds to the vertical straight-line segment to be filtered in the target image, the process of determining the line width corresponding to each point on each target edge line in the target straight-line segment set is similar, and this embodiment is not described herein again.
Step S502: and determining the average line width of the straight line segments to be filtered corresponding to the target straight line segment set based on the line width corresponding to each target edge line in the target straight line segment set.
In one possible implementation mode, the mean value of the line widths corresponding to all the target edge lines in the target straight line segment set can be calculated, and the obtained mean value of all the line widths is used as the mean line width of the straight line segments to be filtered corresponding to the target straight line segment set. In another preferred implementation manner, the line width with the largest occurrence frequency in the line widths corresponding to each point on each target straight-line segment in the target straight-line segment set may be determined as the average line width of the straight-line segments to be filtered corresponding to the target straight-line segment set. The process of determining the line width with the largest occurrence number may include: and counting histograms of the occurrence times of different line widths, and determining the line width with the maximum occurrence time based on the histograms.
After determining the average line width of the straight line segments to be filtered corresponding to the target straight line segment set, the straight line segments in the target straight line segment set can be paired based on the average line width, and the pairing process can include: acquiring a straight line segment which is not paired from the target straight line segment set as a target straight line segment; determining a pair of straight line segments of the target straight line segment from the remaining straight line segments in the target straight line segment set based on the average line width; if the target straight-line segment has the paired straight-line segments, the target straight-line segment and the paired straight-line segments of the target straight-line segment form a paired straight-line segment group, the paired straight-line segments of the target straight-line segment and the target straight-line segment are deleted from the target straight-line segment set, and then the target straight-line segment group is switched to execute the step of obtaining a straight-line segment which is not paired from the target straight-line segment set as the; and if the target straight-line segment does not have the paired straight-line segment, executing to obtain a straight-line segment which is not paired from the target straight-line segment set as the target straight-line segment, and finishing the pairing when the straight-line segment which is not paired does not exist in the target straight-line segment set.
Illustratively, the target straight-line segments are set to { L11, L12, L13, L14 }, then a straight-line segment L14 is obtained from the target straight-line segments set, and it is determined whether L14, L14 are paired straight-line segments of L14, if L14, L14 are paired straight-line segments of L14, then L14, L14 are grouped into a paired straight-line segment group, and L14, L14 are deleted from the target straight-line segment set, and the target straight-line segment set at this time is changed to { L14, L14 }, then an unpaired straight-line segment L14 is obtained from the target straight-line segment set { L14, L14 } is not paired straight-line segments, and therefore, no L14 is obtained from the paired straight-line segments of the target straight-line segments L14, and no paired straight-line segments are obtained from the L14, and the L14 is continued (L14, L36, respectively determining whether L14, L16 and L17 are paired straight-line segments of L15, if L14 and L16 are paired straight-line segments of L15, forming L15, L14 and L16 into a paired straight-line segment group, and deleting L15, L14 and L16 from a target straight-line segment set { L14, L15, L16 and L17}, wherein the target straight-line segment set at the moment becomes { L17}, and since only L17 is included in the target straight-line segment set at the moment, no paired straight-line pair exists in L17.
In this embodiment, one paired straight line group includes a target straight line segment and paired straight line segments of the target straight line segment. If a straight line segment is a paired straight line segment of the target straight line segment, the straight line segment needs to satisfy the following conditions: the distance between the target straight line segment and the target straight line segment is smaller than a third threshold set on the basis of the average line width, the relative position between the target straight line segment and the target straight line segment meets a preset position relation, and the ratio of the area occupied by the foreground point in a target area formed by the target straight line segment to the area of the target area is larger than a fourth threshold. The target area is an area formed by four points, wherein the four points comprise two end points of the straight line segment and two points which are respectively perpendicular to the target straight line segment from the two end points of the straight line segment and intersect with the target straight line segment.
Referring to fig. 6, a schematic diagram of an example of a pair of straight line segment groups is shown, where L34 is a target straight line segment, L12 is a pair of straight line segments of L34, and L34 satisfies: the abscissa of the two end points of L34 is located between the abscissas of the two end points of L12, and the distance between L34 and L12 is smaller than the third threshold value set based on the average line width, and in the two end points of L34, a target region formed by two points where the two end points of L34 intersect with L12 with a perpendicular line to L12, respectively, the ratio of the foreground point area to the target region area is larger than a preset value (e.g., 50%). It should be noted that the foreground point refers to a pixel point that needs to be focused on in the target image, for example, a pixel point that constitutes a ruler line, a frame line, text content, and the like in the image.
In another embodiment of the present application, for step S103: and determining the line width of the straight line segment to be filtered corresponding to the paired straight line segment group for introduction based on the paired straight line segment group.
Based on the paired straight line segment groups, the process of determining the line widths of the straight line segments to be filtered out corresponding to the paired straight line segment groups may include: for each paired straight line segment group, if the paired straight lines of the target straight line segments in the paired straight line segment group are multiple, respectively calculating the distance from each paired straight line segment of the target straight line segment to obtain multiple distances, and calculating the average value of the multiple distances to be used as the line width of the straight line segment to be filtered corresponding to the paired straight line segment group; if the number of the paired straight lines of the target straight line segment in the paired straight line segment group is one, calculating the distance from the paired straight lines of the target straight line segment to the target straight line segment, and taking the distance as the line width of the straight line segment to be filtered corresponding to the paired straight line segment group. Through the process, the line width of the straight line segment to be filtered corresponding to each paired straight line segment group can be obtained.
It should be noted that some false detection straight-line segments may exist in at least one target straight-line segment set, which are straight-line segments that do not need to be filtered out but are detected as straight-line segments that need to be filtered out, such as the straight- line segments 701 and 702 in fig. 7. In order to avoid the false filtering and improve the efficiency of the straight line filtering, in another embodiment of the present application, the straight line filtering method may further include: and acquiring a candidate false detection straight line segment set from a plurality of straight line segments contained in at least one target straight line segment set, determining false detection straight line segments from the candidate false detection straight line segment set, and removing the false detection straight line segments from the target straight line segment set.
The candidate false detection straight-line segment set comprises at least one first candidate false detection straight-line segment and/or at least one second candidate false detection straight-line segment, the first candidate false detection straight-line segment has a straight-line segment collinear with the first candidate false detection straight-line segment, and the second candidate false detection straight-line segment is detected as an edge line of a designated position corresponding to the straight-line segment to be filtered.
The process of determining the false detection straight line is described below by way of a specific example: assuming that the target image comprises horizontal straight line segments to be filtered and vertical straight line segments to be filtered, wherein a first target straight line segment set corresponds to the horizontal straight line segments to be filtered in the target image, a second target straight line segment set corresponds to the vertical straight line segments to be filtered in the target image, and for a straight line segment in the first target straight line segment set, if the straight line segment has a straight line segment collinear with the straight line segment, and the number of background points on a straight line path through which a connecting line of a first target endpoint in two endpoints of the straight line segment and a second target endpoint in two endpoints of the straight line segment collinear with the straight line passes is greater than a preset value, the straight line is considered as a false detection straight line segment, wherein the first target endpoint and the second target endpoint are endpoints of the two straight line segments and are two endpoints (endpoints 2 and 3 in fig. 4) closest to each other; and if the straight line segment corresponds to the upper edge of the horizontal straight line segment to be filtered, and a target straight line segment exists below the straight line segment (the horizontal coordinates of two end points of the target straight line segment are out of the horizontal coordinates of the two end points of the straight line segment), and the distance from the straight line segment to the target straight line segment is greater than the line width of the straight line segment to be filtered corresponding to the paired straight line segment group where the target straight line segment is located and smaller than the average line width of the straight line segments to be filtered corresponding to the second target straight line segment set, determining that the straight line segment is.
In another embodiment of the present application, for step S104 in the above embodiment: and filtering the straight line segments to be filtered in the target image based on the line width of the straight line segments to be filtered, and introducing.
Referring to fig. 8, a schematic flow chart illustrating a process for filtering out straight line segments to be filtered out in a target image based on line widths of the straight line segments to be filtered out is shown, and the process may include:
step S801: and acquiring a set of straight line segments to be processed, wherein the set of straight line segments to be processed at least comprises target straight line segments in the paired straight line segment groups.
It should be noted that when matching the straight-line segments in the target straight-line segment set, in addition to the target straight-line segments having the matched straight-line segments, there may be target straight-line segments not having the matched straight-line segments.
Step S802: and determining the filtering height corresponding to each point on each linear segment to be processed in the linear segment set to be processed, determining whether the point can be filtered or not based on the filtering height corresponding to the point and the line width corresponding to the linear segment to be processed, and if the point can be filtered, performing filtering operation based on the filtering height corresponding to the point.
The filtering height refers to the number of pixel points to be filtered.
The line width corresponding to the target straight-line segment with the paired straight-line segments is the line width of the straight-line segment to be filtered corresponding to the paired straight-line segment group where the target straight-line segment is located, and the line width corresponding to the target straight-line segment without the paired straight-line segments is the average line width of the straight-line to be filtered corresponding to the target straight-line segment set to which the target straight-line segment belongs.
Preferably, in order to avoid filtering text content in the image, for each point on each to-be-processed straight line segment in the to-be-processed straight line segment set, if the to-be-processed straight line where the point is located is an edge of a specified position of the to-be-filtered straight line segment, determining that the point is filterable based on the filtering height corresponding to the point and the line width corresponding to the to-be-processed straight line segment where the point is located, and then determining whether the candidate point is filterable based on the candidate point and the variation of the filtering height corresponding to a preset point near the candidate point, instead of directly performing the filtering operation on the point, further determining that the point is filterable based on the variation of the filtering height, and then performing the filtering operation based on the filtering height corresponding to the point.
In a possible implementation manner, the process of determining whether the candidate point is filterable based on the candidate point and the variation of the filtering heights corresponding to the preset points near the candidate point may include: and respectively calculating the difference value between the filtering height corresponding to the candidate point and the filtering height corresponding to each point in the adjacent preset filtering points, if the calculated preset difference values are less than the preset value, indicating that the filtering height changes smoothly, determining that the candidate point can be filtered, otherwise, determining that the candidate point cannot be filtered.
Taking a straight-line segment to be processed as a straight-line segment in an angle range [0, 30 degrees ]), the filtering process is explained as follows: considering that the detected straight line segment and the edge of the corresponding straight line to be filtered have a deviation, for example, the straight line segment detected as the lower edge of the corresponding straight line to be filtered may be located inside the corresponding filtering straight line, based on this, no matter whether the straight line segment to be processed is the upper edge or the lower edge of the corresponding straight line to be filtered, a downward filtering operation is performed on the straight line segment to be processed, specifically, each point on the straight line to be processed is scanned downward until a preset number of background points are continuously scanned, a filtering height corresponding to the point is determined based on the scanning cut-off position, if the filtering height corresponding to the point is smaller than a third threshold (the third threshold is set based on a line width corresponding to the point, for example, 2 times of the line width), the point is determined to be filtered, and the filtering operation is performed based. If the straight line segment to be processed corresponds to the lower edge of the straight line to be filtered, scanning each point on the straight line to be processed upwards, counting the total number of continuous foreground points above the point as the corresponding filtering height of the point, if the filtering height is smaller than a fourth threshold (the fourth threshold is set based on the corresponding line width of the point, such as 1.5 times of the line segment), taking the point as a candidate point, further determining whether the candidate point can be filtered or not based on the corresponding filtering height of the point and the filtering height corresponding to a preset filtering point nearby, and if the candidate point can be filtered, executing filtering operation.
Because a straight line segment may be detected as a plurality of broken short straight line segments, if the straight line segments have different line widths, the straight line segments are obviously not in accordance with expectations, based on this, in the straight line filtering method provided by the application, based on the line width of the straight line segment to be filtered, the straight line segment to be filtered in the target image is filtered, and the method further includes: forming the straight line segments to be processed in the straight line segment sets to be processed into at least one collinear set, wherein all the straight line segments in one collinear set are collinear; and for each collinear set, determining the filtering heights corresponding to all points of all the to-be-processed straight line segments in the collinear set, and determining a target filtering height as a common filtering height corresponding to the collinear set based on the filtering heights corresponding to all the points of all the to-be-processed straight line segments in the collinear set so as to obtain the common filtering heights corresponding to the collinear sets respectively. Preferably, for each collinear set, the filtering height with the largest occurrence number in the filtering heights corresponding to the points of each linear segment to be processed in the collinear set is used as the common filtering height corresponding to the collinear set. And filtering corresponding to each point on each straight line segment to be processed in one collinear set is the common filtering height corresponding to the collinear set.
Referring to fig. 9a and 9b, fig. 9a shows a target image including horizontal line segments to be filtered, and fig. 9b shows an image obtained by filtering the horizontal line segments to be filtered from the target image by using the line filtering method according to the embodiment of the present disclosure. The line width can be dynamically estimated and filtered by the line width filtering method provided by the embodiment of the application, manual setting is not needed, the line width filtering method is not only suitable for filtering of lines with uniform distribution and uniform thickness, but also suitable for filtering operation of lines with irregular distribution and nonuniform thickness, and is wide in application range and good in filtering effect.
Corresponding to the above-mentioned linear filtering method, an embodiment of the present application further provides a linear filtering apparatus, please refer to fig. 10, which shows a schematic structural diagram of the linear filtering apparatus, and the apparatus may include: the device comprises an acquisition module 1001, a pairing module 1002, a line width determination module 1003 and a straight line filtering module 1004.
An obtaining module 1001 is configured to obtain at least one target straight-line segment set including a plurality of straight-line segments from a target image.
One set of target straight line segments can correspond to straight line segments to be filtered in a specific direction in the target image. The directions of the straight line segments to be filtered, which correspond to different target segment sets, are different.
A pairing module 1002, configured to pair the multiple straight line segments to obtain a paired straight line segment group.
The target image processing method comprises the following steps that one paired straight line segment group corresponds to a straight line segment to be filtered in a target image, the straight line segment included in one paired straight line segment group is an edge line which is paired with the corresponding straight line segment to be filtered, one paired straight line segment group includes a target straight line segment and the paired straight line segment of the target straight line segment, the target straight line segment is one edge of the straight line segment to be filtered, the paired straight line segment of the target straight line segment is the other edge of the straight line segment to be filtered, for example, the target straight line segment is the upper edge of the straight line to be filtered, and the paired straight line of the target. It should be noted that there may be one or more paired straight line segments of the target straight line segment.
The line width determining module 1003 is configured to determine, based on the paired straight line segment group, a line width of a straight line segment to be filtered, which corresponds to the paired straight line segment group.
And the straight line filtering module 1004 is configured to filter the straight line segments to be filtered in the target image based on the line width of the straight line segments to be filtered.
The straight line filtering device provided by the embodiment of the application obtains a plurality of straight line segments from a target image, can obtain a paired straight line segment group by pairing the plurality of straight line segments, because the straight line segments in the paired straight line segment groups are two edges corresponding to the straight line segments to be filtered, the line width of the corresponding straight line segment to be filtered can be determined based on the straight line segments in the paired straight line segment groups, further filtering the straight line segments to be filtered in the target image based on the determined width and the line width of the straight line segments to be filtered, therefore, the linear filtering device provided by the embodiment of the application can dynamically estimate the line width and filter the line width, without manual setting, the method is not only suitable for filtering straight-line segments with uniform distribution and consistent thickness, and the method is suitable for filtering operation of straight line segments with irregular distribution and inconsistent straight line thickness, and has wide applicability and good filtering effect. In addition, the straight line filtering device provided by the embodiment of the application is not used for filtering the image based on the image color, so that the straight line filtering device is suitable for both the image obtained by scanning and the image obtained by photographing, and does not need to have higher photographing quality.
In a possible implementation manner, the obtaining module 1001 in the straight line filtering apparatus provided in the foregoing embodiment may include: the device comprises a detection submodule, a straight line segment determination submodule and a target straight line segment set determination submodule.
And the detection submodule is used for detecting straight line segments existing in the target image to obtain a first straight line segment set.
The straight line segment determining submodule is used for determining straight line segments which do not meet the filtering requirement in the first straight line segment set based on the length and/or angle of each straight line segment in the first straight line segment set;
and the target straight-line segment set determination submodule is used for forming at least one second straight-line segment set based on angles of the straight-line segments, wherein the straight-line segments meeting the filtering requirement are used as the at least one target straight-line segment set.
In a possible implementation manner, the detection submodule is specifically configured to determine, as the straight line segment that does not meet the filtering requirement, a straight line segment in the first straight line segment set whose angle is not within a first angle range and/or a straight line segment in which the angle is not within a second angle range; and/or determining the straight line segment with the length less than a first threshold value as the straight line segment which does not meet the filtering requirement in the straight line segments with the angles in the first angle range, and/or determining the straight line segment with the length less than a second threshold value as the straight line segment which does not meet the filtering requirement in the straight line segments with the angles in the second angle range.
And the straight line segments meeting the filtering requirement and having the angles within the first angle range form the second straight line segment set, and/or the straight line segments meeting the filtering requirement and having the angles within the second angle range form the second straight line segment set.
Preferably, the obtaining module 1001 further includes: the device comprises a candidate false detection straight line segment set acquisition sub-module, a false detection straight line segment determination sub-module and a false detection straight line segment processing sub-module.
And the candidate false detection straight line segment set acquisition sub-module is used for acquiring a candidate false detection straight line segment set from the straight line segments which do not meet the filtering requirement.
And the false detection straight line segment determining submodule is used for determining false detection straight line segments from the candidate false detection straight line segment set.
And the false detection straight line segment processing submodule is used for adding the false detection straight line segment into the corresponding second straight line segment set based on the angle of the false detection straight line segment.
And the target straight-line segment set determining module is further used for taking a second straight-line segment set added with the false detection straight-line segment as the target straight-line segment set.
In a possible implementation manner, the false detection straight-line segment determining sub-module is specifically configured to, for each candidate false detection straight-line segment in the candidate false detection straight-line segment set, determine that the candidate false detection straight-line segment is the false detection straight-line segment if the straight-line segment meeting the filtering requirement exists in a region near the candidate false detection straight-line segment, and the straight-line segment meeting the filtering requirement is a straight-line segment collinear with the candidate false detection straight-line segment.
Wherein, two straightway collineations satisfy: the difference value of the angles of every two straight line segments in a plurality of straight line segments formed by four endpoints of the two straight lines is smaller than a preset angle.
In a possible implementation manner, the pairing module 1002 in the straight line filtering apparatus provided in the above embodiment includes: an average line width determination submodule and a pairing submodule.
And the average line width determining submodule is used for determining the average line width of the straight line segments to be filtered corresponding to each target straight line segment set.
And the matching submodule is used for matching the straight line segments in the target straight line segment set based on the average line width to obtain the matching straight line segment groups, wherein the same straight line segment does not exist in any two matching straight line segment groups.
In one possible implementation, the paired straight-line segments of the target straight-line segment in the paired straight-line segment group satisfy: the distance between the target straight line segment and the target straight line segment is smaller than a third threshold value set on the basis of the average line width, the relative position between the target straight line segment and the target straight line segment meets a preset position relation, and the ratio of the area occupied by the foreground point in a target area formed by the target straight line segment to the area of the target area is larger than a fourth threshold value.
The target area is an area formed by four points, wherein the four points comprise two end points of a paired straight line segment of the target straight line segment, and two points which are respectively perpendicular to the target straight line segment from the two end points of the paired straight line segment of the target straight line segment and intersect with the target straight line segment.
In a possible implementation manner, the average line width determining submodule is specifically configured to, for each straight line segment in the target straight line segment set, if the straight line segment is an edge at an assigned position corresponding to a straight line segment to be filtered, take the straight line segment as a target edge line, determine a line width corresponding to each point on the target edge line, and obtain a line width corresponding to each point on each target edge line in the target straight line segment set; and determining the average line width of the straight line segments to be filtered corresponding to the target straight line segment set based on the line width corresponding to each point on each target edge line in the target straight line segment set.
In a possible implementation manner, when determining a line width corresponding to each point on the target edge line, the average line width determining submodule is specifically configured to determine, for each point on the target edge line, the total number of foreground points of the point in a preset first direction and a preset second direction, and determine the total number of the foreground points as the line width corresponding to the point, so as to obtain the line width corresponding to each point on the target edge line, where the first direction is opposite to the second direction.
In a possible implementation manner, when determining the average line width of the straight-line segment to be filtered corresponding to the target straight-line segment set based on the line widths corresponding to the points on the target edge lines in the target straight-line segment set, the average line width determination sub-module is specifically configured to determine the line width with the largest occurrence frequency among the line widths corresponding to the points on the target edge lines in the target straight-line segment set as the average line width of the straight-line segment to be filtered corresponding to the target straight-line segment set.
In a possible implementation manner, the line width determining module 1004 in the straight line filtering device provided in the above embodiment is specifically configured to, for each paired straight line segment group, calculate a distance between a paired straight line segment of a target straight line segment and the target straight line segment if the paired straight line segment of the target straight line segment in the paired straight line segment group is one, and make a line width of a straight line segment to be filtered corresponding to the paired straight line segment group, and if the paired straight line segments of the target straight line segment in the paired straight line segment group are multiple, calculate distances from each paired straight line segment of the target straight line segment to the target straight line segment, obtain multiple distances, calculate a mean value of the multiple distances, and use the mean value as the line width of the straight line segment to be filtered corresponding to the paired straight line segment group, so as to obtain the line width of the straight line segment to be.
The linear filtering device provided by the above embodiment further includes: the device comprises a false detection straight line segment determining module and a false detection straight line segment removing module.
And the false detection straight line segment determining module is used for acquiring a candidate false detection straight line segment set from the straight line segments and determining the false detection straight line segment from the candidate false detection straight line segment set.
The candidate false detection straight-line segment set comprises at least one first candidate false detection straight-line segment and/or at least one second candidate false detection straight-line segment, the first candidate false detection straight-line segment has a straight-line segment collinear with the first candidate false detection straight-line segment, and the second candidate false detection straight-line segment is detected as an edge of a specified position corresponding to a straight-line segment to be filtered.
And the false detection straight-line segment removing module is used for removing the false detection straight-line segment from the target straight-line segment set.
In a possible implementation manner, the straight line filtering module 1004 in the straight line filtering apparatus provided in the above embodiment includes: the straight line section to be processed comprises a straight line section acquisition submodule and a straight line filtering submodule.
And the to-be-processed straight-line segment acquisition submodule is used for acquiring a to-be-processed straight-line segment set, and the to-be-processed straight-line segment set at least comprises target straight-line segments in the paired straight-line segment groups.
And the straight line filtering submodule is used for determining a filtering height corresponding to each point on each straight line segment to be processed in the straight line segment set to be processed, determining whether the point can be filtered or not based on the filtering height corresponding to the point and the line width corresponding to the straight line segment to be processed, and if the point can be filtered, performing filtering operation based on the filtering height corresponding to the point, wherein the line width corresponding to the target straight line segment is the line width of the straight line segment to be filtered corresponding to the paired straight line segment group where the target straight line segment is located.
The set of straight line segments to be treated further comprises: and the line width corresponding to the target straight line segment is the average line width of the line to be filtered corresponding to the target straight line segment set to which the target straight line segment belongs.
In a possible implementation manner, the straight line filtering sub-module is further configured to, for each point on each straight line segment to be processed in the straight line segment set to be processed, when it is determined that the point is filterable based on a filtering height corresponding to the point and a line width corresponding to the straight line segment to be processed, use the point as a candidate point, further determine whether the candidate point is filterable based on the candidate point and a variation of the filtering heights corresponding to preset points near the candidate point, and if it is determined that the candidate point is filterable, perform a filtering operation based on the filtering height corresponding to the point.
In a possible implementation manner, the straight line filtering module 1004 in the straight line filtering apparatus provided in the above embodiment further includes: and the straight line segment classification submodule and the common filtering height determination submodule.
The straight line segment classification submodule is used for forming straight line segments to be processed in the straight line segment sets to be processed into at least one collinear set, wherein all straight line segments in one collinear set are collinear;
and the common filtering height determining submodule is used for determining the filtering height corresponding to each point of each linear segment to be processed in each collinear set, and determining a target filtering height as the common filtering height corresponding to the collinear set based on the filtering height corresponding to each point of each linear segment to be processed in the collinear set so as to obtain the common filtering heights corresponding to the collinear sets respectively.
And the straight line filtering submodule is specifically used for acquiring a common filtering height corresponding to a collinear set to which the straight line segment to be processed where the point is located belongs as the filtering height corresponding to the point when the filtering height corresponding to the point is determined.
An embodiment of the present application further provides a linear filtering device, please refer to fig. 11, which shows a schematic structural diagram of the linear filtering device, where the linear filtering device may include: a memory 1101 and a processor 1102.
A memory 1101 for storing a program;
a processor 1102 configured to execute the program, the program specifically configured to:
acquiring at least one target straight-line segment set comprising a plurality of straight-line segments from a target image;
pairing the plurality of straight line segments to obtain paired straight line segment groups, wherein one paired straight line segment group comprises a target straight line segment and paired straight line segments of the target straight line segment, one paired straight line segment group corresponds to a straight line segment to be filtered in the target image, and the straight line segments included in one paired straight line segment group are edge lines which are paired with each other on the corresponding straight line segment to be filtered;
determining the line width of the straight line segment to be filtered corresponding to the paired straight line segment group based on the paired straight line segment group;
and filtering the straight line segments to be filtered in the target image based on the line width of the straight line segments to be filtered.
The linear filtering device further includes: a bus, a communication interface 1103, and the like.
The processor 1102, the memory 1101, and the communication interface 1103 are connected to each other by a bus. Wherein:
a bus may include a path that transfers information between components of a computer system.
The processor 1102 may be a general-purpose processor, such as a general-purpose Central Processing Unit (CPU), microprocessor, etc., an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to control the execution of programs in accordance with the inventive arrangements. But may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components.
The processor 1102 may include a main processor and may also include a baseband chip, modem, and the like.
The memory 1101 stores programs for executing the technical solution of the present invention, and may also store an operating system and other key services. In particular, the program may include program code including computer operating instructions. More specifically, memory 1101 may include a read-only memory (ROM), other types of static storage devices that may store static information and instructions, a Random Access Memory (RAM), other types of dynamic storage devices that may store information and instructions, a disk storage, a flash, and so forth.
Communication interface 1103 may include any device or means for communicating with another device or communication network, such as an ethernet network, a Radio Access Network (RAN), a Wireless Local Area Network (WLAN), etc., using any transceiver or the like.
The processor 1102 executes the programs stored in the memory 1101, and invokes other devices, which can be used to implement the steps of the line filtering method provided by the embodiment of the present invention.
The embodiment of the present application further provides a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps of the straight line filtering method provided in any of the above embodiments.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
In the several embodiments provided in the present application, it should be understood that the disclosed method, apparatus, and device may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (16)

1. A method for filtering a straight line, comprising:
acquiring at least one target straight-line segment set comprising a plurality of straight-line segments from a target image;
pairing the plurality of straight line segments to obtain paired straight line segment groups, wherein one paired straight line segment group comprises a target straight line segment and paired straight line segments of the target straight line segment, one paired straight line segment group corresponds to a straight line segment to be filtered in the target image, and the straight line segments included in one paired straight line segment group are edge lines which are paired with each other on the corresponding straight line segment to be filtered;
determining the line width of the straight line segment to be filtered corresponding to the paired straight line segment group based on the paired straight line segment group;
and filtering the straight line segments to be filtered in the target image based on the line width of the straight line segments to be filtered.
2. The line filtering method according to claim 1, wherein the obtaining at least one target straight-line segment set comprising a plurality of straight-line segments from a target image comprises:
detecting straight line segments existing in the target image to obtain a first straight line segment set;
determining straight line segments which do not meet the filtering requirement in the first straight line segment set based on the length and/or angle of each straight line segment in the first straight line segment set;
and forming at least one second straight-line segment set based on angles of the straight-line segments, wherein the straight-line segments meeting the filtering requirement are used as the at least one target straight-line segment set.
3. The line filtering method according to claim 2, wherein the determining, based on the length and/or the angle of each line segment in the first line segment set, the line segment in the first line segment set that does not meet the filtering requirement comprises:
determining the straight line segment with an angle not in the first angle range and/or an angle not in the second angle range in the first straight line segment set as the straight line segment which does not meet the filtering requirement;
and/or the presence of a gas in the gas,
determining the straight line segment with the angle within the first angle range and the length smaller than a first threshold value as the straight line segment which does not meet the filtering requirement, and/or determining the straight line segment with the angle within the second angle range and the length smaller than a second threshold value as the straight line segment which does not meet the filtering requirement;
and the straight line segments meeting the filtering requirement and having the angles within the first angle range form the second straight line segment set, and/or the straight line segments meeting the filtering requirement and having the angles within the second angle range form the second straight line segment set.
4. The line filtering method of claim 3, wherein obtaining at least one set of target straight-line segments from the target image further comprises:
acquiring a candidate false detection straight line segment set from the straight line segments which do not meet the filtering requirement;
determining false detection straight line segments from the candidate false detection straight line segment set;
adding the false detection straight line segment into the corresponding second straight line segment set based on the angle of the false detection straight line segment; and adding a second straight line segment set after the false detection straight line segment as the target straight line segment set.
5. The line filtering method of claim 4, wherein said determining false positive line segments from said set of candidate false positive line segments comprises:
taking each candidate false detection straight line segment in the candidate false detection straight line segment set as a straight line segment to be distinguished: if the straight line segment meeting the filtering requirement exists in the area near the straight line segment to be judged, and the straight line segment meeting the filtering requirement is a straight line segment which is collinear with the straight line segment to be judged, determining that the straight line segment to be judged is a false detection straight line segment;
wherein, two straightway collineations satisfy: the difference value of the angles of every two of the straight line segments formed by the four endpoints of the two straight line segments is smaller than the preset angle.
6. The line filtering method of claim 1, wherein the pairing the plurality of line segments to obtain a paired line segment group comprises:
determining the average line width of the straight line segments to be filtered corresponding to each target straight line segment set, and pairing the straight line segments in each target straight line segment set based on the determined average line width to obtain paired straight line segment groups, wherein the same straight line segments do not exist in any two paired straight line segment groups.
7. The line filtering method of claim 6, wherein the paired straight line segments of the target straight line segment in any paired straight line segment group satisfy:
the distance between the target straight line segment and the target straight line segment is smaller than a third threshold, the relative position between the target straight line segment and the target straight line segment meets a preset position relation, and the ratio of the area occupied by a foreground point in a target area formed by the target straight line segment to the area of the target area is larger than a fourth threshold;
the third threshold is set based on the average line width of straight-line segments to be filtered, corresponding to a target straight-line segment set to which a paired straight-line segment group to which the target straight-line segment belongs, the target area is an area formed by four points, the four points comprise two end points of the paired straight-line segment of the target straight-line segment, and two points which are perpendicular to the target straight-line segment from the two end points of the paired straight-line segment of the target straight-line segment and intersect with the target straight-line segment.
8. The line filtering method according to claim 6, wherein the determining an average line width of the line segments to be filtered corresponding to the target line segment set comprises:
determining a target edge line from the target straight line segment set, and determining line widths corresponding to all points on the target edge line to obtain the line widths corresponding to all points on the target edge line in the target straight line segment set, wherein the target edge line refers to a straight line segment corresponding to an edge of a specified position of a straight line segment to be filtered in the target straight line segment set;
and determining the average line width of the straight line segments to be filtered corresponding to the target straight line segment set based on the line width corresponding to each point on each target edge line in the target straight line segment set.
9. The straight line filtering method according to claim 1, wherein the determining, based on the paired straight line segment groups, line widths of straight line segments to be filtered, which correspond to the paired straight line segment groups, includes:
respectively calculating the distance from each paired straight line segment of the target straight line segment in each paired straight line segment group to the target straight line segment to obtain a plurality of distances corresponding to each paired straight line segment group, and respectively calculating the mean value of the plurality of distances corresponding to each straight line segment group to be used as the line width of the straight line segment to be filtered corresponding to each paired straight line segment group;
the straight line filtering method further comprises the following steps: if a target straight-line segment without the matched straight-line segment exists after the plurality of straight-line segments are matched, determining the average line width of straight-line segments to be filtered, which correspond to a target straight-line segment set to which the target straight-line segment without the matched straight-line segment belongs, as the line width corresponding to the target straight-line segment without the matched straight-line segment.
10. The line filtering method as claimed in claim 4, wherein the set of candidate false straight line segments includes at least one first candidate false straight line segment and/or at least one second candidate false straight line segment, the first candidate false straight line segment has a straight line segment collinear with the first candidate false straight line segment, and the second candidate false straight line segment is detected as an edge of a specified position corresponding to a straight line segment to be filtered out.
11. The line filtering method according to any one of claims 1 to 10, wherein the filtering out the line segments to be filtered out in the target image based on the line widths of the line segments to be filtered out includes:
acquiring a set of straight line segments to be processed, wherein the set of straight line segments to be processed at least comprises target straight line segments in the paired straight line segment groups;
and determining a filtering height corresponding to the to-be-processed straight line segment for each to-be-processed point on each to-be-processed straight line segment in the to-be-processed straight line segment set, determining whether the to-be-processed point can be filtered based on the filtering height corresponding to the to-be-processed point and the line width corresponding to the to-be-processed straight line segment where the to-be-processed point is located, and if the to-be-processed point can be filtered, performing filtering operation based on the filtering height corresponding to the to-be-processed point, wherein the line width corresponding to the target straight line segment is the line width of the to-be-filtered straight line segment corresponding to the paired.
12. The line filtering method according to claim 11, wherein the filtering out the line segments to be filtered out in the target image based on the line widths of the line segments to be filtered out further comprises:
and when the point to be processed can be filtered based on the filtering height corresponding to the point to be processed and the line width corresponding to the straight line segment to be processed where the point to be processed is located, taking the point to be processed as a candidate point, further determining whether the candidate point can be filtered based on the candidate point and the variation condition of the filtering height corresponding to a preset point near the candidate point, and if the candidate point is determined to be filtered, executing the filtering operation based on the filtering height corresponding to the point to be processed.
13. The line filtering method according to claim 11, wherein the filtering out the line segments to be filtered out in the target image based on the line widths of the line segments to be filtered out further comprises:
forming straight line segments to be processed in the straight line segment sets to be processed into at least one collinear set, wherein all the straight line segments in one collinear set are collinear;
determining filtering heights corresponding to all points of all straight line segments to be processed in the collinear set, and determining a common filtering height corresponding to the collinear set based on the filtering heights corresponding to all points of all straight line segments to be processed in the collinear set;
determining a filtered height corresponding to a target point comprises: and acquiring a common filtering height corresponding to a collinear set to which the straight line segment to be processed where the target point is located belongs, and taking the common filtering height as the filtering height corresponding to the target point.
14. A linear filtering device, comprising: the device comprises an acquisition module, a pairing module, a line width determination module and a straight line filtering module;
the acquisition module is used for acquiring at least one target straight-line segment set comprising a plurality of straight-line segments from a target image;
the matching module is used for matching the plurality of straight-line segments to obtain matching straight-line segment groups, wherein one matching straight-line segment group comprises a target straight-line segment and a matching straight-line segment of the target straight-line segment, one matching straight-line segment group corresponds to a straight-line segment to be filtered in the target image, and the straight-line segment included in one matching straight-line segment group is an edge line which is matched with the corresponding straight-line segment to be filtered;
the line width determining module is used for determining the line width of the straight line segment to be filtered, which corresponds to the paired straight line segment group, based on the paired straight line segment group;
and the straight line filtering module is used for filtering the straight line segments to be filtered in the target image based on the line width of the straight line segments to be filtered.
15. A linear filtering device, comprising: a memory and a processor;
the memory is used for storing programs;
the processor is configured to execute the program, and the program is specifically configured to:
acquiring at least one target straight-line segment set comprising a plurality of straight-line segments from a target image;
pairing the plurality of straight line segments to obtain paired straight line segment groups, wherein one paired straight line segment group comprises a target straight line segment and paired straight line segments of the target straight line segment, one paired straight line segment group corresponds to a straight line segment to be filtered in the target image, and the straight line segments included in one paired straight line segment group are edge lines which are paired with each other on the corresponding straight line segment to be filtered;
determining the line width of the straight line segment to be filtered corresponding to the paired straight line segment group based on the paired straight line segment group;
and filtering the straight line segments to be filtered in the target image based on the line width of the straight line segments to be filtered.
16. A readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the line filtering method according to any one of claims 1 to 13.
CN201811469354.5A 2018-11-28 2018-11-28 Linear filtering method, device, equipment and storage medium Active CN109460745B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811469354.5A CN109460745B (en) 2018-11-28 2018-11-28 Linear filtering method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811469354.5A CN109460745B (en) 2018-11-28 2018-11-28 Linear filtering method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109460745A CN109460745A (en) 2019-03-12
CN109460745B true CN109460745B (en) 2021-01-29

Family

ID=65612313

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811469354.5A Active CN109460745B (en) 2018-11-28 2018-11-28 Linear filtering method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109460745B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112541914B (en) * 2020-12-25 2022-06-03 三峡大学 Short line filtering method for image recognition

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102833460B (en) * 2011-06-15 2015-03-11 富士通株式会社 Image processing method, image processing device and scanner
CN104391681B (en) * 2014-03-21 2017-11-17 贵阳朗玛信息技术股份有限公司 Picture erasing implementation method and device based on mobile terminal
CN106951855B (en) * 2017-03-16 2020-04-10 深圳市六六六国际旅行社有限公司 Method for positioning and cutting document in picture

Also Published As

Publication number Publication date
CN109460745A (en) 2019-03-12

Similar Documents

Publication Publication Date Title
CN108830133B (en) Contract image picture identification method, electronic device and readable storage medium
CN111047615B (en) Image-based straight line detection method and device and electronic equipment
CN109636753B (en) Image processing method and apparatus, electronic device, and computer-readable storage medium
JP2016516245A (en) Classification of objects in images using mobile devices
JP6642970B2 (en) Attention area detection device, attention area detection method, and program
CN109559344B (en) Frame detection method, device and storage medium
US8913836B1 (en) Method and system for correcting projective distortions using eigenpoints
CN109214996B (en) Image processing method and device
CN109729298B (en) Image processing method and image processing apparatus
CN105761256B (en) The sub-pixel edge straight line acquisition methods and device of image
CN109460745B (en) Linear filtering method, device, equipment and storage medium
JP6542230B2 (en) Method and system for correcting projected distortion
CN110084229B (en) Seal detection method, device and equipment and readable storage medium
US8477988B2 (en) Image processing apparatus, image forming apparatus and computer readable medium
CN110321887B (en) Document image processing method, document image processing apparatus, and storage medium
CN108305284B (en) Method and device for determining character stroke width
CN107766014B (en) Character enhancement method and device
JP2016012767A (en) Image processing system
CN115049713B (en) Image registration method, device, equipment and readable storage medium
CN115410191A (en) Text image recognition method, device, equipment and storage medium
CN103426144A (en) Method and device for deblurring image having perspective distortion
US9858512B2 (en) Image processing apparatus with an improved detection of ruled lines
CN112364835B (en) Video information frame taking method, device, equipment and storage medium
CN113762244A (en) Document information extraction method and device
CN112800824A (en) Processing method, device and equipment for scanning file 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