Bathtub residual water area detection method and related equipment

By combining the colored water liquid with the image recognition method, the water accumulation area and connected area at the bottom of the bathtub can be accurately identified, which solves the problem of inaccurate detection in the existing technology and achieves a more reliable detection of the residual water area of ​​the bathtub.

CN118396983BActive Publication Date: 2024-09-10GUANGXUN TESTING (GUANGDONG) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410818874.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-09-10
Estimated Expiration
2044-06-24

AI Technical Summary

Technical Problem

The existing bathtub residual water detection method is difficult to accurately measure the water accumulation area surrounding the protrusion and the connected water lines, resulting in inaccurate detection results.

Method used

Using the colored water liquid combined with image recognition method, by obtaining the non-water area, water accumulation area and the entire bottom photo of the bottom of the bathtub, using the ruler to determine the ratio of the pixel size to the actual size, binary processing and image recognition are performed, and the water accumulation area is calculated area and generate an inspection report.

Benefits of technology

It improves the accuracy of the residual water accumulation area and the reliability of the test report, ensuring the accuracy of the bathtub qualification judgment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118396983B
    Figure CN118396983B
Patent Text Reader

Abstract

The present application belongs to the technical field of bathtub detection, and discloses a bathtub residual water area detection method and related equipment. By using colored water liquid with a color different from that of the bottom of the bathtub to be inspected in combination with an image recognition method for detection, the water accumulation area of ​​the residual water can be more accurately identified, thereby more accurately calculating the water accumulation area of ​​each water accumulation area, improving the reliability of the qualification judgment result, and thus facilitating the acquisition of a reliable detection report.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of bathtub detection, and in particular to a bathtub residual water area detection method and related equipment. Background Art

[0002] Due to design or manufacturing reasons, there are some tiny concave areas at the bottom of the bathtub. When the bathtub is drained, residual water will form in these concave areas. The presence of residual water will cause bacteria to grow, thus affecting the hygiene of the bathtub. Therefore, the residual water area at the bottom of the bathtub needs to be tested before leaving the factory. Among them, there are two conditions for the qualified residual water test of the bathtub. One is that the area of ​​any single water accumulation area does not exceed the single area index, and the other is that the total area of ​​the water accumulation area does not exceed the total area index. At present, in addition to the drainage outlet, some bathtubs are also provided with some protrusions (such as the water spray head of the massage bathtub) at the bottom. It is easy to form a water accumulation area around the protrusions. For such water accumulation areas around the protrusions, the existing detection methods are difficult to accurately measure the actual water accumulation area; sometimes, two or more water accumulation areas are connected by narrow water lines. In fact, these connected areas and the corresponding water lines should be regarded as the same water accumulation area, but the existing detection methods usually measure them as multiple water accumulation areas and ignore the area of ​​the water line itself, resulting in inaccurate detection results and failure to obtain reliable detection reports.

[0003] Therefore, it is necessary to find a detection method that can accurately detect the water accumulation area of ​​the residual water at the bottom of the bathtub, so as to obtain a reliable detection report. Summary of the invention

[0004] The purpose of the present application is to provide a bathtub residual water area detection method and related equipment, which can accurately detect the water accumulation area of ​​the residual water at the bottom of the bathtub so as to obtain a reliable detection report.

[0005] In a first aspect, the present application provides a method for detecting residual water area in a bathtub, comprising the steps of:

[0006] A1. After the colored liquid is drained from the inspected bathtub, a first photograph with the center aligned with the non-water accumulation area of ​​the bottom surface of the inspected bathtub, a second photograph with the center aligned with the water accumulation area of ​​the bottom surface of the inspected bathtub, and a third photograph including the entire bottom surface of the inspected bathtub are obtained; the third photograph includes an image of a ruler placed in the non-water accumulation area of ​​the bottom surface of the inspected bathtub; the color of the colored liquid is different from the color of the bottom surface of the inspected bathtub;

[0007] A2. Determine the proportional relationship between the pixel size and the actual size of the third photo according to the image of the ruler;

[0008] A3. Based on the first photo and the second photo, the third photo is binarized to obtain a binarized photo; the binarized photo includes background pixels and valid pixels corresponding to residual colored water;

[0009] A4. Based on the proportional relationship, an image recognition method is used to identify the area of ​​each connected domain of valid pixels in the binary photo as the area of ​​a single waterlogged area, and the total waterlogged area is calculated based on the area of ​​each single waterlogged area;

[0010] A5. The conformity of the bathtub under inspection is judged based on the area of ​​the single water accumulation region and the total water accumulation area, and a corresponding inspection report is generated based on the judgment result.

[0011] By using colored water that is different from the color of the bottom of the bathtub being tested in combination with image recognition methods, the areas of residual water can be identified more accurately, thereby more accurately calculating the area of ​​water in each area, improving the reliability of the qualification judgment results, and making it easier to obtain a reliable test report.

[0012] Preferably, step A2 comprises:

[0013] A201. Extract pixel coordinates of at least two scale points of the image of the ruler, recorded as first pixel coordinates;

[0014] A202. Calculate the proportional relationship between the pixel size and the actual size of the third photo based on the pixel distance between each of the first pixel coordinates and the actual distance between the corresponding scale points.

[0015] The proportional relationship is calculated using a ruler to ensure the reliability of the calculation result. In addition, the ruler image is included in the third photo. When the test report is subsequently generated, the third photo can be included in the test report, which is conducive to ensuring the credibility of the test report.

[0016] Preferably, step A3 comprises:

[0017] A301. Perform grayscale processing on the first photo, the second photo and the third photo respectively to obtain a first grayscale photo, a second grayscale photo and a third grayscale photo;

