A method for obtaining scale value of floor plan

Through OCR recognition and image processing technology, the scale recognition standard from floor plan is solved, and the difficulty in identifying floor plan scale in automatic home decoration design is improved, and the reliability and accuracy of calculation results are improved.

CN111814619BActive Publication Date: 2024-12-17BEIJING LBADVISOR TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010600735.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-28
Publication Date
2024-12-17
Estimated Expiration
2040-06-28

AI Technical Summary

Technical Problem

It is difficult for the prior art to accurately and quickly identify the scale values ​​in floor plans, resulting in the problems of long design cycles and high costs in automatic home decoration design.

Method used

OCR recognition technology is used to obtain character information in the floor plan, combine image processing technology to divide the scale area from the floor plan, identify the marking scale, and obtain a set of scale data through calculations, and obtain the final scale through voting principles and data abnormality removal technology. value.

Benefits of technology

The reliability and accuracy of the scale calculation results are improved, and the scale calculation errors caused by errors in segmenting identification areas and annotating digital areas are solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111814619B_ABST
    Figure CN111814619B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for obtaining a scale value of a floor plan, wherein the method comprises: A1, for a floor plan to be processed, using an OCR recognition method to obtain character information of all characters in the floor plan; A2, segmenting a scale area from the floor plan, and obtaining a scale value one (S1) according to the character information and the scale area; A3, obtaining a scale value two (S2) according to the area information of each room in the floor plan; A4, using the scale value two to correct the scale value one, and obtaining a final determined scale value. The method of the present application can greatly improve the reliability and accuracy of obtaining a scale value in a floor plan.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to image processing technology, and in particular to a method for obtaining the scale value of a floor plan. Background Art

[0002] With the continuous improvement of living standards, people's requirements for home environment are also increasing, which has spawned a huge home improvement market and many home improvement companies. The ability to design decoration plans is the core competitiveness of home improvement companies, but the currently commonly used manual design method has problems such as long design cycle and high cost. Therefore, the market urgently needs automatic / semi-automatic home improvement design systems. Automatically extracting the structure and proportional size information of the house type from the house type is an important step in realizing automatic / semi-automatic home improvement design. The scale of the house type refers to the ratio of the actual size of a certain section of the house type to the pixel width of the image of that section. It is an important indicator for restoring the size of the house type during 3D reconstruction. Therefore, it is very important to correctly identify the scale in the house type.

[0003] Therefore, how to accurately and quickly identify the scale of the floor plan in automatic home decoration design has become a technical problem that needs to be solved urgently. Summary of the invention

[0004] 1. Technical issues to be resolved

[0005] In view of the above-mentioned shortcomings and deficiencies of the prior art, the present invention provides a method for obtaining the scale value of a floor plan, which combines image processing technology, data precision processing technology and data correction technology to solve the above-mentioned problem of being unable to accurately obtain the scale value of the floor plan.

[0006] (II) Technical solution

[0007] In order to achieve the above object, the main technical solutions adopted by the present invention include:

[0008] In a first aspect, an embodiment of the present invention provides a method for obtaining a scale value of a floor plan, comprising:

[0009] A1. For the floor plan to be processed, obtain character information of all characters in the floor plan by using OCR recognition;

[0010] A2, segmenting a scale area from the floor plan, and obtaining a scale value S1 according to the character information and the scale area;

[0011] A3, obtaining a scale value S2 according to the area information of each room in the floor plan;

[0012] A4. Use the scale value 2 to correct the scale value 1 to obtain a final scale value.

[0013] Optionally, the character information includes:

[0014] Literal characters, position information of literal characters, numeric characters, position information of numeric characters;

[0015] The numeric characters and the position information of the numeric characters include: area information of each room.

[0016] Optionally, the A2 includes:

[0017] A2-1. According to the distribution characteristics of the scale information, segment the area image containing the scale information in the floor plan as the scale area, and convert the position information of the character information corresponding to the scale area;

[0018] A2-2. Based on the character information of the scale area after the position information conversion, identify the marking scales in the scale area, and obtain the scale value S1 according to the identified marking scales.

[0019] Optionally, A2-1 includes:

[0020] A2-1-1. Perform grayscale processing on the floor plan, perform binarization processing on the grayscale processed image, and obtain the binarized image;

[0021] A2-1-2. According to the distribution characteristics of the scale information, segment the area image containing the scale information from the binarized image as the scale area, and convert the position information of the character information belonging to the scale area to obtain the converted character information and the position information of the character information.

[0022] Optionally, A2-2 includes:

[0023] A2-2-1. Based on the computer vision library, the character information after the position information conversion and the position information of the character information, adopt a line detection method to detect the line information in the scale area, and the line information is used to determine the position information of the marking scales;

[0024] A2-2-2. Identify the marking scales in the line information and the actual distance information represented by the marking scales, including:

