Image edge segmentation method and related equipment

By decolorizing the image, edge fitting sharpening and gradient merging, the problem of poor edge detection effect in image edge segmentation is solved, and image edge segmentation with high precision and low resource consumption is achieved.

CN119625000APending Publication Date: 2025-03-14E SURFING VISION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411873805.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

The prior art has problems in image edge segmentation that the edge detection effect is thicker and the positioning accuracy is not high enough. Deep learning methods require a large amount of training data, have high computing costs, high requirements for hardware devices, and may have overfitting.

Method used

By decolorizing the original image, converting it into the target grayscale image, detecting the edges and performing fitting and sharpening processing, the gradients are merged using the Sobel algorithm to determine the edge contour, and image segmentation is performed by traversing the edge contour point coordinates.

Benefits of technology

More refined image edge segmentation is achieved, reducing resource computing power consumption, and improving the accuracy and efficiency of edge segmentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119625000A_ABST
    Figure CN119625000A_ABST
Patent Text Reader

Abstract

The invention discloses an image edge segmentation method and related equipment, and the method comprises the steps: firstly converting an original image into a gray image through decoloring processing, reducing the interference of color information on edge detection, and improving the processing efficiency. Then, detecting the edge of the grayscale image by using an edge detection technology, fitting the detected edge into a straight line in a segmented manner, and then performing sharpening processing to generate a fitted sharpened image; the step not only enhances the edge features in the image, but also makes the edge clearer and more prominent. Afterwards, a Sobel algorithm is adopted to process the fitting sharpening image, gradients in the X direction and the Y direction are combined, a gradient combined image is obtained, and therefore the edge contour is determined more accurately. And finally, edge contour point coordinates in the gradient merging image are traversed, and coordinate-based image segmentation is realized. According to the method, the edge segmentation precision is improved, unnecessary calculation and processing steps are reduced, and the resource calculation power consumption is relatively low.
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, and more specifically, to an image edge segmentation method and related equipment. Background Art

[0002] The current image edge segmentation methods are mainly divided into two categories: traditional image segmentation methods and deep learning methods. Traditional image segmentation methods, such as the Sobel algorithm, are mainly based on the calculation of image pixel gradients. These methods identify objects by detecting edges with obvious brightness changes in images. They have a certain effect on suppressing noise, but the common problem is that the detected edge effect is coarse and the positioning accuracy is not high enough.

[0003] Deep learning methods, such as U-Net, Mask R-CNN, and DeepLab series, train multi-layer perceptrons to obtain linear decision functions, and then use the decision functions to classify pixels to achieve segmentation. These methods perform well in processing complex images and noise suppression, and can accurately segment tiny structures and edge details in images. However, deep learning methods require a large amount of training data, have high computational costs, high hardware requirements, and may have overfitting problems.

[0004] Based on this, the present application provides a more comprehensive image edge segmentation solution, which effectively makes up for the shortcomings of the existing technology and has low resource and computing power consumption. Summary of the invention

[0005] In view of this, the present application provides an image edge segmentation method and related equipment, which can obtain more refined image edges with lower resource computing power consumption.

[0006] An image edge segmentation method, comprising:

[0007] Decolorize the original image and convert it into a target grayscale image;

[0008] Detecting the edge of the target grayscale image, fitting the detected edge into segments and performing sharpening processing to generate a fitted sharpened image;

[0009] Using the Sobel algorithm to merge the gradients of the fitted sharpened image in the X direction and the Y direction to obtain a gradient merged image and determine the edge contour of the gradient merged image;

[0010] The coordinates of each contour point in the edge contour of the gradient merging image are traversed, and the image is segmented according to the coordinates.

[0011] Optionally, detecting the edge of the target grayscale image, segmentally fitting the detected edge into straight lines and performing sharpening processing to generate a fitted sharpened image, includes:

[0012] Determine the edge of the target grayscale image by Canny edge detection;

[0013] Fitting straight lines to the edge segments of the target grayscale image by Hough line detection, and generating a fitting edge image by using the created image mask;

[0014] Perform convolution sharpening on the fitted edge image to generate a fitted sharpened image.

[0015] Optionally, the step of using the Sobel algorithm to merge the gradients of the fitted sharpened image in the X direction and the Y direction to obtain a gradient merged image and determine the edge contour of the gradient merged image includes:

[0016] Applying Sobel operator in the X direction and Y direction of the fitted sharpened image respectively, and obtaining a gradient recognition result through linear transformation;

[0017] According to the gradient recognition result, respectively merging the gradients in the X direction and the Y direction of the fitted sharpened image to generate a gradient merged image;

[0018] The edge contour of the gradient merged image is determined by contour tracking.

[0019] Optionally, decolorize the original image and convert it into a target grayscale image, including:

[0020] Use the interface reading function to read the original image;

[0021] Using a spatial color conversion function to convert the original image into a grayscale image according to the color space specified by the parameters;

[0022] The grayscale image format is converted using an interface writing function to generate a target grayscale image.

[0023] Optionally, before determining the edge of the target grayscale image by using Canny edge detection, the method further includes:

[0024] Perform Gaussian blur processing on the target grayscale image.

[0025] Optionally, fitting straight lines to the edge segments of the target grayscale image by Hough line detection, and generating a fitting edge image by using the created image mask, including:

[0026] The edge of the target grayscale image is segmented and fitted with straight lines by Hough line detection to obtain a segmented fitting image;

[0027] Creating an image mask, wherein the image mask is marked with a fitted straight line;

[0028] The image mask is applied to perform a bitwise AND operation on the segmented fitting image to generate a fitting edge image.

[0029] An image edge segmentation device, comprising:

[0030] A grayscale conversion unit, used for decolorizing the original image and converting it into a target grayscale image;

[0031] A fitting and sharpening unit, used for detecting the edge of the target grayscale image, fitting the detected edge into straight lines and performing sharpening processing to generate a fitting and sharpened image;

[0032] A gradient merging unit, used to merge the gradients of the fitted sharpened image in the X direction and the Y direction by using a Sobel algorithm to obtain a gradient merged image and determine the edge contour of the gradient merged image;

[0033] The traversal segmentation unit is used to traverse the coordinates of each contour point in the edge contour of the gradient merging image and perform image segmentation according to the coordinates.

[0034] An image edge segmentation device, comprising a memory and a processor;

[0035] The memory is used to store programs;

[0036] The processor is used to execute the program to implement each step of the image edge segmentation method as described in any one of the above items.

[0037] A readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, each step of the image edge segmentation method as described in any one of the above items is implemented.

[0038] A computer program product comprises a computer program, wherein when the computer program is run by a processor, each step of the image edge segmentation method as described above is executed.

[0039] It can be seen from the above technical solution that an image edge segmentation method and related equipment provided by the embodiment of the present application first decolorizes the original image and converts it into a target grayscale image. By detecting the edge of the target grayscale image, the detected edge segment is fitted with a straight line and sharpened to generate a fitted sharpened image. Then, the Sobel algorithm is used to merge the gradients of the fitted sharpened image in the X and Y directions to obtain a gradient merged image and determine the edge contour of the gradient merged image. Finally, the coordinates of each contour point in the edge contour of the gradient merged image are traversed and the image is segmented according to the coordinates.

[0040] The present application first converts the original image into a grayscale image by decolorization, which reduces the interference of color information on edge detection and improves processing efficiency. Then, the edge of the grayscale image is detected by edge detection technology, and the detected edge segments are fitted into straight lines, followed by sharpening to generate a fitted sharpened image. This step not only enhances the edge features in the image, but also makes the edges clearer and more prominent. Afterwards, the fitted sharpened image is processed by the Sobel algorithm, and the gradients in the X and Y directions are merged to obtain a gradient merged image, thereby more accurately determining the edge contour. Finally, by traversing the coordinates of the edge contour points in the gradient merged image, coordinate-based image segmentation is achieved. This method not only improves the accuracy of edge segmentation, but also reduces unnecessary calculations and processing steps, making resource computing power consumption relatively low. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0042] Figure 1 A flowchart of an image edge segmentation method disclosed in an embodiment of the present application;

[0043] Figure 2 A schematic diagram of an image edge segmentation device disclosed in an embodiment of the present application;

[0044] Figure 3 This is a hardware structure block diagram of an image edge segmentation device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only 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.

[0046] The present application can be used in many general or special computing device environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multi-processor devices, distributed computing environments including any of the above devices or equipment, etc.

[0047] Next, the present application scheme is introduced. The present application proposes the following technical scheme, please see below for details.