[0018] A302. Obtain a first grayscale value representing the color of the bottom of the bathtub under inspection according to the first grayscale photograph, and obtain a second grayscale value representing the color of the water accumulation area according to the second grayscale photograph;

[0019] A303. According to the first grayscale value and the second grayscale value, binarize the third grayscale photo to obtain the binarized photo.

[0020] Preferably, step A303 includes:

[0021] Calculate the average of the first grayscale value and the second grayscale value, and record it as a first grayscale threshold;

[0022] comparing the grayscale value of each pixel of the third grayscale photo with the first grayscale threshold value to divide the pixels of the third grayscale photo into background pixels and candidate pixels;

[0023] According to the grayscale value of each candidate pixel and the second grayscale value, the candidate pixels are divided into background pixels and valid pixels;

[0024] The grayscale value of the background pixel is set to a first preset grayscale value, and the grayscale value of the effective pixel is set to a second preset grayscale value.

[0025] Using the above method to perform binarization processing can ensure that the waterlogged area identification result has a high accuracy.

[0026] Preferably, step A4 comprises:

[0027] A401. Extract pixel coordinates of valid pixels in the binary photo;

[0028] A402. Grouping the effective pixels according to the pixel coordinates of the effective pixels to obtain at least one effective pixel group, so that the pixel distance between any effective pixel in each effective pixel group and at least N other effective pixels in the same effective pixel group is not greater than a preset distance threshold; N is a preset positive integer;

[0029] A403. Taking the effective pixel distribution area of ​​each effective pixel group as the effective pixel connected domain, calculating the area of ​​each effective pixel connected domain according to the proportional relationship as the area of ​​a single water accumulation area;

[0030] A404. Calculate the sum of the areas of the single waterlogged areas to obtain the total waterlogged area.

[0031] Preferably, step A5 comprises:

[0032] A501. If at least one of the single water accumulation areas is larger than the preset single area index, or the total water accumulation area is larger than the preset total area index, the bathtub under inspection is determined to be unqualified; otherwise, the bathtub under inspection is determined to be qualified;

[0033] A502. If the inspected bathtub is qualified, a first inspection report indicating that the inspected bathtub is qualified is generated; otherwise, a second inspection report indicating that the inspected bathtub is unqualified is generated.

[0034] Preferably, the test report includes a qualification judgment result and an annotated image of the third photo; the annotated image includes area labels of water accumulation areas corresponding to each valid pixel connected domain, and the area labels are used to mark the area of ​​a single water accumulation area of ​​the corresponding water accumulation area and the exceeding of the area of ​​the corresponding single water accumulation area.

[0035] In a second aspect, the present application provides a bathtub residual water area detection device, comprising:

[0036] A first acquisition module is used to acquire, after the colored liquid is drained from the inspected bathtub, a first photo centered on the non-water accumulation area of ​​the bottom surface of the inspected bathtub, a second photo centered on the water accumulation area of ​​the bottom surface of the inspected bathtub, and a third photo including the entire bottom surface of the inspected bathtub; the third photo includes an image of a ruler placed on the non-water accumulation area of ​​the bottom surface of the inspected bathtub; the color of the colored liquid is different from the color of the bottom surface of the inspected bathtub;

[0037] a ratio determination module, used to determine the ratio relationship between the pixel size and the actual size of the third photo according to the image of the ruler;

[0038] A binarization module, configured to perform binarization processing on the third photo according to the first photo and the second photo to obtain a binarized photo; the binarized photo includes background pixels and valid pixels corresponding to residual colored liquid;

[0039] an identification module, for identifying the area of ​​each connected domain of valid pixels in the binary photo by using an image recognition method according to the proportional relationship as the area of ​​a single waterlogged area, and calculating the total waterlogged area according to the area of ​​each single waterlogged area;

[0040] The test report generating module is used to judge the eligibility of the tested bathtub according to the area of ​​the single water accumulation area and the total water accumulation area, and to generate a corresponding test report according to the judgment result.

[0041] In a third aspect, the present application provides an electronic device, including a processor and a memory, wherein the memory stores a computer program executable by the processor, and when the processor executes the computer program, it runs the steps in the bathtub residual water area detection method as described above.

[0042] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the bathtub residual water area detection method as described above are executed.

[0043] Beneficial effect: The bathtub residual water area detection method and related equipment provided in the present application utilize colored water liquid of a different color from that of the bottom of the bathtub being inspected in combination with an image recognition method for detection, which can more accurately identify the accumulated water area of ​​the residual water, thereby more accurately calculating the accumulated water area of ​​each accumulated water area, improving the reliability of the qualification judgment results, thereby facilitating obtaining a reliable test report. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 This is a flow chart of a bathtub residual water area detection method provided in an embodiment of the present application.

[0045] Figure 2 A schematic diagram of the structure of a bathtub residual water area detection device provided in an embodiment of the present application.

[0046] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0047] Explanation of reference numerals: 1. First acquisition module; 2. Ratio determination module; 3. Binarization module; 4. Recognition module; 5. Detection report generation module; 301. Processor; 302. Memory; 303. Communication bus. DETAILED DESCRIPTION

[0048] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0049] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0050] Please refer to Figure 1 , Figure 1 A bathtub residual water area detection method in some embodiments of the present application comprises the steps of:

[0051] A1. After the colored liquid is drained from the inspected bathtub, a first photo is taken with the center aligned with the non-water accumulation area of ​​the bottom surface of the inspected bathtub (i.e., the center of the first photo is located at the non-water accumulation area), a second photo is taken with the center aligned with the water accumulation area of ​​the bottom surface of the inspected bathtub (i.e., the center of the second photo is located at the water accumulation area), and a third photo including the entire bottom surface of the inspected bathtub; the third photo includes an image of a ruler placed in the non-water accumulation area of ​​the bottom surface of the inspected bathtub; the color of the colored liquid is different from the color of the bottom surface of the inspected bathtub;

