CN112733868A - Image contour searching method, device, server and medium - Google Patents

Image contour searching method, device, server and medium Download PDF

Info

Publication number
CN112733868A
CN112733868A CN202110337303.2A CN202110337303A CN112733868A CN 112733868 A CN112733868 A CN 112733868A CN 202110337303 A CN202110337303 A CN 202110337303A CN 112733868 A CN112733868 A CN 112733868A
Authority
CN
China
Prior art keywords
contour
matrix
image
point
points
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.)
Granted
Application number
CN202110337303.2A
Other languages
Chinese (zh)
Other versions
CN112733868B (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.)
Suoto Hangzhou Automotive Intelligent Equipment Co Ltd
Zhejiang Suoto Ruian Technology Group Co Ltd
Original Assignee
Suoto Hangzhou Automotive Intelligent Equipment Co Ltd
Zhejiang Suoto Ruian Technology Group 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 Suoto Hangzhou Automotive Intelligent Equipment Co Ltd, Zhejiang Suoto Ruian Technology Group Co Ltd filed Critical Suoto Hangzhou Automotive Intelligent Equipment Co Ltd
Priority to CN202110337303.2A priority Critical patent/CN112733868B/en
Publication of CN112733868A publication Critical patent/CN112733868A/en
Application granted granted Critical
Publication of CN112733868B publication Critical patent/CN112733868B/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
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides an image contour searching method, a device, a server and a medium, which are characterized in that a binary image is reduced by a preset multiple, contour points of the reduced image are mapped to an original binary image to form a mapping square matrix, the contour points searched in the mapping square matrix are used as starting points, the contour points are searched in the original binary image, the searching amount of pixel points is reduced, and the repeated searching is avoided by deleting the contours which are subjected to mapping operation in the reduced image one by one. The image contour searching method, the image contour searching device, the image contour searching server and the image contour searching medium reduce the searching amount and the searching complexity of binary image contour points and improve the use efficiency of a kernel.

Description

