Image edge processing method, device, electronic device and storage medium

By slicing and data fusion layer by layer on layer, generating a tree data structure and determining edge contour lines, the problems of insufficient universality and noise reduction capabilities of image edge detection operators in the prior art are solved, and higher detection accuracy and processing efficiency are achieved.

CN114170253BActive Publication Date: 2025-05-02NAVINFO
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010844093.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-20
Publication Date
2025-05-02
Estimated Expiration
2040-08-20

AI Technical Summary

Technical Problem

In the prior art, the image edge detection operator has poor generality, resulting in weak noise reduction capability of target edge detection, which in turn affects detection accuracy.

Method used

By slicing the target image layer by layer, a tree map is generated and the tree data structure is determined, edge key points are filtered, and data fusion is performed through the minimum cost path to generate edge contour lines.

Benefits of technology

It improves the versatility and detection accuracy of image edge processing, reduces dependence on identifying target categories, avoids clustering instantiation and noise reduction operations, and improves processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114170253B_ABST
    Figure CN114170253B_ABST
Patent Text Reader

Abstract

The present application provides an image edge processing method, device, electronic device and storage medium, the method comprising: segmenting the target image layer by layer, generating a dendrogram of the target image, and determining the tree data structure of the target image, the tree data structure including the node information of each node in the dendrogram, the node information including the edge key points of the target; determining the minimum cost path of the edge key points, obtaining the target key points on the minimum cost path; performing data fusion on the target key points according to the target key points and the node information, generating fusion data of the target key points; finally determining the edge contour line of the target according to the fusion data of the target key points. The data structuring of the edge pixel points of the image is realized, and when determining the edge contour line of the target according to the fusion data, no requirement is made on the category of the identified target, thereby improving the versatility, image edge processing efficiency and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image edge processing method, device, electronic device and storage medium. Background Art

[0002] In the process of intelligent human-computer interaction and the research on edge detection of computer images, edge detection of images can effectively distinguish the target from other objects (such as background). Edge detection technology has become an important basis for image analysis such as image segmentation, target area recognition and area shape extraction. So far, edge detection technology has played an increasingly important role in scientific research, industrial production, military technology and health, and the research on edge detection technology has also received increasing attention.

[0003] In digital images, the grayscale values ​​of pixels located on the edge of the image are relatively small and change slowly, while the grayscale values ​​of pixels located on the edge of the image and pixels close to the edge of the image are relatively large and change dramatically. Based on this, the first-order derivative and second-order derivative of the grayscale value of the image are usually used as image edge detection operators for digital images, such as differential operators, Sobel operators, Canny operators, Prewwitt operators, etc. Among them, the Sobel operator is not accurate in edge positioning and can only be used for edge detection requirements with low precision requirements. Although the Canny operator has strong anti-interference ability, it is very easy to mistakenly identify noise points as boundaries. The Prewwitt operator is a 3*3 operator template that uses the grayscale difference between the upper and lower and left and right neighboring points of the pixel point to reach the extreme value at the edge to detect the edge, remove some pseudo edges, and use average filtering to smooth the noise. However, for images mixed with multiple complex noises, the processing effect is difficult to achieve ideal results. Moreover, according to different recognition requirements, the image edge detection operator needs to define the code business level and set the threshold. For example, the threshold setting for the target being a person cannot be applied to the recognition of targets such as fruits or tables and chairs.

[0004] However, in the prior art, since each image edge detection operator has its own advantages and disadvantages, the Sobel operator can be used for edge detection needs with low precision requirements, the Canny operator can be used for detection needs that require strong anti-interference ability, and the Prewwitt operator can be used for edge detection needs of images with non-mixed and complex noises. Therefore, in the prior art, image target edge detection usually selects a suitable detection operator from a variety of image edge detection operators based on the scene type and target category, resulting in poor versatility of the detection operator. In addition, when performing target edge detection, the image edge detection operator performs edge detection on multiple targets in the original image, and then performs subsequent operations on the target edge by clustering and instantiating the detected edge pixels and using a denoising method suitable for the target, resulting in poor denoising ability of target edge detection, which in turn leads to low accuracy. Summary of the invention

[0005] The present application provides an image edge processing method, device, electronic device and storage medium, which realize edge detection of an image and improve the versatility of the edge processing method and the accuracy of edge detection.

[0006] In a first aspect, an embodiment of the present application provides an image edge processing method, comprising:

[0007] The target image is segmented layer by layer to generate a dendrogram of the target image, and a tree data structure of the target image is determined, wherein the tree data structure includes node information of each node in the dendrogram, and the node information includes edge key points of the target;

[0008] Determine the minimum cost path of edge key points and obtain the target key points on the minimum cost path;

[0009] According to the target key points and node information, data fusion is performed on the target key points to generate fusion data of the target key points;

[0010] According to the fusion data of the target key points, the edge contour of the target is determined.