[0048] Figure 1 The present invention is a flowchart of an image edge segmentation method disclosed in an embodiment of the present application.

[0049] like Figure 1 As shown, the method may include:

[0050] Step S1, decolorize the original image and convert it into a target grayscale image.

[0051] Specifically, the original image is decolorized and converted into a target grayscale image. This step is a key preprocessing before edge detection, which aims to reduce the interference of color information in the image and improve the efficiency and accuracy of subsequent processing. Decolorization uses a specific algorithm to fuse the three primary color channel information in the image to form a single grayscale value, thereby generating a grayscale image. Grayscale images only contain brightness information, not color information, which makes the edge features in the image more prominent and facilitates subsequent edge detection. In addition, the processing of grayscale images is simpler than that of color images, which can reduce the amount of calculation and reduce resource computing power consumption.

[0052] First, the original image is read using the interface reading function to ensure that the image data for subsequent processing is accurate and complete. The reading function is usually related to the format of the image file and can parse and extract key information such as color and brightness from the image data.

[0053] Next, the original image is converted to a grayscale image using a spatial color conversion function according to the color space specified by the parameters. Color space conversion can convert an image from one color space to another to meet different processing requirements. In this step, by selecting appropriate color space conversion parameters, the three primary color channel information in the original image is fused to form a single grayscale value, thereby generating a grayscale image.

[0054] Finally, the interface write function is used to convert the converted grayscale image format (such as adjusting resolution, compression, etc.) and generate the target grayscale image. The write function is also related to the format of the image file, and can store the processed image data in a specific format to the storage medium, ensuring that the generated grayscale image can be correctly read and used by subsequent processing steps.

[0055] That is to say, the original image is decolorized and converted into a target grayscale image, including:

[0056] ①Use the interface reading function to read the original image;

[0057] ② Using a spatial color conversion function to convert the original image into a grayscale image according to the color space specified by the parameters;

[0058] ③ Use the interface writing function to convert the grayscale image format to generate a target grayscale image.

[0059] Step S2: Detect the edge of the target grayscale image, segment the detected edge into straight lines and perform sharpening processing to generate a fitted sharpened image.

[0060] Specifically, step S2 aims to further refine the edge information in the target grayscale image, providing a more accurate basis for subsequent edge contour determination and image segmentation. The specific operations are as follows:

[0061] First, use the edge detection algorithm to detect the edge of the target grayscale image and identify the area with obvious brightness change in the image, that is, the edge. Common edge detection algorithms include Sobel, Canny, Prewitt, etc. In this step, you can select a suitable edge detection algorithm and adjust its parameters to accurately capture the edge information in the target grayscale image.

[0062] Next, the detected edges are segmented and fitted with straight lines. Since the edges in the image often show a certain degree of continuity and regularity, the detected edge points can be segmented and fitted with straight lines to improve the accuracy and smoothness of the edges. This step can be achieved through algorithms such as the least squares method and Hough transform.

[0063] Finally, the fitted edge is sharpened to generate a fitted sharpened image. Sharpening is a technique to enhance the edge contrast of an image, which can make the edge clearer and more prominent. In this step, the Laplace operator, gradient enhancement and other algorithms can be used to sharpen the fitted edge to generate a fitted sharpened image.

[0064] Step S3: using the Sobel algorithm to merge the gradients of the fitted sharpened image in the X direction and the Y direction to obtain a gradient merged image and determine the edge contour of the gradient merged image.

[0065] Specifically, step S3 further refines the edge information of the image and defines the edge contour of the image by gradient merging and contour tracking.

[0066] First, apply the Sobel operator in the X and Y directions of the fitted sharpened image. The Sobel operator is a discrete differential operator used to calculate the approximate value of the gradient of the image grayscale function. It combines Gaussian smoothing and differential derivation, and can effectively detect edges in the presence of noise. By applying the Sobel operator, we can get two gradient images in the X and Y directions, which show the rate of change of the brightness of the image in the corresponding directions.

[0067] Next, based on these gradient recognition results, the gradients of the fitted sharpened image in the X and Y directions are merged respectively. The purpose of this step is to combine the gradient information in the two directions to form a more comprehensive and accurate gradient representation. The merging process can be achieved by simple weighted summation, maximum value selection or other appropriate fusion strategies to generate a gradient merged image. The gradient merged image combines the gradient information of the image in two directions, so it can more accurately reflect the edge features of the image.