[0052] A2. Determine the proportional relationship between the pixel size and the actual size of the third photo according to the image of the ruler;

[0053] A3. Binarize the third photo according to the first photo and the second photo to obtain a binary photo; the binary photo includes background pixels and valid pixels corresponding to the residual colored liquid (i.e., the colored liquid remaining on the bottom of the bathtub under inspection);

[0054] A4. Based on the proportional relationship, the image recognition method is used to identify the area of ​​each connected domain of valid pixels in the binary photo as the area of ​​a single waterlogged area, and the total waterlogged area is calculated based on the area of ​​each single waterlogged area;

[0055] A5. The conformity of the bathtub under inspection is judged based on the single water accumulation area and the total water accumulation area, and a corresponding test report is generated based on the judgment result.

[0056] By using colored water that is different from the color of the bottom of the bathtub being tested in combination with image recognition methods, the areas of residual water can be identified more accurately, thereby more accurately calculating the area of ​​water in each area, improving the reliability of the qualification judgment results, and making it easier to obtain a reliable test report.

[0057] The colored liquid refers to a water solution with one color. When testing, the color of the colored liquid is selected according to the color of the bottom surface of the tested bathtub, so that the two colors are different. If the bottom surface of the tested bathtub has a protruding structure (such as a sprinkler head or other structure) with a color different from the color of the bottom surface of the tested bathtub, it is also necessary to make the color of the colored liquid different from the color of the protruding structure to avoid the inability to accurately identify the area of ​​the water accumulation area when the protruding structure is surrounded by a single water accumulation area. After the test starts, the colored liquid is first injected into the tested bathtub to cover the entire bottom surface, and then the drain is opened to discharge the colored liquid, and then the first photo, the second photo, and the third photo are taken. The bottom surface of the tested bathtub refers to the lower surface of the water storage cavity of the tested bathtub.

[0058] When taking the first photo, the optical axis of the camera is aimed at the non-water accumulation area; when taking the second photo, the optical axis of the camera is aimed at the water accumulation area. Preferably, in the first photo, the area of ​​the non-water accumulation area accounts for no less than a preset proportion of the total area of ​​the first photo (which can be set according to actual needs, such as 1 / 3, but not limited thereto), and in the second photo, the area of ​​the water accumulation area accounts for no less than a preset proportion of the total area of ​​the second photo, so as to more accurately extract the first gray value representing the color of the bottom of the bathtub being inspected and the second gray value representing the color of the water accumulation area (see step A3 below for details).

[0059] Before taking the third photo, place the ruler in a non-waterlogged area so that there is an appropriate distance between the ruler and the waterlogged area, and then take the third photo.

[0060] Specifically, step A2 includes:

[0061] A201. Extract pixel coordinates of at least two scale points of the ruler image (extracted from the third photo), recorded as first pixel coordinates;

[0062] A202. Calculate the proportional relationship between the pixel size and the actual size of the third photo according to the pixel distance between the first pixel coordinates and the actual distance between the corresponding scale points.

[0063] The proportional relationship is calculated using a ruler to ensure the reliability of the calculation result. In addition, the ruler image is included in the third photo. When the test report is subsequently generated, the third photo can be included in the test report, which is conducive to ensuring the credibility of the test report.

[0064] Among them, at least two scale points are set on the ruler, and the actual distance between the scale points is known. The existing image recognition method can be used to identify the scale points and extract their pixel coordinates (which will not be described in detail here). When only the first pixel coordinates of two scale points are extracted, the pixel spacing of the two first pixel coordinates is calculated, and then the pixel spacing is divided by the actual distance between the two scale points to obtain the proportional relationship between the pixel size and the actual size of the third photo; when more than two scale points are extracted, the pixel spacing between each first pixel coordinate can be calculated, and then the ratio of each pixel spacing to the actual distance between the corresponding two scale points is calculated, recorded as the first ratio, and then the average of all first ratios is calculated to obtain the proportional relationship between the pixel size and the actual size of the third photo.

[0065] The ruler may be transparent (with opaque graduations, such as a glass ruler, but not limited thereto) or opaque.

[0066] When the ruler is opaque, in order to prevent the ruler from affecting the accuracy of identifying the waterlogged area, the image of the ruler may be removed first and then binarized; thus, in some preferred embodiments, after step A2 and before step A3, the following steps are further included:

[0067] A6. Remove the ruler image from the third photo so that the color of the area occupied by the ruler image is the same as the color of the bottom of the bathtub being inspected.

[0068] For example, since the ruler is a standard part, the image matching method can be used to identify the contour line of the ruler image, and then the contour line is offset outward by a preset offset distance (which can be set according to actual needs) to obtain a bias line, and the average pixel value of the pixels between the contour line and the bias line is calculated (since the third photo is an RGB image, the average pixel values ​​of the three channels R, G, and B are calculated respectively), and the pixel values ​​of the contour line and all the pixels inside it are replaced with the average value (the pixel values ​​of the three channels R, G, and B are replaced with the average values ​​of the corresponding channels).

[0069] If the third photo before the image with the scale removed is called the initial third photo, and the third photo after the image with the scale removed is called the third photo with the scale removed, then the third photo with the scale removed is subsequently subjected to binarization processing.

[0070] When the ruler is transparent, in step A3, the initial third photo can be directly binarized.

[0071] Specifically, step A3 includes:

[0072] A301. grayscale the first photo, the second photo and the third photo respectively to obtain a first grayscale photo, a second grayscale photo and a third grayscale photo;

