Crack identification method and device based on linear scanning and medium
Through a straight line scanning method, using grayscale images and rotating scanning straight lines in sliding windows, identifying and generating crack areas, solving the problems of light interference and uneven color distribution in the prior art, achieving high accuracy and universality The crack identification reduces labor costs.
Patent Information
- Application Number
- CN202410979494.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-11-15
AI Technical Summary
The existing crack identification method has poor recognition accuracy in the case of uneven light interference and color distribution, and the stability and reliability of deep learning methods depend on the training data set and its application scenarios, and lacks universality and anti-interference ability, resulting in There are gaps in actual industrial field applications.
Using a crack recognition method based on straight line scanning, a sliding window is established by obtaining the pixel mean and variance of the grayscale image, and a sliding window is established and a straight line rotated 360° to scan it. When the preset conditions are met, a crack is determined to exist, and a crack area is generated to avoid light and color. Distribution influence, improve identification accuracy and universality.
It improves the accuracy and anti-interference ability of crack identification, is suitable for different types of scenarios, reduces labor costs, and promotes the engineering process.
Smart Images

Figure CN118968290A_ABST
Abstract
Description
Technical Field
[0001] The present application generally relates to the field of engineering detection technology, and specifically to a crack identification method, device and medium based on linear scanning. Background Art
[0002] With the rapid development of transportation, electricity, construction and other fields, crack detection in power tunnels, ground and walls is of great significance to safe production. Traditional crack recognition methods include image processing recognition, deep learning recognition, photoelectric sensor recognition, etc. However, these devices and methods are not universal and are only applicable to specific occasions. At present, most crack detection in tunnels, ground and walls still relies on manual inspection.
[0003] In addition, the image processing recognition method is easily affected by light interference, the color distribution of the wall image is uneven, and the use of pixel threshold to screen the crack area is easy to introduce walls in weak light areas; the deep learning recognition method is equivalent to a black box model, and its stability and reliability are related to the similarity of the training data set and its application scenario. There is still a gap in its widespread application in actual industrial sites. Therefore, we propose a crack recognition method, equipment and medium based on linear scanning to solve the above problems. Summary of the invention
[0004] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a crack identification method, device and medium based on linear scanning that improves the accuracy of crack identification and enhances versatility and anti-interference performance.
[0005] In a first aspect, the present application provides a crack identification method based on linear scanning, comprising the following steps:
[0006] Obtain a grayscale image corresponding to the engineering site picture, and calculate a first pixel mean and a first pixel variance of the grayscale image;
[0007] Establishing a sliding window, and calculating a second pixel mean and a second pixel variance within the sliding window;
[0008] Establishing a scanning line inside the sliding window;
[0009] The grayscale image is traversed by using the sliding window, and the scanning line is rotated 360° in the sliding window, and the third pixel mean and the third pixel variance corresponding to each rotation of the scanning line are calculated;
[0010] When the third pixel mean, the third pixel variance, the second pixel mean, the second pixel variance, the first pixel mean and the first pixel variance meet a preset condition, it is determined that there is a crack in the current sliding window and the crack coincides with the scanning line, and the center point pixel of the current scanning line is used as the crack pixel point;
[0011] A crack area is generated based on all the crack pixel points.
[0012] According to the technical solution provided in the embodiment of the present application, establishing a scanning line inside the sliding window specifically includes the following steps:
[0013] Obtaining the center point of the sliding window;
[0014] A straight line passing through the center point of the sliding window and extending toward the edge of the sliding window is used as a scanning straight line.
[0015] According to the technical solution provided in the embodiment of the present application, the first pixel mean of the grayscale image is calculated according to the following formula:
[0016] M=(a1+a2+...+a n ) / N;
[0017] Wherein, M is the first pixel mean, a is the first pixel point, n is the number of first pixel points, and N is the total number of first pixel points;
[0018] The first pixel variance of the grayscale image is calculated according to the following formula:
[0019] S=[(a1-M) 2 +(a2-M) 2 +...+(a n -M) 2 ] / N;
[0020] Wherein, S is the first pixel variance.
[0021] According to the technical solution provided in the embodiment of the present application, the third pixel mean of the scanning line is calculated according to the following formula:
[0022] m=(b1+b2+...+b t ) / T;
[0023] Wherein, m is the third pixel mean, b is the third pixel point, t is the number of third pixel points, and T is the total number of third pixel points;
[0024] The third pixel variance of the scan line is calculated according to the following formula:
[0025] l=[(b1-m) 2 +(b2-m)2 +...+(b t -m) 2 ] / T;
[0026] Where l is the third pixel variance.
[0027] According to the technical solution provided in the embodiment of the present application, the third pixel point is determined according to the following steps:
[0028] Taking any vertex of the sliding window as the origin, and taking the extension lines passing through the origin and parallel to two sides adjacent to the sliding window as the X-axis and the Y-axis, a two-dimensional coordinate system is established;
[0029] Obtaining a straight line function of the scanning straight line in the two-dimensional coordinate system;
[0030] According to the rotation angle of the scanning line and the center coordinates of the sliding window;
[0031] The rotation angle and the center coordinates are substituted into the straight line function to calculate and obtain the third pixel point.
[0032] According to the technical solution provided in the embodiment of the present application, the grayscale image is traversed by the sliding window, and the scanning line is rotated 360° within the sliding window, which specifically includes the following steps:
[0033] When the sliding window moves on the grayscale image by a preset width, the scanning line is used to rotate 360° within the current sliding window at a preset angle;
[0034] Repeat the above steps to scan all positions of the grayscale image using the scanning line and the sliding window.
[0035] According to the technical solution provided in the embodiment of the present application, when the third pixel mean, the third pixel variance, the second pixel mean, the second pixel variance, the first pixel mean and the first pixel variance meet the preset conditions, it is determined that there is a crack in the current sliding window, which specifically includes the following steps:
[0036] When the proportion of the third pixel mean to the second pixel mean and the proportion of the third pixel variance to the second pixel variance are both within a preset mutation ratio range, and the second pixel mean is less than the first pixel mean, it is determined that all the pixels in the current sliding window are cracks;
[0037] When the ratio of the third pixel mean to the second pixel mean and / or the ratio of the third pixel variance to the second pixel variance exceeds a first mutation ratio value, it is determined that there are partial cracks in the current sliding window; the first mutation ratio value is greater than the maximum value of the preset mutation ratio range.
[0038] According to the technical solution provided in the embodiment of the present application, obtaining a grayscale image corresponding to the engineering site image specifically includes the following steps:
[0039] Collect pictures of the project site;
[0040] The project site picture is converted into a grayscale image using a weighted average method.
[0041] In a second aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned crack identification method based on linear scanning when executing the computer program.
[0042] In a third aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the crack identification method based on linear scanning as described above are implemented.
[0043] It can be seen from the above technical solution that the present application has at least the following beneficial effects:
[0044] The present application discloses a crack identification method based on linear scanning, which comprises: obtaining a grayscale image corresponding to a project site picture, and calculating a first pixel mean and a first pixel variance of the grayscale image; establishing a sliding window, and calculating a second pixel mean and a second pixel variance in the sliding window; establishing a scanning line inside the sliding window; traversing the grayscale image by using the sliding window, and rotating the scanning line by 360° in the sliding window at the same time, and calculating a third pixel mean and a third pixel variance corresponding to each rotation of the scanning line; when the third pixel mean, the third pixel variance, the second pixel mean, the second pixel variance, the first pixel mean and the first pixel variance meet preset conditions, it is determined that there is a crack in the current sliding window and the crack coincides with the scanning line, and the center point pixel of the current scanning line is used as a crack pixel point; and a crack area is generated based on all crack pixels.
[0045] This application converts the engineering site pictures into grayscale images, and has no requirements for the contrast and light intensity of the engineering site pictures, so as to avoid shadows, uneven color distribution or difficulty in determining thresholds in actual lighting; and uses a sliding window to traverse the grayscale image and scan all positions of the grayscale image. At the same time, a scanning straight line is scanned within the sliding window. Only the scanning straight line within the sliding window that meets the preset conditions coincides with the crack to obtain the crack pixel point, and finally forms a crack area, avoiding interference from a single noise point and improving the accuracy of crack identification; in addition, this method can be applied to crack identification in different types of scenes, has strong versatility and reduces labor costs, thus promoting the engineering process. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Other features, objects and advantages of the present application will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings.
[0047] Figure 1 Schematic diagram of the process of crack identification method based on linear scanning.
[0048] Figure 2 A schematic diagram of the process of determining the third pixel point.
[0049] Figure 3 This is an example of a grayscale image.
[0050] Figure 4 This is an example diagram of a sliding window.
[0051] Figure 5 This is an example diagram of a scan line.
[0052] Figure 6 This is an example of placing the scanned line in a grayscale image.
[0053] Figure 7 for Figure 6 Enlarged view of part g.
[0054] Figure 8 This is an example image where all the sliding windows are cracks.
[0055] Fig. 9 An example of a partial crack in the sliding window.
[0056] Fig.10 This is an example image with no cracks in the sliding window.
[0057] Fig.11 A schematic diagram of the structure of an electronic device.
[0058] Fig.12 This is an example of scanning a straight line to a crack.
[0059] Fig.13 An example of sliding window traversal of a grayscale image.
[0060] Fig.14 An example image of the crack area.
[0061] Numbers in the figure: 500, electronic device; 501, CPU; 502, ROM; 503, RAM; 504, bus; 505, I / O interface; 506, input part; 507, output part; 508, storage part; 509, communication part; 510, drive; 511, removable medium. DETAILED DESCRIPTION
[0062] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.
[0063] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0064] In order to make the description of the following embodiments clear and concise, a brief introduction to the related technology is first given:
[0065] Traditional crack recognition methods based on image processing require preprocessing and are seriously affected by light and environment. Methods based on deep learning are widely used, but they require huge computing power support and a large number of similar images to train network models. In some special fields, photoelectric sensors are used to identify cracks or leaking liquids. However, these devices and methods are not universal and are only applicable to specific occasions.
[0066] In view of this, the present application provides a crack recognition method based on linear scanning to achieve the purpose of improving the accuracy of crack recognition and enhancing versatility and anti-interference.
[0067] In order to make the crack identification method based on linear scanning provided in the embodiment of the present application clearer and easier to understand, the method is introduced below in conjunction with the accompanying drawings. Figure 1 As shown, this figure is a schematic diagram of the process of a crack identification method based on linear scanning provided in an embodiment of the present application, and the method includes:
[0068] S100, obtaining a grayscale image corresponding to the engineering site picture, and calculating a first pixel mean and a first pixel variance of the grayscale image.
[0069] Furthermore, the application obtains a grayscale image corresponding to the project site image, specifically including the following steps:
[0070] Collect pictures of the project site;
[0071] The weighted average method is used to convert the construction site pictures into grayscale images.
[0072] Among them, the construction site pictures can be taken by the inspection robot; the inspection robot can take multiple construction site pictures with local scenes at a certain acquisition frequency during the inspection process, and execute the steps of this application one by one for each construction site picture, and each construction site picture has at least a picture number and a shooting location. According to whether the crack area is identified in the final recognition result, the location of the crack can be quickly known to facilitate later maintenance; the inspection robot can also splice the construction site into a panoramic construction site picture, execute the steps of this application on the construction site picture, and conduct a global search for crack areas. This application uses the weighted average method to convert the construction site picture into a grayscale image, and can also use other conventional conversion methods, such as Figure 3 As shown, this figure is an example of a grayscale image provided in an embodiment of the present application.
[0073] It should be noted that the first pixel mean of the grayscale image is calculated according to the following formula:
[0074] M=(a1+a2+...+a n ) / N;
[0075] Wherein, M is the first pixel mean, a is the first pixel point, n is the number of first pixel points, and N is the total number of first pixel points;
[0076] The first pixel variance of the grayscale image is calculated according to the following formula:
[0077] S=[(a1-M) 2 +(a2-M) 2 +...+(a n -M) 2 ] / N;
[0078] Wherein, S is the first pixel variance.
[0079] S101, establishing a sliding window, and calculating a second pixel mean and a second pixel variance within the sliding window.
[0080] It should be noted that the sliding window can be rectangular in shape, and its specifications are that the window length and window width are both greater than one pixel width, and it is at least 10 times the average width of the detected cracks. It can also be set according to actual needs. For example, if the average width of the crack is 3 pixels, then the specification of the sliding window is 30*30. Figure 4 As shown, Figure 4 Here z is the grayscale image and w is the sliding window.
[0081] Furthermore, the second pixel mean in the sliding window is calculated according to the following formula:
[0082] D=(c1+c2+...+c q ) / Q;
[0083] Wherein, D is the second pixel mean, c is the second pixel point, q is the number of second pixel points, and Q is the total number of second pixel points;
[0084] The second pixel variance within the sliding window is calculated according to the following formula:
[0085]
[0086] Wherein, E is the second pixel variance.
[0087] S102: Establish a scanning line inside the sliding window.
[0088] It should be noted that establishing a scanning line inside the sliding window specifically includes the following steps:
[0089] Get the center point of the sliding window;
[0090] A straight line passing through the center point of the sliding window and extending toward the edge of the sliding window is used as the scanning line.
[0091] Since the actual direction of the crack is randomly generated in 360°, the present application designs a radial scanning line in the sliding window, which can rotate 360° in the sliding window, so that all positions in the sliding window can be scanned. Figure 5 As shown in the figure, u is the scanning line. Figure 6 and Figure 7 As shown, the figure represents the scanning process of the scanning line in the sliding window and grayscale image.
[0092] S103, traversing the grayscale image using a sliding window, and rotating the scanning line 360° in the sliding window, and calculating the third pixel mean and the third pixel variance corresponding to each rotation of the scanning line.
[0093] It should be noted that the grayscale image is traversed by using a sliding window and a scanning line is used to rotate 360° in the sliding window, which specifically includes the following steps:
[0094] When the sliding window moves a preset width on the grayscale image, the scanning line is used to rotate 360° within the current sliding window at a preset angle;
[0095] Repeat the above steps and use the scanning line and sliding window to scan all positions of the grayscale image.
[0096] Here, the preset width is, for example, one pixel width, and its specific value can be set according to actual needs. The preset angle is, for example, 1°, and its specific value can also be set according to actual needs.
[0097] like Fig.13As shown, the present application traverses the grayscale image through a sliding window and scans all positions of the grayscale image. At the same time, a scanning straight line is scanned within the sliding window to avoid interference from a single noise point and improve the accuracy of crack recognition.
[0098] It should be noted that the third pixel mean of the scan line is calculated according to the following formula:
[0099] m=(b1+b2+...+b t ) / T;
[0100] Wherein, m is the third pixel mean, b is the third pixel point, t is the number of third pixel points, and T is the total number of third pixel points;
[0101] The third pixel variance of the scanned line is calculated according to the following formula:
[0102]
[0103] Where l is the third pixel variance.
[0104] Furthermore, if Figure 2 As shown, the third pixel point is determined according to the following steps:
[0105] S10, establishing a two-dimensional coordinate system with any vertex of the sliding window as the origin and with the extension lines passing through the origin and parallel to two sides adjacent to the sliding window as the X-axis and the Y-axis.
[0106] S20, obtaining a straight line function of the scanning line in a two-dimensional coordinate system.
[0107] S30, according to the rotation angle of the scanning line and the center coordinates of the sliding window.
[0108] S40, substituting the rotation angle and the center coordinate into the straight line function to calculate and obtain the third pixel point.
[0109] Here, the straight line function is:
[0110] y=kx+b,k=tan -1 ;
[0111] Among them, y is the vertical coordinate value of the center coordinate, x is the horizontal coordinate value of the center coordinate, k is the rotation angle, and b is the third pixel point.
[0112] Since the sliding window and the scanning line are moving, the position of the sliding window relative to the grayscale image is different, and the corresponding second pixel mean and second pixel variance are different. Similarly, the third pixel mean and third pixel variance of the scanning line are also different.
[0113] S104. When the third pixel mean, the third pixel variance, the second pixel mean, the second pixel variance, the first pixel mean and the first pixel variance meet the preset conditions, it is determined that there is a crack in the current sliding window and the crack coincides with the scanning line, and the center point pixel of the current scanning line is used as the crack pixel point.
[0114] Among them, when the third pixel mean, the third pixel variance, the second pixel mean, the second pixel variance, the first pixel mean and the first pixel variance meet the preset conditions, it is determined that there is a crack in the current sliding window, which specifically includes the following steps:
[0115] When the ratio of the third pixel mean to the second pixel mean, the ratio of the third pixel variance to the second pixel variance are both within the preset mutation ratio range, and the second pixel mean is less than the first pixel mean, it is determined that all the pixels in the current sliding window are cracks, such as Figure 8 This situation indicates that the center point pixels of all scanning lines in the current sliding window are regarded as crack pixels.
[0116] When the ratio of the third pixel mean to the second pixel mean and / or the ratio of the third pixel variance to the second pixel variance exceeds the first mutation ratio value, it is determined that there are partial cracks in the current sliding window, such as Fig. 9 and Fig.12 The first mutation ratio value is greater than the maximum value of the preset mutation ratio range. In addition, the scanning line with the smallest third pixel mean value in the current sliding window is selected as the line coinciding with the crack, and the center point pixel of the scanning line is used as the crack pixel point.
[0117] In addition, when the proportion of the third pixel mean to the second pixel mean, the proportion of the third pixel variance to the second pixel variance are both less than the preset mutation ratio range, and the first pixel mean and the second pixel mean are similar, and the first pixel variance and the second pixel variance are close, it indicates that there is no crack in the current sliding window, such as Fig.10 shown.
[0118] Here, the preset mutation ratio range is, for example, ±20% of the second pixel mean and ±20% of the second pixel variance, which can be set according to actual needs. The preset mutation ratio range is, for example, 40% of the second pixel mean and 40% of the second pixel variance, which can be set according to actual needs.
[0119] S105: Generate a crack area based on all crack pixel points.
[0120] like Fig.14 As shown, the figure shows the final crack area, that is, the crack identification operation at the engineering site can be completed after the above steps.
[0121] This application converts the engineering site pictures into grayscale images, and has no requirements for the contrast and light intensity of the engineering site pictures, so as to avoid shadows, uneven color distribution or difficulty in determining thresholds in actual lighting; and uses a sliding window to traverse the grayscale image and scan all positions of the grayscale image. At the same time, a scanning straight line is scanned within the sliding window. Only the scanning straight line within the sliding window that meets the preset conditions coincides with the crack to obtain the crack pixel point, and finally forms a crack area, avoiding interference from a single noise point and improving the accuracy of crack identification; in addition, this method can be applied to crack identification in different types of scenes, has strong versatility and reduces labor costs, thus promoting the engineering process.
[0122] The present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of a crack identification method based on linear scanning as described in the above embodiment are implemented.
[0123] Among them, Fig.11 As shown, electronic device 500 includes CPU 501, which can perform various appropriate actions and processes according to the program stored in ROM 502 or the program loaded from the storage part into RAM 503. Various programs and data required for system operation are also stored in RAM 503. CPU 501, ROM 502 and RAM 503 are connected to each other through bus 504. I / O interface 505 is also connected to bus 504.
[0124] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0125] In particular, according to the embodiments of the present application, the above reference process Figure 1The described process can be implemented as a computer software program. For example, the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by CPU501, the above-mentioned functions defined in the system of the present application are executed.
[0126] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a RAM (random access memory), a ROM (read-only memory), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0127] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0128] The units involved in the embodiments described in the present application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not constitute limitations on the units themselves under certain circumstances. The units or modules described may also be set in a processor.
[0129] The present application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements a crack identification method based on linear scanning as described in the above embodiment.
[0130] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other.
Claims
1. A crack identification method based on linear scanning, characterized in that: The following steps are involved: Obtain a grayscale image corresponding to the engineering site picture, and calculate a first pixel mean and a first pixel variance of the grayscale image; Establishing a sliding window, and calculating a second pixel mean and a second pixel variance within the sliding window; Establishing a scanning line inside the sliding window; The grayscale image is traversed by using the sliding window, and the scanning line is rotated 360° in the sliding window, and the third pixel mean and the third pixel variance corresponding to each rotation of the scanning line are calculated; When the third pixel mean, the third pixel variance, the second pixel mean, the second pixel variance, the first pixel mean and the first pixel variance meet a preset condition, it is determined that there is a crack in the current sliding window and the crack coincides with the scanning line, and the center point pixel of the current scanning line is used as the crack pixel point; A crack area is generated based on all the crack pixel points.
2. A crack identification method based on linear scanning according to claim 1, characterized in that: Establishing a scanning line inside the sliding window specifically includes the following steps: Obtaining the center point of the sliding window; A straight line passing through the center point of the sliding window and extending toward the edge of the sliding window is used as a scanning straight line.
3. A crack identification method based on linear scanning according to claim 1, characterized in that: The first pixel mean of the grayscale image is calculated according to the following formula: M=(a1+a2+...+a n ) / N; Wherein, M is the first pixel mean, a is the first pixel point, n is the number of first pixel points, and N is the total number of first pixel points; The first pixel variance of the grayscale image is calculated according to the following formula: Wherein, S is the first pixel variance.
4. A crack identification method based on linear scanning according to claim 1, characterized in that: The third pixel mean of the scan line is calculated according to the following formula: m=(b1+b2+...+b t ) / T; Wherein, m is the third pixel mean, b is the third pixel point, t is the number of third pixel points, and T is the total number of third pixel points; The third pixel variance of the scan line is calculated according to the following formula: Where l is the third pixel variance.
5. A crack identification method based on linear scanning according to claim 4, characterized in that: Determine the third pixel point according to the following steps: Taking any vertex of the sliding window as the origin, and taking the extension lines passing through the origin and parallel to two sides adjacent to the sliding window as the X-axis and the Y-axis, a two-dimensional coordinate system is established; Obtaining a straight line function of the scanning straight line in the two-dimensional coordinate system; According to the rotation angle of the scanning line and the center coordinates of the sliding window; The rotation angle and the center coordinates are substituted into the straight line function to calculate and obtain the third pixel point.
6. A crack identification method based on linear scanning according to claim 1, characterized in that: The grayscale image is traversed by the sliding window, and the scanning line is rotated 360° in the sliding window, which specifically includes the following steps: When the sliding window moves on the grayscale image by a preset width, the scanning line is used to rotate 360° within the current sliding window at a preset angle; Repeat the above steps to scan all positions of the grayscale image using the scanning line and the sliding window.
7. The crack identification method based on linear scanning according to claim 1, characterized in that: When the third pixel mean, the third pixel variance, the second pixel mean, the second pixel variance, the first pixel mean and the first pixel variance meet a preset condition, it is determined that there is a crack in the current sliding window, which specifically includes the following steps: When the proportion of the third pixel mean to the second pixel mean and the proportion of the third pixel variance to the second pixel variance are both within a preset mutation ratio range, and the second pixel mean is less than the first pixel mean, it is determined that all the pixels in the current sliding window are cracks; When the ratio of the third pixel mean to the second pixel mean and / or the ratio of the third pixel variance to the second pixel variance exceeds a first mutation ratio value, it is determined that there are partial cracks in the current sliding window; the first mutation ratio value is greater than the maximum value of the preset mutation ratio range.
8. The crack identification method based on linear scanning according to claim 1, characterized in that: Obtaining the grayscale image corresponding to the project site image includes the following steps: Collect pictures of the project site; The project site picture is converted into a grayscale image using a weighted average method.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the crack identification method based on linear scanning as described in any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the crack identification method based on linear scanning as described in any one of claims 1 to 8 are implemented.