[0011] In the embodiment of the present application, the target image is segmented layer by layer and the tree data structure of the target image is determined, and then the target key points on the minimum cost path are determined according to the edge key points in the tree data structure, so as to achieve the screening of the edge key points, and then the target key points are data-fused according to the target key points and the node information in the tree data structure to generate the fusion data of the target key points, so as to achieve the data structuring of the edge of the image. When the edge contour line of the target is determined according to the fusion data, no requirement is made on the category of the identified target, and it is not necessary to select the image edge detection operator according to the scene and the target type, nor is it necessary to set the parameters in the edge detection operator according to different targets, which can effectively improve the versatility of image edge processing. In addition, in the embodiment of the present application, after the target image is segmented layer by layer, the edge of the image is data-structured, and the edge pixels and noise points can be directly determined by the data structure of the edge pixels of the image, thereby avoiding the subsequent operation of the target edge by clustering and instantiating the detected edge pixels and the noise reduction method suitable for the target in the prior art, which can not only improve the accuracy of target edge detection, but also improve the processing efficiency.

[0012] In a possible implementation, the target image is segmented layer by layer to generate a tree diagram of the target image, and the tree data structure of the target image is determined, including:

[0013] The target image is used as the root node image of the dendrogram, and the root node image is segmented to generate multiple child node images; the multiple child node images are segmented respectively until the leaf node image is smaller than a preset size to generate a dendrogram; according to the node relationship between the node images in the dendrogram, a tree data structure of the target image is constructed.

[0014] In an embodiment of the present application, the target image is used as the root node image of the tree diagram, and the root node image is divided layer by layer until the leaf node image of the last layer is smaller than a preset size, thereby constructing a tree data structure of the target image, thereby improving the reliability of the tree data structure.

[0015] In a possible implementation manner, before segmenting the target image layer by layer, the method further includes:

[0016] Locate the target in the original image and obtain the target's circumscribed rectangular image;

[0017] Divide the bounding rectangle image into a layer and determine the layer as the target image.

[0018] In the embodiment of the present application, by determining the circumscribed rectangular image of the target and using the layers divided by the circumscribed rectangular image as the target image, it is helpful to improve the accuracy of target edge detection.

[0019] In a possible implementation, determining the minimum cost path of edge key points includes:

[0020] Determine a first edge key point before a current edge key point and a second edge key point after the current edge key point;

[0021] Fill the pixel point information of the first edge key point and the second edge key point and the positional relationship with the current edge key point into the data structure of the current edge key point to obtain the data structure of each edge key point;

[0022] According to the data structure of each edge key point, the cost of the edge key point is calculated to determine the minimum cost path of the edge key point.

[0023] In a possible implementation manner, before calculating the cost of the edge key point according to the data structure of each edge key point, the method further includes:

[0024] According to the positional relationship between each edge key point, a task queue of the edge key point is generated; according to the data structure of each edge key point, the cost of the edge key point is calculated, including: according to the task queue of the edge key point, according to the data structure of each edge key point, the cost of the edge key point is calculated.

[0025] In the embodiment of the present application, by generating a task queue of edge key points according to the positional relationship between each edge key point, and performing cost calculation on the edge key points according to the task queue, the efficiency of cost calculation can be improved.

[0026] In a possible implementation, data fusion is performed on the target key points according to the target key points and the tree data structure to generate fused data of the target key points, including:

[0027] The coordinates of the target key points in the leaf node image are restored to the coordinates of the target key points in the target image according to the node information of the node where the target key points are located, so as to obtain the fusion data of the target key points.

[0028] In a possible implementation, determining the edge contour of the target according to the fusion data of the target key points includes:

[0029] The target key points are sorted by using their coordinates in the target image to determine the sorting positions of the target key points; the target key points are connected according to their sorting positions to determine the edge contour lines of the target.

[0030] In a possible implementation manner, the fused data of the target key point is a tree data structure of the target key point and / or a vector of the target key point.

[0031] The following introduces the device, electronic device, computer-readable storage medium and computer program product provided in the embodiments of the present application. Their contents and effects can refer to the image edge processing method provided in the embodiments of the present application and will not be repeated here.

[0032] In a second aspect, an embodiment of the present application provides an image edge processing device, including:

[0033] The processing module is used to segment the target image layer by layer, generate a dendrogram of the target image, and determine the tree data structure of the target image. The tree data structure includes node information of each node in the dendrogram, and the node information includes edge key points of the target.

[0034] The determination module is used to determine the minimum cost path of the edge key points and obtain the target key points on the minimum cost path.

[0035] The fusion module is used to fuse the target key points data according to the target key points and node information to generate fused data of the target key points.

[0036] The determination module is also used to determine the edge contour of the target based on the fusion data of the target key points.

[0037] In a possible implementation manner, the processing module is specifically configured to:

[0038] The target image is used as the root node image of the dendrogram, and the root node image is segmented to generate multiple child node images; the multiple child node images are segmented respectively until the leaf node image is smaller than a preset size to generate a dendrogram; according to the node relationship between the node images in the dendrogram, a tree data structure of the target image is constructed.

[0039] In a possible implementation, the determination module is specifically configured to:

[0040] Determine the first edge key point before the current edge key point and the second edge key point after the current edge key point; fill the pixel point information of the first edge key point and the second edge key point and the positional relationship with the current edge key point into the data structure of the current edge key point, and obtain the data structure of each edge key point; calculate the cost of the edge key point according to the data structure of each edge key point, and determine the minimum cost path of the edge key point.

[0041] In a possible implementation, the fusion module is specifically configured to:

[0042] The coordinates of the target key points in the leaf node image are restored to the coordinates of the target key points in the target image according to the node information of the node where the target key points are located, so as to obtain the fusion data of the target key points.