[0073] A302. Obtain a first grayscale value representing the color of the bottom of the bathtub under inspection according to the first grayscale photograph, and obtain a second grayscale value representing the color of the water accumulation area according to the second grayscale photograph;

[0074] A303. Perform binarization processing on the third grayscale photo according to the first grayscale value and the second grayscale value to obtain a binarized photo.

[0075] Among them, grayscale processing is an existing technology and will not be described in detail here.

[0076] Wherein, in some embodiments, step A302 includes: calculating the average grayscale value of pixels in the preset feature area of ​​the first grayscale photo as the first grayscale value, and calculating the average grayscale value of pixels in the preset feature area of ​​the second grayscale photo as the second grayscale value; wherein the preset feature area refers to an area of ​​a preset shape and size centered on the center point of the photo (for example, a circular area of ​​a preset pixel radius, but not limited thereto). Wherein, the size of the preset feature area can be set according to actual needs. Preferably, the area of ​​the preset feature area accounts for no more than 60% of the aforementioned preset proportion in the total area of ​​the corresponding photo, which is conducive to ensuring that the probability that the preset feature areas of the first grayscale photo are all non-waterlogged areas is sufficiently high, and the probability that the preset feature areas of the second grayscale photo are all waterlogged areas is sufficiently high.

[0077] Among them, the preset feature area can also be divided into multiple sub-feature areas from the inside to the outside, and a weight value is pre-assigned to each sub-feature area. From the inside to the outside, the weight value of each sub-feature area gradually decreases. In step A302, the average grayscale value of the pixels of each sub-feature area in the preset feature area of ​​the first grayscale photo is calculated respectively, recorded as the first average grayscale value, and then the weighted average of the first average grayscale values ​​of each sub-feature area in the preset feature area is calculated as the first grayscale value; the average grayscale value of the pixels of each sub-feature area in the preset feature area of ​​the second grayscale photo is calculated respectively, recorded as the second average grayscale value, and then the weighted average of the second average grayscale values ​​of each sub-feature area in the preset feature area is calculated as the second grayscale value. For the first grayscale photo, since the probability that all sub-feature areas closer to the center of the photo belong to non-water accumulation areas is greater, the larger the weight value is, the first grayscale value finally calculated can be closer to the standard grayscale value corresponding to the color of the bottom surface of the bathtub being inspected; similarly, the second grayscale value finally calculated can be closer to the standard grayscale value corresponding to the actual color of the water accumulation area. It is more conducive to improving the accuracy of the water accumulation area recognition result.

[0078] It should be noted that, since the depth of the residual water is not large, part of the light will pass through the residual water and be reflected by the bottom of the bathtub under inspection. Therefore, in the third photo, the color of the residual water is actually a mixture of the color of the bottom of the bathtub under inspection and the color of the colored water itself. Therefore, the second grayscale value can only represent the color of the accumulated water area, rather than the color of the colored water. Therefore, if the known color of the colored water itself is directly used to identify the accumulated water area, it is easy to cause inaccurate recognition results.

[0079] Wherein, step A303 includes:

[0080] Calculate the average of the first grayscale value and the second grayscale value, and record it as the first grayscale threshold;

[0081] comparing the grayscale value of each pixel of the third grayscale photo with the first grayscale threshold value to divide the pixels of the third grayscale photo into background pixels and candidate pixels;

[0082] According to the gray value and the second gray value of each candidate pixel, the candidate pixels are divided into background pixels and valid pixels;

[0083] The grayscale value of the background pixel is set to a first preset grayscale value, and the grayscale value of the effective pixel is set to a second preset grayscale value.

[0084] Since the bottom of the inspected bathtub may have a raised structure whose color is different from the bottom color of the bathtub when it is inspected, the candidate pixels may include pixels of the raised structure. Therefore, the candidate pixels need to be divided again to divide the pixels of the raised structure into background pixels. The remaining valid pixels are the pixels of residual water. The binarization process using the above method can ensure that the recognition result of the water accumulation area has a high accuracy.

[0085] Specifically, comparing the grayscale value of each pixel of the third grayscale photo with the first grayscale threshold to divide the pixels of the third grayscale photo into background pixels and candidate pixels includes:

[0086] If the first grayscale value is greater than the second grayscale value, the pixels in the third grayscale photo whose grayscale values ​​are greater than or equal to the first grayscale threshold are classified as background pixels, and the pixels in the third grayscale photo whose grayscale values ​​are less than the first grayscale threshold are classified as candidate pixels;

[0087] If the first grayscale value is less than the second grayscale value, the pixels in the third grayscale photo whose grayscale values ​​are less than or equal to the first grayscale threshold are classified as background pixels, and the pixels in the third grayscale photo whose grayscale values ​​are greater than the first grayscale threshold are classified as candidate pixels.

[0088] Specifically, according to the grayscale value and the second grayscale value of each candidate pixel, the candidate pixels are divided into background pixels and valid pixels, including:

[0089] Obtaining a grayscale range of grayscale values ​​of candidate pixels (the lower limit value of which is the minimum grayscale value of the candidate pixels, and the upper limit value of which is the maximum grayscale value of the candidate pixels);

[0090] Divide the grayscale range into multiple range segments, and count the number of candidate pixels in each range segment;

[0091] Calculate the ratio of the number of candidate pixels in each range segment to the total number of candidate pixels as the weighted value of each range segment;

[0092] Assign the weighted value of each range segment to all candidate pixels within the corresponding range segment, and calculate the weighted sum of all candidate pixels as the second grayscale threshold;