[0068] Finally, the edge contour of the gradient merged image is determined by a contour tracking algorithm. Contour tracking is an image processing method used to identify and track the boundaries of objects in binary images or gradient images. In this step, a contour tracking algorithm can be used to traverse the pixels in the gradient merged image and identify the edge contour based on the changes in pixel values. In this way, a series of continuous edge points can be obtained, which define the edge contour of the image.

[0069] That is, the gradients of the fitted sharpened image in the X direction and the Y direction are merged using the Sobel algorithm to obtain a gradient merged image and determine the edge contour of the gradient merged image, including:

[0070] ① Applying the Sobel operator in the X direction and the Y direction of the fitted sharpened image respectively, and obtaining the gradient recognition result through linear transformation;

[0071] ② According to the gradient recognition result, respectively merge the gradients in the X direction and the Y direction of the fitted sharpened image to generate a gradient merged image;

[0072] ③ Determine the edge contour of the gradient merged image by contour tracking.

[0073] Step S4, traversing the coordinates of each contour point in the edge contour of the gradient merging image, and performing image segmentation according to the coordinates.

[0074] Specifically, the image edge contours are merged based on the gradients obtained in the previous steps, and the image edge segmentation is achieved by traversing the coordinates of the contour points.

[0075] First, the coordinates of all contour points recorded in the edge contour of the gradient merged image are traversed. These coordinate points accurately depict the edges of each object in the image and are the key basis for image segmentation. By traversing these coordinate points, the system can clearly identify the boundaries of each object in the image.

[0076] Next, the image edge segmentation operation is performed based on the coordinates of the contour points obtained by traversal. This step usually involves cropping or dividing the image along the coordinates of the contour points to separate different objects or regions in the image. The system will perform accurate segmentation along the edges of the object based on the position information of the contour points to ensure that each object is completely contained in its corresponding area.

[0077] When performing image edge segmentation, the system needs to ensure the accuracy and consistency of the segmentation. This means that during the segmentation process, it is necessary to keep accurate tracking of the coordinates of the contour points and ensure that the segmented image area remains visually coherent and complete. To achieve this goal, image processing algorithms such as contour smoothing and area filling can be used to optimize the segmentation results.

[0078] Finally, when the image edge segmentation is completed, the segmented image or segmentation result data is output. These data can be used in subsequent image analysis, recognition or processing tasks, providing strong support for research and application in the field of image processing and computer vision.

[0079] It can be seen from the above technical solution that an image edge segmentation method and related equipment provided by the embodiment of the present application first decolorizes the original image and converts it into a target grayscale image. By detecting the edge of the target grayscale image, the detected edge segment is fitted with a straight line and sharpened to generate a fitted sharpened image. Then, the Sobel algorithm is used to merge the gradients of the fitted sharpened image in the X and Y directions to obtain a gradient merged image and determine the edge contour of the gradient merged image. Finally, the coordinates of each contour point in the edge contour of the gradient merged image are traversed and the image is segmented according to the coordinates.

[0080] The present application first converts the original image into a grayscale image by decolorization, which reduces the interference of color information on edge detection and improves processing efficiency. Then, the edge of the grayscale image is detected by edge detection technology, and the detected edge segments are fitted into straight lines, followed by sharpening to generate a fitted sharpened image. This step not only enhances the edge features in the image, but also makes the edges clearer and more prominent. Afterwards, the fitted sharpened image is processed by the Sobel algorithm, and the gradients in the X and Y directions are merged to obtain a gradient merged image, thereby more accurately determining the edge contour. Finally, by traversing the coordinates of the edge contour points in the gradient merged image, coordinate-based image segmentation is achieved. This method not only improves the accuracy of edge segmentation, but also reduces unnecessary calculations and processing steps, making resource computing power consumption relatively low.

[0081] In some embodiments of the present application, the process of step S2, detecting the edge of the target grayscale image, segmentally fitting the detected edge into straight lines and performing sharpening processing, and generating a fitted sharpened image is further introduced, which may specifically include:

[0082] Step S21, determining the edge of the target grayscale image by Canny edge detection.