[0025] Horizontal direction recognition method: Identify the marking scales within the preset range of the line information in the order from left to right. The first pixel point with a "meter" shape or a half "meter" shape and a pixel value of 0 from the left is recorded as the starting point of the first scale. Scan to the right until a pixel point with a "meter" shape or a half "meter" shape and a pixel value of 0 appears, and mark the previous pixel point as the ending point of the scale; at the same time, count the digital information between the starting point and the ending point of the scale, and add the numbers within the area of the first scale starting point and ending point to obtain the actual distance information represented by the scale; continue scanning until there are no more scales;

[0026] and including a vertical recognition method: identifying the identification scales within a preset range of straight line information in the order from top to bottom. The first "cross" or half "cross" pixel point with a pixel value of 0 from the top is recorded as the starting point of the first scale. Scan downwards until a "cross" or half "cross" pixel point with a pixel value of 0 appears, and mark the previous pixel point as the ending point of this scale. At the same time, count the digital information between the starting point and the ending point of the scale, add the numbers within the area of the first scale starting point and ending point to obtain the actual distance information represented by this scale. Continue scanning until there are no more scales.

[0027] A2-2-3. Use Formula 1 to calculate Scale Value 1; based on all the identified identification scales and the scale information of the actual distance information represented by this identification scale, obtain an array of Scale Value 1.

[0028] Formula 1: Scale Value 1 = Scale Actual Distance Information / (Scale Ending Point Pixel Coordinate - Scale Starting Point Pixel Coordinate);

[0029] A2-2-4. Conduct a voting process on each Scale Value 1 in the array of Scale Value 1, and take the value with the most votes as the obtained Scale Value 1.

[0030] Optionally, A3 includes:

[0031] A3-1. According to the number of pixels in each connected region and the actual area information of this connected region, use Formula 2 to obtain an array of Scale Value 2.

[0032] Formula 2 is: Scale Value 2 = sqrt(Region Actual Area Size / Region Total Pixel Number);

[0033] Each connected region is each room region predetermined in the floor plan, and the actual area information of the connected region is the area information of each room in the character information.

[0034] A3-2. Eliminate the outliers in the array of Scale Value 2, and take the average of the filtered data to obtain Scale Value 2 in the floor plan.

[0035] Optionally, A4 includes:

[0036] A4-1. Judge whether both Scale Value 1 and Scale Value 2 are not zero. If Scale Value 1 is zero, then take Scale Value 2 as the final scale value; if Scale Value 2 is zero, then take Scale Value 1 as the final scale value.

[0037] A4-2. If scale value 1 and scale value 2 are not zero, and the error between scale value 1 and scale value 2 is less than or equal to a preset threshold, scale value 1 is used as the final scale value;

[0038] A4-3. If the scale value 1 and the scale value 2 are not zero, and the error between the scale value 1 and the scale value 2 is greater than a preset threshold, the scale value 1 is obtained again, and the process of A4 is repeated.

[0039] Optionally, the re-obtaining scale value one includes:

[0040] The values ​​in the array of the set of scale values ​​one that are equal to the scale value one obtained in A2-2-4 are eliminated to obtain a new array of scale values ​​one, and the new scale value one is obtained by voting, that is, as the re-obtained scale value one.

[0041] In a second aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the method for obtaining the scale value of a floor plan as described in any one of the first aspects above are implemented.

[0042] In a third aspect, a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for obtaining the scale value of a floor plan as described in any one of the first aspects above are implemented.

[0043] (III) Beneficial effects

[0044] The beneficial effects of the present invention are as follows: the method of this embodiment recognizes and processes the scale in the floor plan based on image processing technology, data precision processing technology, and data correction technology. Specifically:

[0045] Firstly, the characters in the floor plan are recognized by OCR recognition technology; secondly, the scale area is segmented from the floor plan by image processing technology, and the size mark area and the marked number area are segmented in the scale image; the size mark and its corresponding marked number are identified respectively, and a set of scale data is obtained by calculation; the scale value is determined by the voting principle; thirdly, a set of scale data is calculated according to the connected area of ​​the room and the corresponding actual area, and the data anomaly elimination technology is used to process the set of data, and then the average scale value is calculated; finally, the scale value obtained in the third step is used to correct the scale value obtained in the second step to obtain the final floor plan scale value; this method greatly improves the reliability and accuracy of the scale calculation results. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1A schematic diagram of a flow chart of a method for obtaining a scale value of a floor plan provided by an embodiment of the present invention;

[0047] Figure 2 A schematic flow chart of a method for obtaining a scale value of a floor plan provided by another embodiment of the present invention;

[0048] Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;

[0049] Figure 4 A schematic diagram of an actual distance indicated by customer information provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0050] In order to better explain the present invention and facilitate understanding, the present invention is described in detail below through specific implementation modes in conjunction with the accompanying drawings.