[0043] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0044] at least one processor; and

[0045] a memory communicatively coupled to at least one processor; wherein

[0046] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method provided in the first aspect or in an implementable manner of the first aspect.

[0047] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to cause a computer to execute the method provided in the first aspect or in an implementable manner of the first aspect.

[0048] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising: executable instructions, wherein the executable instructions are used to implement the method provided in the first aspect or in an optional manner of the first aspect.

[0049] The image edge processing method, device, electronic device and storage medium provided by the present application generate a dendrogram of the target image by segmenting the target image layer by layer, and determine the tree data structure of the target image, wherein the tree data structure includes node information of each node in the dendrogram, and the node information includes the edge key points of the target; then determine the minimum cost path of the edge key points, and obtain the target key points on the minimum cost path; then, perform data fusion on the target key points based on the target key points and the node information, and generate fused data of the target key points; finally, determine the edge contour line of the target based on the fused data of the target key points. In the embodiment of the present application, by segmenting the target image layer by layer and determining the tree data structure of the target image, and then determining the target key points on the minimum cost path according to the edge key points in the tree data structure, the edge key points are screened, and then the target key points are data fused according to the target key points and the node information in the tree data structure to generate fused data of the target key points, so that the edge pixel points of the image are data structured. When the edge contour line of the target is determined according to the fused data, no requirement is made on the category of the identified target, and it is not necessary to select the image edge detection operator according to the scene and the target type, nor is it necessary to set the parameters in the edge detection operator according to different targets, which can effectively improve the versatility of image edge processing. In addition, in the embodiment of the present application, after the target image is segmented layer by layer, the edge of the image is data structured, and the edge pixel points and noise points can be directly determined by the data structure of the edge pixel points of the image, thereby avoiding the prior art of performing subsequent operations on the target edge by clustering and instantiating the detected edge pixel points and using a noise reduction method suitable for the target, which can not only improve the accuracy of target edge detection, but also improve processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0051] Figure 1 This is an exemplary application scenario architecture diagram provided by an embodiment of the present application;

[0052] Figure 2 is a flowchart of an image edge processing method provided by an embodiment of the present application;

[0053] Figure 3 is a schematic diagram of generating a target image provided by an embodiment of the present application;

[0054] Figure 4 is a schematic diagram of a dendrogram of a target image provided in an embodiment of the present application;

[0055] Figure 5 is a schematic diagram of a tree data structure provided in an embodiment of the present application;

[0056] Figure 6 is a flowchart of an image edge processing method provided by another embodiment of the present application;

[0057] Figure 7 is a schematic diagram of segmenting a target image provided by another embodiment of the present application;

[0058] Figure 8 is a flowchart of an image edge processing method provided by another embodiment of the present application;

[0059] Fig. 9 is a structural schematic diagram of an image edge processing device provided by an embodiment of the present application;

[0060] Fig.10 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0062] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0063] In the process of intelligent human-computer interaction and the research on edge detection of computer images, edge detection of images can effectively distinguish the target from other objects (such as background). Edge detection technology has become an important basis for image analysis such as image segmentation, target region recognition and region shape extraction. In the prior art, the first-order derivative and second-order derivative of the gray value of the image are usually used as image edge detection operators for digital images, such as differential operators, Sobel operators, Canny operators, etc. However, in the prior art, for edge detection of targets in images, a suitable detection operator is usually selected from a variety of image edge detection operators according to the scene type and target category, and the versatility of the detection operator is poor.

[0064] The inventive concept of the image edge processing method, device, electronic device and storage medium provided in the embodiments of the present application is that by dividing the target image layer by layer and determining the tree data structure of the target image, and then determining the target key points on the minimum cost path according to the edge key points in the tree data structure, the edge key points are screened, and then the target key points are data-fused according to the target key points and the node information in the tree data structure to generate fused data of the target key points, thereby structuring the data of the edge pixel points of the image. When determining the edge contour line of the target according to the fused data, no requirement is made on the category of the identified target, and no root is required. The image edge detection operator is selected according to the scene and target type, and there is no need to set the parameters in the edge detection operator according to different targets, which can effectively improve the versatility of image edge processing. In addition, in the embodiment of the present application, after the target image is segmented layer by layer, the edge of the image is processed in a data structured manner, and the edge pixels and noise points can be directly determined through the data structure of the image edge pixels, thereby avoiding the subsequent operation of the target edge by clustering and instantiating the detected edge pixels and using a noise reduction method suitable for the target in the prior art, which can not only improve the accuracy of target edge detection, but also improve processing efficiency. The following is an introduction to the exemplary application scenarios of the embodiments of the present application.

[0065] The image edge processing method provided in the embodiment of the present application can be executed by the image edge processing device provided in the embodiment of the present application. The image edge processing device provided in the embodiment of the present application can be integrated in the terminal device, or the image edge processing device can be the terminal device itself. The embodiment of the present application does not limit the specific type of the terminal device. For example, the terminal device can be a smart phone, a personal computer, a tablet computer, a wearable device, a vehicle-mounted terminal, a monitoring device, a camera, etc. Figure 1 is an exemplary application scenario architecture diagram provided by an embodiment of the present application, such as Figure 1As shown, the architecture mainly includes: a terminal device 11 and a server 12. Among them, the image edge processing method provided in the embodiment of the present application can be applied to the terminal device 11, for example, it can be implemented through the application software or web page in the terminal device 11, for example, it can be implemented through the image processing APP in the terminal device 11. The terminal device 11 is connected to the server 12 for data communication with the server 12, for example, the fused data can be sent to the server, and the server can store and process the fused data, etc. The embodiment of the present application does not limit the type of the server.