[0083] Specifically, the Canny edge detection algorithm is applied to detect the edge of the target grayscale image after Gaussian blur processing. Canny edge detection is a multi-stage algorithm, including Gaussian filtering, gradient calculation, non-maximum suppression and double threshold detection. It can effectively identify strong and weak edges in the image and generate a binary edge image, in which edge pixels are marked as white (or a specific value) and non-edge pixels are marked as black (or zero value).

[0084] In addition, before determining the edge of the target grayscale image through Canny edge detection, Gaussian blur processing may be performed on the target grayscale image.

[0085] Specifically, before performing Canny edge detection, the target grayscale image is first Gaussian blurred. Gaussian blur is an image smoothing technique that reduces noise and details in the image so that the edge detection algorithm can more accurately identify the edges in the image. This step helps reduce false detection and noise interference on edge detection results.

[0086] Step S22: fitting straight lines to the edge segments of the target grayscale image by Hough line detection, and generating a fitting edge image by using the created image mask.

[0087] Specifically, the Hough line detection algorithm is applied to the edge image obtained by Canny edge detection. Hough line detection is a technique for detecting straight lines in an image. It detects straight lines in an image by mapping points in the image space to straight lines in the Hough space. By adjusting the parameters of the Hough transform, straight lines of different directions and lengths can be detected.

[0088] According to the results of Hough line detection, the edge points in the edge image are segmented into straight line fitting. This step can be achieved by the least squares method or other curve fitting algorithms to fit the edge points into a series of straight line segments.

[0089] Create an image mask with the locations of the fitted lines marked on it. Then, perform a bitwise AND operation on the segmented fitted image and the image mask, retaining only the edge points marked as lines on the mask, and generate a fitted edge image. This step helps remove edge points that do not match the line fit and improves edge accuracy and smoothness.

[0090] Therefore, fitting straight lines to the edge segments of the target grayscale image by Hough line detection and generating a fitting edge image by using the created image mask may include:

[0091] ① Using Hough line detection to segmentally fit straight lines to the edge of the target grayscale image to obtain a segmented fitting image;

[0092] ② Creating an image mask, wherein the image mask is marked with a fitting straight line;

[0093] ③ Apply the image mask to perform a bitwise AND operation on the segmented fitting image to generate a fitting edge image.

[0094] Step S23: performing convolution sharpening on the fitted edge image to generate a fitted sharpened image.

[0095] Specifically, a convolution sharpening operation is applied to the fitted edge image. Convolution sharpening is an image enhancement technique that enhances the edges and details in an image by applying a sharpening filter (such as a Laplacian filter, a gradient filter, etc.). This step can further highlight the edge features in the fitted edge image, making the edges clearer and more prominent. After the convolution sharpening process, a fitted sharpened image is obtained. The edge features in this image are more obvious, providing stronger support for subsequent image segmentation and recognition tasks.

[0096] An image edge segmentation device provided in an embodiment of the present application is described below. The image edge segmentation device described below and the image edge segmentation method described above can be referred to each other.

[0097] See also Figure 2 , Figure 2 A schematic diagram of an image edge segmentation device disclosed in an embodiment of the present application.

[0098] like Figure 2 As shown, the image edge segmentation device may include:

[0099] A grayscale conversion unit 110 is used to perform decolorization processing on the original image and convert it into a target grayscale image;

[0100] A fitting and sharpening unit 120 is used to detect the edge of the target grayscale image, fit the detected edge into straight lines and perform sharpening processing to generate a fitting and sharpened image;

[0101] A gradient merging unit 130 is used to merge the gradients of the fitted sharpened image in the X direction and the Y direction using a Sobel algorithm to obtain a gradient merged image and determine the edge contour of the gradient merged image;

[0102] The traversal segmentation unit 140 is used to traverse the coordinates of each contour point in the edge contour of the gradient merging image and perform image segmentation according to the coordinates.

[0103] It can be seen from the above technical solution that an image edge segmentation method and related equipment provided by the embodiment of the present application first decolorizes the original image and converts it into a target grayscale image. By detecting the edge of the target grayscale image, the detected edge segment is fitted with a straight line and sharpened to generate a fitted sharpened image. Then, the Sobel algorithm is used to merge the gradients of the fitted sharpened image in the X and Y directions to obtain a gradient merged image and determine the edge contour of the gradient merged image. Finally, the coordinates of each contour point in the edge contour of the gradient merged image are traversed and the image is segmented according to the coordinates.