[0093] If the second grayscale value is less than or equal to the second grayscale threshold, classify the candidate pixels whose grayscale values ​​are less than or equal to the second grayscale threshold as valid pixels, and classify the other candidate pixels as background pixels;

[0094] If the second grayscale value is greater than the second grayscale threshold, the candidate pixels whose grayscale values ​​are greater than the second grayscale threshold are classified as valid pixels, and the other candidate pixels are classified as background pixels.

[0095] The first preset grayscale value and the second preset grayscale value can be set according to actual needs. For example, the first preset grayscale value is 255 and the second preset grayscale value is 0, that is, the effective pixels are black and the background pixels are white, but not limited thereto.

[0096] In some embodiments, step A4 comprises:

[0097] A401. Extract pixel coordinates of valid pixels in the binary photo;

[0098] A402. Grouping each effective pixel according to the pixel coordinates of the effective pixel to obtain at least one effective pixel group, so that the pixel distance between any effective pixel in each effective pixel group and at least N other effective pixels in the same effective pixel group is not greater than a preset distance threshold (which can be set according to actual needs); N is a preset positive integer (which can be set according to actual needs);

[0099] A403. Taking the effective pixel distribution area of ​​each effective pixel group as the effective pixel connected domain, the area of ​​each effective pixel connected domain is calculated according to the proportional relationship (the proportional relationship between the pixel size of the third photo and the actual size) as the area of ​​a single water accumulation area;

[0100] A404. Calculate the sum of the areas of individual waterlogged areas to obtain the total waterlogged area.

[0101] In step A402, any valid pixel can be used as a starting pixel to construct a new valid pixel group for the starting pixel, and the starting pixel is added to the new valid pixel group, and then the pixel distance between the remaining valid pixels and each valid pixel in the new valid pixel group is calculated. If there are remaining valid pixels whose pixel distances to at least N valid pixels in the new valid pixel group are not greater than a preset distance threshold (remaining valid pixels refer to valid pixels that have not been added to any valid pixel group), then the corresponding remaining valid pixels are added to the new valid pixel group, thereby traversing all valid pixels; then any remaining valid pixel is used as a starting pixel to repeat the above process until all valid pixels are grouped. In the above manner, the residual water area connected by a narrow water line can be identified as the same water accumulation area, thereby ensuring the accuracy of the detection result.

[0102] Among them, in step A403, the existing area recognition method can be used to calculate the area of ​​a single water accumulation area, or the area of ​​a single water accumulation area can be calculated according to the following formula: S=s / (n*n), wherein S is the area of ​​a single water accumulation area, s is the number of valid pixels in the valid pixel connected domain (that is, the number of valid pixels of the corresponding valid pixel group), and n is the proportional relationship between the pixel size of the third photo and the actual size.

[0103] Specifically, step A5 includes:

[0104] A501. If at least one single water accumulation area is larger than the preset single area index, or the total water accumulation area is larger than the preset total area index, the bathtub under inspection is judged to be unqualified; otherwise, the bathtub under inspection is judged to be qualified;

[0105] A502. If the bathtub under inspection is qualified, a first inspection report indicating that the bathtub under inspection is qualified is generated; otherwise, a second inspection report indicating that the bathtub under inspection is unqualified is generated.

[0106] When generating a test report, a preset first test report template may be used to generate the first test report, or a preset second test report template may be used to generate the second test report. Specific report items of the first test report template and the second test report template may be set according to actual needs.

[0107] Generally, the inspection report includes the qualification judgment result and the annotated image of the third photo (i.e., the image obtained by annotating on the initial third photo); the annotated image includes the area label of the waterlogged area corresponding to each valid pixel connected domain, and the area label is used to mark the area of ​​a single waterlogged area of ​​the corresponding waterlogged area and the exceeding of the area of ​​the corresponding single waterlogged area.

[0108] Thus, step A502 includes:

[0109] If the bathtub under inspection is qualified, the preset first inspection report template is called; if the bathtub under inspection is unqualified, the preset second inspection report template is called;

[0110] Generate qualification judgment result information indicating that the test is unqualified or generate qualification judgment result information indicating that the test is qualified according to the test result, and add it to the corresponding filling position in the called test report template;

[0111] Generate area labels of water accumulation areas corresponding to connected domains of each effective pixel on the initial third photo to obtain a labeled image, and add the labeled image to the corresponding image adding position in the called detection report template.

[0112] Among them, the area label includes a label box and a label value. The label box of the area label can be the minimum circumscribed rectangular box corresponding to a single waterlogged area, or it can be the contour line corresponding to a single waterlogged area. The label value of the area label is the area of ​​the single waterlogged area corresponding to the single waterlogged area.

[0113] Wherein, the single waterlogging area with an area exceeding the standard and the single waterlogging area with an area not exceeding the standard can be distinguished by using area labels of different colors, so that the step of generating area labels of each effective pixel connected domain corresponding to the waterlogging area on the initial third photo includes: if the area of ​​a single waterlogging area corresponding to the waterlogging area of ​​an effective pixel connected domain exceeds the standard, then generating an area label of a first preset color for the waterlogging area corresponding to the effective pixel connected domain, otherwise, generating an area label of a second preset color for the waterlogging area corresponding to the effective pixel connected domain. Wherein, the first preset color and the second preset color can be set according to actual needs, for example, the first preset color is red, and the second preset color is green, but it is not limited thereto.

