Polygonal region detection
AssigneeBeijing Sankuai Online Technology Co., Ltd
InventorsBeier Zhu, Rui Zhang
Life of this patent
Estimating the term…
Abstract
Various embodiments provide a polygonal region detection method and apparatus, a computer readable storage medium and an electronic device. In those embodiments, a to-be-detected image can be obtained. A plurality of line segments in the image can be calculated based on a line detection algorithm. The plurality of line segments meeting a merging condition can be merged into a line segment. Crosspoints of the pairwise merged line segments can be calculated according to the merged line segments in the image. A polygonal region can be generated with the crosspoints as vertexes of the polygonal region in the image.
Claims18
A polygonal region detection method, comprising:
- obtaining, by at least one processor, a to-be-detected image;
- calculating, by the at least one processor, line segments in the image based on a line detection algorithm;
- merging, by the at least one processor, a plurality of line segments meeting a merging condition into a merged line segment;
- determining, by the at least one processor, crosspoints of pairwise merged line segments according to the merged line segment;
- and
- generating, by the at least one processor, a polygonal region with the crosspoints as vertexes of the polygonal region in the image;
- wherein merging the plurality of line segments meeting the merging condition into the merged line segment comprises:
- obtaining, by the at least one processor, any two adjacent line segments;
- calculating, by the at least one processor, projection lengths of the two line segments on the same coordinate axis;
- and
- merging, by the at least one processor, the two line segments into a merged line segment when both of vertical distances between two end points of the line segment with the shorter projection length and the other line segment are less than a threshold.
A non-transitory computer readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is configured to perform:
- obtaining a to-be-detected image;
- calculating line segments in the image based on a line detection algorithm;
- merging a plurality of line segments meeting a merging condition into a merged line segment;
- determining crosspoints of the pairwise merged line segments according to the merged line segment;
- and
- generating a polygonal region with the crosspoints as vertexes of the polygonal region in the image;
- wherein merging the plurality of line segments meeting the merging condition into the line segment comprises:
- obtaining any two adjacent line segments;
- calculating projection lengths of the two line segments on the same coordinate axis;
- and
- merging the two line segments into the line segment when both of vertical distances between two end points of the line segment with the shorter projection length and the other line segment are less than a threshold.
An electronic device, comprising:
- a processor;
- and
- a memory configured to store an executable instruction of the processor;
- wherein the processor is configured to perform:
- obtaining a to-be-detected image;
- calculating line segments in the image based on a line detection algorithm;
- merging a plurality of line segments meeting a merging condition into a merged line segment;
- determining crosspoints of pairwise merged line segments according to the merged line segments;
- and
- generating a polygonal region with the crosspoints as vertexes of the polygonal region in the image;
- wherein merging the plurality of line segments meeting the merging condition into the line segment comprises:
- obtaining any two adjacent line segments;
- calculating projection lengths of the two line segments on the same coordinate axis;
- and
- merging the two line segments into the line segment when both of vertical distances between two end points of the line segment with the shorter projection length and the other line segment are less than a threshold.
Dependencies are inferred from the claim text.