Image contour searching method, device, server and medium
Technical Field
The invention belongs to the technical field of blind spot monitoring, and particularly relates to an image contour searching method, an image contour searching device, a server and a medium.
Background
Binary images, as the name implies, have only two states of brightness values: black (0) and white (255). Binary images are of great importance in image analysis and recognition because of their simple pattern and strong expressive force on the spatial relationship of pixels. In practical applications, the analysis of many images is ultimately converted into the analysis of binary images, such as: medical image analysis, foreground detection, character recognition and shape recognition. Binarization + mathematical morphology can solve many problems of target extraction in computer recognition engineering.
The result output by the semantic segmentation network is a category label of each pixel, a category target is firstly binarized according to categories, and then the binarized image is subjected to contour searching. The invention aims to find a rapid binary image contour searching algorithm, which is applied to a post-processing algorithm of a semantic segmentation network output result, and at an embedded end, the time complexity is reduced and the kernel use efficiency is improved.
Disclosure of Invention
In view of this, the present invention provides an image contour searching method to reduce the complexity of binary image contour searching and improve the kernel utilization efficiency.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
an image contour searching method comprises the following steps:
step 1, reducing an original binary image by a preset multiple to generate a reduced image;
step 2, traversing the reduced image, searching each contour point contained in the foreground of the reduced image, and storing all the searched contour points into a first matrix;
step 3, traversing the first matrix according to the same sequence as the traversing reduced image, mapping the first contour point obtained by searching to the original binary image, and forming a mapping square matrix of pixel points corresponding to the contour point on the original binary image;
step 4, traversing the mapping square matrix, carrying out contour searching in the original binary image by taking the searched first foreground pixel point as a starting point, and storing the searched contour point of the first contour in a second matrix;
step 5, reducing the second matrix according to the reduction times of the reduced image;
step 6, comparing the contour points in the reduced second matrix with the contour points in the first matrix, and deleting the contour points in the first matrix corresponding to the contour points in the reduced second matrix;
and 7, repeating the steps 3 to 6, storing the contour points of the rest contours in the searched original binary image into the second matrix until all contour points in the second matrix are required contour points when no contour point exists in the first matrix.
Further, the specific method of step 1 is as follows:
A1. reducing the original binary image by a preset multiple, wherein each pixel point of the reduced image corresponds to a pixel point square matrix of the original binary image;
A2. and assigning values to the reduced image pixel points, wherein if one of the image pixel point matrixes before reduction is a foreground pixel point, the assignment of the reduced pixel point is the same as that of the foreground pixel point.
Further, the specific method of step 2 is as follows:
B1. searching foreground pixel points line by line from the upper left corner of the reduced image, and taking the first foreground pixel point as an initial contour point;
B2. carrying out contour searching in the reduced image according to a region growing method by taking the initial contour point as a starting point until traversing each contour point of the reduced image;
B3. all contour points of the reduced image are stored in a first matrix.
Further, the specific method of step 4 is as follows:
C1. searching foreground pixel points line by line from the upper left corner of the mapping square matrix, and taking the first foreground pixel point as an initial contour point;
C2. carrying out contour searching in the original binary image by taking the initial contour point as a starting point according to a region growing method;
C3. and storing the searched contour points of the first contour in a second matrix.
Further, a specific method for searching contour points by using a region growing method is as follows:
D1. extracting 8 pixel points around the initial contour point, traversing the 8 pixel points according to a preset sequence until a second contour point is met;
D2. extracting 8 pixel points around the second contour point, and traversing 8 pixel points from the next pixel point of the second contour point until the next contour point is met;
D3. d2 is repeated until all contour points of the two-dimensional matrix are traversed.
An image contour-finding apparatus comprising:
the first reducing module is used for reducing the original binary image by a preset multiple to generate a reduced image;
the first searching module is used for traversing the reduced image, searching each contour point contained in the foreground of the reduced image and storing all the searched contour points into a first matrix;
the mapping module is used for traversing the first matrix according to the same sequence as the traversing reduced image, mapping the first contour point obtained by searching to the original binary image, and forming a mapping square matrix of pixel points corresponding to the contour point on the original binary image;
the second searching module is used for traversing the mapping square matrix, carrying out contour searching in the original binary image by taking the searched first foreground pixel point as a starting point, and storing the searched contour point of the first contour into the second matrix;
a second reduction module for reducing the second matrix according to the reduction multiple of the reduced image;
the comparison module is used for comparing the contour points in the reduced second matrix with the contour points in the first matrix and deleting the contour points in the first matrix corresponding to the contour points in the reduced second matrix;
and the control module is used for repeating the steps 3 to 6, storing the contour points of the rest contours in the searched original binary image into the second matrix until all the contour points in the second matrix are required contour points when no contour point exists in the first matrix.
Further, the first scaling-down module comprises:
the first submodule is used for reducing the original binary image by preset times, and each pixel point of the reduced image corresponds to a pixel point square matrix of the original binary image;
and the second sub-module is used for assigning values to the reduced image pixel points, and if one of the image pixel point matrixes before reduction is a foreground pixel point, the assignment of the reduced pixel point is the same as the assignment of the foreground pixel point.
Further, the first lookup module includes:
the third sub-module is used for searching foreground pixel points line by line from the upper left corner of the reduced image and taking the first foreground pixel point as an initial contour point;
the fourth sub-module is used for searching the outline in the reduced image by taking the initial outline point as a starting point according to a region growing method until each outline point of the reduced image is traversed;
the fifth sub-module is used for establishing a two-dimensional first matrix, wherein the size of the first matrix is equal to that of a circumscribed rectangle for reducing the foreground contour of the image, and the first matrix is used for assigning values to contour points and non-contour points;
a sixth sub-module for storing all contour points of the reduced image in the first matrix;
the second lookup module comprises:
the seventh submodule is used for searching foreground pixel points line by line from the upper left corner of the mapping square matrix and taking the searched first foreground pixel point as an initial contour point;
the eighth submodule is used for searching the outline in the original binary image by taking the initial outline point as a starting point according to a region growing method;
the ninth sub-module is used for establishing a two-dimensional second matrix, the size of the second matrix is equal to the circumscribed rectangle of the foreground contour of the original binary image, and the contour points and the non-contour points are assigned with values;
and the tenth submodule is used for storing the searched contour points of the first contour into the second matrix.
A server, comprising: the image contour searching method comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the steps of the binary image contour searching method.
A computer-readable storage medium, comprising: the computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the binary image contour search method.
Compared with the prior art, the invention has the beneficial effects that:
the image contour searching method reduces the binary image by a preset multiple, maps the contour points of the reduced image into the original binary image to form a mapping square matrix, takes the contour points searched in the mapping square matrix as a starting point, searches the contour points in the original binary image, reduces the searching amount of pixel points, and avoids repeated searching by deleting the contours which are subjected to mapping operation in the reduced image one by one, so as to reduce the searching amount and searching complexity of the contour points of the binary image and improve the use efficiency of a kernel.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate an embodiment of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a flowchart illustrating steps of an image contour searching method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of an image contour searching method according to a second embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating steps of an image contour searching method according to the present invention;
FIG. 4 is a block diagram of an image contour searching apparatus according to a third embodiment of the present invention;
FIG. 5 is a block diagram of an image contour searching apparatus according to a fourth embodiment of the present invention;
FIG. 6 schematically shows a block diagram of a server for performing the image contour finding method of the present invention;
fig. 7 schematically shows a computer-readable storage medium for storing or carrying program code for implementing the image contour finding method of the present invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
For convenience of description, the foreground of the binary image is assigned 1 and the background is assigned 0.
Example one
Referring to fig. 1, a flowchart illustrating steps of an image contour searching method according to a first embodiment of the present invention is shown.
The image contour searching method provided by the embodiment of the invention comprises the following steps:
step 101: and reducing the original binary image by a preset multiple to generate a reduced image.
The original binary image is an image binarized by a semantic segmentation result, and each pixel point of the image is a black or white image. In the original binary image, for R, an image subset is defined, and if R is connected, R is defined as a region. For all unconnected K regions, the union Rk constitutes the foreground of the image, and the complement of Rk is called the background.
Based on the size of the original binary image, the original binary image is reduced to 1/mx 1/n, namely the length and the width are respectively 1/m and 1/n of the original binary image, and each pixel point of the reduced binary image is an mxn pixel square matrix of the original binary image. In a specific implementation process, in order to avoid contour loss, if a non-zero value exists in the m × n pixel square matrix before reduction, the value of the image after reduction is assigned to be 1.
m and n are preset multiples, and the specific multiples can be set by a user according to actual requirements. The method for reducing a binary image in the present embodiment is executed by a computing device in which a reduction program for a binary image is stored.
Step 102: and traversing the reduced image, searching each contour point contained in the foreground of the reduced image, and storing all the searched contour points into a first matrix.
The method for determining contour points in the present embodiment is executed by a computing device in which a contour point determination program is stored. Before searching the outline point of the reduced image, firstly adding an edge to the reduced image, assigning the edge to be 0, and determining the initial position of the outline point search and the search boundary.
Step 103: and traversing the first matrix according to the same sequence as the traversing reduced image, mapping the first contour point obtained by searching to the original binary image, and forming a mapping square matrix of pixel points corresponding to the contour point on the original binary image.
Searching contour points line by line from the upper left corner of the first matrix, mapping the first contour point obtained by searching into the original binary image to form an m × n pixel point mapping square matrix, wherein the mapping square matrix is the m × n pixel square matrix of the first contour point in the original binary image before image reduction, and the first contour point is from a point assigned with a value of 1 in the reduced image, so that non-0 pixel points are inevitably present in the mapping square matrix.
Step 104: and traversing the mapping square matrix, carrying out contour searching in the original binary image by taking the searched first foreground pixel point as a starting point, and storing the searched contour point of the first contour in a second matrix.
The searching sequence of the step is the same as that of the step 103, namely, non-0 pixel points are searched line by line from the top left corner of the mapping square matrix according to the sequence from top to bottom and from left to right, the outline position of the first matrix corresponds to the outline position of the original binary image where the mapping square matrix is located, and the first non-0 pixel point searched in the mapping square matrix is the outline point of the original binary image.
Step 105: the second matrix is reduced by a reduction factor of the reduced image.
In the reduced second matrix, the pixel point of the second matrix corresponds to the pixel point of the first matrix, and the first matrix has a contour point corresponding to the first contour position in the reduced second matrix.
Step 106: and comparing the contour points in the reduced second matrix with the contour points in the first matrix, and deleting the contour points in the first matrix corresponding to the contour points in the reduced second matrix.
The contour point search of the original binary image is started by the contour point mapping of the first matrix, the contour point search is performed contour by contour, after the step 105, the position of the first contour in the original binary image is determined, in order to avoid repeated search of the contour which is subjected to the mapping operation in the first matrix, before the second contour of the original binary image is searched, the step 106 is set, the first contour in the first matrix is deleted, and similarly, after each contour search of the original binary image is ended, the contour which provides the mapping contour point in the first matrix is deleted in the next step.
Step 107: and step 103 and 106 are repeated, and the contour points of the rest contours in the searched original binary image are stored in the second matrix until all the contour points in the second matrix are the required contour points when no contour point exists in the first matrix.
The contour points of the original binary image are searched one by one, the contours in the first matrix provide mapped contour points, and the contour points corresponding to the searched contours are deleted, in the process of searching the contour points, the contours adhered together due to image reduction in the first matrix can be separated in the contrast deletion of the contours one by one, and the exact positions of the original binary image contour points are finally determined.
Example two
Referring to fig. 2, a flowchart illustrating steps of an image contour searching method according to a second embodiment of the present invention is shown.
FIG. 3 is a schematic diagram of the steps of the image contour searching method.
The image contour searching method implemented by the invention specifically comprises the following steps:
step 201: and reducing the original binary image by a preset multiple to generate a reduced image.
Referring to fig. 3, the original binary image (a in fig. 3) is reduced to 1/mx 1/n to form a reduced image (B in fig. 3), the length and width of the reduced image are 1/m and 1/n, respectively, and each pixel point of the reduced binary image is an mxn pixel square matrix of the original binary image.
Step 202: and traversing the reduced image, searching each contour point contained in the foreground of the reduced image, and storing all the searched contour points into a first matrix.
Firstly, searching foreground pixel points line by line from the upper left corner of a reduced image, namely the upper left corner of an edge, from top to bottom and from left to right, and taking the first foreground pixel point as an initial contour point;
secondly, using the initial contour point as a starting point, and searching the contour in the reduced image according to a region growing method, wherein the specific operation method of the region growing method comprises the following steps:
extracting 8 pixel points around the initial contour point, and traversing the 8 pixel points from any searched non-0 pixel point at the upper left of the initial contour point according to a preset clockwise or anticlockwise sequence until a second contour point is encountered; then extracting 8 pixel points around the second contour point, and traversing 8 pixel points from the next pixel point of the second contour point according to a preset sequence until the next contour point is met; repeating the steps until all contour points of the two-dimensional matrix are traversed;
thirdly, establishing a two-dimensional first matrix, wherein the size of the first matrix is equal to that of a circumscribed rectangle of the foreground contour, assigning a value of 1 to the contour point, and assigning a value of 0 to the non-contour point;
finally, all contour points of the reduced image are stored in the first matrix (D in fig. 3).
Step 203: and traversing the first matrix according to the same sequence as the traversing reduced image, mapping the first contour point obtained by searching to the original binary image, and forming a mapping square matrix of pixel points corresponding to the contour point on the original binary image.
The mapping operation in the embodiment is executed by a computing device, and an operation program for mapping the first matrix contour points to the original binary image is stored in the computing device.
Step 204: and traversing the mapping square matrix, carrying out contour searching in the original binary image by taking the searched first foreground pixel point as a starting point, and storing the searched contour point of the first contour in a second matrix.
Firstly, searching foreground pixel points line by line from the upper left corner of a mapping square matrix, and taking a first searched non-0 pixel point as an initial contour point;
secondly, searching the outline in the original binary image by taking the initial outline point as a starting point according to a region growing method;
thirdly, establishing a two-dimensional second matrix, wherein the size of the second matrix is equal to that of a circumscribed rectangle of the foreground contour of the original binary image, assigning a value of 1 to the contour point, and assigning a value of 0 to the non-contour point;
finally, the found contour point (C in fig. 3) of the first contour is stored into the second matrix (E in fig. 3).
Step 205: the second matrix is reduced by the reduction factor of the reduced image (G in fig. 3).
The original binary image is reduced to 1/mx 1/n to form a reduced image, the outline points of the reduced image are stored in a first matrix, and the outline points of the reduced image are an mxn pixel square matrix where the outline points of the original binary image are located; and the contour points of the original binary image are stored in a second matrix, after the second matrix is reduced to 1/mx 1/n, the included contours are simultaneously reduced, and the reduced contour points of the second matrix are formed by scaling an mxn pixel square matrix where the contour points in the second matrix are located and correspond to the contour points in the first matrix.
Step 206: the contour points in the reduced second matrix (G in fig. 3) are compared with the contour points in the first matrix (F in fig. 3), and the contour points in the first matrix corresponding to the contour points in the reduced second matrix are deleted (I in fig. 3).
In this embodiment, the matching operation is executed by a computing device, and the computer device stores therein an outline point matching program of the first matrix and the reduced second matrix.
Step 207: step 203 and 206 are repeated, and the contour points of the remaining contours in the searched original binary image are stored in the second matrix until all the contour points (O in fig. 3) in the second matrix are the required contour points when no contour point exists in the first matrix (N in fig. 3).
EXAMPLE III
Referring to fig. 4, a block diagram of an image contour searching apparatus according to a third embodiment of the present invention is shown.
The image contour searching device of the embodiment of the invention comprises: a first reducing module 301, configured to reduce the original binary image by a preset multiple to generate a reduced image; a first searching module 302, configured to traverse the reduced image, search for each contour point included in a foreground in the reduced image, and store all the searched contour points in a first matrix; a mapping module 303, configured to traverse the first matrix in the same order as that of the traverse reduced image, map the first contour point obtained by the search to the original binary image, and form a mapping square matrix of pixel points corresponding to the contour point on the original binary image; a second searching module 304, configured to traverse the mapping square matrix, perform contour searching in the original binary image with the searched first foreground pixel point as a starting point, and store the searched contour point of the first contour in a second matrix; a second reduction module 305 for reducing the second matrix by a reduction factor of the reduced image; a comparing module 306, configured to compare the contour points in the reduced second matrix with the contour points in the first matrix, and delete the contour points in the first matrix corresponding to the contour points in the reduced second matrix; and the control module 307 is configured to repeat steps 3 to 6, store the contour points of the remaining contours in the searched original binary image into the second matrix, until no contour point exists in the first matrix, and all contour points in the second matrix are required contour points.
Example four
Referring to fig. 5, a block diagram of a preferred structure of an image contour searching apparatus according to a fourth embodiment of the present invention is shown.
The image contour searching device of the embodiment of the invention comprises: a first reducing module 301, configured to reduce the original binary image by a preset multiple to generate a reduced image; a first searching module 302, configured to traverse the reduced image, search for each contour point included in a foreground in the reduced image, and store all the searched contour points in a first matrix; a mapping module 303, configured to traverse the first matrix in the same order as that of the traverse reduced image, map the first contour point obtained by the search to the original binary image, and form a mapping square matrix of pixel points corresponding to the contour point on the original binary image; a second searching module 304, configured to traverse the mapping square matrix, perform contour searching in the original binary image with the searched first foreground pixel point as a starting point, and store the searched contour point of the first contour in a second matrix; a second reduction module 305 for reducing the second matrix by a reduction factor of the reduced image; a comparing module 306, configured to compare the contour points in the reduced second matrix with the contour points in the first matrix, and delete the contour points in the first matrix corresponding to the contour points in the reduced second matrix; and the control module 307 is configured to repeat steps 3 to 6, store the contour points of the remaining contours in the searched original binary image into the second matrix, until no contour point exists in the first matrix, and all contour points in the second matrix are required contour points.
Preferably, the first scaling-down module 301 comprises: the first sub-module 3011, configured to reduce the original binary image by a preset multiple, where each pixel of the reduced image is a pixel square matrix of the original binary image; and a second sub-module 3012, configured to assign values to the reduced image pixels, where if one of the image pixel matrixes before reduction is a foreground pixel, the assignment of the reduced pixel is the same as the assignment of the foreground pixel.
Preferably, the first lookup module 302 includes: a third sub-module 3021, configured to search foreground pixel points line by line from the upper left corner of the reduced image, and use the first foreground pixel point searched as an initial contour point; a fourth sub-module 3022, configured to perform contour search in the reduced image according to a region growing method with the starting contour point as a starting point until each contour point of the reduced image is traversed; a fifth sub-module 3023, configured to establish a two-dimensional first matrix, where the size of the first matrix is equal to a circumscribed rectangle that reduces a foreground contour of the image, and assign values to contour points and non-contour points; a sixth sub-module 3024 for storing all contour points of the reduced image in the first matrix.
Preferably, the second lookup module 304 includes: a seventh sub-module 3041, configured to search foreground pixel points line by line from the upper left corner of the mapping square matrix, and use the first foreground pixel point obtained by the search as an initial contour point; an eighth sub-module 3042, configured to perform contour search in the original binary image according to a region growing method with the start contour point as a starting point; a ninth sub-module 3043, configured to establish a two-dimensional second matrix, where the size of the second matrix is equal to a circumscribed rectangle of the foreground contour of the original binary image, and assign values to contour points and non-contour points; a tenth sub-module 3044 for storing the found contour points of the first contour in the second matrix.
The image contour searching device provided by the embodiment of the invention can realize each process in the image contour searching method in the method embodiments of fig. 1 to 2, and is not repeated here for avoiding repetition.
Each software module in the embodiment of the present invention has the same function as each corresponding software module in the foregoing system embodiment, and the specific operation description that each software module can execute may refer to the related description in the first embodiment and the second embodiment, which is not described herein again.
Those of ordinary skill in the art will appreciate that the elements and method steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of clearly illustrating the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. The program for implementing the invention may be stored on a computer readable medium or have one or more signals. Such a signal may be downloaded from a network or provided by a carrier signal or in some other form.
For example, FIG. 6 illustrates a server that may implement the image silhouette lookup method of the present invention, the server conventionally comprising a processor 401 and a computer program product or computer readable medium in memory 402. The memory 402 may be an electronic memory, e.g. a flash memory or a hard disk, and the memory 402 has a storage space 403 in which program code 4031 for performing the above-described method is stored, which program code can be read from or written to a computer program product.
The computer program product comprises a program code carrier, such as a hard disk, a memory card, etc., a computer readable storage medium, such as that shown in fig. 7, which may have a similar storage space as the memory 402 in the server shown in fig. 6, etc., and typically comprises code, such as computer readable code 4031, which can be read by the processor 401 and which, when executed by the computer, performs the steps of the method described above.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the present invention, and they should be construed as being included in the following claims and description.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. An image contour searching method is characterized by comprising the following steps:
step 1, reducing an original binary image by a preset multiple to generate a reduced image;
step 2, traversing the reduced image, searching each contour point contained in the foreground of the reduced image, and storing all the searched contour points into a first matrix;
step 3, traversing the first matrix according to the same sequence as the traversing reduced image, mapping the first contour point obtained by searching to the original binary image, and forming a mapping square matrix of pixel points corresponding to the contour point on the original binary image;
step 4, traversing the mapping square matrix, carrying out contour searching in the original binary image by taking the searched first foreground pixel point as a starting point, and storing the searched contour point of the first contour in a second matrix;
step 5, reducing the second matrix according to the reduction times of the reduced image;
step 6, comparing the contour points in the reduced second matrix with the contour points in the first matrix, and deleting the contour points in the first matrix corresponding to the contour points in the reduced second matrix;
and 7, repeating the steps 3 to 6, storing the contour points of the rest contours in the searched original binary image into the second matrix until all contour points in the second matrix are required contour points when no contour point exists in the first matrix.
2. The image contour searching method according to claim 1, wherein: the specific method of the step 1 is as follows:
A1. reducing the original binary image by a preset multiple, wherein each pixel point of the reduced image corresponds to a pixel point square matrix of the original binary image;
A2. and assigning values to the reduced image pixel points, wherein if one of the image pixel point matrixes before reduction is a foreground pixel point, the assignment of the reduced pixel point is the same as that of the foreground pixel point.
3. The image contour searching method according to claim 1, wherein: the specific method of the step 2 is as follows:
B1. searching foreground pixel points line by line from the upper left corner of the reduced image, and taking the first foreground pixel point as an initial contour point;
B2. carrying out contour searching in the reduced image according to a region growing method by taking the initial contour point as a starting point until traversing each contour point of the reduced image;
B3. establishing a two-dimensional first matrix, wherein the size of the first matrix is equal to that of a circumscribed rectangle of a foreground contour of a reduced image, and assigning values to contour points and non-contour points;
B4. all contour points of the reduced image are stored in a first matrix.
4. The image contour searching method according to claim 3, wherein: the specific method of the step 4 is as follows:
C1. searching foreground pixel points line by line from the upper left corner of the mapping square matrix, and taking the first foreground pixel point as an initial contour point;
C2. carrying out contour searching in the original binary image by taking the initial contour point as a starting point according to a region growing method;
C3. establishing a two-dimensional second matrix, wherein the size of the second matrix is equal to that of a circumscribed rectangle of the foreground contour of the original binary image, and assigning values to contour points and non-contour points;
C4. and storing the searched contour points of the first contour in a second matrix.
5. The image contour searching method according to claim 3 or 4, characterized in that: the specific method for searching contour points by using the region growing method is as follows:
D1. extracting 8 pixel points around the initial contour point, traversing the 8 pixel points according to a preset sequence until a second contour point is met;
D2. extracting 8 pixel points around the second contour point, and traversing 8 pixel points from the next pixel point of the second contour point until the next contour point is met;
D3. d2 is repeated until all contour points of the two-dimensional matrix are traversed.
6. An image contour search apparatus, comprising:
the first reducing module is used for reducing the original binary image by a preset multiple to generate a reduced image;
the first searching module is used for traversing the reduced image, searching each contour point contained in the foreground of the reduced image and storing all the searched contour points into a first matrix;
the mapping module is used for traversing the first matrix according to the same sequence as the traversing reduced image, mapping the first contour point obtained by searching to the original binary image, and forming a mapping square matrix of pixel points corresponding to the contour point on the original binary image;
the second searching module is used for traversing the mapping square matrix, carrying out contour searching in the original binary image by taking the searched first foreground pixel point as a starting point, and storing the searched contour point of the first contour into the second matrix;
a second reduction module for reducing the second matrix according to the reduction multiple of the reduced image;
the comparison module is used for comparing the contour points in the reduced second matrix with the contour points in the first matrix and deleting the contour points in the first matrix corresponding to the contour points in the reduced second matrix;
and the control module is used for repeating the steps 3 to 6, storing the contour points of the rest contours in the searched original binary image into the second matrix until all the contour points in the second matrix are required contour points when no contour point exists in the first matrix.
7. The image contour searching device of claim 6, wherein the first reducing module comprises:
the first submodule is used for reducing the original binary image by preset times, and each pixel point of the reduced image corresponds to a pixel point square matrix of the original binary image;
and the second sub-module is used for assigning values to the reduced image pixel points, and if one of the image pixel point matrixes before reduction is a foreground pixel point, the assignment of the reduced pixel point is the same as the assignment of the foreground pixel point.
8. The image contour searching device of claim 6, wherein the first searching module comprises:
the third sub-module is used for searching foreground pixel points line by line from the upper left corner of the reduced image and taking the first foreground pixel point as an initial contour point;
the fourth sub-module is used for searching the outline in the reduced image by taking the initial outline point as a starting point according to a region growing method until each outline point of the reduced image is traversed;
the fifth sub-module is used for establishing a two-dimensional first matrix, wherein the size of the first matrix is equal to that of a circumscribed rectangle for reducing the foreground contour of the image, and the first matrix is used for assigning values to contour points and non-contour points;
a sixth sub-module for storing all contour points of the reduced image in the first matrix;
the second lookup module comprises:
the seventh submodule is used for searching foreground pixel points line by line from the upper left corner of the mapping square matrix and taking the searched first foreground pixel point as an initial contour point;
the eighth submodule is used for searching the outline in the original binary image by taking the initial outline point as a starting point according to a region growing method;
the ninth sub-module is used for establishing a two-dimensional second matrix, the size of the second matrix is equal to the circumscribed rectangle of the foreground contour of the original binary image, and the contour points and the non-contour points are assigned with values;
and the tenth submodule is used for storing the searched contour points of the first contour into the second matrix.
9. A server, characterized by: the method comprises the following steps: memory, processor and computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the steps of the binary image contour search method according to any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that: the method comprises the following steps: the computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the binary image contour finding method as claimed in any one of claims 1 to 5.
CN202110337303.2A 2021-03-30 2021-03-30 Image contour searching method, device, server and medium Active CN112733868B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110337303.2A CN112733868B (en) 2021-03-30 2021-03-30 Image contour searching method, device, server and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110337303.2A CN112733868B (en) 2021-03-30 2021-03-30 Image contour searching method, device, server and medium