[0114] Among them, when the inspected bathtub is unqualified and the reason for the unqualified includes that the area of ​​a single water accumulation area exceeds the standard, it is also necessary to report the situation of the single water accumulation area exceeding the standard in the inspection report, so step A502 also includes: if the reason for the unqualified bathtub includes that the area of ​​a single water accumulation area exceeds the standard, then the water accumulation areas with each single water accumulation area exceeding the standard are numbered in the annotated image, and according to the numbering result, the first report information containing the single water accumulation area area and the degree of exceeding the standard corresponding to each water accumulation area with each single water accumulation area exceeding the standard is generated (for example, the format of the first report information is that the single water accumulation area area of ​​water accumulation area No. X is S, and the degree of exceeding the standard is P1, where X is the number, P1 is the degree of exceeding the standard of the single water accumulation area area, and P1 is equal to the percentage of the difference between the single water accumulation area area and the single area index in the single area index, but not limited to this), and added to the corresponding filling position in the called inspection report template.

[0115] Among them, when numbering the waterlogged areas with areas exceeding the standard, the waterlogged areas with areas exceeding the standard can be randomly sorted, and the numbers of the waterlogged areas with areas exceeding the standard are generated according to the sorting results; and the numbers of the waterlogged areas with areas exceeding the standard are added to the center or side of the corresponding annotation box in the annotation image.

[0116] Among them, when the inspected bathtub is unqualified and the reason for the failure includes that the total water accumulation area exceeds the standard, the total water accumulation area situation also needs to be reported in the inspection report, so step A502 also includes: if the reason for the unqualified bathtub under inspection includes that the total water accumulation area exceeds the standard, then generate a second report information including the total water accumulation area and the degree of exceeding the total water accumulation area (for example, the format of the second report information is that the total water accumulation area is z, and the degree of exceeding the total water accumulation area is P2, where P2 is equal to the difference between the total water accumulation area and the total area index as a percentage of the total area index, but not limited to this), and add it to the corresponding filling position in the called inspection report template.

[0117] Generating a test report in the above manner can help manufacturers understand the reasons for non-compliance and the distribution of water accumulation more intuitively, and help manufacturers to make more targeted improvements to design plans or production processes.

[0118] As can be seen from the above, the method for detecting the residual water area of ​​the bathtub is to obtain, after the colored water is drained from the inspected bathtub, a first photo with the center aligned with the non-water accumulation area of ​​the bottom surface of the inspected bathtub, a second photo with the center aligned with the water accumulation area of ​​the bottom surface of the inspected bathtub, and a third photo including the entire bottom surface of the inspected bathtub; the third photo includes an image of a ruler placed in the non-water accumulation area of ​​the bottom surface of the inspected bathtub; the color of the colored water is different from the color of the bottom surface of the inspected bathtub; the proportional relationship between the pixel size of the third photo and the actual size is determined according to the image of the ruler; the third photo is imaged according to the first photo and the second photo. A binarization process is performed to obtain a binary photo; the binary photo includes background pixels and effective pixels corresponding to residual colored water; according to the proportional relationship, an image recognition method is used to identify the area of ​​each connected domain of effective pixels in the binary photo as the area of ​​a single water accumulation area, and the total water accumulation area is calculated according to the area of ​​each single water accumulation area; the conformity of the inspected bathtub is judged according to the area of ​​the single water accumulation area and the total water accumulation area, and a corresponding test report is generated according to the judgment result; thereby, the water accumulation area of ​​the residual water at the bottom of the bathtub can be accurately detected, so as to obtain a reliable test report.

[0119] refer to Figure 2 The present application provides a bathtub residual water area detection device, comprising:

[0120] A first acquisition module 1 is used to acquire, after the colored liquid is drained from the inspected bathtub, a first photo centered on the non-water accumulation area of ​​the bottom surface of the inspected bathtub, a second photo centered on the water accumulation area of ​​the bottom surface of the inspected bathtub, and a third photo including the entire bottom surface of the inspected bathtub; the third photo includes an image of a ruler placed on the non-water accumulation area of ​​the bottom surface of the inspected bathtub; the color of the colored liquid is different from the color of the bottom surface of the inspected bathtub (refer to step A1 above for details);

[0121] Ratio determination module 2, used to determine the ratio between the pixel size and the actual size of the third photo according to the image of the ruler (refer to step A2 above for details);

[0122] Binarization module 3, used for binarizing the third photo according to the first photo and the second photo to obtain a binarized photo; the binarized photo includes background pixels and valid pixels corresponding to the residual colored liquid (refer to step A3 above for details);

[0123] Identification module 4, used to identify the area of ​​each connected domain of valid pixels in the binary photo according to the proportional relationship by using an image recognition method as the area of ​​a single waterlogged area, and calculate the total waterlogged area according to the area of ​​each single waterlogged area (for details, refer to step A4 above);

[0124] The test report generating module 5 is used to judge the eligibility of the bathtub under test according to the area of ​​the single water accumulation area and the total water accumulation area, and to generate a corresponding test report according to the judgment result (refer to the above step A5 for details).

[0125] The ruler may be transparent (with opaque graduations, such as a glass ruler, but not limited thereto) or opaque.

[0126] When the ruler is opaque, in order to prevent the ruler from affecting the accuracy of water accumulation area recognition, the image of the ruler can be removed first and then binarized; thus, in some preferred embodiments, the bathtub residual water area detection device further includes:

[0127] The removal module is used to remove the image of the ruler from the third photo so that the color of the area occupied by the image of the ruler is the same as the color of the bottom surface of the inspected bathtub.

[0128] For example, since the ruler is a standard part, the image matching method can be used to identify the contour line of the ruler image, and then the contour line is offset outward by a preset offset distance (which can be set according to actual needs) to obtain a bias line, and the average pixel value of the pixels between the contour line and the bias line is calculated (since the third photo is an RGB image, the average pixel values ​​of the three channels R, G, and B are calculated respectively), and the pixel values ​​of the contour line and all the pixels inside it are replaced with the average value (the pixel values ​​of the three channels R, G, and B are replaced with the average values ​​of the corresponding channels).