[0066] Figure 2 1 is a flow chart of an image edge processing method provided by an embodiment of the present application. The method can be executed by an image edge processing device, which can be implemented by software and / or hardware. The image edge processing method is described below with a terminal device as the execution subject. Figure 2 As shown, the image edge processing method provided in the embodiment of the present application may include:

[0067] Step S101: segment the target image layer by layer, generate a tree diagram of the target image, and determine the tree data structure of the target image.

[0068] The target image may be a layer of the original image, and the layer includes the target. For example, if the original image includes 4 targets, the original image may be divided into 4 layers, each layer having the same size as the original image, and each layer including one target. The pixel values ​​of other pixels in the layer except the target may be set to 0 or other fixed values. The embodiment of the present application is only taken as an example and is not limited thereto.

[0069] In order to determine the target image, in a possible implementation manner, the image edge processing method provided in the embodiment of the present application may further include, before segmenting the target image layer by layer:

[0070] The target is located in the original image, and the bounding rectangle image of the target is obtained; the bounding rectangle image is divided into a layer, and the layer is determined as the target image of the target.

[0071] For ease of introduction, Figure 3 is a schematic diagram of generating a target image provided by an embodiment of the present application, such as Figure 3As shown, the original image 21 is positioned, and after positioning, it is determined that the original image 21 includes target 1 and target 2, and then the bounding rectangle images of target 1 and target 2 are obtained respectively. The original image can be an image taken by the terminal device, or it can be an image obtained by the terminal device from other devices. The embodiment of the present application does not limit the source, format, size, etc. of the original image. The embodiment of the present application does not limit the specific implementation method of positioning the original image and obtaining the bounding rectangle image of the target. For example, the original image can be input into the segmentation deep network to obtain the output result of the segmentation deep network, and the bounding rectangle image of the target can be extracted according to the output result of the deep network; for another example, the original image can be input into the detection deep network, and the detection deep network can output the bounding rectangle image of the target; for another example, the bounding rectangle image of the target can also be extracted by manual box selection or bounding rectangle algorithm. The specific method can refer to the bounding rectangle algorithm in the prior art, which will not be repeated.

[0072] After determining the bounding rectangle image of the target, the bounding rectangle image is divided into a layer, and a target image 22 of target 1 and a target image 23 of target 2 are generated respectively, as shown in FIG. Figure 3 As shown, the position of the target in the target image is consistent with that in the original image.

[0073] In the embodiment of the present application, by determining the circumscribed rectangular image of the target and using the layers divided by the circumscribed rectangular image as the target image, it is helpful to improve the accuracy of target edge detection.

[0074] After determining the target image, the target image is divided layer by layer to generate a tree diagram of the target image, and a tree data structure of the target image is determined, wherein the tree data structure includes node information of each node in the tree diagram, and the node information includes edge key points of the target. The embodiment of the present application does not limit the specific content of the node information. In one possible implementation, the node information of each node includes pixel information of the image corresponding to the node and the relationship between the node and the root node and other nodes. In another possible implementation, the node information may include a storage address, which stores pixel information of the image corresponding to the node and the relationship between the node and the root node and other nodes, so as to improve the processing rate.

[0075] In the process of layer-by-layer segmentation of the target image in the embodiment of the present application, the number and segmentation method of each layer are not limited. For example, the original image can be segmented into N first-layer images, and then the N first-layer images are segmented into M second-layer images, and so on, where M and N are integers greater than 1, and M and N can be equal or unequal. The embodiment of the present application only takes this as an example and is not limited to this. For the convenience of introduction, the target image is taken as follows Figure 3Take the target image 22 of target 1 in the example, and divide each layer of image into 2 images. Figure 4 is a schematic diagram of a dendrogram of a target image provided in an embodiment of the present application, Figure 5 is a schematic diagram of a tree data structure provided in an embodiment of the present application, such as Figure 4 and Figure 5 As shown, the root node includes the data of the target image. After the target image is divided for the first time, image 211 and image 212 are obtained. Figure 5 In the middle subnode 1, the pixel value, pixel coordinates, and node relationship between the image 211 and the target image of each edge key point of the target in the image 211 may be included, and the subnode 2 includes the data of the image 212, wherein, since the target 1 does not exist in the image 212, the data in the subnode 2 may be set to empty, or the subnode 2 may be removed. Then, the image 211 and the image 212 are divided into two sub-images respectively, wherein the sub-image 212 may not be further processed, and only the sub-image 211 containing the target 1 is divided into the image 213 and the image 214, wherein the pixel value, pixel coordinates, and node relationship between the sub-image 211 and the target image of each edge key point of the target in the image 213 are filled in the leaf node 1, and the data of the sub-image 214 is filled in the leaf node 2, wherein the leaf node is the bottommost node in the tree data structure, and the embodiment of the present application is only taken as an example, and is not limited thereto. For example, the image 213 may be further divided, and the data of the divided image may be filled in the node after the leaf node 1, and at this time, the leaf node 1 is no longer a leaf node but a sub-node.