Publications (2)

Publication Number Publication Date
CN112733868A true CN112733868A (en) 2021-04-30
CN112733868B CN112733868B (en) 2021-08-20

Family

ID=75596016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110337303.2A Active CN112733868B (en) 2021-03-30 2021-03-30 Image contour searching method, device, server and medium

Country Status (1)

Country Link
CN (1) CN112733868B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006235733A (en) * 2005-02-22 2006-09-07 Mitsubishi Electric Corp Image processor, image processing method, and image display device
CN105184785A (en) * 2015-08-28 2015-12-23 厦门天马微电子有限公司 Method and device for extracting image contour
US20160035065A1 (en) * 2011-07-12 2016-02-04 Apple Inc. Multifunctional environment for image cropping
CN105427284A (en) * 2015-11-06 2016-03-23 西北工业大学 Fixed target marking method based on airborne android platform
CN108537099A (en) * 2017-05-26 2018-09-14 华南理工大学 A kind of licence plate recognition method of complex background
CN109658376A (en) * 2018-10-24 2019-04-19 哈尔滨工业大学 A kind of surface defect recognition method based on image recognition

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006235733A (en) * 2005-02-22 2006-09-07 Mitsubishi Electric Corp Image processor, image processing method, and image display device
US20160035065A1 (en) * 2011-07-12 2016-02-04 Apple Inc. Multifunctional environment for image cropping
CN105184785A (en) * 2015-08-28 2015-12-23 厦门天马微电子有限公司 Method and device for extracting image contour
CN105427284A (en) * 2015-11-06 2016-03-23 西北工业大学 Fixed target marking method based on airborne android platform
CN108537099A (en) * 2017-05-26 2018-09-14 华南理工大学 A kind of licence plate recognition method of complex background
CN109658376A (en) * 2018-10-24 2019-04-19 哈尔滨工业大学 A kind of surface defect recognition method based on image recognition