[0051] Before understanding the solution of the embodiment of the present invention, the existing technology provides two methods for identifying the scale of a floor plan. The first method is to first segment the scale area from the floor plan, segment the size mark area and the number mark area in the scale image, respectively identify the size mark and its corresponding number mark, and then calculate the corresponding scale. However, this method has the following problems: first, segmentation errors may occur when segmenting the mark area and the number mark area; second, identification errors may occur when identifying the size mark and its corresponding number mark; in either of the above two situations, any problem will result in an error in the final scale calculation or the inability to calculate the scale value at all.

[0052] An embodiment of the present invention discloses a method for obtaining the scale value of a floor plan. The method uses image processing technology, data precision processing technology, data correction method and OCR recognition technology to identify and process the scale in the floor plan, so as to obtain a final floor plan scale value. The method of this embodiment greatly improves the reliability and accuracy of the scale calculation result, and effectively solves the problem of scale calculation errors caused by errors in segmenting identification areas and marking digital areas.

[0053] Embodiment 1

[0054] like Figure 1 As shown, Figure 1 A flow chart of a method for obtaining a scale value of a floor plan provided by an embodiment of the present invention is shown. The execution subject of the method of this embodiment can be any electronic device. The method may include the following steps:

[0055] Step A1: for the floor plan to be processed, obtain character information of all characters in the floor plan by using OCR recognition.

[0056] In an embodiment, the character information may include: text characters and position information of the text characters.

[0057] For example, the numeric characters and the location information of the numeric characters in this embodiment may include: area information of each room, etc.

[0058] Step A2: Segment a scale area from the floor plan, and obtain a scale value S1 according to the character information and the scale area.

[0059] For example, step A2 may include the following sub-steps:

[0060] A2-1. According to the distribution characteristics of the scale information, a regional image containing the scale information is segmented in the floor plan as a scale area, and the position information of the character information corresponding to the scale area is converted.

[0061] The scale information in this embodiment includes digital information and straight line information, and the straight line information includes identification scales and actual distance information represented by the identification scales.

[0062] Usually, the scale in the floor plan is drawn around the floor plan. The background of the area is generally monotonous, with few complex interferences. It is composed of line segments and the actual length corresponding to the line segments.

[0063] To this end, in this embodiment, the surrounding area can be segmented from the floor plan as the scale area.

[0064] A2-2. Based on the character information of the scale area after the position information is converted, identify the scale mark in the scale area, and obtain the scale value S1 according to the identified scale mark.

[0065] Step A3: Obtain a scale value S2 according to the area information of each room in the floor plan.

[0066] For example, step A3 may be specifically implemented as follows:

[0067] A3-1. According to the number of pixels in each connected region and the actual area information of the connected region, use Formula 2 to obtain an array of scale value 2;

[0068] Formula 2 is: Scale value 2 = sqrt (actual area size of the region / total number of pixels in the region);

[0069] Each connected area is a room area predetermined in the floor plan, and the actual area information of the connected area is the area information of each room in the character information.

[0070] A3-2. Use the Grubbs criterion method to remove abnormal values ​​in an array of scale value two, calculate the average value of the filtered data, and obtain the scale value two in the floor plan.

[0071] Step A4: Use the scale value 2 to correct the scale value 1 to obtain a final scale value.

[0072] Specifically, the calibration process may include: determining whether scale value 1 and scale value 2 are both non-zero, and if scale value 1 is zero, taking scale value 2 as the final scale value; if scale value 2 is zero, taking scale value 1 as the final scale value;

[0073] Otherwise, determine whether the error between scale value 1 and scale value 2 is less than a preset threshold. If so, use scale value 1 as the final scale value. Otherwise, re-acquire scale value 1 and repeat the determination process in A4.

[0074] The method of this embodiment uses image processing technology, data precision processing technology, data correction method and OCR recognition technology to process the floor plan. It obtains scale value one with the help of OCR technology and image technology, obtains scale value two with the help of information about the rooms in the floor plan, and then corrects scale value one according to scale value two. In this way, a scale value with higher accuracy can be obtained. Compared with the method of obtaining scale in the prior art, it effectively solves the problem of scale calculation errors caused by errors in segmenting identification areas and marking digital areas. At the same time, the method of this embodiment greatly improves the reliability and accuracy of the scale calculation results.

[0075] In order to better understand the processing process of step A2 in the above embodiment, the calculation process of step A2 is described in detail below:

[0076] Segmenting a scale area from the floor plan, and acquiring a scale value S1 corresponding to a first processing method according to the character information and the scale area, including:

[0077] Sub-step A2-1, according to the distribution characteristics of the scale information, segmenting the area image containing the scale information in the floor plan as the scale area, and converting the position information of the character information corresponding to the scale area;

[0078] Specifically, in this embodiment, the floor plan may be firstly grayscale processed, and the grayscale processed image may be binarized to obtain a binarized image; and then, based on the distribution characteristics of the scale information, a regional image containing the scale information may be segmented from the binarized image as a scale area.