[0076] Step S102: Determine the minimum cost path of the edge key point, and obtain the target key point on the minimum cost path.

[0077] After determining the edge key points of the target, determine the minimum cost path of the edge key points. The embodiment of the present application does not limit the specific implementation method of determining the minimum cost path of the edge key points. In one possible implementation, the minimum cost path from the initial key point in each leaf node to other edge key points can be automatically calculated by the terminal device, wherein the initial key point can be any key point among the edge key points. In another possible implementation, the minimum cost of all edge pixel points between the initial key point and the current key point in each leaf node can be calculated by receiving the manually selected initial key point or the current key point. The embodiment of the present application takes this as an example only and is not limited to this. After determining the minimum cost path of the edge key points, the edge key points on the minimum cost path are determined as the target key points, thereby achieving further screening of the edge key points.

[0078] Step S103: performing data fusion on the target key points according to the target key points and the node information to generate fused data of the target key points.

[0079] After determining the target key point on the minimum cost path, since the information of the target key point may be stored in different leaf nodes respectively, in order to fully express the relationship between each target key point in the target image, the target key point can be fused according to the target key point and the node information to generate fused data of the target key point. The embodiment of the present application does not limit the form of the fused data of the target key point. In one possible implementation, the fused data of the target key point is a tree data structure of the target key point, and / or a vector of the target key point.

[0080] Since the original coordinates of the pixel points in the target image may be different from the coordinates in the segmented image when the target image is segmented, in a possible implementation, data fusion is performed on the target key points according to the target key points and the tree data structure to generate fused data of the target key points, including: restoring the coordinates of the target key points in the leaf node image to the coordinates of the target key points in the target image according to the node information of the node where the target key points are located, and obtaining the fused data of the target key points.

[0081] For example, refer to Figure 4 and Figure 5 , taking data fusion of target key points of target 1 as an example, wherein, for example, the coordinates of target key point 1 of target 1 in image 213 are (x1, y1), and according to the node information in leaf node 1, it is determined that image 213 is divided by image 211, and image 213 is the lower half image of image 211, and according to the node information, the coordinates of target key point 1 in image 211 are determined to be (x1, y2). Then, according to the node information of child node 1, it is determined that image 211 is divided by image 22, and image 211 is the left half image of image 22, then it can be determined that the coordinates of target key point 1 in image 22 are the same as those in image 211, that is, (x1, y2). The embodiments of the present application take this as an example only, and are not limited thereto. By analogy, the coordinates of each target key point in the target image are determined, and a tree data structure of the target key point can be obtained, the tree data structure of the target key point includes the coordinates of the target key point in each node in the target image, the coordinates of the node image, the relationship with other nodes, and the previous target key point and the next target key point of the target key point, etc., which are not limited in the embodiments of the present application. A vector of the target key point can also be obtained, and the vector of the target key point includes the coordinates of the target key point in the target image.

[0082] After restoring the coordinates of the target key point in the leaf node image to the coordinates of the target key point in the target image, the coordinates of the target key point in the target image can also be written into a blank image to express the fused data of the target key point in the form of an image, wherein the blank image has the same size as the target image.

[0083] Step S104: Determine the edge contour of the target based on the fused data of the target key points.

[0084] After determining the fusion data of the target key points, the edge contour line of the target can be determined based on the fusion data of the target key points. In a possible implementation, the edge contour line of the target can be determined based on the tree data structure of the target key points, or based on the vectors of the target key points. Taking the determination of the edge contour line of the target based on the vectors of the target key points as an example, in a possible implementation, the edge contour line of the target is determined based on the fusion data of the target key points, including: sorting the target key points using the coordinates of the target key points in the target image to determine the sorting position of the target key points; connecting the target key points according to the sorting position of the target key points to determine the edge contour line of the target.

[0085] In the embodiment of the present application, the target image is segmented layer by layer and the tree data structure of the target image is determined, and then the target key points on the minimum cost path are determined according to the edge key points in the tree data structure, so as to achieve the screening of the edge key points, and then the target key points are data-fused according to the target key points and the node information in the tree data structure to generate the fusion data of the target key points, so as to achieve the data structuring of the edge of the image. When the edge contour line of the target is determined according to the fusion data, no requirement is made on the category of the identified target, and it is not necessary to select the image edge detection operator according to the scene and the target type, nor is it necessary to set the parameters in the edge detection operator according to different targets, which can effectively improve the versatility of image edge processing. In addition, in the embodiment of the present application, after the target image is segmented layer by layer, the edge of the image is data-structured, and the edge pixels and noise points can be directly determined by the data structure of the edge pixels of the image, thereby avoiding the subsequent operation of the target edge by clustering and instantiating the detected edge pixels and the noise reduction method suitable for the target in the prior art, which can not only improve the accuracy of target edge detection, but also improve the processing efficiency.