[0104] The present application first converts the original image into a grayscale image by decolorization, which reduces the interference of color information on edge detection and improves processing efficiency. Then, the edge of the grayscale image is detected by edge detection technology, and the detected edge segments are fitted into straight lines, followed by sharpening to generate a fitted sharpened image. This step not only enhances the edge features in the image, but also makes the edges clearer and more prominent. Afterwards, the fitted sharpened image is processed by the Sobel algorithm, and the gradients in the X and Y directions are merged to obtain a gradient merged image, thereby more accurately determining the edge contour. Finally, by traversing the coordinates of the edge contour points in the gradient merged image, coordinate-based image segmentation is achieved. This method not only improves the accuracy of edge segmentation, but also reduces unnecessary calculations and processing steps, making resource computing power consumption relatively low.

[0105] Optionally, the fitting sharpening unit may include:

[0106] An edge detection unit, used for determining the edge of the target grayscale image by Canny edge detection;

[0107] A mask fitting unit, used for fitting straight lines to the edge segments of the target grayscale image by Hough line detection, and generating a fitting edge image by using the created image mask;

[0108] The convolution sharpening unit is used to perform convolution sharpening on the fitted edge image to generate a fitted sharpened image.

[0109] Optionally, the gradient merging unit may include:

[0110] Applying Sobel operator in the X direction and Y direction of the fitted sharpened image respectively, and obtaining a gradient recognition result through linear transformation;

[0111] According to the gradient recognition result, respectively merging the gradients in the X direction and the Y direction of the fitted sharpened image to generate a gradient merged image;

[0112] The edge contour of the gradient merged image is determined by contour tracking.

[0113] Optionally, the grayscale conversion unit may include:

[0114] An image reading unit, used for reading the original image using an interface reading function;

[0115] A conversion processing unit, used for converting the original image into a grayscale image according to the color space converted by the parameter specified by the spatial color conversion function;

[0116] The image writing unit is used to convert the grayscale image format by using the interface writing function to generate a target grayscale image.

[0117] Optionally, the fitting sharpening unit may further include:

[0118] The Gaussian processing unit is used to perform Gaussian blur processing on the target grayscale image before determining the edge of the target grayscale image through Canny edge detection.

[0119] Optionally, the mask fitting unit may include:

[0120] A segmented fitting unit is used to segmentally fit straight lines to the edge of the target grayscale image through Hough line detection to obtain a segmented fitting image;

[0121] A mask creation unit, used for creating an image mask, wherein the image mask is marked with a fitting straight line;

[0122] The fitting operation unit is used to apply the image mask to perform a bitwise AND operation on the segmented fitting image to generate a fitting edge image.

[0123] The image edge segmentation apparatus provided in the embodiment of the present application can be applied to an image edge segmentation device. Figure 3 The hardware structure diagram of the image edge segmentation device is shown in FIG. Figure 3 ,The hardware structure of the image edge segmentation device may include: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4;

[0124] In the embodiment of the present application, the number of the processor 1, the communication interface 2, the memory 3, and the communication bus 4 is at least one, and the processor 1, the communication interface 2, and the memory 3 communicate with each other through the communication bus 4;

[0125] The processor 1 may be a central processing unit CPU, or an application-specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention, etc.;

[0126] The memory 3 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), etc., such as at least one disk memory;

[0127] The memory stores a program, and the processor can call the program stored in the memory, wherein the program is used to:

[0128] Decolorize the original image and convert it into a target grayscale image;

[0129] Detecting the edge of the target grayscale image, fitting the detected edge into segments and performing sharpening processing to generate a fitted sharpened image;

[0130] Using the Sobel algorithm to merge the gradients of the fitted sharpened image in the X direction and the Y direction to obtain a gradient merged image and determine the edge contour of the gradient merged image;

[0131] The coordinates of each contour point in the edge contour of the gradient merging image are traversed, and the image is segmented according to the coordinates.

[0132] Optionally, the detailed functions and extended functions of the program may refer to the above description.

[0133] The embodiment of the present application further provides a readable storage medium, which may store a program suitable for execution by a processor, wherein the program is used to:

[0134] Decolorize the original image and convert it into a target grayscale image;

[0135] Detecting the edge of the target grayscale image, fitting the detected edge into segments and performing sharpening processing to generate a fitted sharpened image;