[0079] In this embodiment, the distribution characteristic of the scale information can be understood as being generally distributed around the floor plan. In addition, after the scale area is segmented, the character information belonging to the scale area in the character information can be converted according to the scale area to obtain the character information of the converted scale area.

[0080] It can be understood that the character information obtained after OCR recognition of the original image includes characters and the position information of the characters. The 'area image containing scale information' is segmented from the original image, and this segmented image is only a part of the original image. The relative position information of the characters will change, so position information conversion needs to be done here.

[0081] Sub-step A2-2: Based on the character information of the scale area after position information conversion, identify the marking scale in the scale area, and obtain the scale value S1 according to the identified marking scale.

[0082] In the specific implementation process, sub-step A2-2 may include the following sub-steps:

[0083] A2-2-1: Based on the computer vision library (opencv), the character information after position information conversion, and the position information of the character information, use the line detection method to detect the line information in the scale area, and this line information is used to determine the position information of the marking scale;

[0084] A2-2-2: Identify the marking scale in the line information and the actual distance information represented by the marking scale;

[0085] Specifically, A2-2-2 includes:

[0086] Horizontal recognition method: Identify the marking scale within the preset range of the line information in the order from left to right. The first pixel point with a pixel value of 0 in the shape of a 'cross' or half 'cross' from the left is recorded as the starting point of the first scale. Scan to the right until a pixel point with a pixel value of 0 in the shape of a 'cross' or half 'cross' appears, and mark the previous pixel point as the ending point of the scale; at the same time, count the digital information between the starting point and the ending point of the scale. Add the numbers within the area of the first scale starting point and ending point to obtain the actual distance information represented by this scale; continue scanning until there is no scale.

[0087] Identification method in the vertical direction: identify the marking scale within the preset range of the straight line information from top to bottom, and mark the first "M"-shaped or half-"M"-shaped pixel point with a pixel value of 0 as the starting point of the first scale, scan downward until a "M"-shaped or half-"M"-shaped pixel point with a pixel value of 0 appears, and mark the previous pixel point as the end point of the scale; at the same time, count the digital information between the starting point and the end point of the scale, add the numbers in the area of ​​the first scale starting point and the end point, and get the actual distance information represented by the scale; continue scanning until there is no scale;

[0088] A2-2-3. Calculate the scale value one using formula one; obtain an array of scale value one based on all the identified scale marks and the actual distance information represented by the scale marks;

[0089] Formula 1: Scale value 1 = scale actual distance information / (scale end pixel coordinates - scale start pixel coordinates)

[0090] A2-2-4. According to the voting principle, voting is performed on each scale value one in the array of the set of scale values ​​one, and the value with the most votes is used as the obtained scale value one.

[0091] Sub-step A3-2: acquiring the scale value S1 according to the recognized identification scale and the character information of the converted scale area.

[0092] The scale value S1 obtained by the above method is more accurate and reliable than the acquisition method in the prior art.

[0093] In another optional implementation, the above step A3 may include the following sub-steps:

[0094] Sub-step A3-1, according to the number of pixels in each connected region and the actual area information of the connected region, use formula 2 to obtain an array of scale value 2;

[0095] Formula 2 is: Scale value 2 = sqrt (actual area size of the region / total number of pixels in the region);

[0096] Each connected area is a room area predetermined in the floor plan, and the actual area information of the connected area is the area information of each room in the character information;

[0097] Sub-step A3-2: using the Grubbs criterion method, remove abnormal values ​​in an array of scale value two, calculate the average value of the filtered data, and obtain the scale value two in the floor plan.

[0098] Accordingly, the above step A4 may include the following sub-steps:

[0099] A4-1. Determine whether scale value 1 and scale value 2 are both non-zero. If scale value 1 is zero, scale value 2 is used as the final scale value. If scale value 2 is zero, scale value 1 is used as the final scale value.

[0100] A4-2. If scale value 1 and scale value 2 are not zero, and the error between scale value 1 and scale value 2 is less than or equal to a preset threshold, scale value 1 is used as the final scale value;

[0101] A4-3. If the scale value 1 and the scale value 2 are not zero, and the error between the scale value 1 and the scale value 2 is greater than a preset threshold, the scale value 1 is obtained again, and the process of A4 is repeated.

[0102] It should be noted that the above-mentioned re-acquisition of scale value one can be an array corresponding to sub-step A2-2-4, and the values ​​in the array of the group of scale value one that are equal to the scale value one obtained in A2-2-4 are eliminated to obtain a new array of scale value one, and the new scale value one is obtained by voting.

[0103] Embodiment 2

[0104] like Figure 2 As shown, Figure 2 A flow chart of a method for obtaining a scale value of a floor plan provided by an embodiment of the present invention is shown. The execution subject of the method of this embodiment can be any electronic device. The method may include the following steps:

[0105] 101, input the two-dimensional floor plan to be recognized into the OCR recognition model to obtain text information and digital information, that is, character information, in the floor plan.

[0106] The character information includes Chinese characters, English characters, and numeric characters, as well as the position information corresponding to each character.

[0107] 102 , according to the distribution characteristics of the scale area, segment the scale area in the two-dimensional floor plan to be recognized, and convert the character information.

[0108] For example, segmenting the scale area includes: graying and binarizing the original two-dimensional floor plan to be identified, detecting straight lines using the OpenCV method, and segmenting the area. Graying and binarizing are processes for the two-dimensional floor plan.

[0109] That is to say, the two-dimensional floor plan to be recognized is gray-scaled and binarized; and the regional image containing the scale information is segmented according to the distribution characteristics of the scale information, and the digital position information corresponding to the digital information recognized by OCR based on the scale area conversion is obtained.

[0110] 103 , for the segmented scale area, identify and mark the scale, and calculate the scale value array.

[0111] This step needs to count all the identifiable scale information, and then combine the digital information of each scale mark to calculate an array of scale value one, and then calculate the scale value one S1 obtained in this step according to the voting principle.

[0112] Specifically, the following sub-steps may be included:

[0113] Sub-step 1. Use the line detection method in OpenCV to detect the straight line information in the scale area;

[0114] Sub-step 2. Identify the scale information and the actual distance information represented by the scale, such as Figure 4 As shown;

[0115] For example, the horizontal recognition method is to identify the marking scale on the straight line from left to right, and mark the first pixel point with a pixel value of 0 in the shape of a "M" or a half "M" on the left as the starting point of the first scale, and scan to the right until a pixel point with a pixel value of 0 in the shape of a "M" or a half "M" appears, and mark the previous pixel point as the ending point of the scale; at the same time, the digital information between the starting point and the ending point of the scale is counted, and the sum of the numbers in the starting point and the ending point area of ​​the scale is the actual distance information represented by the scale; continue scanning until there is no scale;

[0116] The recognition method in the vertical direction is to identify the marking scales on the straight line in order from top to bottom, and mark the first "M"-shaped or half "M"-shaped pixel point with a pixel value of 0 as the starting point of the first scale, and scan downward until a "M"-shaped or half "M"-shaped pixel point with a pixel value of 0 appears, and mark the previous pixel point as the ending point of the scale; at the same time, count the digital information between the starting point and the ending point of the scale, and the sum of the numbers in the starting point and the ending point area of ​​the scale is the actual distance information represented by the scale; continue scanning until there are no more scales.

[0117] It should be noted that the straight line information is only used to locate the scale position, and the search for the scale mark is performed along the straight line in the area image.

[0118] Sub-step 3. Calculate the scale value represented by each scale. The calculation formula is as follows:

[0119] Scale value = scale actual distance information / (scale end point pixel coordinates - scale start point pixel coordinates);

[0120] Calculate all the identified scale information to obtain a set of scale value arrays array_S1.

[0121] It should be understood that the scale information in the floor plan is usually in sections, each of which can independently represent the scale of the entire image. The purpose of calculating the scale values ​​represented by all the scales is to reduce inaccurate results caused by recognition errors.

[0122] Sub-step 4. Determine the final scale value by voting: The scale value array array_S1 calculated in the previous step will not have exactly the same values ​​due to errors in counting pixels or digital recognition. There will be certain errors, but the errors will not be large, except for calculation errors. Even if there are individual calculation errors, they will not affect the calculation of the final scale value here; Ignore the influence of the scale value's single digit, vote on the group of data, and the value with the most votes is the scale value S1 obtained in this step.

[0123] For example, ignore the last digit of each number (approximately, for example, the three values ​​12305, 12306, and 12301 are all treated as 12300), and then count the number that appears the most times.

[0124] 104, calculate the scale value S2 based on the area information of the room.

[0125] The room area information in this step is the room area size and the number of pixels occupied by the room area in the two-dimensional floor plan given before this step. The room area size here is the result obtained by the text information recognized by OCR, and the number of pixels occupied by the room area is the result calculated based on the room outline information; here, the scale value of each room area is calculated according to Formula 2 to obtain a set of values;

[0126] Formula 2: Scale value 2 = sqrt (actual area of ​​the region / total number of pixels in the region)

[0127] Since both the OCR recognition result and the room outline information may be wrong, there is erroneous information in the array of a set of scale values ​​2 calculated by this method. The erroneous data is eliminated through data elimination technology, and the accurate scale value 2 S2 is calculated through the remaining data;

[0128] 105, use scale value 2 S2 to calibrate scale value 1 S1.

[0129] For example, scale value 1 S1 exists, scale value 2 S2 exists

[0130] If the error between scale value 1 S1 and scale value 2 S2 abs(S1-S2) / S1 is less than 0.02 (empirical value), scale value S = scale value 1 S1;