[0086] exist Figure 2 Based on the shown embodiment, Figure 61 is a flow chart of an image edge processing method provided by another embodiment of the present application. The method can be executed by an image edge processing device, which can be implemented by software and / or hardware. The image edge processing method is described below with a terminal device as the execution subject. Figure 6 As shown, step S101 in the image edge processing method provided in the embodiment of the present application, i.e., segmenting the target image layer by layer, generating a tree diagram of the target image, and determining the tree data structure of the target image, may include:

[0087] Step S201: taking the target image as the root node image of the tree diagram, segmenting the root node image to generate a plurality of child node images.

[0088] For example, Figure 7 FIG. 1 is a schematic diagram of segmenting a target image provided by another embodiment of the present application. Taking the target image as an example, each layer can be segmented into 4 images, such as Figure 7 As shown, the target image is segmented to generate 4 sub-node images, that is, the first layer images of the four quadrants are obtained. Figure 7 Only the image of the first quadrant of the first layer is shown, and the others are not repeated.

[0089] Step S202: Segment the plurality of child node images respectively until the leaf node image is smaller than a preset size, thereby generating a tree diagram.

[0090] The multiple sub-node images are segmented respectively. Figure 7 Taking the segmentation of the image in the first quadrant of the first layer as an example, the second layer image of four quadrants is obtained, and then the size of the second layer image is compared to see if it is smaller than the preset size. If the size of the second layer image is not smaller than the preset size, the second layer image of each quadrant is further segmented into four quadrants. Taking the segmentation of the image in the second quadrant of the second layer as an example, the third layer image of four quadrants is further obtained, and then the third layer image is compared with the preset size, and this is performed in sequence until the node image is smaller than the preset size. At this time, the node image is a leaf node image, and a tree diagram is generated. Figure 7 In the example of dividing the target image into quadrants six times, a quadrant tree diagram with seven levels is constructed.

[0091] Among them, the preset size is the minimum core size of the image. The embodiment of the present application does not limit the size of the preset size. For example, the preset size can be 32*32, 38*38, 72*72, 128*128, etc. The embodiment of the present application only takes this as an example. The embodiment of the present application does not limit the method for determining the preset size. In a possible implementation, the size of the target image and the size of the target's circumscribed rectangular image can be calculated by common calculation, and the greatest common divisor is used as the number of cuts, and the ratio of the size of the target circumscribed rectangular image to the greatest common divisor is used as the preset size. In a possible implementation, if the specification of the preset size is 128*128 or more (including the case of unilateral breakthrough of 128), then in the case of a decimal, add 1 to divide until it is constrained within 128*128. Step S203: According to the node relationship between each node image in the tree diagram, a tree data structure of the target image is constructed.

[0092] After the dendrogram of the target image is generated, a tree data structure of the target image is constructed according to the node relationship between the node images in the dendrogram, and the embodiment of the present application does not limit this. Figure 4 and Figure 5 The description related to constructing the tree data structure of the target image in the illustrated embodiment will not be repeated any more.

[0093] In an embodiment of the present application, the target image is used as the root node image of the tree diagram, and the root node image is divided layer by layer until the leaf node image of the last layer is smaller than a preset size, thereby constructing a tree data structure of the target image, thereby improving the reliability of the tree data structure.

[0094] exist Figure 2 or Figure 6 Based on any of the embodiments shown, Figure 8 1 is a flow chart of an image edge processing method provided by another embodiment of the present application. The method can be executed by an image edge processing device, and the device can be implemented by software and / or hardware. The image edge processing method is described below with a terminal device as the execution subject. Figure 8 As shown, step S102 in the image edge processing method provided in the embodiment of the present application, i.e., determining the minimum cost path of the edge key points, may include:

[0095] Step S301: Determine a first edge key point before a current edge key point and a second edge key point after the current edge key point.

[0096] Determine the adjacent key points of the current edge key point. For example, start from the initial edge key point to find the next edge key point of the initial edge key point, and take the edge key point as the current edge key point. Then the first edge key point before the current edge key point is the initial edge key point, and the second edge key point after the current edge key point is the next edge key point of the current edge key point.

[0097] Step S302: Fill the pixel point information of the first edge key point and the second edge key point and the positional relationship with the current edge key point into the data structure of the current edge key point respectively, and obtain the data structure of each edge key point.

[0098] The pixel point information of the first edge key point of the current edge key point and the positional relationship with the current edge key point, and the pixel point information of the second edge key point of the current edge key point and the positional relationship with the current edge key point are filled into the data structure of the current edge key point to obtain the data structure of each edge key point. That is, the pixel point information of the adjacent key points is filled into the data structure of the current edge key point to obtain the data structure of each edge key point.

[0099] The data structure of edge key points can include the coordinates of edge key points, total cost, previous pointer, next pointer, and tree diagram inheritance information, etc. Among them, the tree diagram inheritance information is used for boundary constraints, and other information is some environmental element information generated when the edge key point is activated, which is stored as "memory" at runtime.

[0100] Step S303: Calculate the cost of each edge key point according to the data structure of each edge key point to determine the minimum cost path of the edge key point.

[0101] According to the data structure of each edge key point, the cost of the edge key point is calculated to determine the minimum cost path of the edge key point, which is not limited in the embodiment of the present application. The pixel information in the data structure of each edge key point and the pixel information of the adjacent edge key point are used to calculate the cost of the edge key point to determine the minimum cost path of the edge key point. In a possible implementation, the cost calculation can be performed by calculating the coincidence value of the three image features of the Laplacian Zero-Crossing, gradient magnitude and gradient direction of the edge key point. The formula is as follows:

[0102] l(p,q)=ω Z ·f Z (q)+ω D ·f D(p, q)+ω G ·f G (q)

[0103] Among them, l(p,q) represents the cost path between the edge key point p and the adjacent key point q, and f z (q) represents the Laplace zero-crossing value of edge key point q, f D (p, q) represents the gradient direction value of the edge key point p and the adjacent key point q, f G (q) represents the gradient value of edge key point q, ω z ,ω D and ω G They are weighted value data respectively.

[0104] When calculating the cost of edge key points, it is necessary to continuously calculate which edge key point the current minimum cost path is on to determine the edge key points to be processed in the next round. In order to improve the calculation efficiency, a queue can be used to process the edge key points that have been processed. In a possible implementation, before calculating the cost of the edge key points according to the data structure of each edge key point, it also includes:

[0105] According to the positional relationship between each edge key point, a task queue of the edge key point is generated; according to the data structure of each edge key point, the cost of the edge key point is calculated, including: according to the task queue of the edge key point, according to the data structure of each edge key point, the cost of the edge key point is calculated.

[0106] The embodiment of the present application does not limit the form of the task queue of the edge key points. For example, a bucket sort queue can be selected as the task queue of the edge key points. The embodiment of the present application does not limit the specific implementation method of generating the task queue of the edge key points.

[0107] In the embodiment of the present application, by generating a task queue of edge key points according to the positional relationship between each edge key point, and performing cost calculation on the edge key points according to the task queue, the efficiency of cost calculation can be improved.

[0108] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0109] Fig. 9 is a schematic diagram of the structure of an image edge processing device provided by an embodiment of the present application. The device can be implemented by software and / or hardware, for example, by a terminal device, such as Fig. 9 As shown, the image edge processing device provided in the embodiment of the present application may include: a processing module 51, a determination module 52 and a fusion module 53.

[0110] The processing module 51 is used to segment the target image layer by layer, generate a tree diagram of the target image, and determine the tree data structure of the target image. The tree data structure includes node information of each node in the tree diagram, and the node information includes edge key points of the target.

[0111] The determination module 52 is used to determine the minimum cost path of the edge key point and obtain the target key point on the minimum cost path.

[0112] The fusion module 53 is used to perform data fusion on the target key points according to the target key points and the node information to generate fusion data of the target key points.

[0113] The determination module 52 is further used to determine the edge contour line of the target according to the fusion data of the target key points.

[0114] In a possible implementation manner, the processing module 51 is further configured to:

[0115] The target is located in the original image, and the bounding rectangle image of the target is obtained; the bounding rectangle image is divided into a layer, and the layer is determined as the target image of the target.

[0116] In a possible implementation, the fusion module 53 is specifically configured to:

[0117] The coordinates of the target key points in the leaf node image are restored to the coordinates of the target key points in the target image according to the node information of the node where the target key points are located, so as to obtain the fusion data of the target key points.

[0118] In a possible implementation, the determination module 52 is specifically configured to:

[0119] The target key points are sorted by using their coordinates in the target image to determine the sorting positions of the target key points; the target key points are connected according to their sorting positions to determine the edge contour lines of the target.

[0120] In a possible implementation manner, the fused data of the target key point is a tree data structure of the target key point and / or a vector of the target key point.

[0121] The device of this embodiment can perform the above Figure 2 The technical principle and technical effect of the method embodiment shown are similar to those of the above-mentioned embodiment and will not be described in detail here.

[0122] exist Fig. 9 On the basis of the illustrated embodiment, further, in another embodiment of the image edge processing device provided by the present application, the processing module 51 is specifically used for:

[0123] The target image is used as the root node image of the dendrogram, and the root node image is segmented to generate multiple child node images; the multiple child node images are segmented respectively until the leaf node image is smaller than a preset size to generate a dendrogram; according to the node relationship between the node images in the dendrogram, a tree data structure of the target image is constructed.

[0124] The device of this embodiment can perform the above Figure 6 The technical principle and technical effect of the method embodiment shown are similar to those of the above-mentioned embodiment and will not be described in detail here.

[0125] exist Fig. 9 On the basis of the illustrated embodiment, further, in another embodiment of the image edge processing device provided by the present application, the determination module 52 is specifically used for:

[0126] Determine the first edge key point before the current edge key point and the second edge key point after the current edge key point; fill the pixel point information of the first edge key point and the second edge key point and the positional relationship with the current edge key point into the data structure of the current edge key point, and obtain the data structure of each edge key point; calculate the cost of the edge key point according to the data structure of each edge key point, and determine the minimum cost path of the edge key point.

[0127] The device of this embodiment can perform the above Figure 8 The technical principle and technical effect of the method embodiment shown are similar to those of the above-mentioned embodiment and will not be described in detail here.

[0128] The device embodiments provided in this application are merely illustrative. Fig. 9 The module division in the description is only a logical function division, and there may be other division methods in actual implementation. For example, multiple modules can be combined or integrated into another system. The coupling between the modules can be realized through some interfaces, which are usually electrical communication interfaces, but it is not excluded that they may be mechanical interfaces or other forms of interfaces. Therefore, the modules described as separate components may or may not be physically separated, and may be located in one place or distributed in different locations of the same or different devices.

