A building space partitioning method and system based on the largest inscribed rectangle
By acquiring marked text points from architectural space images, establishing horizontal and vertical scales to divide the grid and combining rectangles, and combining OCR models to handle overlapping cases, the problem of slow calculation speed and non-compliance with building codes in existing technologies is solved, achieving efficient and accurate architectural space segmentation and model reconstruction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI BANGTU INFORMATION TECH CO LTD
- Filing Date
- 2023-09-22
- Publication Date
- 2026-05-12
AI Technical Summary
Existing methods for finding the maximum inscribed rectangle are slow to compute, making it difficult to meet the needs of spatial division based on text in residential buildings, and also difficult to meet the standardization requirements for architectural space segmentation.
By acquiring marked text points in architectural space images, a grid area is divided using horizontal and vertical scales. Grid points are randomly combined to form rectangles, and background features are filtered out. The combined rectangle with the largest area is selected as the largest inscribed rectangle. Combined with an OCR model, different overlapping cases are handled to achieve accurate segmentation of marked text points.
It achieves efficient computational segmentation of building space, meets building codes, is suitable for accurate segmentation of various marked text points, and supports 2D image restoration and 3D model reconstruction.
Smart Images

Figure CN117291931B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method and system for architectural space segmentation based on the maximum inscribed rectangle. Background Technology
[0002] In CAD images of architectural spaces, different text labels are generally used in spaces of different types and locations. Abstract architectural space segmentation can be visualized as an image processing problem of finding the largest inscribed rectangle in the space. However, for architectural spaces containing multiple text labels, the spatial segmentation needs to meet the condition that the spatial divisions do not overlap and conform to the artificial division criteria of standardized architecture.
[0003] In existing technologies, most methods for finding the maximum inscribed rectangle involve: finding spatial contour points, arbitrarily selecting two contour points for pairing, and iterating through them sequentially. The rectangle with the largest area among the resulting rectangles is then selected as the maximum inscribed rectangle. This method is not only slow in computation but also difficult to meet the needs of residential buildings where spatial division based on text is required. Summary of the Invention
[0004] This invention provides a method and system for architectural space segmentation based on the maximum inscribed rectangle, which concretizes the abstract problem of space division and solves the problem of segmenting architectural space in various cases of labeled text points while conforming to architectural professional specifications.
[0005] To address the aforementioned technical problems, this invention provides a method for dividing architectural space based on the maximum inscribed rectangle, comprising:
[0006] Obtain the architectural space image to be segmented, and read the number of marked text points in the architectural space image to be segmented;
[0007] The maximum inscribed rectangle of the building space image to be segmented is obtained by solving the maximum inscribed rectangle of the marked text points;
[0008] For architectural space images to be segmented with different numbers of marked text points, different processing is applied to the maximum inscribed rectangle of each marked text point to obtain spatial segmentation results, and the architectural space segmentation image is output.
[0009] This invention provides a multi-space partitioning method based on the maximum inscribed rectangle, concretizing the abstract spatial partitioning problem into a practical image processing problem. It reads the marked text points from the architectural space image and calculates the maximum inscribed rectangle of the space containing each text point. Appropriate processing is performed according to different marked text point scenarios to obtain the spatial segmentation result, achieving accurate and standardized partitioning of architectural spaces containing only one or multiple marked text points.
[0010] Furthermore, the step of acquiring the architectural space image to be segmented and reading the number of marked text points in the architectural space image to be segmented specifically involves:
[0011] The architectural space mask image is generated by converting user-input architectural space images and marked text points through a program.
[0012] The generated architectural space mask image is used as the architectural space image to be segmented, and the number of user-inputted marker text points is used as the number of marker text points in the architectural space image to be segmented.
[0013] Furthermore, the step of solving for the maximum inscribed rectangle of the building space image to be segmented based on the marked text points, and obtaining the maximum inscribed rectangle of the marked text points, specifically involves:
[0014] Find all grid points within the building space image to be segmented. Based on any grid point, use the horizontal coordinate as the horizontal scale and the vertical coordinate as the vertical scale.
[0015] Based on the marked text points, the text area is divided into four regions: top left, top right, bottom left, and bottom right, according to the horizontal and vertical rulers.
[0016] For the grid points in the upper left and lower right text regions, deduplication and background point removal are performed to obtain a set LU consisting of N processed grid points in the upper left text region and a set RD consisting of M processed grid points in the lower right text region.
[0017] Randomly select any grid point in set LU and any grid point in set RD, and combine them in pairs to obtain a combined rectangle;
[0018] For the resulting composite rectangles, filter out the rectangles with background features to obtain composite rectangles without background.
[0019] Select the largest background-free rectangle as the largest inscribed rectangle for marking text points.
[0020] This invention presents a method for finding the maximum inscribed rectangle based on marked text points. The method involves dividing the grid region using horizontal and vertical scales, then randomly pairing grid points within the selected region to obtain combined rectangles. Rectangles containing background features are then filtered out. Finally, the combined rectangle with the largest area is the desired maximum inscribed rectangle. This method offers high computational speed and meets the requirements for finding the maximum inscribed rectangle of marked text points in architectural spaces.
[0021] Furthermore, for architectural space images to be segmented with different numbers of marked text points, different processing is applied to the largest inscribed rectangle of each marked text point to obtain spatial segmentation results, and an architectural space segmentation image is output, specifically as follows:
[0022] For a building space image to be segmented containing only a single labeled text point, the building space segmentation result is the largest inscribed rectangle of that labeled text point, and the building space segmentation image is output.
[0023] For a building space image to be segmented containing two or more marked text points, the maximum inscribed rectangle of each marked text point is processed differently according to the different overlap situations of the maximum inscribed rectangle of each marked text point to obtain the spatial segmentation result, and the building space segmentation image is output.
[0024] Furthermore, for the architectural space image to be segmented containing two or more marked text points, the spatial segmentation result is obtained by applying different processing to the maximum inscribed rectangle of each marked text point based on the different overlap situations of the maximum inscribed rectangle of each marked text point. Specifically:
[0025] For cases where the maximum inscribed rectangle of each marked text point does not contain a common area, the architectural space segmentation result is the combination of the maximum inscribed rectangles of each marked text point, and the architectural space segmentation image is output.
[0026] For cases where the largest inscribed rectangle of each marked text point contains a common area but does not overlap, select the second-level inscribed rectangle corresponding to each marked text point that does not contain other text points, combine the second-level inscribed rectangles of each marked text point to obtain the architectural space segmentation result, and output the architectural space segmentation image.
[0027] For cases where the maximum inscribed rectangles of all marked text points completely overlap, the text center point is obtained through an OCR model, a midline is constructed based on the text center point, the overlapping maximum inscribed rectangles are divided and updated according to the midline, and the updated maximum inscribed rectangles are combined to obtain the architectural space segmentation result, and the architectural space segmentation image is output.
[0028] The embodiments of the present invention realize the solution of the maximum inscribed rectangle for various marked text point cases, thereby obtaining spatial segmentation results for different types of building images. The calculation efficiency is high, the segmentation results are accurate and conform to building space specifications.
[0029] Accordingly, this invention provides a building space segmentation system based on the maximum inscribed rectangle, including: a text point recognition module, a maximum inscribed rectangle module, and a space segmentation module;
[0030] The text point recognition module is used to acquire the architectural space image to be segmented and read the number of marked text points in the architectural space image to be segmented.
[0031] The maximum inscribed rectangle module is used to solve for the maximum inscribed rectangle of the building space image to be segmented based on the marked text points, and to obtain the maximum inscribed rectangle of the marked text points.
[0032] The spatial segmentation module is used to process the largest inscribed rectangle of each marked text point in a building space image to be segmented with different numbers of marked text points to obtain spatial segmentation results and output building space segmentation images.
[0033] Furthermore, the text point recognition module includes: an image acquisition unit and a text point reading unit;
[0034] The image acquisition unit is used to convert the user-input architectural space image and marked text points into an architectural space mask image through a program.
[0035] The text point reading unit is used to take the generated architectural space mask image as the architectural space image to be segmented, and to take the number of marked text points input by the user as the number of marked text points in the architectural space image to be segmented.
[0036] Furthermore, the maximum inscribed rectangle module includes: a first unit, a second unit, a third unit, a fourth unit, a fifth unit, and a sixth unit;
[0037] The first unit is used to find all grid points in the building space image to be segmented. Based on any grid point, the horizontal coordinate is used as the horizontal scale and the vertical coordinate is used as the vertical scale.
[0038] The second unit is used to divide the text into four regions—upper left, upper right, lower left, and lower right—based on the marked text points and according to the horizontal and vertical rulers.
[0039] The third unit performs deduplication and background point removal on the grid points of the upper left and lower right text regions to obtain a set LU consisting of N processed grid points of the upper left text region and a set RD consisting of M processed grid points of the lower right text region.
[0040] The fourth unit is used to randomly select any grid point in set LU and any grid point in set RD and combine them in pairs to obtain a combined rectangle;
[0041] The fifth unit is used to filter out rectangles with background features from the obtained combined rectangles to obtain a background-free combined rectangle;
[0042] The sixth unit is used to select the largest background-free combined rectangle as the largest inscribed rectangle for marking text points.
[0043] Furthermore, the spatial segmentation module includes: a single text point spatial segmentation unit and a multi-text point spatial segmentation unit;
[0044] The single text point spatial segmentation unit is used to segment a building space image containing only a single marked text point. The building space segmentation result is the maximum inscribed rectangle of the marked text point, and the building space segmentation image is output.
[0045] The multi-text point spatial segmentation unit is used to process the maximum inscribed rectangle of each marked text point in a building space image containing two or more marked text points according to the different overlap situations of the maximum inscribed rectangle of each marked text point, and output the building space segmentation image.
[0046] Furthermore, the multi-text point spatial segmentation unit includes: a first case subunit, a second case subunit, and a third case subunit;
[0047] The first case subunit is used for cases where the maximum inscribed rectangle of each marked text point does not contain a common area. The architectural space segmentation result is the combination result of the maximum inscribed rectangle of each marked text point, and the architectural space segmentation image is output.
[0048] The second sub-unit is used to select the next-level inscribed rectangle corresponding to each marked text point that does not contain other text points, and to combine the next-level inscribed rectangles of each marked text point to obtain the architectural space segmentation result and output the architectural space segmentation image, for the case where the largest inscribed rectangle of each marked text point contains a common area but does not overlap.
[0049] The third sub-unit is used for cases where the maximum inscribed rectangles of all marked text points completely overlap. It obtains the text center point through an OCR model, constructs a midline based on the text center point, divides and updates the maximum inscribed rectangles of each marked text point according to the midline, combines the updated maximum inscribed rectangles to obtain the architectural space segmentation result, and outputs the architectural space segmentation image. Attached Figure Description
[0050] Figure 1 : A flowchart illustrating an embodiment of the architectural space segmentation method based on the maximum inscribed rectangle provided by this invention;
[0051] Figure 2 : A schematic diagram showing the result of an embodiment of text region division provided by the present invention;
[0052] Figure 3 : A schematic diagram showing the result of an embodiment of the method for solving the maximum inscribed rectangle of marked text points provided by the present invention;
[0053] Figure 4 : A schematic diagram showing the result of an embodiment of the architectural space segmentation method based on the maximum inscribed rectangle provided by the present invention;
[0054] Figure 5 : A schematic diagram showing the result of an embodiment of the architectural space segmentation method based on the maximum inscribed rectangle provided by the present invention;
[0055] Figure 6 : A schematic diagram showing the result of an embodiment of the architectural space segmentation method based on the maximum inscribed rectangle provided by the present invention;
[0056] Figure 7 : A schematic diagram showing the result of an embodiment of the architectural space segmentation method based on the maximum inscribed rectangle provided by the present invention;
[0057] Figure 8 : A schematic diagram showing the result of an embodiment of the architectural space segmentation method based on the maximum inscribed rectangle provided by the present invention;
[0058] Figure 9 : A schematic diagram showing the result of an embodiment of the architectural space segmentation method based on the maximum inscribed rectangle provided by the present invention;
[0059] Figure 10 : A schematic diagram showing the result of an embodiment of the architectural space segmentation method based on the maximum inscribed rectangle provided by the present invention;
[0060] Figure 11 : A schematic diagram of an embodiment of the architectural space partitioning system based on the maximum inscribed rectangle provided by the present invention;
[0061] Figure 12 : A schematic diagram of the structure of an embodiment of the text point recognition module provided by the present invention;
[0062] Figure 13 : A schematic diagram of an embodiment of the maximum inscribed rectangle module provided by the present invention;
[0063] Figure 14 : A schematic diagram of an embodiment of the spatial segmentation module provided by the present invention. Detailed Implementation
[0064] The technical solutions of this invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0065] In the description of this invention, it should be noted that the directional terms such as "center", "lateral", "longitudinal", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", and "counterclockwise" indicate the orientation and positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the method or system referred to must have a specific orientation, or be constructed and operated in a specific orientation. They should not be construed as limiting the specific protection scope of this invention.
[0066] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0067] Example 1
[0068] Segmenting architectural spaces with human-marked elements is an important aspect of image processing. This invention provides a method for architectural space segmentation based on the maximum inscribed rectangle, concretizing the abstract problem of spatial partitioning into a practical image processing problem, and enabling accurate and compliant segmentation of architectural spaces with various text point markings.
[0069] Based on the above requirements, such as Figure 1 As shown, Embodiment 1 of the present invention provides a method for dividing architectural space based on the maximum inscribed rectangle. The method includes steps S1 to S3, and the specific steps are as follows:
[0070] S1. Obtain the architectural space image to be segmented, and read the number of marked text points in the architectural space image to be segmented. This step includes steps S1.1 to S1.2, each of which is as follows:
[0071] S1.1 Build a building space mask image generated by converting the user-input building space image and marked text points through a program.
[0072] In this embodiment of the invention, the architectural space image input by the user is an image of an architectural space such as a living room or a sitting room. The input architectural space image is converted by a program to obtain an architectural space mask image, which is beneficial for subsequent recognition of manually marked text points and ensures the accuracy of spatial segmentation.
[0073] S1.2. Use the generated architectural space mask image as the architectural space image to be segmented, and use the number of marked text points input by the user as the number of marked text points in the architectural space image to be segmented.
[0074] S2. Calculate the maximum inscribed rectangle of the building space image to be segmented based on the marked text points. This step includes steps S2.1 to S2.6, each step as follows:
[0075] S2.1 Find all grid points within the building space image to be segmented. Based on any grid point, use the horizontal coordinate as the horizontal scale and the vertical coordinate as the vertical scale.
[0076] S2.2 Based on the marked text points, the text area is divided into four regions: upper left, upper right, lower left, and lower right, according to the horizontal and vertical rulers.
[0077] Using the marked text points in the architectural space image as the origin, and employing the horizontal coordinates as the horizontal scale and the vertical coordinates as the vertical scale, the text point coordinates are established. Centered on the marked text points and bounded by the horizontal and vertical scales, the image is divided into four text regions: upper left, upper right, lower left, and lower right. One embodiment of this invention provides a text region division result as follows: Figure 2 As shown, Figure 2 In the text, pt is the marker text point used as the origin.
[0078] S2.3. For the grid points in the upper left and lower right text regions, perform deduplication and background point removal processing to obtain a set LU consisting of N processed grid points in the upper left text region and a set RD consisting of M processed grid points in the lower right text region.
[0079] The grid points in the upper left and lower right text regions are deduplicated and background points are removed to avoid the influence of furniture, wires, and cluttered backgrounds in the architectural space image on solving for the maximum inscribed rectangle. After deduplication and background point removal, the remaining N grid points in the upper left text region form the upper left text region grid point set LU, and the remaining M grid points in the lower right text region form the set RD.
[0080] S2.4. Randomly select any grid point in set LU and any grid point in set RD, and combine them in pairs to obtain a combined rectangle.
[0081] S2.5. For the obtained combined rectangles, filter out the rectangles with background features to obtain a combined rectangle without background.
[0082] S2.6. Select the largest background-free rectangle as the maximum inscribed rectangle for the text markers. The final maximum inscribed rectangle for the text markers is as follows: Figure 3 As shown, Figure 3 In the text, pt represents the marked text point.
[0083] Existing technologies for finding the maximum inscribed rectangle involve finding contour points, selecting two points from the contour points, iterating through these points to form multiple rectangles, and then selecting the rectangle with the largest area as the maximum inscribed rectangle. This method is computationally intensive, slow, and difficult to apply to manually defined text points within architectural spaces, thus failing to meet architectural space partitioning standards. This invention provides a method for finding the maximum inscribed rectangle based on text points. Through step S2, this method satisfies the requirement for finding the maximum inscribed rectangle of text points, while also being computationally efficient and requiring less computation.
[0084] S3. For architectural space images to be segmented with different numbers of marked text points, different processing methods are applied to the maximum inscribed rectangle of each marked text point to obtain the spatial segmentation result, and the architectural space segmentation image is output. This step includes steps S3.1 to S32, and the specific details of each step are as follows:
[0085] S3.1 For a building space image to be segmented containing only a single marked text point, the building space segmentation result is the largest inscribed rectangle of that marked text point, and the building space segmentation image is output.
[0086] For an architectural space image to be segmented containing only a single marked text point, a single marked text point means that its spatial region contains only one functional room area. Therefore, the largest inscribed rectangle of the marked text point obtained in step S2 is used as the segmentation result of the architectural space image to be processed, and the segmented architectural space image is output to the user.
[0087] S3.2 For architectural space images containing two or more labeled text points, based on the different overlap scenarios of the largest inscribed rectangles of each labeled text point, different processing methods are applied to the largest inscribed rectangles of each labeled text point to obtain spatial segmentation results, and the architectural space segmentation image is output. This step includes steps S3.2.1 to S3.2.3, each step as follows:
[0088] S3.2.1 For cases where the maximum inscribed rectangle of each marked text point does not contain a common area, the architectural space segmentation result is the combination result of the maximum inscribed rectangle of each marked text point, and the architectural space segmentation image is output.
[0089] For cases where the largest inscribed rectangle of each marked text point does not contain a common area, such as two non-adjacent bedroom spaces in the embodiments of the present invention, see [reference needed]. Figure 4 As shown, there are two labeled text points pt1 and pt2, and the largest inscribed rectangles of labeled text points pt1 and pt2 do not contain a common area. In this case, the architectural space segmentation result is the combination of the largest inscribed rectangles of labeled text points pt1 and pt2, and the architectural space segmentation image is output to the user.
[0090] S3.2.2 For cases where the largest inscribed rectangle of each marked text point contains a common area but does not overlap, select the second-level inscribed rectangle corresponding to each marked text point that does not contain other text points, combine the second-level inscribed rectangles of each marked text point to obtain the architectural space segmentation result, and output the architectural space segmentation image.
[0091] For cases where the maximum inscribed rectangle of each marked text point contains a common area but does not overlap, it is necessary to solve for the next-level inscribed rectangle of each marked text point and classify and discuss them. The embodiments of this invention provide various specific examples, such as... Figure 5 , Figure 6 , Figure 7 , Figure 8 and Figure 9 As shown, there exist two marked text points, pt1 and pt2, and their maximum inscribed rectangles contain a common area but do not overlap. In this case, it is necessary to solve for the next-level inscribed rectangle of pt1 until the resulting next-level inscribed rectangle does not contain pt. This next-level inscribed rectangle is then taken as the latest maximum inscribed rectangle of the marked text point pt1. After removing the latest maximum inscribed rectangle of pt1 from the architectural space image to be segmented, the latest maximum inscribed rectangle of pt2 is then solved within the remaining region.
[0092] In this embodiment of the invention, to ensure the accuracy of spatial segmentation, it is also necessary to perform a secondary solution for the second-level inscribed rectangle of each marked text point according to the above steps. During the secondary solution process, the second-level inscribed rectangle of pt2 is solved first to obtain the latest maximum inscribed rectangle of the marked text point pt2, and then the latest maximum inscribed rectangle of pt1 is solved.
[0093] Combining the results of the two solutions, the latest maximum inscribed rectangle of the marked text points pt1 and pt2 is taken as the final segmentation result, and the architectural space segmentation image is output to the user.
[0094] S3.2.3 For cases where the maximum inscribed rectangles of all marked text points completely overlap, the text center point is obtained through the OCR model, a midline is constructed based on the text center point, the overlapping maximum inscribed rectangles are divided and updated according to the midline, and the updated maximum inscribed rectangles are combined to obtain the architectural space segmentation result, and the architectural space segmentation image is output.
[0095] For cases where the largest inscribed rectangles of all marked text points completely overlap, such as when a living room and dining room share a space, please refer to [reference needed]. Figure 10As shown, there are two marked text points, pt1 and pt2, and their maximum inscribed rectangles completely overlap. First, all marked text points in the image are identified using an OCR (Optical Character Recognition) model, and the text center point is obtained. Based on the obtained text center point, a text centerline is constructed, and the marked text points in the image are positioned in either an "up-down" or "left-right" relationship, depending on the specific situation. The maximum inscribed rectangle of each marked text point is then divided into "up-down" or "left-right" equal parts according to the text centerline. The resulting rectangles are used to update the maximum inscribed rectangle of each marked text point. The updated maximum inscribed rectangles are then combined to obtain the architectural space segmentation result, and the architectural space segmentation image is output to the user, as shown below. Figure 6 As shown.
[0096] Through the above steps, the spatial division problem of multiple marked text points was discussed and corresponding division methods were provided, achieving accurate division of manually annotated architectural space images and ensuring that the division results conform to building codes.
[0097] Based on the architectural space segmentation results obtained through these steps, a 2D image of the architectural space can be reconstructed. Furthermore, users can reconstruct a 3D model of the architectural space based on the actual wall width and height. Additionally, users can review relevant architectural design specifications to verify whether the space directly connects to the living room, family room, etc., in order to validate the practicality and robustness of the architectural space method provided by this invention.
[0098] The implementation of the above embodiments of the present invention has the following beneficial effects:
[0099] Compared to existing technologies, this invention provides a building space segmentation method based on the largest inscribed rectangle, which concretizes the abstract spatial division problem into a practical image processing problem, and combines it with marked text points to achieve accurate and building code-compliant division of building spaces for various marked text point scenarios.
[0100] Example 2
[0101] Based on the content of Embodiment 1 above, an embodiment of the present invention provides a building space segmentation system based on the maximum inscribed rectangle, the system structure of which is as follows: Figure 11 As shown, the system includes a text point recognition module 101, a maximum inscribed rectangle module 102, and a space segmentation module 103.
[0102] The text point recognition module 101 is used to acquire the building space image to be segmented and read the number of marked text points in the building space image to be segmented.
[0103] The maximum inscribed rectangle module 102 is used to solve for the maximum inscribed rectangle of the building space image to be segmented based on the marked text points, and obtain the maximum inscribed rectangle of the marked text points.
[0104] The spatial segmentation module 103 is used to perform different processing on the maximum inscribed rectangle of each marked text point in the architectural space image to be segmented for different numbers of marked text points to obtain spatial segmentation results and output architectural space segmentation images.
[0105] In one possible implementation, the text point recognition module 101, as follows: Figure 12 As shown, it includes: an image acquisition unit 201 and a text point reading unit 202.
[0106] The image acquisition unit 201 is used to convert the user-input architectural space image and marked text points into an architectural space mask image through a program.
[0107] The text point reading unit 202 is used to take the generated architectural space mask image as the architectural space image to be segmented, and take the number of marked text points input by the user as the number of marked text points in the architectural space image to be segmented.
[0108] In one possible implementation, the maximum inscribed rectangle module 102, as shown... Figure 13 As shown, it includes: first unit 301, second unit 302, third unit 303, fourth unit 304, fifth unit 305 and sixth unit 306.
[0109] The first unit 301 is used to find all grid points in the building space image to be segmented, and based on any grid point, the horizontal coordinate is used as the horizontal scale and the vertical coordinate is used as the vertical scale.
[0110] The second unit 302 is used to divide the text into four text regions—upper left, upper right, lower left, and lower right—based on the marked text points and according to the horizontal and vertical rulers.
[0111] The third unit 303 performs deduplication and background point removal processing on the grid points of the upper left and lower right text regions to obtain a set LU consisting of N processed grid points of the upper left text region and a set RD consisting of M processed grid points of the lower right text region.
[0112] The fourth unit 304 is used to randomly select any grid point in set LU and any grid point in set RD and combine them in pairs to obtain a combined rectangle.
[0113] The fifth unit 305 is used to filter out rectangles with background features from the obtained combined rectangles to obtain a background-free combined rectangle.
[0114] The sixth unit 306 is used to select the largest background-free combined rectangle as the largest inscribed rectangle of the marked text point.
[0115] In one possible implementation, the space partitioning module 103, such as Figure 14 As shown, it includes: a single text point spatial segmentation unit 401 and a multi-text point spatial segmentation unit 402.
[0116] The single text point spatial segmentation unit 401 is used to segment a building space image containing only a single marked text point, and the building space segmentation result is the maximum inscribed rectangle of the marked text point, and outputs a building space segmentation image.
[0117] The multi-text point spatial segmentation unit 402 is used to process the maximum inscribed rectangle of each marked text point in different ways according to the different overlap situations of the maximum inscribed rectangle of each marked text point in a building space image to be segmented, and output the building space segmentation image.
[0118] Furthermore, the multi-text point spatial segmentation unit 402 includes: a first case subunit 501, a second case subunit 502, and a third case subunit 503.
[0119] The first case subunit 501 is used for cases where the maximum inscribed rectangle of each marked text point does not contain a common area. The architectural space segmentation result is the combination result of the maximum inscribed rectangle of each marked text point, and the architectural space segmentation image is output.
[0120] The second scenario subunit 502 is used to select the next-level inscribed rectangle corresponding to each marked text point that does not contain other text points when the largest inscribed rectangle of each marked text point contains a common area but does not overlap, and to combine the next-level inscribed rectangles of each marked text point to obtain the architectural space segmentation result and output the architectural space segmentation image.
[0121] The third subunit 503 is used for the case where the maximum inscribed rectangles of each marked text point completely overlap. It obtains the text center point through the OCR model, constructs a midline based on the text center point, divides and updates the maximum inscribed rectangles of each marked text point according to the midline, combines the updated maximum inscribed rectangles to obtain the architectural space segmentation result, and outputs the architectural space segmentation image.
[0122] The implementation of the above embodiments of the present invention has the following beneficial effects:
[0123] This invention provides a building space segmentation system based on the maximum inscribed rectangle. The system segments building space by reading the number of marked text points and solving for the maximum inscribed rectangle of the marked text points, thereby achieving accurate and building code-compliant division of building space for various marked text point scenarios.
[0124] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for dividing a building space based on a maximum inscribed rectangle, characterized by, include: Obtain the architectural space image to be segmented, and read the number of marked text points in the architectural space image to be segmented; The maximum inscribed rectangle of the building space image to be segmented is obtained based on the marked text points. Specifically, all grid points in the building space image to be segmented are found. Based on any grid point, the horizontal coordinate is used as the horizontal scale and the vertical coordinate is used as the vertical scale. Based on the marked text points, the text is divided into four regions: top left, top right, bottom left, and bottom right, according to the horizontal and vertical rulers. For the grid points in the top left and bottom right text regions, duplicate and background points are removed, resulting in a set LU of N processed grid points from the top left text region and a set RD of M processed grid points from the bottom right text region. Any grid point from set LU and any grid point from set RD are randomly selected and paired to obtain a combined rectangle. For the resulting combined rectangles, rectangles with background features are filtered out to obtain background-free combined rectangles. The background-free combined rectangle with the largest area is selected as the largest inscribed rectangle of the marked text points. For architectural space images to be segmented with different numbers of marked text points, different processing is applied to the maximum inscribed rectangle of each marked text point to obtain spatial segmentation results, and the architectural space segmentation image is output.
2. The architectural space segmentation method based on the maximum inscribed rectangle as described in claim 1, characterized in that, The process of acquiring the architectural space image to be segmented and reading the number of marked text points in the architectural space image to be segmented specifically involves: The architectural space mask image is generated by converting user-input architectural space images and marked text points through a program. The generated architectural space mask image is used as the architectural space image to be segmented, and the number of user-inputted marker text points is used as the number of marker text points in the architectural space image to be segmented.
3. The architectural space segmentation method based on the maximum inscribed rectangle as described in claim 1, characterized in that, For architectural space images to be segmented with different numbers of marked text points, different processing is applied to the largest inscribed rectangle of each marked text point to obtain spatial segmentation results, and the architectural space segmentation image is output. Specifically: For a building space image to be segmented containing only a single labeled text point, the building space segmentation result is the largest inscribed rectangle of that labeled text point, and the building space segmentation image is output. For a building space image to be segmented containing two or more marked text points, the maximum inscribed rectangle of each marked text point is processed differently according to the different overlap situations of the maximum inscribed rectangle of each marked text point to obtain the spatial segmentation result, and the building space segmentation image is output.
4. The architectural space segmentation method based on the maximum inscribed rectangle as described in claim 3, characterized in that, For architectural space images containing two or more marked text points, the spatial segmentation results are obtained by applying different processing methods to the maximum inscribed rectangles of each marked text point based on the different overlap scenarios of their maximum inscribed rectangles. Specifically: For cases where the maximum inscribed rectangle of each marked text point does not contain a common area, the architectural space segmentation result is the combination of the maximum inscribed rectangles of each marked text point, and the architectural space segmentation image is output. For cases where the largest inscribed rectangle of each marked text point contains a common area but does not overlap, select the second-level inscribed rectangle corresponding to each marked text point that does not contain other text points, combine the second-level inscribed rectangles of each marked text point to obtain the architectural space segmentation result, and output the architectural space segmentation image. For cases where the maximum inscribed rectangles of all marked text points completely overlap, the text center point is obtained through an OCR model, a midline is constructed based on the text center point, the overlapping maximum inscribed rectangles are divided and updated according to the midline, and the updated maximum inscribed rectangles are combined to obtain the architectural space segmentation result, and the architectural space segmentation image is output.
5. A building space partitioning system based on the largest inscribed rectangle, characterized in that, include: Text point recognition module, maximum inscribed rectangle module, and spatial segmentation module; The text point recognition module is used to acquire the architectural space image to be segmented and read the number of marked text points in the architectural space image to be segmented. The maximum inscribed rectangle module is used to solve the maximum inscribed rectangle of the building space image to be segmented based on the marked text points. Specifically, it is used to find all grid points in the building space image to be segmented, and based on any grid point, the horizontal coordinate is used as the horizontal scale and the vertical coordinate is used as the vertical scale. Based on the marked text points, the text is divided into four regions: top left, top right, bottom left, and bottom right, according to the horizontal and vertical rulers. For the grid points in the top left and bottom right text regions, duplicate and background points are removed, resulting in a set LU of N processed grid points from the top left text region and a set RD of M processed grid points from the bottom right text region. Any grid point from set LU and any grid point from set RD are randomly selected and paired to obtain a combined rectangle. For the resulting combined rectangles, rectangles with background features are filtered out to obtain background-free combined rectangles. The background-free combined rectangle with the largest area is selected as the largest inscribed rectangle of the marked text points. The spatial segmentation module is used to process the largest inscribed rectangle of each marked text point in a building space image to be segmented with different numbers of marked text points to obtain spatial segmentation results and output building space segmentation images.
6. The architectural space partitioning system based on the maximum inscribed rectangle as described in claim 5, characterized in that, The text point recognition module includes: an image acquisition unit and a text point reading unit; The image acquisition unit is used to convert the user-input architectural space image and marked text points into an architectural space mask image through a program. The text point reading unit is used to take the generated architectural space mask image as the architectural space image to be segmented, and to take the number of marked text points input by the user as the number of marked text points in the architectural space image to be segmented.
7. A building space partitioning system based on the maximum inscribed rectangle as described in claim 5, characterized in that, The spatial segmentation module includes: a single text point spatial segmentation unit and a multi-text point spatial segmentation unit; The single text point spatial segmentation unit is used to segment a building space image containing only a single marked text point. The building space segmentation result is the maximum inscribed rectangle of the marked text point, and the building space segmentation image is output. The multi-text point spatial segmentation unit is used to process the maximum inscribed rectangle of each marked text point in a building space image containing two or more marked text points according to the different overlap situations of the maximum inscribed rectangle of each marked text point, and output the building space segmentation image.
8. A building space partitioning system based on the maximum inscribed rectangle as described in claim 7, characterized in that, The multi-text point spatial segmentation unit includes: a first case subunit, a second case subunit, and a third case subunit; The first case subunit is used for cases where the maximum inscribed rectangle of each marked text point does not contain a common area. The architectural space segmentation result is the combination result of the maximum inscribed rectangle of each marked text point, and the architectural space segmentation image is output. The second sub-unit is used to select the next-level inscribed rectangle corresponding to each marked text point that does not contain other text points, and to combine the next-level inscribed rectangles of each marked text point to obtain the architectural space segmentation result and output the architectural space segmentation image, for the case where the largest inscribed rectangle of each marked text point contains a common area but does not overlap. The third sub-unit is used for cases where the maximum inscribed rectangles of all marked text points completely overlap. It obtains the text center point through an OCR model, constructs a midline based on the text center point, divides and updates the maximum inscribed rectangles of each marked text point according to the midline, combines the updated maximum inscribed rectangles to obtain the architectural space segmentation result, and outputs the architectural space segmentation image.