[0136] Using the Sobel algorithm to merge the gradients of the fitted sharpened image in the X direction and the Y direction to obtain a gradient merged image and determine the edge contour of the gradient merged image;

[0137] The coordinates of each contour point in the edge contour of the gradient merging image are traversed, and the image is segmented according to the coordinates.

[0138] Optionally, the detailed functions and extended functions of the program may refer to the above description.

[0139] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the execution method is as follows:

[0140] Decolorize the original image and convert it into a target grayscale image;

[0141] Detecting the edge of the target grayscale image, fitting the detected edge into segments and performing sharpening processing to generate a fitted sharpened image;

[0142] Using the Sobel algorithm to merge the gradients of the fitted sharpened image in the X direction and the Y direction to obtain a gradient merged image and determine the edge contour of the gradient merged image;

[0143] The coordinates of each contour point in the edge contour of the gradient merging image are traversed, and the image is segmented according to the coordinates.

[0144] Optionally, the detailed functions and extended functions of the program may refer to the above description.

[0145] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0146] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0147] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for image edge segmentation, characterized in that: include: Decolorize the original image and convert it into a target grayscale image; Detecting the edge of the target grayscale image, fitting the detected edge into straight lines and performing sharpening processing to generate a fitted sharpened image; Using the Sobel algorithm to merge the gradients of the fitted sharpened image in the X direction and the Y direction to obtain a gradient merged image and determine the edge contour of the gradient merged image; The coordinates of each contour point in the edge contour of the gradient merging image are traversed, and the image is segmented according to the coordinates.

2. The method according to claim 1, characterized in that Detecting the edge of the target grayscale image, segmenting the detected edge into straight lines and performing sharpening processing to generate a fitted sharpened image, including: Determine the edge of the target grayscale image by Canny edge detection; Fitting straight lines to the edge segments of the target grayscale image by Hough line detection, and generating a fitting edge image by using the created image mask; Perform convolution sharpening on the fitted edge image to generate a fitted sharpened image.

3. The method according to claim 1, characterized in that The step of using the Sobel algorithm to merge the gradients of the fitted sharpened image in the X direction and the Y direction to obtain a gradient merged image and determine the edge contour of the gradient merged image includes: Applying Sobel operator in the X direction and Y direction of the fitted sharpened image respectively, and obtaining a gradient recognition result through linear transformation; According to the gradient recognition result, respectively merging the gradients in the X direction and the Y direction of the fitted sharpened image to generate a gradient merged image; The edge contour of the gradient merged image is determined by contour tracing.

4. The method according to claim 1, characterized in that: Decolorize the original image and convert it into the target grayscale image, including: Use the interface reading function to read the original image; Using a spatial color conversion function to convert the original image into a grayscale image according to the color space specified by the parameters; The grayscale image format is converted using an interface writing function to generate a target grayscale image.

5. The method according to claim 2, characterized in that: Before determining the edge of the target grayscale image by using Canny edge detection, the method further includes: Perform Gaussian blur processing on the target grayscale image.

6. The method according to claim 2, characterized in that The edge segmentation of the target grayscale image is fitted with a straight line by Hough line detection, and a fitted edge image is generated by using the created image mask, including: The edge of the target grayscale image is segmented and fitted with straight lines by Hough line detection to obtain a segmented fitting image; Creating an image mask, wherein the image mask is marked with a fitted straight line; The image mask is applied to perform a bitwise AND operation on the segmented fitting image to generate a fitting edge image.

7. An image edge segmentation device, characterized in that: include: A grayscale conversion unit, used for decolorizing the original image and converting it into a target grayscale image; A fitting and sharpening unit, used for detecting the edge of the target grayscale image, fitting the detected edge into straight lines and performing sharpening processing to generate a fitting and sharpened image; A gradient merging unit, used to merge the gradients of the fitted sharpened image in the X direction and the Y direction by using a Sobel algorithm to obtain a gradient merged image and determine the edge contour of the gradient merged image; The traversal segmentation unit is used to traverse the coordinates of each contour point in the edge contour of the gradient merging image and perform image segmentation according to the coordinates.

8. An image edge segmentation device, characterized in that: including memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the image edge segmentation method according to any one of claims 1 to 6.

9. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step of the image edge segmentation method according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, each step of the image edge segmentation method according to any one of claims 1 to 6 is executed.