[0129] Fig.10 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Fig.10 As shown, the electronic device includes:

[0130] A processor 61, a memory 62, a transceiver 63 and a computer program; wherein the transceiver 63 implements data transmission between other devices, the computer program is stored in the memory 62, and is configured to be executed by the processor 61, and the computer program includes instructions for executing the above-mentioned image edge processing method, and its content and effect please refer to the method embodiment.

[0131] In addition, an embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When at least one processor of a user device executes the computer-executable instructions, the user device executes the above-mentioned various possible methods.

[0132] Among them, computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of computer programs from one place to another. The storage medium can be any available medium that can be accessed by a general or special-purpose computer. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a user device. Of course, the processor and the storage medium can also be present in a communication device as discrete components.

[0133] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for image edge processing, characterized in that: include: Segment the target image layer by layer to generate a dendrogram of the target image, and determine a tree data structure of the target image, wherein the tree data structure includes node information of each node in the dendrogram, and the node information includes edge key points of the target; Determine the minimum cost path of the edge key point, and obtain the target key point on the minimum cost path; According to the target key point and the node information, data fusion is performed on the target key point to generate fusion data of the target key point; The edge contour line of the target is determined according to the fused data of the target key points.

2. The method according to claim 1, characterized in that The step of segmenting the target image layer by layer, generating a tree diagram of the target image, and determining a tree data structure of the target image includes: Using the target image as the root node image of the dendrogram, segmenting the root node image to generate a plurality of child node images; The plurality of child node images are segmented respectively until the leaf node image is smaller than a preset size, thereby generating the tree diagram; According to the node relationship between each node image in the tree diagram, a tree data structure of the target image is constructed.

3. The method according to claim 2, characterized in that Before the target image is segmented layer by layer, the method further includes: Positioning the target in the original image and obtaining the circumscribed rectangular image of the target; The circumscribed rectangular image is divided into a layer, and the layer is determined as the target image of the target.

4. The method according to any one of claims 1 to 3, characterized in that: The determining of the minimum cost path of the edge key point comprises: Determine a first edge key point before a current edge key point and a second edge key point after the current edge key point; Filling the pixel point information of the first edge key point and the second edge key point and the positional relationship with the current edge key point into the data structure of the current edge key point to obtain the data structure of each edge key point; According to the data structure of each edge key point, the cost of the edge key point is calculated to determine the minimum cost path of the edge key point.

5. The method according to claim 4, characterized in that Before calculating the cost of the edge key point according to the data structure of each edge key point, the method further includes: According to the positional relationship between each edge key point, a task queue of the edge key point is generated; The cost calculation of each edge key point according to the data structure of each edge key point includes: According to the task queue of the edge key point and the data structure of each edge key point, the cost of the edge key point is calculated.

6. The method according to any one of claims 1 to 3, characterized in that: The step of fusing the target key points according to the target key points and the tree data structure to generate fused data of the target key points includes: The coordinates of the target key point in the leaf node image are restored to the coordinates of the target key point in the target image according to the node information of the node where the target key point is located, so as to obtain the fusion data of the target key point.

7. The method according to claim 6, characterized in that Determining the edge contour line of the target according to the fused data of the target key points includes: Sorting the target key points using the coordinates of the target key points in the target image to determine the sorting positions of the target key points; The target key points are connected according to their sorted positions to determine the edge contour line of the target.

8. The method according to claim 6, characterized in that The fusion data of the target key point is a tree data structure of the target key point and / or a vector of the target key point.

9. An image edge processing device, characterized in that: include: A processing module, used to segment the target image layer by layer, generate a dendrogram of the target image, and determine a tree data structure of the target image, wherein the tree data structure includes node information of each node in the dendrogram, and the node information includes edge key points of the target; A determination module, used to determine the minimum cost path of the edge key point and obtain the target key point on the minimum cost path; A fusion module, used for performing data fusion on the target key point according to the target key point and the node information to generate fusion data of the target key point; The determination module is also used to determine the edge contour line of the target according to the fusion data of the target key points.

10. The device according to claim 9, characterized in that The processing module is specifically used for: Using the target image as the root node image of the dendrogram, segmenting the root node image to generate a plurality of child node images; The plurality of child node images are segmented respectively until the leaf node image is smaller than a preset size, thereby generating the tree diagram; According to the node relationship between each node image in the tree diagram, a tree data structure of the target image is constructed.

11. The device according to claim 9 or 10, characterized in that The determination module is specifically used for: Determine a first edge key point before a current edge key point and a second edge key point after the current edge key point; Filling the pixel point information of the first edge key point and the second edge key point and the positional relationship with the current edge key point into the data structure of the current edge key point to obtain the data structure of each edge key point; According to the data structure of each edge key point, the cost of the edge key point is calculated to determine the minimum cost path of the edge key point.

12. The device according to claim 9 or 10, characterized in that The fusion module is specifically used for: The coordinates of the target key point in the leaf node image are restored to the coordinates of the target key point in the target image according to the node information of the node where the target key point is located, so as to obtain the fusion data of the target key point.

13. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.

14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • CAD edge region detection method and system

    CN107358615A

  • Digital image edge detection

    US20150206319A1