[0129] If the third photo before the scale is removed is called the initial third photo, and the third photo after the scale is removed is called the scale-removed third photo, then the binarization module 3 performs binarization processing on the scale-removed third photo.

[0130] When the ruler is transparent, the binarization module 3 can directly perform binarization processing on the initial third photo.

[0131] Please refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The present application provides an electronic device, including: a processor 301 and a memory 302. The processor 301 and the memory 302 are interconnected and communicate with each other through a communication bus 303 and / or other forms of connection mechanisms (not shown). The memory 302 stores a computer program executable by the processor 301. When the electronic device is running, the processor 301 executes the computer program to execute the bathtub residual water area detection method in any optional implementation of the above embodiment to achieve the following functions: after the colored water is drained from the inspected bathtub, a first photo of the non-water accumulation area centered on the bottom surface of the inspected bathtub, a second photo of the water accumulation area centered on the bottom surface of the inspected bathtub, and a second photo of the entire bottom surface of the inspected bathtub are obtained. a third photograph of the bathtub under test; the third photograph includes an image of a ruler placed in a non-water accumulation area on the bottom of the bathtub under test; the color of the colored water is different from the color of the bottom of the bathtub under test; the proportional relationship between the pixel size and the actual size of the third photograph is determined based on the image of the ruler; the third photograph is binarized based on the first photograph and the second photograph to obtain a binarized photograph; the binarized photograph includes background pixels and valid pixels corresponding to the residual colored water; based on the proportional relationship, an image recognition method is used to identify the area of ​​each connected domain of valid pixels in the binarized photograph as the area of ​​a single water accumulation area, and the total water accumulation area is calculated based on the area of ​​each single water accumulation area; the qualifiedness of the bathtub under test is judged based on the area of ​​the single water accumulation area and the total water accumulation area, and a corresponding test report is generated based on the judgment result.

[0132] The embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for detecting the residual water area of ​​a bathtub in any optional implementation of the above embodiment is executed to achieve the following functions: after the colored water is drained from the inspected bathtub, a first photo with the center aligned with the non-water accumulation area of ​​the bottom surface of the inspected bathtub, a second photo with the center aligned with the water accumulation area of ​​the bottom surface of the inspected bathtub, and a third photo including the entire bottom surface of the inspected bathtub are obtained; the third photo includes an image of a ruler placed in the non-water accumulation area of ​​the bottom surface of the inspected bathtub; the color of the colored water is different from the color of the bottom surface of the inspected bathtub. ; Determine the proportional relationship between the pixel size and the actual size of the third photo according to the image of the ruler; Binarize the third photo according to the first photo and the second photo to obtain a binary photo; The binary photo includes background pixels and valid pixels corresponding to the residual colored liquid; According to the proportional relationship, use the image recognition method to identify the area of ​​each connected domain of valid pixels in the binary photo as the area of ​​a single water accumulation area, and calculate the total water accumulation area according to the area of ​​each single water accumulation area; Make a qualification judgment on the bathtub under inspection according to the area of ​​the single water accumulation area and the total water accumulation area, and generate a corresponding test report according to the judgment result. Among them, the computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0133] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0134] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0135] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0136] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0137] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for detecting residual water area in a bathtub, characterized in that: Includes steps: A1. After the colored liquid is drained from the inspected bathtub, a first photograph with the center aligned with the non-water accumulation area of ​​the bottom surface of the inspected bathtub, a second photograph with the center aligned with the water accumulation area of ​​the bottom surface of the inspected bathtub, and a third photograph including the entire bottom surface of the inspected bathtub are obtained; the third photograph includes an image of a ruler placed in the non-water accumulation area of ​​the bottom surface of the inspected bathtub; the color of the colored liquid is different from the color of the bottom surface of the inspected bathtub; A2. Determine the proportional relationship between the pixel size and the actual size of the third photo according to the image of the ruler; A3. Based on the first photo and the second photo, the third photo is binarized to obtain a binarized photo; the binarized photo includes background pixels and valid pixels corresponding to residual colored water; A4. Based on the proportional relationship, an image recognition method is used to identify the area of ​​each connected domain of valid pixels in the binary photo as the area of ​​a single waterlogged area, and the total waterlogged area is calculated based on the area of ​​each single waterlogged area; A5. Make a qualification judgment on the bathtub under inspection according to the area of ​​the single water accumulation area and the total water accumulation area, and generate a corresponding inspection report according to the judgment result; Step A3 includes: A301. Perform grayscale processing on the first photo, the second photo and the third photo respectively to obtain a first grayscale photo, a second grayscale photo and a third grayscale photo; A302. Obtain a first grayscale value representing the color of the bottom of the bathtub under inspection according to the first grayscale photograph, and obtain a second grayscale value representing the color of the water accumulation area according to the second grayscale photograph; A303. Binarize the third grayscale photo according to the first grayscale value and the second grayscale value to obtain the binary photo; Step A303 includes: Calculate the average of the first grayscale value and the second grayscale value, and record it as a first grayscale threshold; comparing the grayscale value of each pixel of the third grayscale photo with the first grayscale threshold value to divide the pixels of the third grayscale photo into background pixels and candidate pixels; According to the grayscale value of each candidate pixel and the second grayscale value, the candidate pixels are divided into background pixels and valid pixels; Setting the grayscale value of the background pixel to a first preset grayscale value, and setting the grayscale value of the valid pixel to a second preset grayscale value; Step A4 includes: A401. Extract pixel coordinates of valid pixels in the binary photo; A402. Grouping the effective pixels according to the pixel coordinates of the effective pixels to obtain at least one effective pixel group, so that the pixel distance between any effective pixel in each effective pixel group and at least N other effective pixels in the same effective pixel group is not greater than a preset distance threshold; N is a preset positive integer; A403. Taking the effective pixel distribution area of ​​each effective pixel group as the effective pixel connected domain, calculating the area of ​​each effective pixel connected domain according to the proportional relationship as the area of ​​a single water accumulation area; A404. Calculate the sum of the areas of the single waterlogged areas to obtain the total waterlogged area.