[0131] If the error abs(S1-S2) / S1 between scale value 1 S1 and scale value 2 S2 is greater than 0.02, remove the value equal to scale value 1 S1 in the array array_S1 of scale value 1, recalculate scale value 1 S1, and then recalculate abs(S1-S2) / S1. If it is less than 0.02, then scale value S = scale value 1 S1;

[0132] If not, continue to perform this step until the condition is met, unless the array array_S1 of scale value one is empty, then the scale value S = scale value two S2;

[0133] In addition, scale value one S1 exists, scale value two S2 does not exist, and scale value S = scale value one S1;

[0134] Next, scale value one S1 does not exist, scale value two S2 exists, and scale value S = scale value two S2;

[0135] Then, scale value 1 S1 does not exist, scale value 2 S2 does not exist, and the calculation of scale value S fails.

[0136] 106. If the scale value S exists, output the scale value S of the final recognition result.

[0137] The result of this step is the actual distance information represented by each pixel in the two-dimensional floor plan to be identified.

[0138] The method of this embodiment greatly improves the reliability and accuracy of the scale calculation result.

[0139] In addition, in order to understand the content of the room area involved in the above-mentioned acquisition of the second scale value, the number of pixels occupied by the room area is a result of statistics based on the contour information of the room. The contour information of the room can be obtained in the following manner.

[0140] M1. Obtain the corner point information and character information of the floor plan to be identified, and input the corner point information into the quadratic programming model to obtain the connection information of the wall line and the doors and windows.

[0141] For example, the connection information may include a line connecting two end points constituting a wall line, or a line connecting two end points constituting a door or window icon.

[0142] The quadratic programming model is pre-established and includes a plurality of corresponding corner point connection rules and constraint conditions of the positional relationship between the wall line and the doors and windows. For example, the constraint conditions of the corresponding corner point connection rules include: if two directions contained in two corner points point to each other, they can be connected, otherwise they cannot be connected; if the direction of the line connecting the two corner points is similar to any one of the four predefined straight lines, they can be connected, otherwise they cannot be connected;

[0143] The constraints corresponding to the positional relationship between the wall line and the doors and windows include: the corner connection result of the door or window must be on the wall line, otherwise the wall line connection relationship or the door and window connection relationship is adjusted, and the final connection result must ensure that the door and window must be above the wall line.

[0144] For example, the corner point information of the floor plan to be recognized can be obtained through a trained neural network, and the text information in the floor plan can be recognized through OCR recognition technology.

[0145] M2. Input the connection information of the wall lines and doors and windows into a graph theory optimization model to obtain the area composition information of each room area in the floor plan.

[0146] For example, the area composition information may include: a set of points constituting the starting point and the ending point of the clockwise or counterclockwise wall line of the room, the starting point information of doors and windows, the ending point information of doors and windows, and the classification information of doors and windows.

[0147] The graph theory optimization model is a pre-established Graham algorithm model improved based on graph theory knowledge.

[0148] M3. Match the character information with the area composition information to obtain a recognition result.

[0149] For example, the recognition result may include: the area composition of the rooms in the floor plan, the room names, the room sizes, the locations of doors and windows, scale information, etc.

[0150] For example, the scale in the floor plan can be obtained in advance, and the obtained scale can be corrected (automatically or manually) to obtain accurate and complete scale information;

[0151] Then, the apartment area and text information are matched, for example, the results of OCR recognition are screened, sorted and corrected; then, optimal matching is performed based on the scale information, apartment area information and OCR sorting results.

[0152] In an optional manner, before executing step M1 in the aforementioned method, the method further includes the following step N1 which is not shown in the figure:

[0153] N1: Train the neural network model.

[0154] For example, a training set may be obtained, and each floor plan data in the training set may be floor plan data that is manually annotated in advance, such as annotating the corner point types of wall lines and doors and windows.

[0155] The data in the above training set is input into the neural network model with selected parameters for training, without adjusting the parameters, until convergence, thereby obtaining the trained neural network.

[0156] Each floor plan data in the training set may include:

[0157] Pre-mark the wall lines and doors and windows in the floor plan, and use line segments to represent the wall line and door and window marking data;

[0158] Organize the labeled data and calculate the type of corner points as label data for input into the neural network.

[0159] In a specific application, the floor plan to be identified is input into a trained neural network to obtain the corner point information of the wall lines, doors and windows in the floor plan.

[0160] It should be noted that each floor plan input into the neural network does not require any preprocessing operation, and the original image can be input.

[0161] In a second optional manner, before executing step M1 in the aforementioned method, the method further includes the following step N2 which is not shown in the figure:

[0162] N2: Establish a quadratic programming model.

[0163] That is to say, a quadratic programming model is defined, which consists of a series of constraints, which are mainly the connection rules of corner points and the positional relationships of wall lines, doors and windows.

