Image processing method and device, storage medium and electronic equipment
By employing a semantic-aware diffusion model and geometric computation, the problem of poor accuracy in processing non-standard floor plans was solved, generating high-quality structured vector data suitable for spatial layout analysis and 3D reconstruction.
Patent Information
- Application Number
- CN202611105892.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-11-24
AI Technical Summary
Existing technologies have poor accuracy in processing non-standard floor plans, making it difficult to effectively distinguish between structural elements and noise interference.
A semantic-aware diffusion model is used to process two-dimensional planar images. A structural mask map is generated through classification and geometric operations, and geometric operations are performed to obtain structured vector data, including techniques such as boundary contour processing, polygon approximation algorithms, and connected component analysis.
It improves the structural integrity and geometric accuracy of non-standard floor plans, and provides high-quality, editable, and semantically clear structured data support, suitable for spatial layout analysis and 3D reconstruction.
Smart Images

Figure CN123160932A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to an image processing method, apparatus, storage medium, and electronic device. Background Technology
[0002] Floor plans are crucial input data for home decoration design, interior design, and spatial intelligence tasks. In real-world scenarios, floor plans uploaded or acquired by users are often not standard vector files, but rather ordinary two-dimensional images in the form of screenshots, scans, photos, or images from third-party platforms. Related technologies for parsing floor plans mainly rely on traditional image processing algorithms or general computer vision models. However, when faced with complex and varied non-standard floor plans, it is often difficult to effectively distinguish structural elements from noise interference.
[0003] There is currently no effective solution to the technical problem of poor accuracy in processing non-standard floor plans in the aforementioned related technologies. Summary of the Invention
[0004] This application provides an image processing method, apparatus, storage medium, and electronic device to at least solve the technical problem of poor accuracy in processing non-standard floor plans in related technologies.
[0005] According to one aspect of the embodiments of this application, an image processing method is provided, comprising: acquiring a two-dimensional planar image corresponding to a target space, wherein the two-dimensional planar image includes at least structural elements; performing classification processing based on the two-dimensional planar image to obtain a structural mask image corresponding to each structural element; performing geometric operation processing on the structural mask image to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space.
[0006] Furthermore, classification processing is performed based on the two-dimensional planar image to obtain the structural mask map corresponding to each structural element, including: inputting the two-dimensional planar image into the semantic perception diffusion model; processing the two-dimensional planar image under category constraints through the semantic perception diffusion model to output a semantic coding map, wherein the semantic coding map distinguishes and marks various structural elements in the two-dimensional planar image with the help of differential coding information; and classifying the semantic coding map to obtain the structural mask map.
[0007] Furthermore, geometric operations are performed on the structural mask to obtain structured vector data, including: performing geometric operations on the structural mask to obtain an initial processed image corresponding to each structural element; performing a fusion operation on the initial processed images corresponding to multiple structural elements to obtain a fused processed image; and correcting the gaps between structural elements in the fused processed image to obtain structured vector data.
[0008] Furthermore, when the structural element is a first-type structural element, geometric operations are performed on the structural mask image, including: performing boundary contour processing on the structural mask image to obtain a two-dimensional coordinate point sequence; processing the two-dimensional coordinate point sequence based on a polygon approximation algorithm to obtain polygon contour information; and performing geometric processing on the polygon contour information to obtain the initial processed image corresponding to the first-type structural element.
[0009] Further, geometric processing is performed on the polygon contour information to obtain the initial processed image corresponding to the first type of structural element, including: performing geometric union processing on the polygon contour information to obtain merged polygon contour information; simplifying the merged polygon contour information while keeping the topology unchanged to obtain simplified polygon contour information; performing collinear point filtering processing on the simplified polygon contour information to obtain filtered polygon contour information; and performing coordinate snapping processing on the filtered polygon contour information to obtain the initial processed image.
[0010] Furthermore, when the structural element is a second type of structural element or a third type of structural element, geometric operations are performed on the structural mask image, including: performing connected component processing on the structural mask image to obtain multiple connected components; calculating the rotational bounding rectangle and the first area value corresponding to the rotational bounding rectangle for each of the multiple connected components; determining the geometric representation information corresponding to each of the multiple connected components based on the first area value; and obtaining the initial processing image corresponding to the second type of structural element or the third type of structural element based on the geometric representation information.
[0011] Further, based on the first area value, the geometric representation information corresponding to each of the multiple connected components is determined, including: calculating the actual pixel area value corresponding to each of the multiple connected components to obtain a second area value; if the ratio between the first area value and the second area value is greater than a first preset threshold, then the rotated bounding rectangle is used as the geometric representation information of the corresponding connected component; if the ratio between the first area value and the second area value is less than or equal to the first preset threshold, then the contour of the connected component is simplified, and the simplified contour is used as the geometric representation information of the corresponding connected component.
[0012] Furthermore, the gaps between structural elements in the fused image are corrected to obtain structured vector data. This includes: filtering structural elements in the fused image to obtain multiple pairs of structural elements; determining whether the multiple pairs of structural elements meet preset merging conditions, wherein the merging conditions include at least one of the following: the directional angle between the pair of structural elements is less than a second preset threshold, the thickness difference between the pair of structural elements is less than a third preset threshold, and the endpoint spacing value of the pair of structural elements is less than a fourth preset threshold; if the merging conditions are met, the gaps between the pair of structural elements are corrected to obtain structured vector data.
[0013] According to another aspect of the embodiments of this application, an image processing method is also provided, comprising: acquiring a two-dimensional planar image corresponding to a target space uploaded by a client, wherein the two-dimensional planar image includes at least structural elements; performing classification processing on the two-dimensional planar image in a cloud server to obtain a structural mask image corresponding to each structural element; performing geometric operation processing on the structural mask image to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space; and returning the structured vector data to the client.
[0014] According to another aspect of the embodiments of this application, an image processing apparatus is also provided, comprising: an acquisition unit, configured to acquire a two-dimensional planar image corresponding to a target space, wherein the two-dimensional planar image includes at least structural elements; a first processing unit, configured to perform classification processing based on the two-dimensional planar image to obtain a structural mask image corresponding to each structural element; and a second processing unit, configured to perform geometric operation processing on the structural mask image to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space.
[0015] Further, the first processing unit includes: an input subunit for inputting a two-dimensional planar image into a semantic-aware diffusion model; a first processing subunit for processing the two-dimensional planar image under category constraints through the semantic-aware diffusion model and outputting a semantic coding map, wherein the semantic coding map distinguishes and marks various structural elements in the two-dimensional planar image by means of differential coding information; and a second processing subunit for classifying the semantic coding map to obtain a structural mask map.
[0016] Furthermore, the second processing unit includes: a third processing subunit, used to perform geometric operations on the structural mask image to obtain an initial processing image corresponding to each structural element; a fusion subunit, used to perform a fusion operation on the initial processing images corresponding to multiple structural elements to obtain a fused processing image; and a correction subunit, used to correct the gaps between structural elements in the fused processing image to obtain structured vector data.
[0017] Furthermore, when the structural element is a first type of structural element, the third processing subunit includes: a first processing module for performing boundary contour processing on the structural mask image to obtain a two-dimensional coordinate point sequence; a second processing module for processing the two-dimensional coordinate point sequence based on a polygon approximation algorithm to obtain polygon contour information; and a third processing module for performing geometric processing on the polygon contour information to obtain an initial processing image corresponding to the first type of structural element.
[0018] Further, the first processing module includes: a first processing submodule, used to perform geometric union processing on the polygon contour information to obtain merged polygon contour information; a simplification submodule, used to simplify the merged polygon contour information while keeping the topology unchanged to obtain simplified polygon contour information; a filtering submodule, used to perform collinear point filtering processing on the simplified polygon contour information to obtain filtered polygon contour information; and a second processing submodule, used to perform coordinate snapping processing on the filtered polygon contour information to obtain an initial processed image.
[0019] Furthermore, when the structural element is a second type of structural element or a third type of structural element, the third processing subunit includes: a third processing submodule, used to perform connected component processing on the structural mask map to obtain multiple connected components; a calculation submodule, used to calculate the rotational bounding rectangle and the first area value corresponding to the rotational bounding rectangle for each of the multiple connected components; a first determination submodule, used to determine the geometric representation information corresponding to each of the multiple connected components based on the first area value; and a second determination submodule, used to obtain the initial processing map corresponding to the second type of structural element or the initial processing map corresponding to the third type of structural element based on the geometric representation information.
[0020] Further, the first determining submodule includes: a calculation submodule, used to calculate the actual pixel area values corresponding to multiple connected components respectively to obtain a second area value; a determining submodule, used to use the rotated circumscribed rectangle as the geometric representation information of the corresponding connected component if the ratio between the first area value and the second area value is greater than a first preset threshold; and a simplification submodule, used to simplify the contour of the connected component if the ratio between the first area value and the second area value is less than or equal to the first preset threshold, and use the simplified contour as the geometric representation information of the corresponding connected component.
[0021] Further, the correction subunit includes: a filtering module for filtering structural elements in the fusion processing diagram to obtain multiple pairs of structural elements; a judgment module for judging whether the multiple pairs of structural elements meet preset merging conditions, wherein the merging conditions include at least one of the following: the directional angle between the pair of structural elements is less than a second preset threshold, the thickness difference between the pair of structural elements is less than a third preset threshold, and the endpoint spacing value of the pair of structural elements is less than a fourth preset threshold; and a correction module for correcting the gap between the pair of structural elements if the merging conditions are met, so as to obtain structured vector data.
[0022] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, which includes a stored program, wherein the program controls the device where the storage medium is located to execute the above-described image processing method when it is running.
[0023] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory storing an executable program; and a processor for running the program, wherein the program executes the image processing method described above when it runs.
[0024] According to another aspect of the embodiments of this application, a computer program product is also provided, including a computer program or instructions that, when executed by a processor, implement the image processing method described above.
[0025] In this embodiment, the following steps are adopted: obtaining a two-dimensional planar image corresponding to the target space, wherein the two-dimensional planar image includes at least structural elements; performing classification processing based on the two-dimensional planar image to obtain a structural mask image corresponding to each structural element; performing geometric operation processing on the structural mask image to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space, thereby solving the technical problem of poor accuracy in processing non-standard floor plans in related technologies.
[0026] In this application, a two-dimensional planar image of the target space containing structural and unstructured elements is acquired, and classification processing is performed on the image to separate the structural mask image corresponding to the structural elements, thereby effectively separating the structural elements from the background and unstructured elements. Then, geometric operations are performed on the structural mask image to transform the separated structural information into structured vector data that can be used for analysis. Through the above processing method, the problem of incomplete or broken structure extraction caused by image style, resolution and background noise interference in traditional image processing algorithms can be effectively overcome. The redundancy of vector data is reduced and unreasonable gaps are eliminated, thereby improving the structural integrity and geometric accuracy of the non-standard floor plan analysis results. This provides high-quality, editable and semantically clear structured data support for subsequent spatial layout analysis, 3D reconstruction and other tasks. Attached Figure Description
[0027] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0028] Figure 1 This is a hardware structure block diagram of a computer terminal provided according to Embodiment 1 of this application;
[0029] Figure 2 This is a flowchart of the image processing method provided according to Embodiment 1 of this application;
[0030] Figure 3 This is a schematic diagram of the image processing method provided in Embodiment 1 of this application. Figure 1 ;
[0031] Figure 4 This is a schematic diagram of the image processing method provided in Embodiment 1 of this application. Figure 2 ;
[0032] Figure 5 This is a schematic diagram of the image processing method provided in Embodiment 1 of this application. Figure 3 ;
[0033] Figure 6 This is a schematic diagram of the image processing method provided in Embodiment 1 of this application. Figure 4 ;
[0034] Figure 7 This is a schematic diagram of the image processing method provided in Embodiment 1 of this application. Figure 5 ;
[0035] Figure 8 This is a schematic diagram of the image processing method provided in Embodiment 1 of this application. Figure 6 ;
[0036] Figure 9 This is a schematic diagram of the image processing method provided in Embodiment 1 of this application. Figure 7 ;
[0037] Figure 10 This is a flowchart of the image processing method provided according to Embodiment 2 of this application;
[0038] Figure 11 This is a schematic diagram of an image processing apparatus provided according to Embodiment 3 of this application;
[0039] Figure 12 This is a structural block diagram of an electronic device provided according to Embodiment 4 of this application. Detailed Implementation
[0040] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0041] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0042] 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, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant regulations and standards of the relevant regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0043] Example 1
[0044] According to an embodiment of this application, an image processing method is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0045] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal (or mobile device) for implementing an image processing method is shown. Figure 1 As shown, the computer terminal (or mobile device) 10 may include a processor set 102 (the processor set 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, and the processor set 102 may include a processor set, Figure 1The data is illustrated using 102a, 102b, ..., 102n. A memory 104 is used for storing data, and a transmission module 106 is used for communication functions. In addition, it may include: a display, an input / output interface (I / O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0046] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0047] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the image processing method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the above-mentioned image processing method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0048] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0049] The display may be, for example, a touchscreen LCD display that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0050] Under the aforementioned operating environment, this application provides the following: Figure 2 The image processing method shown. Figure 2 This is a flowchart of an image processing method according to Embodiment 1 of this application. The image processing method includes:
[0051] Step S201: Obtain a two-dimensional planar image corresponding to the target space, wherein the two-dimensional planar image includes at least structural elements.
[0052] Optionally, a two-dimensional planar image of the target space to be parsed (such as a residence, office, or shop) can be received or acquired. For example, a two-dimensional planar image can be received or acquired through a preset image input interface. It should be noted that the two-dimensional planar image is not a standard computer-aided design (CAD) vector file (such as .dwg or .dxf format) and may include elements such as walls, doors, windows, dimension lines, text annotations, furniture symbols, and equipment symbols.
[0053] It should be noted that two-dimensional plan images are not limited to floor plans, but also applicable to any plan image that contains architectural structural elements.
[0054] In some embodiments, the acquired two-dimensional planar images may include, but are not limited to, the following sources and formats: photographs or scans of paper floor plans taken by a scanner or mobile phone camera, which may contain perspective distortion, uneven lighting, shadow interference, or blurring; and stylized floor plans generated from different decoration platforms or design tools, which may use non-standard line thicknesses, color fills, or symbols.
[0055] In some embodiments, a two-dimensional planar image may include two types of information: structural elements and unstructured elements. Structural elements refer to objects that need to be structured and analyzed, and may include walls (straight walls, sloping walls, curved walls), doors (hinged doors, sliding doors, etc.), and windows (fixed windows, operable windows, bay windows, etc.). Structural elements constitute the basic framework of the target space. Unstructured elements include text labels (such as "master bedroom", "bathroom", "dimensions", "area"), dimension lines, furniture symbols (such as beds, sofas, dining tables), equipment symbols (such as toilets, washbasins), legends, decorative textures, and blank areas or background noise at the edges of the image.
[0056] In some embodiments, after acquiring a two-dimensional planar image, the following preprocessing operations can be performed (depending on the specific implementation): images of different formats are uniformly converted to a standard RGB three-channel image format (such as JPEG or PNG), and a fixed resolution (e.g., 1024×1024 pixels) is set to adapt to subsequent processing. If a tilt in the shooting angle is detected, perspective transformation or affine transformation can be applied to correct the image, making it as close as possible to the front view and reducing the impact of geometric distortion on subsequent recognition. For noise generated by scanning or shooting, a lightweight denoising algorithm can be used for preliminary cleaning, but care should be taken to preserve line details and avoid excessive smoothing that would blur the edges of the wall.
[0057] Step S202: Classify the two-dimensional planar image to obtain the structural mask image corresponding to each structural element.
[0058] Optionally, a trained semantic-aware diffusion model can be used to process the input two-dimensional planar image. For example, the semantic-aware diffusion model takes the two-dimensional planar image as input and combines it with preset category constraints (such as walls, doors, windows, and background). Through a denoising generation process, it obtains the structural mask map corresponding to each structural element. For example, the semantic-aware diffusion model starts iterating from a purely noisy image. In each denoising step, the model gradually corrects the pixel values based on the features of the original input image and the preset category constraints. The prior knowledge learned by the model enables it to identify and erase non-structural elements such as text, furniture symbols, and dimension lines in the two-dimensional planar image, redrawing them as background colors or ignoring them. At the same time, the model infers missing or occluded wall lines based on context, strengthens the boundaries of doors and windows, generates continuous and smooth structural contours, and thus obtains the structural mask map corresponding to each structural element.
[0059] In some embodiments, the semantically aware diffusion model may consist of a backbone network (such as U-Net), an encoder / decoder structure, an attention mechanism, and conditional injection (such as injecting the original image into the denoising process through cross-attention).
[0060] In some embodiments, the two-dimensional planar image can also be classified using an image segmentation model. The preprocessed image is input into the segmentation model, and the model outputs a probability map of each pixel belonging to each category. For each pixel, the category with the highest probability is selected as its label. If a pixel has the highest probability of belonging to "wall," it is assigned to the wall mask. If a pixel has the highest probability of belonging to "door," it is assigned to the door mask. If a pixel has the highest probability of belonging to "window," it is assigned to the window mask. Other categories (such as furniture and text) are assigned to the background or ignored. Finally, based on the category decision results, a binarized structural mask map is generated.
[0061] It should be noted that structural mask images include, but are not limited to, binary images, grayscale masks, multi-channel probability maps, etc.
[0062] Step S203: Perform geometric operations on the structure mask to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space.
[0063] Optionally, differentiated geometric processing strategies can be applied to the structural mask generated in step S202. For example, multiple structural elements include walls, doors, and windows, and the corresponding structural mask can include wall mask, door mask, and window mask.
[0064] For wall processing, the focus is on topology preservation and contour simplification to retain complex shapes such as curved and sloping walls while eliminating pixel-level jagged edges. For door and window processing, the focus is on rectangle fitting and gap merging to correct edge irregularities caused by incomplete semantic classification and repair breaks between continuous window blocks. Global normalization may also be included: coordinate snapping and collinear point cleanup for all elements to ensure that the output vector data conforms to architectural drawing standards, facilitating subsequent spatial layout analysis. Through the above geometric operations, structured vector data is obtained, which can be output through a preset vector data output interface. It should be noted that the structured vector data can be in Extensible Vector Graphics (SVG) format or Extensible Markup Language (JSON) format. The structured vector data may include vector polygon representations corresponding to each structural element.
[0065] After obtaining the structured vector data, it can be directly called by spatial layout analysis algorithms, 3D reconstruction engines, or front-end rendering components to achieve efficient and accurate parsing of the target space.
[0066] In summary, by acquiring a two-dimensional planar image of the target space containing both structural and unstructured elements, and performing classification processing on this image to separate the structural mask images corresponding to the structural elements, the structural elements are effectively separated from the background and unstructured elements. Then, geometric operations are performed on the structural mask images to transform the separated structural information into structured vector data that can be used for analysis. This processing method effectively overcomes the problem of incomplete or broken structure extraction caused by image style, resolution, and background noise interference in traditional image processing algorithms. It reduces the redundancy of vector data, eliminates unreasonable gaps, and thus improves the structural integrity and geometric accuracy of non-standard floor plan analysis results. This provides high-quality, editable, and semantically clear structured data support for subsequent spatial layout analysis, 3D reconstruction, and other tasks.
[0067] To improve classification accuracy, the image processing method provided in Embodiment 1 of this application performs classification processing based on a two-dimensional planar image to obtain a structural mask image corresponding to each structural element. This includes: inputting the two-dimensional planar image into a semantic-aware diffusion model; processing the two-dimensional planar image under category constraints through the semantic-aware diffusion model to output a semantic coding map, wherein the semantic coding map distinguishes and marks various structural elements in the two-dimensional planar image using differential coding information; and performing classification processing on the semantic coding map to obtain a structural mask image.
[0068] Optionally, a two-dimensional planar image can be used as a conditional input to a trained semantic-aware diffusion model. Under predefined category logic constraints, the semantic-aware diffusion model reconstructs the image content through a denoising process. The semantic-aware diffusion model mainly suppresses unstructured elements (text, furniture, textures), strengthens and normalizes the features of structural elements (walls, doors, windows), and finally outputs a semantically encoded map.
[0069] It should be noted that semantic coding graphs use differential coding information to distinguish and label various structural elements within a two-dimensional planar image. For example, predefined differential color coding is used to differentiate different structural elements, such as... Figure 3 The semantic encoding diagram shown is illustrated. The wall is output as the first color, the door as the second color, the window as the third color, and the background as the fourth color. Specific colors can be configured; for example, the wall can be black, the door yellow, the window blue, and the background white.
[0070] In some embodiments, different structural elements can be distinguished by predefined differential grayscale levels: walls are mapped to grayscale value 0 (black), doors to grayscale value 128 (medium gray), windows to grayscale value 255 (white), and the background to grayscale value 64. This format typically occupies less storage space and facilitates rapid mask extraction via simple threshold classification. Alternatively, different structural elements can be distinguished by predefined index encoding to generate a single-channel image, where the value of each pixel represents its category ID. For example, the category IDs are defined as follows: 0 for background, 1 for wall, 2 for door, and 3 for window.
[0071] In some embodiments, the semantic encoding map can also be output as a multi-channel tensor, where each channel corresponds to a probability map or feature map of a specific structuring element category. For example, a 3-channel tensor can be output, where the first channel represents the confidence level of a wall, the second channel represents the confidence level of a door, and the third channel represents the confidence level of a window. This approach not only preserves category information but also the model's confidence distribution for each pixel belonging to that category. In subsequent processing, more refined mask generation can be performed based on confidence thresholds, or confidence information can be used to assist in geometric post-processing (e.g., edges of low-confidence regions can be subjected to more aggressive smoothing).
[0072] In some embodiments, the aforementioned color, grayscale values, or index values can also be dynamically configured according to requirements or model training objectives. By introducing a differential encoding mechanism (whether for color, grayscale, or index), this application transforms complex visual semantic information into a numerical representation that is easily processed by machines. This standardized intermediate representation not only masks the differences in style, lighting, and noise in the original image but also provides clear and unambiguous structural boundary criteria for subsequent steps, thereby helping to improve the accuracy and efficiency of the conversion from mask to vector data.
[0073] In some embodiments, the construction and training of the semantic-aware diffusion model includes: the training objective is to train the model to learn the mapping relationship from the original floor plan to the semantically encoded map. The training data includes: the original floor plan image containing various interfering elements (such as sofa icons, dimension labels, the text "master bedroom," and shadows), and the semantically encoded map either manually annotated or program-generated. In the semantically encoded map, all walls are uniformly rendered as black (RGB: 0,0,0), all doors as yellow (RGB: 255,255,0), all windows as blue (RGB: 0,0,255), and the background as white (RGB: 255,255,255).
[0074] During the inference phase, constraints are imposed using text prompts or class activation maps. For example, the input prompt might be: "A clean floor plan, black walls, yellow doors, blue windows, white background, no text, no furniture." During denoising, the model, based on these constraints, erases content that does not conform to semantic rules (e.g., treating text markers as noise and ignoring them, or completing wall lines that are obscured by text), thus obtaining a semantic encoding map.
[0075] After obtaining the semantic encoding map, the following steps can be performed to generate the structure mask map for each structural element: Since the diffusion model may generate slight color shifts (e.g., a wall might be generated as dark gray instead of pure black), precise color matching is not used directly. Instead, the Euclidean distance between each pixel and a preset target color (black, yellow, blue, white) is calculated. Pixels are assigned to the nearest color category, and finally, based on the corresponding color category, the structure mask map for each structural element is obtained. For example, as shown... Figure 4 As shown, from the semantic coding graph Figure 4 (a) Extract all pixels belonging to the "wall color" category, generate a binary image (walls are 1, others are 0), and obtain the wall mask image, as shown below. Figure 4 (b). From the semantic coding graph Figure 4 (a) Extract all pixels belonging to the "gate color" category to obtain the gate mask image, as shown below. Figure 4 (c). From the semantic coding graph Figure 4 (a) Extract all pixels belonging to the "window color" category to obtain the window mask image, as shown below. Figure 4 (d).
[0076] By introducing a semantic-aware diffusion model and imposing category constraints, the original floor plan containing complex interference elements such as text, furniture, and dimension lines can be transformed into a semantically encoded map that retains only structural elements such as walls, doors, and windows. The differentiated encoded information is used to achieve accurate separation of structural elements. Then, the semantically encoded map is classified to obtain a structural mask map. The strategy of decoupling semantic cleaning and geometric extraction helps to reduce the sensitivity of traditional image processing schemes to image style and reduce structural breaks or false detections caused by noise interference, thereby helping to improve the accuracy and robustness of subsequent geometric operations and spatial layout analysis.
[0077] To improve the quality of structured vector data, the image processing method provided in Embodiment 1 of this application performs geometric operations on a structure mask to obtain structured vector data, including: performing geometric operations on the structure mask to obtain an initial processed image corresponding to each structure element; performing a fusion operation on the initial processed images corresponding to multiple structure elements to obtain a fused processed image; and correcting the gaps between structure elements in the fused processed image to obtain structured vector data.
[0078] Optionally, for structural mask images of different structural types such as walls, doors, and windows, operations adapted to their geometric features are performed to generate initial processed images containing preliminary vector information. Then, the initial processed images of each structural element are spatially superimposed and merged to construct a complete spatial scene image containing all structural elements. For structural gaps existing in the merged scene (such as gaps between doors / windows and walls, and breaks between consecutive doors / windows), correction processing is performed, and finally, complete and closed structured vector data is output.
[0079] In some embodiments, performing operations to adapt to the geometric features of structural masks for different structural types such as walls, doors, and windows may include:
[0080] For wall mask images, since walls typically constitute closed or semi-closed boundaries of space and may contain curved, oblique, or other geometric shapes, morphological closing operations can be performed on the wall mask to fill in tiny holes or breaks within the wall caused by incomplete semantic classification. Then, through region growing or distance transformation algorithms, connected regions of walls with close spatial distances are merged to ensure that the same wall is a topologically unified whole. For curved walls, a standard circular arc is not forcibly fitted; instead, it is retained as a multi-segment polyline. By adjusting the approximation threshold, the curvature characteristics of the arc are preserved as much as possible while reducing the number of vertices, avoiding the distortion of spatial shape caused by simplifying curved walls to straight lines. If subsequent analysis requires the centerline information of the wall, the topological centerline of the wall can be extracted using a skeletonization algorithm after contour simplification, and the wall vector polygon can be reconstructed based on the centerline and wall width to ensure the uniformity of wall thickness.
[0081] For door / window masks, since doors and windows appear as slender, approximately rectangular structures, the door / window masks can be processed based on the minimum circumscribed rotating rectangle to obtain the initial processed image.
[0082] In some embodiments, the correction process for structural gaps in the fused scene may include: detecting the spatial relationship between the vector boundaries of doors and windows and the vector boundaries of walls. If it is found that doors and windows are embedded inside the wall but their boundaries do not completely overlap, or there are minor gaps, the boundary lines of the doors and windows are extended or trimmed towards the wall boundary to make them precisely fit the wall boundary. For example, the inner edge of the door is aligned with the inner edge of the wall opening to eliminate the visual break.
[0083] In some embodiments, the vertex coordinates of all structuring elements can be snapped to a preset geometric grid (such as integer pixel coordinates or a grid of a specific precision) to eliminate subpixel-level coordinate drift and detect and remove redundant vertices that are approximately collinear in the polygonal path, thus simplifying the data structure.
[0084] By performing operations on the structural mask maps of each structural element to adapt to its geometric features, the morphological characteristics of various elements can be initially regularized to generate an initial processing map containing preliminary vector information. Then, through spatial overlay and fusion operations, a complete scene is constructed. Combined with the correction processing of structural gaps, it helps to eliminate edge jaggedness, breaks, or incomplete closure caused by semantic classification errors. This helps to improve the geometric accuracy, topological integrity, and visual continuity of structured vector data, making it more suitable for subsequent spatial layout analysis or 3D reconstruction.
[0085] To improve the accuracy of geometric operations, in the image processing method provided in Embodiment 1 of this application, when the structural element is a first type of structural element, geometric operation processing is performed on the structural mask image, including: performing boundary contour processing on the structural mask image to obtain a two-dimensional coordinate point sequence; processing the two-dimensional coordinate point sequence based on a polygon approximation algorithm to obtain polygon contour information; and performing geometric processing on the polygon contour information to obtain an initial processed image corresponding to the first type of structural element.
[0086] Optionally, when the identified structural element belongs to the first category (such as a wall), the processing focuses on preserving the topological connectivity and complex geometric features of the wall (such as curved or sloping walls) while removing pixel noise. Specifically, this may include: performing binarization on the wall mask image and using a contour tracing algorithm to extract the boundary contours of the wall region. If the wall has openings (such as atrium or stairwell openings), the outer and inner contours can be extracted separately, and a parent-child relationship can be established through a hierarchical structure. The extracted boundaries are converted into an ordered sequence of two-dimensional coordinate points x1, y1), (x2, y2), ..., (xn, yn). Before extraction, morphological operations (such as opening operations) can be performed on the mask image to remove isolated noise points and avoid generating false micro-contour branches.
[0087] After obtaining the sequence of two-dimensional coordinate points, the sequence is processed using a polygon approximation algorithm. The polygon approximation algorithm starts by connecting the first and last points of the sequence and calculates the maximum perpendicular distance from the midpoint to this line. If the maximum distance is greater than a preset simplification threshold, the point is retained as a vertex, and the left and right subsequences are processed recursively; otherwise, the point is discarded, and it is considered to lie on a straight line.
[0088] In some embodiments, the simplification threshold can be dynamically adjusted based on the wall length or image resolution. Longer, straight walls can use a larger threshold to significantly reduce vertices, while shorter or curved walls use a smaller threshold to preserve detail. During simplification, line segments shorter than a preset minimum side length (e.g., 2 pixels) can also be ignored to prevent the creation of extremely small fragmented polygons.
[0089] After obtaining the polygon outline information, further geometric regularization can be performed to ensure data standardization and usability. For example, the coordinates of all vertices can be snapped to a preset mesh system (e.g., a 1mm or 1cm mesh). Another example is checking whether the generated polygon is closed. If the first and last vertices do not coincide, the first vertex is added as the final vertex to ensure the polygon is closed. If the wall is split into multiple disconnected segments, and the distance between the segments is less than a preset threshold, a geometric union operation is performed to merge them into a complete polygon.
[0090] In some embodiments, the wall may include straight walls, sloping walls, curved walls, and irregular walls. For the wall, it is not forced to fit as a rectangle or arc, but is represented by a polygon: first, the wall mask is converted into a basic geometric region, and then geometric union, topology preservation simplification, coordinate snapping, and collinear point deletion are performed to finally obtain the wall polygon (i.e., the initial processed image corresponding to the first type of structural element mentioned above).
[0091] In some embodiments, Figure 5 The vectorized results containing the curved wall are shown, in which, Figure 5 (a) is the image before vectorization. Figure 5 (b) is the image after vectorization. Figure 5 The central wall is black, the door is yellow, the window is blue, and the background is white. It can be seen that the curved wall is not simply straightened, but its curved outline is preserved in the form of multiple broken lines.
[0092] By processing the boundary contour of the structural mask to extract the sequence of two-dimensional coordinate points, and simplifying the coordinate sequence based on the polygon approximation algorithm to obtain polygon contour information, and then performing geometric processing to obtain the initial processed image, it is helpful to remove pixel-level noise and redundant vertices while retaining the main geometric features of the first type of structural elements such as walls (such as arc or oblique boundaries), thereby reducing the complexity of vector data and improving the standardization and topological stability of geometric representation.
[0093] To further improve the accuracy of the initial processed image, the image processing method provided in Embodiment 1 of this application performs geometric processing on the polygon contour information to obtain the initial processed image corresponding to the first type of structural element, including: performing geometric union processing on the polygon contour information to obtain merged polygon contour information; simplifying the merged polygon contour information while keeping the topology unchanged to obtain simplified polygon contour information; performing collinear point filtering processing on the simplified polygon contour information to obtain filtered polygon contour information; and performing coordinate snapping processing on the filtered polygon contour information to obtain the initial processed image.
[0094] Optionally, for first-class structural elements such as walls, after obtaining the polygon outline information, potentially broken or overlapping polygon outlines are merged into a single connected region, eliminating internal holes and fragments, to obtain merged polygon outline information. For example, a Boolean union operation can be performed on all extracted wall polygons using a geometry library.
[0095] Then, while maintaining the wall's topology (such as connectivity and the number of holes), the number of vertices is further reduced, and the edges are smoothed. For example, if removing a vertex causes the angle between two adjacent sides to change beyond a preset threshold (such as 5 degrees), the vertex is retained to ensure that the corner features are not overly smoothed. If the simplification operation causes the area of the holes inside the wall to change beyond a threshold or the holes to disappear, the simplification operation is rolled back, the original vertices are retained, and a polygon with a reduced number of vertices but a geometry and topology consistent with the original wall is obtained (i.e., the simplified polygon outline information mentioned above).
[0096] After obtaining the simplified polygon outline information, redundant vertices that are approximately collinear are identified and removed to make the wall edges more straight or smooth. This is the collinearity filtering process described above for the simplified polygon outline information. For example, the simplified polygon vertex sequence is traversed to perform three-point collinearity detection. If three adjacent vertices are found to be approximately collinear, and the side length of the newly formed side after removing the middle vertex is greater than a preset minimum side length threshold, then the middle vertex is removed, thereby further simplifying the polygon structure and obtaining the filtered polygon outline information.
[0097] Finally, the filtered polygon outline information undergoes coordinate snapping to eliminate coordinate drift caused by floating-point calculations or pixel quantization, ensuring that the wall coordinates conform to the accuracy standards of architectural drafting. For example, a preset snapping grid size (such as 1mm or 1cm) can be set to map the coordinate values of each vertex in the polygon to the nearest grid node, i.e., perform coordinate rounding. After snapping, it is also necessary to check for vertex overlap caused by snapping. If the distance between adjacent vertices is found to be less than a minimum threshold, redundant vertices are merged or removed, ultimately generating an initial processed image with regular vertex coordinates, smooth edges, and correct topology.
[0098] Through the cascaded processing of geometric union, topology preservation simplification, collinear point filtering, and coordinate snapping, the geometric distortion caused by pixel-level noise can be effectively suppressed, thereby improving the geometric accuracy and visual continuity of wall vector data.
[0099] To improve the accuracy of geometric operations, in the image processing method provided in Embodiment 1 of this application, when the structuring element is a second type of structuring element or a third type of structuring element, geometric operation processing is performed on the structuring mask image, including: performing connected component processing on the structuring mask image to obtain multiple connected components; calculating the rotational bounding rectangle and the first area value corresponding to the rotational bounding rectangle for each of the multiple connected components; determining the geometric representation information corresponding to each of the multiple connected components based on the first area value; and obtaining the initial processing image corresponding to the second type of structuring element or the third type of structuring element based on the geometric representation information.
[0100] Optionally, for elements such as doors (Category II) and windows (Category III), which are typically slender rectangular or approximately rectangular structures, the process of performing geometric operations on the structural mask image includes:
[0101] Binarize the gate mask or window mask. Identify all connected regions in the image using a connected component labeling algorithm. Calculate the area of each connected region. Set a minimum area threshold (e.g., less than 0.1% of the total image area or a fixed pixel value, such as 50 pixels). Remove connected regions with areas smaller than the threshold, treating them as noise or false positives, thus obtaining multiple connected regions.
[0102] For each preserved connected component, compute its minimum bounding rectangle. For example, by finding the rectangle with the smallest area that encloses the connected component, return the rectangle's center point (cx, cy), dimensions (width, height), and rotation angle θ. Calculate the area of this bounding rectangle, Srect = width × height, to obtain a first area value. Then, determine the geometric representation information based on the first area value.
[0103] In some embodiments, determining the geometric representation information corresponding to multiple connected components based on a first area value includes: calculating the actual pixel area value corresponding to each of the multiple connected components to obtain a second area value; if the ratio between the first area value and the second area value is greater than a first preset threshold, then using the rotated bounding rectangle as the geometric representation information of the corresponding connected component; if the ratio between the first area value and the second area value is less than or equal to the first preset threshold, then simplifying the contour of the connected component and using the simplified contour as the geometric representation information of the corresponding connected component.
[0104] Optionally, for each independent connected component obtained through connected component processing, the total number of pixels belonging to the target structural element (such as a door or window) within that region is counted, and this is used as the second area value. The first area value of the calculated rotating bounding rectangle is divided by the second area value to obtain the area ratio. This ratio is used to characterize how tightly the shape of the connected component fills the rotating bounding rectangle; the closer the ratio is to 1, the closer the shape is to a regular rectangle.
[0105] Set a first preset threshold to distinguish between regular and irregular structures. Based on the comparison between the area ratio and the first preset threshold, perform the following branch operations:
[0106] When the area ratio is greater than a first preset threshold, the connected component is determined to be a regular rectangular structure. In this case, the corresponding rotated bounding rectangle is directly used as its geometric representation information. The rotated bounding rectangle is defined by the center point coordinates, width, height, and rotation angle parameters. This processing method can eliminate the jagged noise of the original pixel edges and generate a smooth and compact vector boundary.
[0107] When the area ratio is less than or equal to a first preset threshold, the connected component is determined to be irregular in shape (such as irregularly shaped doors and windows). In this case, instead of using a rectangular representation, the original pixel boundaries of the connected component are extracted to obtain a discrete vertex sequence. Then, a polygon simplification algorithm (such as a distance threshold-based simplification algorithm) is performed on the vertex sequence to remove redundant vertices, retain the main geometric features, and finally, the simplified polygon contour is used as the geometric representation information of the connected component.
[0108] In some embodiments, the first preset threshold can be set to 0.85. If the actual pixel area of a gate's connected component is 900 pixels and its minimum circumscribed rectangle area is 1000 pixels, the calculated ratio is 0.9. Since 0.9 is greater than 0.85, the gate is determined to be a regular structure, and its circumscribed rectangle parameters (center coordinates, length, width, and angle) are directly output as geometric representation information. If the actual pixel area of a window's connected component is 600 pixels and its minimum circumscribed rectangle area is 1000 pixels, the calculated ratio is 0.6. Since 0.6 is less than or equal to 0.85, the window is determined to be an irregular structure. The contour vertices of the connected component are extracted, and after processing by a simplified algorithm, a set of ordered polygon vertex coordinates is output as geometric representation information, thereby accurately preserving the shape characteristics of the irregular window.
[0109] By following the steps above, we can adaptively select the appropriate geometric representation based on the actual shape characteristics of the structural elements, thereby optimizing the simplicity of vector data while ensuring geometric accuracy.
[0110] After determining the geometric representation information corresponding to multiple connected components, the initial processing graph corresponding to the second type of structural element, or the initial processing graph corresponding to the third type of structural element, is obtained based on the corresponding geometric representation information. It should be noted that if a rectangular representation is used, its center point and angle can be slightly regularized (e.g., angles can be snapped to multiples of 5 degrees; if close to orthogonal, orthogonality can be forced). If a polygonal representation is used, vertex coordinate snapping can be performed (as described above) to ensure coordinate accuracy.
[0111] In some embodiments, Figure 6 The images show the effects of geometric treatment on doors and windows before and after the process. Figure 6 (a) is the image before vectorization. Figure 6 (b) is the image after vectorization. Figure 6 The central wall is black, the door is yellow, the window is blue, and the background is white. After the geometric treatment of the door and window, the slanted door and window and the glass block are closer to regular rectangles, and the jagged edges are significantly reduced.
[0112] By calculating the circumscribed rectangle of the rotation, the geometric position and orientation of angled doors and windows can be accurately described, avoiding the errors and wasted space caused by using horizontal / vertical bounding boxes. Using a fill rate threshold, rectangular representations reduce data complexity and improve the efficiency of subsequent processing for regular doors and windows; for irregular cases, polygonal representations ensure shape accuracy. Connectivity filtering and area ratio judgment effectively remove noise and misclassified fragments, ensuring that the generated initial processed graph contains only true and valid structural elements, thus improving the reliability of the overall analytical results.
[0113] To further improve the quality of structured vector data, in the image processing method provided in Embodiment 1 of this application, the gaps between structural elements in the fused image are corrected to obtain structured vector data. This includes: filtering structural elements in the fused image to obtain multiple pairs of structural elements; determining whether the multiple pairs of structural elements meet preset merging conditions, wherein the merging conditions include at least one of the following: the directional angle between the pair of structural elements is less than a second preset threshold, the thickness difference between the pair of structural elements is less than a third preset threshold, and the endpoint spacing value of the pair of structural elements is less than a fourth preset threshold; if the merging conditions are met, the gaps between the pair of structural elements are corrected to obtain structured vector data.
[0114] Optionally, all doors and windows in the fused image are traversed, and each pair of adjacent or closely located structural elements is extracted to form a pair of structural elements to be detected. If there are many structural elements, spatial indexing or mesh generation methods can be used to filter out only pairs of structural elements that are spatially close, in order to reduce unnecessary calculations. Structural element pairs can be doors and doors, windows and windows, or combinations of doors and windows.
[0115] For each pair of structural elements, calculate its geometric characteristic parameters and determine whether it meets the preset merging conditions. The merging conditions include at least one of the following:
[0116] Orientation Consistency: Calculate the major axis direction vector of the pair of structural elements and the angle between the two vectors. If the angle is less than a second preset threshold (e.g., 15 degrees), the two structural elements are considered to have similar or parallel directions.
[0117] Thickness consistency: Calculate the width or height (i.e., the dimension perpendicular to the major axis) of the pair of structural elements. If the thickness difference between the two structural elements is less than a third preset threshold (e.g., 2 pixels or a fixed value determined according to the image resolution), the two structural elements are considered to have similar thicknesses.
[0118] Spacing proximity: Calculate the distance between the nearest endpoints of the pair of structural elements, or calculate the length of the overlap of the smallest bounding box containing the two structural elements in the direction perpendicular to the major axis. If the endpoint spacing value is less than a fourth preset threshold (e.g., 5 pixels), the two structural elements are considered to be spatially adjacent and may belong to the same continuous structure.
[0119] If there are structural element pairs that meet the above merging conditions, it is determined that there is an unreasonable gap between them, and correction processing is required.
[0120] In some embodiments, the correction process may include an extension operation: for example, extending the shorter structuring element along its major axis until its endpoint coincides with or overlaps the endpoint of another structuring element in the vertical projection direction. It may also include a merge operation: merging the geometric representations of two structuring elements into a single entity. For structuring elements expressed as rectangles, the boundary of the merged new rectangle is determined by the union of the two original rectangles; for structuring elements expressed as polygons, the vertex sequences of the two polygons are merged and topologically simplified again, removing internal overlaps. For example, a merge operation can be used if the pair of structuring elements are of the same type, while an extension operation is used if the pair of structuring elements are not of the same type.
[0121] In some embodiments, the second preset threshold can be set to 15 degrees, the third preset threshold can be set to 2 pixels, and the fourth preset threshold can be set to 5 pixels.
[0122] In some embodiments, Figure 7 The image shows the effect before and after merging the gaps between adjacent doors and windows. Figure 7 (a) is the image before vectorization. Figure 7 (b) is the image after vectorization. Figure 7 With the central wall in black, the door in yellow, the window in blue, and the background in white, the optimization reduces small gaps in window blocks, glass segments, and near doors and windows, resulting in better visual continuity of SVG (Scalable Vector Graphics).
[0123] By following the steps described above, minute gaps caused by semantic classification errors or pixel quantization can be eliminated, ensuring the continuity and integrity of the door and window structure at the vector level, thereby improving the accuracy of subsequent 3D reconstruction or spatial analysis.
[0124] In some embodiments, an illustration of image processing is shown as follows Figure 8 As shown, a standard floor plan is input, and a semantic color-coded map is obtained through a trained diffusion-based image editing model. The semantic color-coded map is then classified by color to obtain wall masks, door masks, and window masks. Noise cleanup, connected component analysis, and geometric regularization are performed on each type of mask. For example, for the wall mask: wall polygonization and topology simplification are performed; for the door mask: connected component analysis and rotating rectangle fitting are performed on the door region; for the window mask: connected component analysis and rotating rectangle fitting are performed. Rotating rectangle fitting and gap merging are performed on the door and window regions, and further coordinate snapping, collinear point removal, and geometric regularization are performed to output SVG / JSON / structured floor plan data. In some embodiments, an SVG example is provided.
[0125] “ <svg> <path class="wall" ... / > <path class="door" ... / > <pathclass="window" ... / >< / svg>
[0126] JSON example:
[0127] { "canvas": {"width": 1024, "height": 1024}, "objects": [ {"type": "wall", "vertices": [[...], ...]}, {"type": "door", "vertices":[[...], ...]}, {"type": "window", "vertices": [[...], ...]} ]}
[0128] {
[0129] "canvas": {"width": 1024, "height": 1024},
[0130] "objects": [
[0131] {"type": "wall", "vertices": [[...], ...]},
[0132] {"type": "door", "vertices": [[...], ...]},
[0133] {"type": "window", "vertices": [[...], ...]} ]
[0135] }
[0136] {
[0137] "canvas": {"width": 1024, "height": 1024},
[0138] "objects": [
[0139] {"type": "wall", "vertices": [[...], ...]},
[0140] {"type": "door", "vertices": [[...], ...]},
[0141] {"type": "window", "vertices": [[...], ...]} ]
[0143] }”。
[0144] In some embodiments, the floor plan can be processed using an image processing system, such as... Figure 9 As shown, the image processing system includes: an image input module, a diffusion-based semantic editing module, a semantic color-coded map generation module, a mask classification module, a wall geometry processing module, a door and window geometry processing module, a vector normalization module, and an SVG / JSON output module. The image input module receives original floor plans uploaded by the user or imported by the system. The diffusion-based semantic editing module and the semantic color-coded map generation module process the original floor plans to obtain semantic color-coded maps. The mask classification module, based on the semantic color-coded maps, separates independent masks for different structural elements. The wall geometry processing module performs geometric operations on the wall masks to generate vector polygon representations of the walls. The door and window geometry processing module performs geometric operations on the door and window masks to generate vector polygon representations of the doors and windows. The vector normalization module and the SVG / JSON output module uniformly normalize the vector data of the walls and doors / windows and convert them into a standard output format.
[0145] In the image processing method provided in Embodiment 1 of this application, a two-dimensional planar image corresponding to the target space is obtained, wherein the two-dimensional planar image includes at least structural elements; classification processing is performed based on the two-dimensional planar image to obtain a structural mask image corresponding to each structural element; geometric operation processing is performed on the structural mask image to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space, thereby solving the technical problem of poor accuracy in processing non-standard floor plans in related technologies.
[0146] In this application, a two-dimensional planar image of the target space containing structural and unstructured elements is acquired, and classification processing is performed on the image to separate the structural mask image corresponding to the structural elements, thereby effectively separating the structural elements from the background and unstructured elements. Then, geometric operations are performed on the structural mask image to transform the separated structural information into structured vector data that can be used for analysis. Through the above processing method, the problem of incomplete or broken structure extraction caused by image style, resolution and background noise interference in traditional image processing algorithms can be effectively overcome. The redundancy of vector data is reduced and unreasonable gaps are eliminated, thereby improving the structural integrity and geometric accuracy of the non-standard floor plan analysis results. This provides high-quality, editable and semantically clear structured data support for subsequent spatial layout analysis, 3D reconstruction and other tasks.
[0147] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0148] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0149] Example 2
[0150] According to embodiments of this application, an image processing method is also provided, such as... Figure 10 As shown, the image processing method includes:
[0151] Step S1001: Obtain the two-dimensional planar image corresponding to the target space uploaded by the client, wherein the two-dimensional planar image includes at least structural elements;
[0152] Step S1002: Classify the two-dimensional planar image in the cloud server to obtain the structural mask image corresponding to each structural element; perform geometric operations on the structural mask image to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space;
[0153] Step S1003: Return the structured vector data to the client.
[0154] It should be noted that the specific image processing steps in the cloud server are the same as in Example 1, and will not be repeated here.
[0155] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0156] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0157] Example 3
[0158] According to embodiments of this application, an image processing apparatus for implementing the above-described image processing method is also provided, such as... Figure 11 As shown, the device includes: an acquisition unit 1101, a first processing unit 1102, and a second processing unit 1103.
[0159] The acquisition unit 1101 is used to acquire a two-dimensional planar image corresponding to the target space, wherein the two-dimensional planar image includes at least a structural element;
[0160] The first processing unit 1102 is used to perform classification processing based on a two-dimensional planar image to obtain a structural mask image corresponding to each structural element.
[0161] The second processing unit 1103 is used to perform geometric operations on the structure mask to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space.
[0162] In the image processing apparatus provided in Embodiment 3 of this application, the acquisition unit 1101 acquires a two-dimensional planar image corresponding to the target space, wherein the two-dimensional planar image includes at least structural elements; the first processing unit 1102 performs classification processing based on the two-dimensional planar image to obtain a structural mask image corresponding to each structural element; the second processing unit 1103 performs geometric operation processing on the structural mask image to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space, thereby solving the technical problem of poor accuracy in processing non-standard floor plans in related technologies.
[0163] In this application, a two-dimensional planar image of the target space containing structural and unstructured elements is acquired, and classification processing is performed on the image to separate the structural mask image corresponding to the structural elements, thereby effectively separating the structural elements from the background and unstructured elements. Then, geometric operations are performed on the structural mask image to transform the separated structural information into structured vector data that can be used for analysis. Through the above processing method, the problem of incomplete or broken structure extraction caused by image style, resolution and background noise interference in traditional image processing algorithms can be effectively overcome. The redundancy of vector data is reduced and unreasonable gaps are eliminated, thereby improving the structural integrity and geometric accuracy of the non-standard floor plan analysis results. This provides high-quality, editable and semantically clear structured data support for subsequent spatial layout analysis, 3D reconstruction and other tasks.
[0164] Optionally, in the image processing apparatus provided in Embodiment 3 of this application, the first processing unit includes: an input subunit for inputting a two-dimensional planar image into a semantic-aware diffusion model; a first processing subunit for processing the two-dimensional planar image under category constraints through the semantic-aware diffusion model and outputting a semantic coding map, wherein the semantic coding map distinguishes and marks various structural elements in the two-dimensional planar image by means of differential coding information; and a second processing subunit for classifying the semantic coding map to obtain a structural mask map.
[0165] Optionally, in the image processing apparatus provided in Embodiment 3 of this application, the second processing unit includes: a third processing subunit, used to perform geometric operation processing on the structure mask to obtain an initial processing image corresponding to each structure element; a fusion subunit, used to perform a fusion operation on the initial processing images corresponding to multiple structure elements to obtain a fused processing image; and a correction subunit, used to correct the gaps between structure elements in the fused processing image to obtain structured vector data.
[0166] Optionally, in the image processing apparatus provided in Embodiment 3 of this application, when the structural element is a first type of structural element, the third processing subunit includes: a first processing module for performing boundary contour processing on the structural mask image to obtain a two-dimensional coordinate point sequence; a second processing module for processing the two-dimensional coordinate point sequence based on a polygon approximation algorithm to obtain polygon contour information; and a third processing module for performing geometric processing on the polygon contour information to obtain an initial processed image corresponding to the first type of structural element.
[0167] Optionally, in the image processing apparatus provided in Embodiment 3 of this application, the first processing module includes: a first processing submodule, used to perform geometric union processing on the polygon contour information to obtain merged polygon contour information; a simplification submodule, used to simplify the merged polygon contour information while keeping the topology unchanged to obtain simplified polygon contour information; a filtering submodule, used to perform collinear point filtering processing on the simplified polygon contour information to obtain filtered polygon contour information; and a second processing submodule, used to perform coordinate snapping processing on the filtered polygon contour information to obtain an initial processed image.
[0168] Optionally, in the image processing apparatus provided in Embodiment 3 of this application, when the structural element is a second type of structural element or a third type of structural element, the third processing subunit includes: a third processing submodule, used to perform connected component processing on the structural mask image to obtain multiple connected components; a calculation submodule, used to calculate the rotational bounding rectangle and the first area value corresponding to the rotational bounding rectangle respectively for the multiple connected components; a first determining submodule, used to determine the geometric representation information corresponding to the multiple connected components based on the first area value; and a second determining submodule, used to obtain the initial processing image corresponding to the second type of structural element or the initial processing image corresponding to the third type of structural element based on the geometric representation information.
[0169] Optionally, in the image processing apparatus provided in Embodiment 3 of this application, the first determining submodule includes: a calculation submodule, used to calculate the actual pixel area values corresponding to multiple connected components respectively to obtain a second area value; a determining submodule, used to use the rotated circumscribed rectangle as the geometric representation information of the corresponding connected component if the ratio between the first area value and the second area value is greater than a first preset threshold; and a simplification submodule, used to simplify the contour of the connected component if the ratio between the first area value and the second area value is less than or equal to the first preset threshold, and use the simplified contour as the geometric representation information of the corresponding connected component.
[0170] Optionally, in the image processing apparatus provided in Embodiment 3 of this application, the correction subunit includes: a filtering module for filtering structural elements in the fused image to obtain multiple pairs of structural elements; a judgment module for judging whether the multiple pairs of structural elements meet preset merging conditions, wherein the merging conditions include at least one of the following: the directional angle between the pairs of structural elements is less than a second preset threshold, the thickness difference between the pairs of structural elements is less than a third preset threshold, and the endpoint spacing value of the pairs of structural elements is less than a fourth preset threshold; and a correction module for correcting the gap between the pairs of structural elements when the merging conditions are met, so as to obtain structured vector data.
[0171] It should be noted that the acquisition unit 1101, the first processing unit 1102, and the second processing unit 1103 mentioned above correspond to steps S201 to S203 in Embodiment 1. The three units and their corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above units, as part of the device, can run in the computer terminal 10 provided in Embodiment 1.
[0172] It should be noted that the preferred implementation schemes involved in the above embodiments of this application are the same as the schemes, application scenarios and implementation processes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0173] Example 4
[0174] Embodiments of this application may provide an electronic device, which may be any one of a group of electronic device terminals. Optionally, in this embodiment, the aforementioned electronic device may also be replaced by a terminal device such as a mobile terminal.
[0175] Optionally, in this embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.
[0176] In this embodiment, the above-mentioned electronic device can execute the program code of the following steps in the image processing method: acquiring a two-dimensional planar image corresponding to the target space, wherein the two-dimensional planar image includes at least structural elements; performing classification processing based on the two-dimensional planar image to obtain a structural mask image corresponding to each structural element; performing geometric operation processing on the structural mask image to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space.
[0177] The aforementioned electronic device can execute the following steps in the image processing method: performing classification processing based on a two-dimensional planar image to obtain a structural mask map corresponding to each structural element, including: inputting the two-dimensional planar image into a semantic-aware diffusion model; processing the two-dimensional planar image under category constraints through the semantic-aware diffusion model to output a semantic coding map, wherein the semantic coding map distinguishes and marks various structural elements in the two-dimensional planar image by means of differential coding information; and performing classification processing on the semantic coding map to obtain a structural mask map.
[0178] The aforementioned electronic device can execute program code for the following steps in the image processing method: performing geometric operations on a structural mask to obtain structured vector data, including: performing geometric operations on the structural mask to obtain an initial processed image corresponding to each structural element; performing a fusion operation on the initial processed images corresponding to multiple structural elements to obtain a fused processed image; and correcting the gaps between structural elements in the fused processed image to obtain structured vector data.
[0179] The aforementioned electronic device can execute the following steps in the image processing method: when the structural element is a first type of structural element, perform geometric operations on the structural mask image, including: performing boundary contour processing on the structural mask image to obtain a two-dimensional coordinate point sequence; processing the two-dimensional coordinate point sequence based on a polygon approximation algorithm to obtain polygon contour information; and performing geometric processing on the polygon contour information to obtain an initial processed image corresponding to the first type of structural element.
[0180] The aforementioned electronic device can execute the program code for the following steps in the image processing method: performing geometric processing on polygon contour information to obtain an initial processed image corresponding to the first type of structural element, including: performing geometric union processing on the polygon contour information to obtain merged polygon contour information; simplifying the merged polygon contour information while keeping the topology unchanged to obtain simplified polygon contour information; performing collinear point filtering processing on the simplified polygon contour information to obtain filtered polygon contour information; and performing coordinate snapping processing on the filtered polygon contour information to obtain the initial processed image.
[0181] The aforementioned electronic device can execute the following steps in the image processing method: when the structural element is a second type of structural element or a third type of structural element, perform geometric operations on the structural mask image, including: performing connected component processing on the structural mask image to obtain multiple connected components; calculating the rotational bounding rectangle and the first area value corresponding to the rotational bounding rectangle for each of the multiple connected components; determining the geometric representation information corresponding to each of the multiple connected components based on the first area value; and obtaining the initial processing image corresponding to the second type of structural element or the third type of structural element based on the geometric representation information.
[0182] The aforementioned electronic device can execute the following steps in the image processing method: determining the geometric representation information corresponding to multiple connected components based on a first area value, including: calculating the actual pixel area value corresponding to each of the multiple connected components to obtain a second area value; if the ratio between the first area value and the second area value is greater than a first preset threshold, then using the rotated bounding rectangle as the geometric representation information of the corresponding connected component; if the ratio between the first area value and the second area value is less than or equal to the first preset threshold, then simplifying the contour of the connected component and using the simplified contour as the geometric representation information of the corresponding connected component.
[0183] The aforementioned electronic device can execute the program code for the following steps in the image processing method: correcting the gaps between structural elements in the fused image to obtain structured vector data, including: filtering structural elements in the fused image to obtain multiple pairs of structural elements; determining whether the multiple pairs of structural elements meet preset merging conditions, wherein the merging conditions include at least one of the following: the directional angle between the pair of structural elements is less than a second preset threshold, the thickness difference between the pair of structural elements is less than a third preset threshold, and the endpoint spacing value of the pair of structural elements is less than a fourth preset threshold; if the merging conditions are met, correcting the gaps between the pair of structural elements to obtain structured vector data.
[0184] Optionally, Figure 12 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 12 As shown, the electronic device may include: one or more ( Figure 12 (Only one is shown in the image) Processor 1202 and memory 1204. The electronic device may also include a memory controller to control and manage the memory 1204; the electronic device may also include a peripheral interface to connect to a radio frequency module, an audio module, and a display screen, etc.
[0185] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the image processing method and apparatus in this application embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby realizing the aforementioned image processing method. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to electronic devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0186] The processor can invoke information and application programs stored in the memory through the transmission device to perform the following steps: acquiring a two-dimensional planar image corresponding to the target space, wherein the two-dimensional planar image includes at least structural elements; performing classification processing based on the two-dimensional planar image to obtain a structural mask image corresponding to each structural element; performing geometric operations on the structural mask image to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space.
[0187] Optionally, the processor may also execute program code for the following steps: performing classification processing based on a two-dimensional planar image to obtain a structural mask map corresponding to each structural element, including: inputting the two-dimensional planar image into a semantic-aware diffusion model; processing the two-dimensional planar image under category constraints through the semantic-aware diffusion model to output a semantic coding map, wherein the semantic coding map distinguishes and marks various structural elements in the two-dimensional planar image by means of differential coding information; and performing classification processing on the semantic coding map to obtain a structural mask map.
[0188] Optionally, the processor may also execute program code for the following steps: performing geometric operations on the structure mask to obtain structured vector data, including: performing geometric operations on the structure mask to obtain an initial processed image corresponding to each structure element; performing a fusion operation on the initial processed images corresponding to multiple structure elements to obtain a fused processed image; and correcting the gaps between structure elements in the fused processed image to obtain structured vector data.
[0189] Optionally, the processor may also execute program code with the following steps: when the structural element is a first type of structural element, perform geometric operations on the structural mask image, including: performing boundary contour processing on the structural mask image to obtain a two-dimensional coordinate point sequence; processing the two-dimensional coordinate point sequence based on a polygon approximation algorithm to obtain polygon contour information; and performing geometric processing on the polygon contour information to obtain an initial processed image corresponding to the first type of structural element.
[0190] Optionally, the processor may also execute program code for the following steps: performing geometric processing on the polygon contour information to obtain an initial processed image corresponding to the first type of structural element, including: performing geometric union processing on the polygon contour information to obtain merged polygon contour information; simplifying the merged polygon contour information while keeping the topology unchanged to obtain simplified polygon contour information; performing collinear point filtering processing on the simplified polygon contour information to obtain filtered polygon contour information; and performing coordinate snapping processing on the filtered polygon contour information to obtain the initial processed image.
[0191] Optionally, the processor may also execute program code with the following steps: when the structuring element is a second type of structuring element or a third type of structuring element, perform geometric operations on the structuring mask, including: performing connected component processing on the structuring mask to obtain multiple connected components; calculating the first area value corresponding to the rotated bounding rectangle and the first area value corresponding to the rotated bounding rectangle for each of the multiple connected components; determining the geometric representation information corresponding to each of the multiple connected components based on the first area value; and obtaining the initial processing map corresponding to the second type of structuring element or the third type of structuring element based on the geometric representation information.
[0192] Optionally, the processor may also execute program code with the following steps: determining the geometric representation information corresponding to multiple connected components based on the first area value, including: calculating the actual pixel area value corresponding to each of the multiple connected components to obtain a second area value; if the ratio between the first area value and the second area value is greater than a first preset threshold, then using the rotated bounding rectangle as the geometric representation information of the corresponding connected component; if the ratio between the first area value and the second area value is less than or equal to the first preset threshold, then simplifying the contour of the connected component and using the simplified contour as the geometric representation information of the corresponding connected component.
[0193] Optionally, the processor may also execute program code for the following steps: correcting the gaps between structural elements in the fusion processing image to obtain structured vector data, including: filtering structural elements in the fusion processing image to obtain multiple pairs of structural elements; determining whether the multiple pairs of structural elements meet preset merging conditions, wherein the merging conditions include at least one of the following: the directional angle between the pair of structural elements is less than a second preset threshold, the thickness difference between the pair of structural elements is less than a third preset threshold, and the endpoint spacing value of the pair of structural elements is less than a fourth preset threshold; if the merging conditions are met, correcting the gaps between the pair of structural elements to obtain structured vector data.
[0194] Those skilled in the art will understand that Figure 12 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 12 This does not limit the structure of the aforementioned electronic device. For example, electronic device 20 may also include components that are more... Figure 12 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 12 The different configurations shown.
[0195] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0196] Example 5
[0197] Embodiments of this application also provide a computer program product. Optionally, in this embodiment, the computer program product can be used to store the program code executed by the image processing method provided in Embodiment 1.
[0198] Optionally, in this embodiment, the computer program product may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0199] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0200] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0201] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0202] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0203] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0204] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0205] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. An image processing method, characterized in that, include: Obtain a two-dimensional planar image corresponding to the target space, wherein the two-dimensional planar image includes at least structural elements; Based on the two-dimensional planar image, classification processing is performed to obtain the structural mask image corresponding to each structural element; Geometric operations are performed on the structure mask to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space.
2. The method according to claim 1, characterized in that, Based on the two-dimensional planar image, classification processing is performed to obtain the structural mask image corresponding to each structural element, including: The two-dimensional planar image is input into the semantic-aware diffusion model; The semantic perception diffusion model is used to process the two-dimensional planar image under category constraints and output a semantic coding map. The semantic coding map distinguishes and marks various structural elements in the two-dimensional planar image by means of differential coding information. The semantic coding graph is classified to obtain the structural mask graph.
3. The method according to claim 1, characterized in that, Geometric operations are performed on the structure mask to obtain structured vector data, including: Perform geometric operations on the structure mask to obtain the initial processed image corresponding to each structural element; A fusion operation is performed on the initial processing graphs corresponding to multiple structural elements to obtain a fused processing graph. The gaps between structural elements in the fusion processing diagram are corrected to obtain the structured vector data.
4. The method according to claim 3, characterized in that, When the structuring element is a first-class structuring element, geometric operations are performed on the structuring mask image, including: The structure mask image is subjected to boundary contour processing to obtain a two-dimensional coordinate point sequence; The two-dimensional coordinate point sequence is processed based on a polygon approximation algorithm to obtain polygon contour information; The polygon contour information is geometrically processed to obtain the initial processed image corresponding to the first type of structural element.
5. The method according to claim 4, characterized in that, Geometric processing is performed on the polygon contour information to obtain the initial processed image corresponding to the first type of structural element, including: The polygon outline information is subjected to geometric union processing to obtain the merged polygon outline information; While keeping the topology unchanged, the merged polygon outline information is simplified to obtain simplified polygon outline information. The simplified polygon outline information is subjected to collinearity point filtering to obtain the filtered polygon outline information. The selected polygonal contour information is subjected to coordinate snapping processing to obtain the initial processed image.
6. The method according to claim 3, characterized in that, When the structural element is a second-type structural element or a third-type structural element, geometric operations are performed on the structural mask image, including: The structure mask image is processed to obtain multiple connected components; Calculate the rotated bounding rectangle corresponding to each of the plurality of connected components and the first area value corresponding to the rotated bounding rectangle; Based on the first area value, determine the geometric representation information corresponding to each of the plurality of connected components; Based on the geometric representation information, an initial processing diagram corresponding to the second type of structural element or an initial processing diagram corresponding to the third type of structural element is obtained.
7. The method according to claim 6, characterized in that, Based on the first area value, determine the geometric representation information corresponding to each of the plurality of connected components, including: Calculate the actual pixel area value corresponding to each of the multiple connected components to obtain the second area value; If the ratio between the first area value and the second area value is greater than the first preset threshold, then the rotated circumscribed rectangle is used as the geometric representation information of the corresponding connected component. If the ratio between the first area value and the second area value is less than or equal to the first preset threshold, the contour of the connected region is simplified, and the simplified contour is used as the geometric representation information of the corresponding connected region.
8. The method according to claim 3, characterized in that, The gaps between structural elements in the fusion processing diagram are corrected to obtain the structured vector data, including: The structural elements in the fusion processing diagram are filtered to obtain multiple pairs of structural elements; Determine whether the multiple pairs of structural elements meet the preset merging conditions, wherein the merging conditions include at least one of the following: the directional angle between the pair of structural elements is less than a second preset threshold, the thickness difference between the pair of structural elements is less than a third preset threshold, and the endpoint spacing value of the pair of structural elements is less than a fourth preset threshold. If the merging conditions are met, the gap between the pair of structural elements is corrected to obtain the structured vector data.
9. An image processing method, characterized in that, include: Obtain a two-dimensional planar image corresponding to the target space uploaded by the client, wherein the two-dimensional planar image includes at least structural elements; The two-dimensional planar image is classified and processed in the cloud server to obtain a structural mask image corresponding to each structural element; geometric operations are performed on the structural mask image to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space; The structured vector data is returned to the client.
10. An image processing apparatus, characterized in that, include: An acquisition unit is used to acquire a two-dimensional planar image corresponding to a target space, wherein the two-dimensional planar image includes at least structural elements; The first processing unit is used to perform classification processing based on the two-dimensional planar image to obtain the structural mask image corresponding to each structural element. The second processing unit is used to perform geometric operations on the structure mask to obtain structured vector data, wherein the structured vector data is used at least for spatial layout analysis of the target space.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the storage medium is located to perform the image processing method according to any one of claims 1 to 9.
12. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, performs the image processing method according to any one of claims 1 to 9.
13. A computer program product, characterized in that, It includes a computer program or instructions that, when executed by a processor, implement the image processing method according to any one of claims 1 to 9.