Also Published As

Publication number Publication date
CN112733868B (en) 2021-08-20

Similar Documents

Publication Publication Date Title
US10970844B2 (en) Image segmentation method and device, computer device and non-volatile storage medium
Ren et al. gSLICr: SLIC superpixels at over 250Hz
CN110853047A (en) Intelligent image segmentation and classification method and device and computer readable storage medium
CN108399424B (en) Point cloud classification method, intelligent terminal and storage medium
CN108334879B (en) Region extraction method, system and terminal equipment
WO2017088462A1 (en) Image processing method and device
CN108345888A (en) A kind of connected domain extracting method and device
CN111797821A (en) Text detection method and device, electronic equipment and computer storage medium
CN111932570B (en) Edge detection method, device, medium and equipment based on grid data
CN112101386B (en) Text detection method, device, computer equipment and storage medium
CN110738203A (en) Method and device for outputting field structuralization and computer readable storage medium
CN111709428B (en) Method and device for identifying positions of key points in image, electronic equipment and medium
CN111091030A (en) Tree species identification method and device, computer equipment and readable storage medium
CN110046623B (en) Image feature point extraction method and camera
CN108877030B (en) Image processing method, device, terminal and computer readable storage medium
Dong et al. A parallel thinning algorithm based on stroke continuity detection
CN109543525B (en) Table extraction method for general table image
CN112733868B (en) Image contour searching method, device, server and medium
CN114444565A (en) Image tampering detection method, terminal device and storage medium
CN109815763A (en) Detection method, device and the storage medium of two dimensional code
Dong et al. An improved parallel thinning algorithm
CN114511862B (en) Form identification method and device and electronic equipment
CN116012393A (en) Carton point cloud segmentation method, device and processing equipment
CN106780637B (en) Rapid parallel image thinning method based on pulse neurolemma system
KR102256409B1 (en) Method of generating a learning data set and computer apparatus for generating a learning data set

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