[0164] For example, the definition of the corner point connection rule: Here, it is explained that the corner point contains at most 8 direction types (M-shaped), each corner point contains some of the 8 directions, and each corner point can only be connected in four directions: horizontal, vertical, 45-degree diagonal, and 135-degree diagonal.

[0165] In this embodiment, the corner point connection rules include: if two directions contained in the two corner points point to each other, they can be connected, otherwise they cannot be connected; if the direction of the line connecting the two corner points is similar to any one of the four predefined straight lines, they can be connected, otherwise they cannot be connected; the position relationship between the wall line and the doors and windows is defined as: the corner point connection result of the door or window must be on the wall line, otherwise the wall line connection relationship or the door and window connection relationship is adjusted, and the final result must ensure that the door and window must be above the wall line.

[0166] When the quadratic programming model is applied, the corner point information output by the above neural network is input into the pre-established quadratic programming model, and the connection information of the wall line and the doors and windows is directly output through iterative optimization.

[0167] The independent variables of the loss function in the quadratic programming model are the corner point variables in the above constraints and the connection relationship between the corner points (1 if connected, 0 otherwise). The loss function is a loss value that measures the failure of the corner points to be correctly connected. Iterative optimization process: the process of constantly adjusting the connection method of the wall line and the doors and windows to ensure the minimum loss function.

[0168] In this embodiment, the quadratic planning model has a very fast planning speed in the process of processing the floor plan, which can be completed in milliseconds, fully meeting the real-time requirements.

[0169] In a third optional manner, before executing step M2 in the aforementioned method, the method further includes the following step N3 which is not shown in the figure:

[0170] N3: Establish a graph theory optimization model.

[0171] The graph theory optimization model is a pre-established Graham algorithm improved based on graph theory knowledge.

[0172] The basic idea of ​​the pure Graham algorithm is to first find a point on the convex hull, and then start from that point to find points on the convex hull one by one in a counterclockwise direction. In fact, it is to sort the polar angles and then use them for query. The points scanned by the Graham algorithm here include not only the coordinate information of the corner points but also the connection information between the corner points. When searching for another point through one point, it is necessary to consider whether there is a connection relationship between the two points. Points without a connection relationship cannot participate in the search.

[0173] After obtaining the room area through the above method, you can execute Figure 1 and Figure 2 The method for obtaining the scale value of the floor plan shown.

[0174] Embodiment 3

[0175] An embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the method for obtaining the scale value of a floor plan as described in any one of the first aspects above are implemented.

[0176] The structural diagram of the electronic device in this embodiment is as follows Figure 3 As shown, the electronic device can be a mobile terminal or an IPAD. Figure 1 and Figure 2 The described method may be implemented by an electronic device.

[0177] Figure 3The electronic device shown may include: at least one processor 31, at least one memory 32, at least one network interface 34 and other user interfaces 33. The various components in the electronic device are coupled together via a bus system 35. It is understood that the bus system 35 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 35 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 35 is not described in detail. Figure 3 Various buses are labeled as bus system 35 .

[0178] The user interface 33 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, or a touch pad).

[0179] It is understood that the memory 32 in this embodiment can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. The memory 32 described herein is intended to include but is not limited to these and any other suitable types of memory.

[0180] In some implementations, the memory 32 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 321 and application programs 322 .

[0181] The operating system 321 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 322 includes various application programs, such as a media player (MediaPlayer), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present invention can be included in the application 322.

[0182] In the embodiment of the present invention, the processor 31 calls the program or instruction stored in the memory 32, specifically, the program or instruction stored in the application 322, and the processor 31 is used to execute the method steps provided in the first aspect.

[0183] The method disclosed in the above embodiment of the present invention can be applied to the processor 31, or implemented by the processor 31. The processor 31 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 31 or the instruction in the form of software. The above processor 31 can be a general-purpose processor. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be combined to execute. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 32, and the processor 31 reads the information in the memory 32 and completes the steps of the above method in combination with its hardware.

[0184] In addition, in combination with the method in the above embodiment, an embodiment of the present invention may provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, any one of the method steps in the above method embodiment is implemented.

[0185] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0186] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0187] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions.

[0188] It should be noted that in the claims, any reference numerals placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In the claims enumerating several means, several of these means may be embodied by the same hardware. The use of the words first, second, third, etc., is for convenience of expression only and does not indicate any order. These words may be understood as part of the component name.

[0189] In addition, it should be noted that, in the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.

[0190] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments after knowing the basic creative concept. Therefore, the claims should be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.

[0191] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention should also include these modifications and variations.

Claims

1. A method for obtaining the scale value of a floor plan, characterized in that: Including: A1. For the floor plan to be processed, use the OCR recognition method to obtain the character information of all characters in the floor plan; A2. Split the scale area from the floor plan, identify the marked scale according to the character information and the scale area, and obtain the first scale value (S1) according to the identified marked scale; A3. According to the room area information in the floor plan, obtain the second scale value (S2), where the room area information includes the room area size and the number of pixels in the room area; A4. Use the second scale value to correct the first scale value to obtain the finally determined scale value.