2. The bathtub residual water area detection method according to claim 1, characterized in that: Step A2 includes: A201. Extract pixel coordinates of at least two scale points of the image of the ruler, recorded as first pixel coordinates; A202. Calculate the proportional relationship between the pixel size and the actual size of the third photo based on the pixel distance between each of the first pixel coordinates and the actual distance between the corresponding scale points.

3. The bathtub residual water area detection method according to claim 1, characterized in that: Step A5 includes: A501. If at least one of the single water accumulation areas is larger than the preset single area index, or the total water accumulation area is larger than the preset total area index, the bathtub under inspection is determined to be unqualified; otherwise, the bathtub under inspection is determined to be qualified; A502. If the inspected bathtub is qualified, a first inspection report indicating that the inspected bathtub is qualified is generated; otherwise, a second inspection report indicating that the inspected bathtub is unqualified is generated.

4. The bathtub residual water area detection method according to claim 1, characterized in that: The test report includes the qualification judgment result and the annotated image of the third photo; the annotated image includes the area label of the water accumulation area corresponding to each valid pixel connected domain, and the area label is used to mark the area of ​​a single water accumulation area of ​​the corresponding water accumulation area and the exceeding of the area of ​​the corresponding single water accumulation area.

5. A bathtub residual water area detection device, characterized in that: include: A first acquisition module is used to acquire, after the colored liquid is drained from the inspected bathtub, a first photo centered on the non-water accumulation area of ​​the bottom surface of the inspected bathtub, a second photo centered on the water accumulation area of ​​the bottom surface of the inspected bathtub, and a third photo including the entire bottom surface of the inspected bathtub; the third photo includes an image of a ruler placed on the non-water accumulation area of ​​the bottom surface of the inspected bathtub; the color of the colored liquid is different from the color of the bottom surface of the inspected bathtub; a ratio determination module, configured to determine a ratio relationship between a pixel size and an actual size of the third photo according to the image of the ruler; A binarization module, configured to perform binarization processing on the third photo according to the first photo and the second photo to obtain a binarized photo; the binarized photo includes background pixels and valid pixels corresponding to residual colored liquid; an identification module, for identifying the area of ​​each connected domain of valid pixels in the binary photo by using an image recognition method according to the proportional relationship as the area of ​​a single waterlogged area, and calculating the total waterlogged area according to the area of ​​each single waterlogged area; A test report generating module, used for judging the eligibility of the bathtub under inspection according to the area of ​​the single water accumulation area and the total water accumulation area, and generating a corresponding test report according to the judgment result; When the binarization module performs binarization processing on the third photo according to the first photo and the second photo to obtain a binarized photo, the following steps are performed: A301. Perform grayscale processing on the first photo, the second photo and the third photo respectively to obtain a first grayscale photo, a second grayscale photo and a third grayscale photo; A302. Obtain a first grayscale value representing the color of the bottom of the bathtub under inspection according to the first grayscale photograph, and obtain a second grayscale value representing the color of the water accumulation area according to the second grayscale photograph; A303. Binarize the third grayscale photo according to the first grayscale value and the second grayscale value to obtain the binary photo; Step A303 includes: Calculate the average of the first grayscale value and the second grayscale value, and record it as a first grayscale threshold; comparing the grayscale value of each pixel of the third grayscale photo with the first grayscale threshold value to divide the pixels of the third grayscale photo into background pixels and candidate pixels; According to the grayscale value of each candidate pixel and the second grayscale value, the candidate pixels are divided into background pixels and valid pixels; Setting the grayscale value of the background pixel to a first preset grayscale value, and setting the grayscale value of the valid pixel to a second preset grayscale value; When the recognition module recognizes the area of ​​each connected domain of valid pixels in the binary photo using an image recognition method according to the proportional relationship as the area of ​​a single waterlogged area, and calculates the total waterlogged area according to the area of ​​each single waterlogged area, the following is executed: A401. Extract pixel coordinates of valid pixels in the binary photo; A402. Grouping the effective pixels according to the pixel coordinates of the effective pixels to obtain at least one effective pixel group, so that the pixel distance between any effective pixel in each effective pixel group and at least N other effective pixels in the same effective pixel group is not greater than a preset distance threshold; N is a preset positive integer; A403. Taking the effective pixel distribution area of ​​each effective pixel group as the effective pixel connected domain, calculating the area of ​​each effective pixel connected domain according to the proportional relationship as the area of ​​a single water accumulation area; A404. Calculate the sum of the areas of the single waterlogged areas to obtain the total waterlogged area.

6. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores a computer program executable by the processor, and when the processor executes the computer program, the steps in the bathtub residual water area detection method according to any one of claims 1 to 4 are executed.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the bathtub residual water area detection method as claimed in any one of claims 1 to 4 are executed.

Citation Information

Patent Citations

  • Automatic water-meter detection system based on image processing and image processing method thereof

    CN108491844A

  • Drinking spring water suspended matter detection method

    CN110726720A

  • Defect detection method and device for sandwich biscuit and storage medium

    CN113610776A

  • Underwater dam surface defect measuring method based on acoustics

    CN116862973A

  • Automatic water area segmentation method and device for SAR image of complex terrain

    EP2816529A2