Contour information extraction method and device and storage medium
The method improves 3D model contour extraction accuracy in construction drawings by enhancing edges and performing morphological operations, addressing noise-related inaccuracies and reducing data size.
Patent Information
- Application Number
- CN202310678460.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-08
- Publication Date
- 2024-12-13
AI Technical Summary
Existing 3D model contour extraction methods in construction drawings are inaccurate due to image noise, leading to low-quality contour results.
A method involving edge detection, skeleton extraction, and morphological operations to enhance the morphological lines of the target object before contour extraction, including steps like converting to grayscale, Gaussian filtering, non-maximum suppression, morphological operations, and contour extraction to improve accuracy.
Enhances the precision of contour extraction results by accurately identifying and smoothing the object's edges and contours, reducing data size by about 50% compared to traditional methods.
Smart Images

Figure CN119131069A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a contour information extraction method, device and storage medium. Background Art
[0002] With the development of computer technology, 3D (3-dimension) design tools are increasingly used in the home improvement industry. After using 3D design tools to design a home improvement plan, in addition to rendering and viewing the 3D model effect of the design plan, it is also necessary to do the actual construction, so it is necessary to export the construction drawings.
[0003] In the construction drawing system, the occlusion relationship between drawing elements is crucial to the accuracy of drawing expression. To this end, it is necessary to extract the closed outer contour of the design model of the object (such as the bed), and use the outer contour of the bed to occlude the wall paving elements behind the object. Therefore, the export of construction drawings requires the contour map of the 3D model in the design plan.
[0004] The common process of 3D model contour extraction is to render a thumbnail of the 3D model of the design solution and then extract the contour of the thumbnail. However, the quality of the contour results extracted by this solution may be affected by factors such as image noise, and the accuracy of the contour extraction result is low. Summary of the invention
[0005] The main purpose of the embodiments of the present application is to provide a contour information extraction method, device and storage medium, which can enhance the morphological lines of the target object in the original image before contour extraction, which is conducive to more accurate contour extraction results and improves the precision of contour extraction results.
[0006] In a first aspect, an embodiment of the present application provides a contour information extraction method, comprising: obtaining an original image to be processed of a target object; performing edge detection on the original image to obtain an edge image of the target object; performing skeleton extraction on the edge image to obtain a morphological image of the target object, the morphological image including skeleton information of the target object; performing contour extraction on the morphological image according to the skeleton information to obtain contour information of the target object.
[0007] In one embodiment, the edge detection is performed on the original image to obtain the edge image of the target object, including: converting the original image into a grayscale image and filtering the grayscale image; calculating the gradient information of the grayscale image after filtering; and performing non-maximum suppression processing on each pixel in the grayscale image according to the gradient information to obtain the edge image of the target object.
[0008] In one embodiment, the non-maximum suppression processing is performed on each pixel point in the grayscale image according to the gradient information to obtain the edge image of the target object, including: for any pixel point in the grayscale image, determining whether the pixel point is a maximum value within a preset neighborhood, if the pixel point is a maximum value within the preset neighborhood, retaining the pixel point; otherwise, if the pixel point is not a maximum value within the preset neighborhood, suppressing the pixel point to obtain the edge image of the target object.
[0009] In one embodiment, before filtering the grayscale image, the method further includes: performing corrosion processing on the grayscale image.
[0010] In one embodiment, the step of performing skeleton extraction on the edge image to obtain a morphological image of the target object, wherein the morphological image includes skeleton information of the target object, includes:
[0011] A morphological operation is used to extract the skeleton of the edge image to obtain a morphological image of the target object, wherein the morphological image includes the skeleton information of the target object.
[0012] In one embodiment, before performing morphological operation on the edge image to obtain the morphological image of the target object, the method further includes: performing denoising on the edge image to remove gaps and / or stray noise in the edge image.
[0013] In one embodiment, the contour extraction of the morphological image according to the skeleton information to obtain the contour information of the target object includes: converting the morphological image into a binary image; traversing the pixel points in the binary image to determine the pixel boundary points in the binary image; and determining the connected domain formed by the pixel boundary points according to the pixel boundary points to generate the contour information of the target object.
[0014] In one embodiment, after extracting the contour of the morphological image according to the skeleton information to obtain the contour information of the target object, it also includes: post-processing the contour information to remove redundant line segments in the contour information, and the redundant line segments include: repeated line segments and / or short lines with a length less than a preset threshold.
[0015] In one embodiment, after extracting the contour of the morphological image according to the skeleton information to obtain the contour information of the target object, it also includes: generating a mask image of the target object according to the outer contour line of the target object in the contour information; and / or generating a legend of the target object according to the inner contour line of the target object in the contour information.
[0016] In a second aspect, an embodiment of the present application provides a method for generating a construction drawing, comprising: in response to a construction drawing query request for three-dimensional design information, obtaining an original image of at least one target object in the three-dimensional design information; processing the original image using a method as described in any of the above aspects to obtain contour information of the at least one target object; generating a mask image of the at least one target object based on the contour information; and stacking and fusing the mask images of the at least one target object based on the positional relationship between the target objects in the three-dimensional design information to generate a construction drawing corresponding to the three-dimensional design information.
[0017] In a third aspect, an embodiment of the present application provides a contour information extraction device, comprising:
[0018] An acquisition module, used for acquiring an original image to be processed of a target object;
[0019] A detection module, used to perform edge detection on the original image to obtain an edge image of the target object;
[0020] A first extraction module, configured to perform skeleton extraction on the edge image to obtain a morphological image of the target object, wherein the morphological image includes skeleton information of the target object;
[0021] The second extraction module is used to extract the contour of the morphological image according to the skeleton information to obtain the contour information of the target object.
[0022] In one embodiment, the detection module is used to convert the original image into a grayscale image and filter the grayscale image; calculate the gradient information of the grayscale image after filtering; perform non-maximum suppression processing on each pixel point in the grayscale image according to the gradient information to obtain the edge image of the target object.
[0023] In one embodiment, the detection module is also used to determine whether any pixel point in the grayscale image is a maximum value within a preset neighborhood. If the pixel point is a maximum value within the preset neighborhood, the pixel point is retained; otherwise, if the pixel point is not a maximum value within the preset neighborhood, the pixel point is suppressed to obtain the edge image of the target object.
[0024] In one embodiment, it further includes: an erosion module, which is used to perform an erosion process on the grayscale image before filtering the grayscale image.
[0025] In one embodiment, the first extraction module is used to perform skeleton extraction on the edge image using morphological operations to obtain a morphological image of the target object, wherein the morphological image includes skeleton information of the target object.
[0026] In one embodiment, it further includes: a denoising module, which is used to perform denoising processing on the edge image before performing morphological operations on the edge image to obtain the morphological image of the target object, so as to remove gaps and / or stray noises in the edge image.
[0027] In one embodiment, the second extraction module is used to convert the morphological image into a binary image; traverse the pixel points in the binary image to determine the pixel boundary points in the binary image; determine the connected domain formed by the pixel boundary points based on the pixel boundary points to generate the contour information of the target object.
[0028] In one embodiment, it also includes: a removal module, which is used to post-process the contour information after extracting the contour of the morphological image according to the skeleton information to obtain the contour information of the target object, and remove redundant line segments in the contour information, wherein the redundant line segments include: repeated line segments and / or short lines with a length less than a preset threshold.
[0029] In one embodiment, the method further includes: a generating module for generating a mask image of the target object according to an outer contour line of the target object in the contour information after extracting the contour of the morphological image according to the skeleton information to obtain the contour information of the target object;
[0030] In one embodiment, the generating module is used to generate a legend of the target object according to an inner contour line of the target object in the contour information.
[0031] In a fourth aspect, an embodiment of the present application provides an electronic device, including:
[0032] at least one processor; and
[0033] a memory communicatively coupled to the at least one processor;
[0034] 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 electronic device to execute the method described in any one of the above aspects.
[0035] In a fifth aspect, an embodiment of the present application provides a cloud device, including:
[0036] at least one processor; and
[0037] a memory communicatively coupled to the at least one processor;
[0038] 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 cloud device to execute the method described in any one of the above aspects.
[0039] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in any one of the above aspects is implemented.
[0040] In a seventh aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the method described in any of the above aspects when executed by a processor.
[0041] The contour information extraction method, device and storage medium provided in the embodiments of the present application detect the edge of the target object in the original image, enhance the edge lines, perform skeleton extraction on the target object, increase the morphological skeleton contour of the target object, and then perform contour extraction on the enhanced morphological image. In this way, since the morphological lines of the target object in the original image are enhanced before contour extraction, the contour extraction result is more accurate and the precision of the contour extraction result is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0043] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of an application scenario of a contour information extraction solution provided in an embodiment of the present application;
[0045] Figure 3 A schematic diagram of a flow chart of a contour information extraction method provided in an embodiment of the present application;
[0046] Figure 4 A schematic diagram showing a mask image of a bed in a construction drawing provided in an embodiment of the present application;
[0047] Figure 5 A schematic diagram of an original image of a target object provided in an embodiment of the present application;
[0048] Figure 6 The embodiment of the present application provides Figure 5The schematic diagram of the result after contour information extraction of the original image shown;
[0049] Figure 7 A schematic diagram of a flow chart of a contour information extraction method provided in an embodiment of the present application;
[0050] Fig. 8A A schematic diagram of a process flow of a construction drawing generation method provided in an embodiment of the present application;
[0051] Figure 8B A schematic diagram of a process flow of a construction drawing generation method provided in an embodiment of the present application;
[0052] Fig. 9 A schematic diagram of the structure of a contour information extraction device provided in an embodiment of the present application;
[0053] Fig.10 A schematic diagram of the structure of a cloud device provided in an embodiment of the present application.
[0054] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0055] Here, exemplary embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application.
[0056] The term "and / or" in this article is used to describe the association relationship of associated objects, specifically indicating that there may be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0057] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0058] In order to clearly describe the technical solution of the embodiment of the present application, the terms involved in the present application are first defined:
[0059] 3D:3-dimension, three-dimensional.
[0060] 3dMax: 3D Studio Max, a 3D modeling, rendering and production software.
[0061] max / 3ds: Files exported after modeling using the 3D modeling software 3dMax.
[0062] obj: obj file is a 3D model file format.
[0063] VRay: is a rendering software.
[0064] vrscene: It is a special file format used by VRay rendering engine for rendering. It is essentially a string text. This file format contains all the information necessary for rendering, including model 3D space information, material information, camera perspective, rendering settings, etc.
[0065] PNG: Portable Network Graphics, portable network graphics.
[0066] SVG: Scalable Vector Graphics, Scalable Vector Graphics, is a graphic file format that can be used to design high-resolution graphic pages.
[0067] MySQL: Relational Database Management System, is a relational database management system.
[0068] MongoDB: is a non-relational database.
[0069] OpenCV: Open Source Computer Vision Library, an open source computer vision library, is a cross-platform computer vision and machine learning software library that implements many common algorithms in image processing and computer vision.
[0070] HTTP: Hyper Text Transfer Protocol.
[0071] morphology: morphology.
[0072] Skeletonize: Skeletonize.
[0073] like Figure 1 As shown, this embodiment provides an electronic device 1, including: at least one processor 11 and a memory 12, Figure 1A processor is taken as an example. The processor 11 and the memory 12 are connected via a bus 10. The memory 12 stores instructions that can be executed by the processor 11, and the instructions are executed by the processor 11 so that the electronic device 1 can execute all or part of the process of the method in the following embodiment, so as to enhance the morphological lines of the target object in the original image before contour extraction, which is conducive to more accurate contour extraction results and improves the precision of contour extraction results.
[0074] In one embodiment, the electronic device 1 may be a mobile phone, a tablet computer, a laptop computer, a desktop computer, or a large computing system composed of multiple computers.
[0075] Figure 2 Schematic diagram of an application scenario 200 of a contour information extraction system provided in an embodiment of the present application. Figure 2 As shown, the system includes: a server 210 and a terminal 220, wherein:
[0076] The server 210 may be a data platform that provides contour information extraction services, such as a home decoration design platform. In actual scenarios, a home decoration design platform may have multiple servers 210. Figure 2 In the figure, one server 210 is taken as an example.
[0077] The terminal 220 may be a computer, mobile phone, tablet or other device used by the user to log in to the home decoration design platform. There may be multiple terminals 220. Figure 2 Two terminals 220 are taken as an example for illustration.
[0078] The terminal 220 and the server 210 can transmit information via the Internet, so that the terminal 220 can access the data on the server 210. The terminal 220 and / or the server 210 can be implemented by the electronic device 1.
[0079] The profile information extraction solution of the embodiment of the present application can be deployed on the server 210, can also be deployed on the terminal 220, or can be deployed partially on the server 210 and partially on the terminal 220. In actual scenarios, it can be selected based on actual needs, and this embodiment does not limit it.
[0080] When the contour information extraction solution is fully or partially deployed on the server 210 , a calling interface may be opened to the terminal 220 to provide algorithm support to the terminal 220 .
[0081] The method provided in the embodiment of the present application can be implemented by executing the corresponding software code by the electronic device 1, and can be implemented by exchanging data with the server. The electronic device 1 can be a local terminal device. When the method is run on the server, the method can be implemented and executed based on the cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0082] In a possible implementation, the method provided in the embodiment of the present application provides a graphical user interface through a terminal device, wherein the terminal device can be the local terminal device mentioned above, or can be the client device in the cloud interaction system mentioned above.
[0083] The contour information extraction method of the embodiment of the present application can be applied to any field that requires contour information.
[0084] Take online home decoration design platforms as an example. With the development of computer technology, 3D (3-dimension) design tools are increasingly widely used in the home decoration industry. After using 3D design tools to design home decoration plans, in addition to rendering and viewing the 3D model effects of the design plans, it is also necessary to do the actual construction, so it is necessary to export construction drawings.
[0085] In the related art, the occlusion relationship between drawing elements in the construction drawing system is crucial to the accuracy of drawing expression. To this end, it is necessary to extract the closed outer contour of the object's design model. Taking the design model of the bed in the home decoration design plan as an example, the outer contour of the bed model is extracted, and the outer contour is used to generate a bed mask to cover the wall paving elements behind the bed, and then the construction drawing is exported. Therefore, the export of construction drawings requires the outline of the 3D model in the design plan.
[0086] The common process of 3D model contour extraction is to render a thumbnail of the 3D model of the design solution and then extract the contour of the thumbnail. However, the quality of the contour results extracted by this solution may be affected by factors such as image noise, and the accuracy of the contour extraction result is low.
[0087] In order to solve the above problems, an embodiment of the present application provides a contour information extraction solution, which detects the edges of the target object in the original image, enhances the edge lines, and performs skeleton extraction on the target object, thereby adding a morphological skeleton contour of the target object in the morphological image, and then performs contour extraction on the enhanced morphological image. In this way, since the morphological lines of the target object in the original image are enhanced before contour extraction, the contour extraction result is more accurate and the precision of the contour extraction result is improved.
[0088] Some embodiments of the present application are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0089] Please see Figure 3 , which is a contour information extraction method of an embodiment of the present application, the method can be Figure 1The electronic device 1 shown is used to perform and can be applied to Figure 2 In the application scenario of contour information extraction shown in , the morphological lines of the target object in the original image are enhanced before contour extraction, which is conducive to more accurate contour extraction results and improves the accuracy of contour extraction results. This embodiment takes terminal 220 as an execution end as an example, and the method includes the following steps:
[0090] Step 301: Obtain an original image to be processed of a target object.
[0091] In this step, the target object refers to the object whose contour needs to be extracted. The target object can be a physical object or a virtual object. Taking the home decoration design scene as an example, the target object can be a model object in a three-dimensional design scheme, such as a three-dimensional model of a bed in a room, a three-dimensional model of a chair, etc. The original image refers to an image containing the target object, such as an image of a bed obtained by shooting a physical bed with a camera, or an image of a bed model in a three-dimensional design scheme. The original image can include one or more of a top view, a side view, and a front view of the target object.
[0092] In one embodiment, taking a home decoration design scene as an example, the original image of the target object can be obtained in the following manner:
[0093] 1. Upload the 3D model of the room's 3D design plan through the HTTP interface, including at least one 3D model of a target object, such as an obj file, max / 3ds file.
[0094] 2. Open the 3D model through the 3dMax script (file extension .mx) to verify whether the model is standard.
[0095] 3. After the model is verified, save the model metadata to the data database (for example, in a MySQL database or a MongoDB database) and the distributed file system.
[0096] 4. The system generates a vrscene file according to the configuration rules. Here, the material rule can be configured as a cartoon material. It can also be configured as other materials according to requirements, which is not limited in this embodiment.
[0097] 5. The VRay rendering engine can be called to render the original image in PNG format. The original image can include the top view, side view and front view of the bed model. Other rendering engines can also be used to render the original image, which is not limited here.
[0098] Step 302: Perform edge detection on the original image to obtain an edge image of the target object.
[0099] In this step, the purpose of edge detection is to identify points in the digital image where the brightness changes significantly. Significant changes in image attributes usually reflect important events and changes in the attributes, such as the boundary between the outline of the target object and the background in the original image. The essence of edge detection is to use an algorithm to extract the boundary between the object and the background in the image. By performing edge detection on the original image, the amount of data for subsequent contour calculation can be greatly reduced, and some information irrelevant to the contour can be eliminated, retaining the important structural attributes of the original image.
[0100] In one embodiment, edge detection methods can be divided into two categories: search-based and zero-crossing-based. Among them, the search-based edge detection method first calculates the edge strength of the original image, usually expressed by a first-order derivative, such as a gradient modulus, and then estimates the local direction of the edge, which can usually be the direction of the gradient, and uses this direction to find the maximum value of the local gradient modulus, and then uses the threshold method to determine the edge. The zero-crossing-based method finds the zero-crossing point of the second-order derivative obtained from the original image to locate the edge. Usually, the zero-crossing point of the Laplace operator or nonlinear differential equation is used.
[0101] In one embodiment, step 302 may specifically include: converting the original image into a grayscale image, and filtering the grayscale image. Calculating the gradient information of the grayscale image after filtering. Performing non-maximum suppression processing on each pixel in the grayscale image according to the gradient information to obtain an edge image of the target object.
[0102] In this embodiment, the original image needs to be gray-scale converted before edge detection. Assuming that the original image is a color image, OpenCV is used as an example to implement the conversion from color to grayscale, and the grayscale image of the original image is obtained to reduce the dimension of the image information and better highlight the shape and structural features. The perfect image information is noise-free and has good image quality. However, in reality, due to various reasons such as acquisition equipment and environmental interference, the original image information collected contains a large amount of noise information. The most common noises are salt and pepper noise and Gaussian noise. The grayscale image can be filtered. Generally, Gaussian filtering can be used to remove noise. Gaussian filtering can filter out the noise part in the image to avoid the erroneous noise information being mistakenly identified as the edge when performing edge detection later. Then the Canny operator can be used to perform edge detection on the grayscale image of the original image to enhance the weak lines of the image and highlight the contour lines of the target object.
[0103] Specifically, the Canny operator is an edge detection method that seeks the best compromise between noise resistance and precise positioning. The gradient information of the grayscale image can be calculated using first-order finite differences. The Sobel operator can be used as a gradient operator in the Canny operator. Of course, other operators such as the Roberts operator and other first-order edge detection operators can be constructed according to actual needs as gradient operators. Then, the grayscale image is subjected to non-maximum suppression processing based on the gradient information, that is, the non-maximum pixel data in the grayscale image is suppressed. Here, the suppression processing refers to excluding the possibility that the non-maximum pixel data is an edge. For example, the larger the element value in the image gradient amplitude matrix within the 8-neighborhood of a certain pixel point, the larger the gradient value of the pixel point in the image. Combined with the gradient direction of the detection point, the approximate edge information can be located.
[0104] In one embodiment, the step 302 performs non-maximum suppression processing on each pixel in the grayscale image according to the gradient information to obtain the edge image of the target object, including: for any pixel in the grayscale image, determining whether the pixel is a maximum value in a preset neighborhood, if the pixel is a maximum value in the preset neighborhood, retaining the pixel. Otherwise, if the pixel is not a maximum value in the preset neighborhood, suppressing the pixel to obtain the edge image of the target object.
[0105] In this embodiment, for each pixel in the grayscale image, the gradient value and gradient direction matrix of each pixel are solved, and the gradient value of the current pixel is compared with the gradient values on both sides of the gradient direction, and the gradient direction is perpendicular to the edge direction. Assuming that the preset neighborhood is an 8-neighborhood, it can be roughly determined whether the current pixel is a maximum value in the 8-neighborhood according to the gradient value and gradient direction. If so, it means that the current pixel may be an edge, and the current pixel is retained. Otherwise, if the current pixel is not a maximum value in the 8-neighborhood, it is determined that the current pixel is not an edge. After traversing each pixel in the grayscale image, the edge information of the grayscale image can be determined to obtain the edge image of the target object.
[0106] In actual scenes, after completing non-maximum suppression, a binary image will be obtained, where the grayscale values of non-edge points are all 0, and the grayscale values of points that may be edges are 255. Such a detection result may still contain many false edges caused by noise and other reasons. Double threshold screening can be used to screen the binary image. By selecting appropriate large and small thresholds, an edge image that is closest to the real edge of the image can be obtained. The specific implementation method is: an edge image is obtained according to a high threshold, so that an image contains very few false edges, but due to the high threshold, the edges of the generated image may not be closed. To solve this problem, another low threshold is used. In the high threshold image, the edges are linked into contours. When the end point of the contour is reached, the algorithm will find a point that meets the low threshold in the 8 neighborhood points of the breakpoint, and then collect new edges based on this point until the edge of the entire image is closed.
[0107] In one embodiment, before filtering the grayscale image in step 302, the process may further include: performing corrosion processing on the grayscale image.
[0108] In this embodiment, the transparent channel of the grayscale image can be eroded to expand the black area toward the white area and shrink the white area adjacent to the black area to remove interference at the edge of the image, wherein the black area represents the background in the image and the white area represents the foreground object to be identified in the image.
[0109] Step 303: extract the skeleton of the edge image to obtain a morphological image of the target object, where the morphological image includes skeleton information of the target object.
[0110] In this step, although some points are removed from the original image, the skeleton features of the image still retain the structural information of the object to be identified. Therefore, the skeleton information of the object to be identified in the image can accurately characterize the structural morphology of the object, and a morphological image containing the skeleton information of the target object can be extracted to enhance the skeleton structural features of the target object.
[0111] In one embodiment, step 303 may specifically include: performing skeleton extraction on the edge image using morphological operations to obtain a morphological image of the target object, wherein the morphological image includes skeleton information of the target object.
[0112] In this embodiment, morphological operation, namely mathematical morphology, is a set of extensive image processing operations based on shape processing images. It can include dilation, erosion, opening, closing and other operation modes. In morphological operation, each pixel in the image is adjusted based on the value of other pixels in its neighborhood. By selecting the size and shape of the neighborhood, a morphological operation sensitive to a specific shape in the input image can be constructed. By performing morphological operation on the edge image, the morphological image obtained can highlight the shape and structural features of the target object in the edge image. Therefore, the skeleton extraction method in the morphological operation can be used to extract the skeleton of the edge image to obtain a morphological image containing the skeleton information of the target object to enhance the skeleton structural features of the target object. In actual scenes, the morphology.Skeletonize_3d algorithm can be selected to realize skeleton extraction. Skeletonize_3d is a computer skeleton extraction algorithm used for image processing, which can be used to create a three-dimensional skeleton representation of a three-dimensional object. This technology is useful in many fields, including biology, medicine, engineering and computer graphics. The Skeletonize_3d algorithm creates a skeletal representation of an object by analyzing the connectivity of pixels in an image and removing redundant pixels. This method can be used to reduce the complexity of an image, making it easier to analyze and process the data. The Skeletonize_3d algorithm is widely used in 3D modeling and computer graphics software to create realistic representations of complex objects.
[0113] In one embodiment, before step 303, the process may further include: performing denoising processing on the edge image to remove gaps and / or stray noise in the edge image.
[0114] In this embodiment, if the outer contour accuracy of the target object is very high, before the morphological operation, the small gaps formed by the tips in the edge image can be removed and the internal details can be ignored so that the processing results can focus more on the outer contour and reduce stray noise, so as to further purify the contour, reduce the amount of data, and improve the outer contour accuracy.
[0115] Step 304: extracting the contour of the morphological image according to the skeleton information to obtain contour information of the target object.
[0116] In this step, since edge detection enhances the line features of the target object, the skeleton information in the morphological image highlights the skeleton shape and skeleton structure features of the target object. On this basis, contour extraction can obtain more accurate contour information and improve the accuracy of contour information. Contour information can be stored in a vector graphics format to facilitate the production of a high-resolution graphical interface. For example, an image of contour information can be saved in SVG format, and the vector graphics storage file format can also use other formats, which are not limited in this embodiment.
[0117] In one embodiment, step 304 may specifically include: converting the morphological image into a binary image, traversing the pixel points in the binary image, and determining the pixel boundary points in the binary image. According to the pixel boundary points, determining the connected domain formed by the pixel boundary points, and generating the contour information of the target object.
[0118] In this embodiment, first, the image after morphological operation needs to be converted into a binary image, which can be achieved in many ways. The purpose of image binarization is to remove redundant information in the image or highlight the object information of interest in the image. Then, the contour of the object is found in the binary image. In this process, the pixels in the binary image can be traversed. If the value of the current pixel is 255, it means that the current pixel is a foreground pixel, which can be saved in a List (form). Then, the pixel boundary points in the binary image are determined according to the form of this foreground pixel. In the actual scene, a contour is composed of many boundary points. For a current pixel in the form, if one of its upper and lower adjacent pixels or left and right adjacent pixels is a foreground pixel and the other is a background pixel, it can be determined that the current pixel is a boundary pixel. In this way, all pixels in the form are judged to obtain a series of boundary pixels. Then, a connected domain is found according to the boundary pixels. The boundary pixels obtained above are some discrete boundary point positions, and these boundary pixels can be composed of a connected contour area. Usually, these boundary pixels can be arranged in a specific order so that the polygonal area composed of them is closed. Select a starting point from the boundary pixel set, then find the next connection point in sequence and connect these points in sequence.
[0119] You can use the cv2.findContours function algorithm in OpenCV2 to implement contour recognition. In the process of finding the connection point, you need to pay attention to: find the first connection point. If this connection point is the first point found, you need to return this connection point to the function, and the function will find the next point based on this point. When a point is found, it needs to be marked as visited and connected to the contour area to be output. In the process of finding contours, there will be many such connection points, and each connection point will generate a new contour. This contour may be one of the contours in the set, or it may be a newly generated contour. Finally, cv2.findContours() will output all the contour point sets. It can easily describe the shape information of the target object in a complex image.
[0120] In one embodiment, after step 304, the following may further be included: generating a mask image of the target object according to the outer contour line of the target object in the contour information.
[0121] In this embodiment, if a construction drawing of a target object is to be generated, it is necessary to focus on the outer contour of the target object. For example, in a home decoration scene, for a bed in a three-dimensional design of a room, it is necessary to focus on the outer contour of the bed and ignore the internal details of the bed. Therefore, the outer contour can be extracted from the contour information of the bed, and the outer contour is used to generate a mask image of the bed, such as Figure 4 As shown, it is a schematic diagram showing the mask image of the bed in the construction drawing. The mask image is used to cover the wall elements behind the bed in the three-dimensional design scheme, so as to clearly and accurately express the construction drawing information.
[0122] In one embodiment, after step 304, the following may further be included: generating a legend of the target object according to the inner contour line of the target object in the contour information.
[0123] In this embodiment, the contour information of the target object may include an inner contour line, which can be used to create an intelligent legend. Taking the bed in a home decoration scene as an example, assuming that the original image is a three-view image of the bed model, the inner contour line of the bed model can be used to generate an intelligent legend of the bed to present the visual effects of the bed model in different views and improve the interactive experience.
[0124] In one embodiment, after step 304, the following may be further included: post-processing the contour information to remove redundant line segments in the contour information.
[0125] In this embodiment, redundant line segments include but are not limited to: repeated line segments and or short lines whose length is less than a preset threshold. The contour information returned by cv2.findContours may contain repeated line segments or short lines. These redundant line segments will affect the accuracy of the contour information. Therefore, the contour information can be post-processed to remove redundant line segments and improve the accuracy of the contour information. The preset threshold can be set based on actual needs. The principle is to eliminate short lines as much as possible to improve the smoothness and accuracy of the contour information.
[0126] After cv2.findContours returns multiple closed contours, you can make intersection judgments between multiple contours, remove duplicate lines, and then merge all contour points into one contour. This can be achieved by using common concave hull algorithms, such as the alpha-shape algorithm. Assuming that cv2.findContours returns multiple closed contour points to form a discrete point set S, the basic idea of the algorithm is to roll a circle with a radius of α around a given discrete point set S. When the value of α is appropriate, the circle will not roll into the interior of S. The point that intersects with the circle is the edge contour point of S, and the trace of its rolling is the boundary line of S. The boundary line can be determined by the following criteria: take any two points in the point set S and draw a circle with a radius of α through these two points. If there are no other points in the circle, it can be considered as a boundary line. In actual scenarios, the value of α can be set according to actual needs to merge all contour points into one contour. After such processing, not only the lines in the contour information are smoother and more accurate, but also the amount of data in the contour information is reduced, reducing the data burden on the application end.
[0127] like Figure 5 As shown in FIG. 1 , it is a schematic diagram of an original image of a target object provided in an embodiment of the present application. After the original image is processed by the contour information extraction method provided in an embodiment of the present application, the following can be obtained: Figure 6 The contour information extraction results shown in Figure 6 As shown, the internal details of the target object are ignored ( Figure 5 The gaps around the inner circle of the target object in the image are removed), and the focus is on the outer contour information. The contour information finally extracted can accurately represent the outer contour information of the target object. Compared with the traditional scheme, the edge detection step through the Canny operator helps to identify the edges in the image, while the morphological operation step helps to fill the gaps and smooth the edges. It can be seen Figure 6 The final extraction result has removed sharp corners, is smoother, and has an outer contour that fits the model lines of the target object more closely. At the same time, experiments have shown that by exporting an SVG file to check the data size of the final result, the solution of the embodiment of the present application can reduce data traffic by about 50% compared to the traditional solution, greatly reducing the data burden on the application side.
[0128] The above-mentioned contour information extraction method detects the edge of the target object in the original image, enhances the edge lines, performs morphological operations on the target object, increases the morphological skeleton contour of the target object, and then performs contour extraction on the enhanced morphological image. In this way, since the morphological lines of the target object in the original image are enhanced before contour extraction, it is beneficial to make the contour extraction result more accurate and improve the precision of the contour extraction result.
[0129] Please see Figure 7 , which is a contour information extraction method of an embodiment of the present application, the method can be Figure 1 The electronic device 1 shown is used to perform and can be applied to Figure 2 In the application scenario of contour information extraction shown in , the shape lines of the target object in the original image are enhanced before contour extraction, which is conducive to more accurate contour extraction results and improves the precision of contour extraction results. This embodiment takes the terminal 220 as an example of the execution end. Compared with the previous embodiment, this embodiment takes the extraction of the outer contour line of the bed model in the home decoration scene as an example. The method includes the following steps:
[0130] Step 701: Upload a 3D model of a three-dimensional design of a room through an HTTP interface, including a 3D model of at least one bed model, such as an obj file, a max / 3ds file.
[0131] Step 702: Open the 3D model through the 3dMax script to verify whether the model is standard.
[0132] Step 703: After the model verification is passed, the model metadata is saved to a database (for example, a MySQL database or a MongoDB database) and a distributed file system.
[0133] Step 704: The system generates a vrscene file according to the configuration rules, where the material rule can be configured as a cartoon material, or can be configured as other materials according to requirements, which is not limited in this embodiment.
[0134] Step 705: The VRay rendering engine may be called to render the original image in PNG format.
[0135] Step 706: Convert the original image into a grayscale image to reduce the dimension of the image information and better highlight the shape and structural features.
[0136] Step 707: performing an erosion operation on the transparent channel of the grayscale image, expanding the black area toward the white area, and shrinking the white area adjacent to the black area, so as to remove interference at the edge of the image.
[0137] Step 708: Perform Gaussian smoothing on the pre-processed grayscale image to reduce noise interference while retaining more overall grayscale distribution features.
[0138] Step 709: Use the Canny operator to perform edge detection on the image to obtain an edge image of the bed model to enhance weak lines and highlight the lines of the bed model.
[0139] Step 710: De-noising the edge image to remove tiny gaps and / or stray noise in the edge image to further purify the contour.
[0140] Step 711: Perform morphological operations on the edge image to obtain a morphological image of the bed model, and strengthen the skeleton contour to further highlight the shape and structural features of the image.
[0141] Step 712: Use the cv2.findContours algorithm to identify the contour information of the morphological image.
[0142] Step 713: extract the outer contour line of the bed model from the contour information output by the cv2.findContours algorithm.
[0143] Step 714: Post-process the extracted outer contour line to remove artifacts and jagged edges to make it smoother and more accurate, and use the outer contour line as reference data for making a mask image of the bed model.
[0144] The above-mentioned contour information extraction method renders the 3D model of the bed based on the Vary rendering engine to generate its top view, side view and front view. First, the edge of the target object in the original image is detected, the edge lines are enhanced, and the target object is subjected to morphological operations to increase the morphological skeleton contour of the target object. Then, the image contour extraction algorithm is used to extract the inner / outer contour information of the bed model from these images. The outer contour line is selected to generate a mask image to block the drawing elements behind the bed model. In the process of extracting the outer contour, it can be ensured that the outer contour can accurately express the external features of the bed model according to the requirements of the construction drawing, while ignoring irrelevant internal details. And the amount of data of the contour information can be reduced to reduce the burden on the application end.
[0145] For details of each step of the above-mentioned contour information extraction method, please refer to the relevant description of the above-mentioned embodiment, which will not be repeated here.
[0146] Please see Fig. 8A , which is a construction drawing generation method of an embodiment of the present application, the method can be Figure 1 The electronic device 1 shown is used to perform and can be applied to Figure 2In the application scenario of contour information extraction shown in , the shape lines of the target object in the original image are enhanced before contour extraction, which is conducive to more accurate contour extraction results, improves the accuracy of contour extraction results, and thus improves the accuracy of construction drawings. This embodiment takes terminal 220 as an execution end as an example, takes the export of construction drawings in a home improvement scene as an example, and the method includes the following steps:
[0147] Step 801: In response to a construction drawing query request for three-dimensional design information, an original image of at least one target object in the three-dimensional design information is obtained.
[0148] In this step, the 3D design information may be a 3D design scheme on a home decoration design platform. Each 3D design scheme may include 3D models of one or more objects. When a user needs to export a construction drawing of a 3D design scheme, a construction drawing query request may be triggered through a terminal. The system automatically obtains the original image of at least one target object in the 3D design information, such as calling a VRay rendering engine to render the original image in PNG format.
[0149] Step 802: Process the original image using a method as described in any of the above embodiments to obtain contour information of at least one target object.
[0150] Step 803: Generate a mask image of at least one target object according to the contour information.
[0151] Step 804: Based on the positional relationship between the target objects in the three-dimensional design information, the mask image of at least one target object is superimposed and merged to generate a construction drawing corresponding to the three-dimensional design information.
[0152] In this step, a 3D design may include multiple target objects, and there may be positional occlusion relationships between the target objects. For example, from a certain angle, the bed model blocks some elements on the wall behind it. Then, according to the positional relationship of the multiple target objects, the corresponding mask images can be stacked, such as the mask image of the bed model stacked on top of the wall. In this way, the relationship between the bed and the wall can be accurately expressed, and then the construction drawing corresponding to the 3D design information can be generated to improve the accuracy of the construction drawing. The construction drawing can be displayed on the user interface for users to view, or it can be saved as a file for easy transmission.
[0153] For details of each step of the above-mentioned construction drawing generation method, please refer to the relevant description of the above-mentioned embodiment, which will not be repeated here.
[0154] Please see Figure 8B , which is a construction drawing generation method of an embodiment of the present application, the method can be Figure 1 The electronic device 1 shown is used to perform and can be applied to Figure 2In the application scenario of contour information extraction shown in , the shape lines of the target object in the original image are enhanced before contour extraction, which is conducive to more accurate contour extraction results, improves the accuracy of contour extraction results, and thus improves the accuracy of construction drawings. This embodiment takes terminal 220 as an execution end as an example, takes the 3D design software exporting construction drawings in the home improvement scene as an example, and the method includes the following steps:
[0155] Step S1: in response to a construction drawing query request for three-dimensional design information, obtaining an original image of at least one target object in the three-dimensional design information;
[0156] Step S2: performing edge detection on the original image to obtain an edge image of at least one target object;
[0157] Step S3: extracting a skeleton from the edge image to obtain a morphological image of at least one target object, wherein the morphological image includes skeleton information of at least one target object;
[0158] Step S4: extracting contours of the morphological image according to the skeleton information to obtain contour information of at least one target object.
[0159] Step S5: generating a mask image of at least one target object according to the contour information;
[0160] Step S6: Based on the positional relationship between the target objects in the three-dimensional design information, the mask image of at least one target object is superimposed and merged to generate a construction drawing corresponding to the three-dimensional design information.
[0161] For details of each step of the above-mentioned construction drawing generation method, please refer to the relevant description of the above-mentioned embodiment, which will not be repeated here.
[0162] Please see Fig. 9 , which is a contour information extraction device 900 of an embodiment of the present application, which can be applied to Figure 1 The electronic device 1 shown can be applied to Figure 2 In the application scenario of contour information extraction shown in , the morphological lines of the target object in the original image are enhanced before contour extraction, which is conducive to more accurate contour extraction results and improves the accuracy of contour extraction results. The device includes: an acquisition module 901, a detection module 902, a first extraction module 903 and a second extraction module 904, and the functional principles of each module are as follows:
[0163] The acquisition module 901 is used to acquire the original image to be processed of the target object.
[0164] The detection module 902 is used to perform edge detection on the original image to obtain an edge image of the target object.
[0165] The first extraction module 903 is used to perform skeleton extraction on the edge image to obtain a morphological image of the target object, where the morphological image includes skeleton information of the target object.
[0166] The second extraction module 904 is used to extract the contour of the morphological image according to the skeleton information to obtain the contour information of the target object.
[0167] In one embodiment, the detection module 902 is used to convert the original image into a grayscale image and filter the grayscale image. The gradient information of the grayscale image after filtering is calculated. Non-maximum suppression is performed on each pixel in the grayscale image according to the gradient information to obtain an edge image of the target object.
[0168] In one embodiment, the detection module 902 is further used to determine whether any pixel point in the grayscale image is a maximum value in a preset neighborhood, and if the pixel point is a maximum value in the preset neighborhood, the pixel point is retained. Otherwise, if the pixel point is not a maximum value in the preset neighborhood, the pixel point is suppressed to obtain an edge image of the target object.
[0169] In one embodiment, it further includes: an erosion module, which is used to perform an erosion process on the grayscale image before filtering the grayscale image.
[0170] In one embodiment, the first extraction module 903 is used to perform skeleton extraction on the edge image using morphological operations to obtain a morphological image of the target object, where the morphological image includes skeleton information of the target object.
[0171] In one embodiment, it further includes: a denoising module for performing denoising processing on the edge image to remove gaps and / or stray noise in the edge image before performing morphological operations on the edge image to obtain the morphological image of the target object.
[0172] In one embodiment, the second extraction module 904 is used to convert the morphological image into a binary image, traverse the pixel points in the binary image, determine the pixel boundary points in the binary image, determine the connected domain formed by the pixel boundary points based on the pixel boundary points, and generate the contour information of the target object.
[0173] In one embodiment, it also includes: a removal module, which is used to extract the contour of the morphological image according to the skeleton information to obtain the contour information of the target object, and then post-process the contour information to remove redundant line segments in the contour information. The redundant line segments include: repeated line segments and / or short lines with a length less than a preset threshold.
[0174] In one embodiment, it further includes: a generating module for generating a mask image of the target object according to the outer contour line of the target object in the contour information after extracting the contour of the morphological image according to the skeleton information to obtain the contour information of the target object.
[0175] In one embodiment, the generating module is used to generate a legend of the target object according to the inner contour line of the target object in the contour information.
[0176] For a detailed description of the above-mentioned contour information extraction device 900, please refer to the description of the relevant method steps in the above-mentioned embodiment. Its implementation principle and technical effect are similar, and will not be repeated here in this embodiment.
[0177] Fig.10 The following is a schematic diagram of a cloud device 100 provided in an exemplary embodiment of the present application. The cloud device 100 can be used to run the method provided in any of the above embodiments. Fig.10 As shown, the cloud device 100 may include: a memory 1004 and at least one processor 1005, Fig.10 A processor is taken as an example.
[0178] The memory 1004 is used to store computer programs and can be configured to store various other data to support operations on the cloud device 100. The memory 1004 can be an object storage service (OSS).
[0179] Memory 1004 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0180] The processor 1005 is coupled to the memory 1004 and is used to execute the computer program in the memory 1004 to implement the solution provided by any of the above method embodiments. The specific functions and technical effects that can be achieved are not repeated here.
[0181] Furthermore, if Fig.10 The cloud device also includes: a firewall 1001, a load balancer 1002, a communication component 1006, a power supply component 1003 and other components. Fig.10 Only some components are shown schematically, which does not mean that the cloud device only includes Fig.10 Components shown.
[0182] In one embodiment, the above Fig.10The communication component 1006 in is configured to facilitate wired or wireless communication between the device where the communication component 1006 is located and other devices. The device where the communication component 1006 is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, LTE (Long Term Evolution, Long Term Evolution, referred to as LTE), 5G and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component 1006 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1006 also includes a near field communication (Near Field Communication, referred to as NFC) module to facilitate short-range communication. For example, the NFC module can be based on Radio Frequency Identification (Radio Frequency Identification, referred to as RFID) technology, Infrared Data Association (Infrared Data Association, referred to as IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (bluetooth, referred to as BT) technology and other technologies to achieve.
[0183] In one embodiment, the above Fig.10 The power supply component 1003 provides power to various components of the device where the power supply component 1003 is located. The power supply component 1003 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply component is located.
[0184] An embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method of any of the aforementioned embodiments is implemented.
[0185] An embodiment of the present application also provides a computer program product, including a computer program, which implements the method of any of the aforementioned embodiments when executed by a processor.
[0186] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed.
[0187] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.
[0188] It should be understood that the above-mentioned processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The memory may include a high-speed RAM (Random Access Memory) memory, and may also include non-volatile storage NVM (Nonvolatile memory, NVM for short), such as at least one disk storage, and can also be a USB flash drive, a mobile hard disk, a read-only memory, a disk or an optical disk, etc.
[0189] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special computer.
[0190] An exemplary storage medium is coupled to a 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 a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.
[0191] It should be noted that, in this article, the terms "include", "comprises" or any other variations 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, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0192] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0193] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods of each embodiment of the present application.
[0194] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of user data and other information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0195] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for extracting contour information, characterized in that: The method comprises: Obtaining the original image to be processed of the target object; Performing edge detection on the original image to obtain an edge image of the target object; Performing skeleton extraction on the edge image to obtain a morphological image of the target object, wherein the morphological image includes skeleton information of the target object; The contour of the morphological image is extracted according to the skeleton information to obtain the contour information of the target object.
2. The method according to claim 1, characterized in that The performing edge detection on the original image to obtain the edge image of the target object includes: Converting the original image into a grayscale image and performing filtering on the grayscale image; Calculate the gradient information of the grayscale image after filtering; Non-maximum suppression processing is performed on each pixel in the grayscale image according to the gradient information to obtain the edge image of the target object.
3. The method according to claim 2, characterized in that The performing non-maximum suppression processing on each pixel in the grayscale image according to the gradient information to obtain the edge image of the target object includes: For any pixel point in the grayscale image, determine whether the pixel point is a local maximum value within a preset neighborhood. If the pixel point is a local maximum value within the preset neighborhood, retain the pixel point; otherwise, if the pixel point is not a local maximum value within the preset neighborhood, suppress the pixel point to obtain the edge image of the target object.
4. The method according to claim 2, characterized in that: Before filtering the grayscale image, the method further includes: The grayscale image is subjected to corrosion processing.
5. The method according to claim 1, characterized in that The step of performing skeleton extraction on the edge image to obtain a morphological image of the target object, wherein the morphological image includes skeleton information of the target object, comprises: A morphological operation is used to extract the skeleton of the edge image to obtain a morphological image of the target object, wherein the morphological image includes the skeleton information of the target object.
6. The method according to claim 1, characterized in that Before performing morphological operation on the edge image to obtain the morphological image of the target object, the method further includes: The edge image is subjected to denoising processing to remove gaps and / or stray noise in the edge image.
7. The method according to claim 1, characterized in that The step of extracting the contour of the morphological image according to the skeleton information to obtain the contour information of the target object includes: converting the morphological image into a binary image; Traversing the pixel points in the binary image to determine the pixel boundary points in the binary image; According to the pixel boundary points, a connected domain formed by the pixel boundary points is determined to generate contour information of the target object.
8. The method according to claim 1, characterized in that After extracting the contour of the morphological image according to the skeleton information to obtain the contour information of the target object, the method further includes: The contour information is post-processed to remove redundant line segments in the contour information, where the redundant line segments include: repeated line segments and / or short lines whose length is less than a preset threshold.
9. The method according to claim 1, characterized in that: After extracting the contour of the morphological image according to the skeleton information to obtain the contour information of the target object, the method further includes: generating a mask image of the target object according to an outer contour line of the target object in the contour information; And / or, generating a legend of the target object according to an inner contour line of the target object in the contour information.
10. A method for generating a construction drawing, characterized in that: include: In response to a construction drawing query request for the three-dimensional design information, obtaining an original image of at least one target object in the three-dimensional design information; Processing the original image using the method described in any one of claims 1 to 9 to obtain contour information of the at least one target object; generating a mask image of the at least one target object according to the contour information; According to the positional relationship between each target object in the three-dimensional design information, the mask image of the at least one target object is superimposed and fused to generate a construction drawing corresponding to the three-dimensional design information.
11. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; 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 electronic device to perform the method described in any one of claims 1 to 10.
12. A cloud device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; 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 cloud device to execute the method described in any one of claims 1-10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 10 is implemented.
14. A computer program product, characterized in that The method comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Cited By
Slag block contour recognition method and device, storage medium and electronic equipment
CN121190782A
Polygon chain skeleton extraction method
US20260187822A1
Image processing method and electronic device
WO2026208208A1