2. The method according to claim 1, characterized in that The character information includes: Text characters, the position information of text characters, numeric characters, and the position information of numeric characters; The numeric characters and the position information of numeric characters include: the area information of each room.

3. The method according to claim 1, characterized in that The A2 includes: A2-1. According to the distribution characteristics of the scale information, split the area image containing the scale information in the floor plan as the scale area, and convert the position information of the character information corresponding to the scale area; A2-2. Based on the character information of the scale area after the position information conversion, identify the marked scale in the scale area, and obtain the first scale value (S1) according to the identified marked scale.

4. The method according to claim 3, characterized in that A2-1 includes: A2-1-1. Perform grayscale processing on the floor plan, perform binary processing on the grayscale processed image, and obtain the binary image; A2-1-2. According to the distribution characteristics of the scale information, split the area image containing the scale information from the binary image as the scale area; and convert the position information of the character information belonging to the scale area to obtain the converted character information and the position information of the character information.

5. The method according to claim 4, characterized in that A2-2 includes: A2-2-1. Based on the computer vision library, the character information after the position information conversion, and the position information of the character information, use the line detection method to detect the line information in the scale area, and the line information is used to determine the position information of the marked scale; A2-2-2. Identify the marked scale in the line information and the actual distance information represented by the marked scale, including: Identify the marked scale within the preset range of the line information in the order from left to right. The pixel point with the "meter" shape or half "meter" shape pixel value of 0 from the leftmost first is recorded as the starting point of the first scale. Scan to the right until a pixel point with the "meter" shape or half "meter" shape pixel value of 0 appears, and mark the previous pixel point as the ending point of the scale; at the same time, count the digital information between the starting point and the ending point of the scale, and add the numbers within the area of the first scale starting point and ending point to obtain the actual distance information represented by the scale; continue scanning until there is no scale. And including, by identifying the identification scales within the preset range of the straight line information in the top-down order, the first pixel point with a pixel value of 0 in the "cross" or half "cross" shape from the top is recorded as the starting point of the first scale. Scan downwards until a pixel point with a pixel value of 0 in the "cross" or half "cross" shape appears, and mark the previous pixel point as the ending point of the scale. At the same time, count the digital information between the starting point and the ending point of the scale, add the numbers within the area of the first scale starting point and ending point to obtain the actual distance information represented by this scale. Continue scanning until there are no more scales. A2-2-3. Use Formula 1 to calculate Scale Value 1. Based on all the identified identification scales and the actual distance information represented by the identification scales, obtain an array of Scale Value 1. Formula 1: Scale Value 1 = Scale Actual Distance Information / (Pixel Coordinate of Scale Ending Point - Pixel Coordinate of Scale Starting Point). A2-2-4. Perform a voting process on each Scale Value 1 in the array of Scale Value 1, and take the value with the most votes as the obtained Scale Value 1.

6. The method according to claim 1, characterized in that A3 Including: A3-1. According to the number of pixels in each connected region and the actual area information of the connected region, use Formula 2 to obtain an array of Scale Value 2. Formula 2 is: Scale Value 2 = sqrt(Actual Area Size of Region / Total Number of Pixels in Region). Each connected region is each room region predetermined in the floor plan, and the actual area information of the connected region is the area information of each room in the character information. A3-2. Eliminate the outliers in the array of Scale Value 2, and calculate the average value of the filtered data to obtain Scale Value 2 in the floor plan.

7. The method according to claim 1, characterized in that A4 Including: A4-1. Determine whether both Scale Value 1 and Scale Value 2 are not zero. If Scale Value 1 is zero, then use Scale Value 2 as the final scale value; if Scale Value 2 is zero, then use Scale Value 1 as the final scale value. A4-2. If both Scale Value 1 and Scale Value 2 are not zero, and the error between Scale Value 1 and Scale Value 2 is less than or equal to the preset threshold, then use Scale Value 1 as the final scale value. A4-3. If both Scale Value 1 and Scale Value 2 are not zero, and the error between Scale Value 1 and Scale Value 2 is greater than the preset threshold, then re-obtain Scale Value 1 and repeat the process of A4.

8. The method according to claim 7, characterized in that The re-obtaining of Scale Value 1 includes: Eliminate the values in the array of Scale Value 1 that are equal to the Scale Value 1 used for judgment, obtain a new array of Scale Value 1, and vote to obtain a new Scale Value 1.

9. An electronic device, characterized in that: Including: A memory, a processor, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the method for obtaining the scale value of the floor plan as described in any one of claims 1 to 8 above.

10. A computer-readable storage medium, characterized in that: A computer program is stored on the computer-readable storage medium. When the computer program is executed by the processor, it implements the steps of the method for obtaining the scale value of the floor plan as described in any one of claims 1 to 8 above.