Stain detection method for linen washing

By dividing the image to be detected into areas and calculating the initial threshold value according to the grayscale value characteristics of the stain and the regularity of the connection domain, the problem of incomplete stain segmentation in the iterative threshold segmentation algorithm is solved, and more efficient stain detection is achieved.

CN119810101AActive Publication Date: 2025-04-11陕西金河洗涤有限公司

Patent Information

Application Number
CN202510293240.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-13
Publication Date
2025-04-11
Estimated Expiration
2045-03-13

AI Technical Summary

Technical Problem

The existing iterative threshold segmentation algorithm is incomplete or oversegmented in linen washing due to inaccurate initial threshold selection in linen washing, which affects the accuracy of stain detection and algorithm efficiency.

Method used

The image to be detected is divided into several areas, and the characteristic values of each area are obtained according to the grayscale value characteristics of the stain and the regularity of the connection domain. The initial threshold is calculated by weighted summing to avoid the influence of the shadowed area and improve the accuracy of stain defect detection.

Benefits of technology

Accurate segmentation of stain defects with different gray values is achieved, the accuracy of stain detection and algorithm efficiency are improved, and misjudgment of shadowed areas is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810101A_ABST
    Figure CN119810101A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to a stain detection method for linen washing, and the method comprises the steps: collecting a standard image and a to-be-detected image, dividing the to-be-detected image into a plurality of regions according to the size of the standard image, and obtaining the feature value of each region; the regularity of each connected domain of each region is obtained, the characteristic value of each region is corrected, the probability that each region contains stain defects is obtained, then target regions are obtained, the initial threshold value of each target region is obtained, the weight of the initial threshold value of each target region is obtained, and the weight of the initial threshold value of each target region is obtained; and according to the weight of the initial threshold value of each target area, performing weighted summation on the initial threshold value of each target area to obtain the initial threshold value of the to-be-detected image, and according to the initial threshold value of the to-be-detected image, segmenting out the stain area, thereby improving the accuracy of stain detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and more specifically, to a stain detection method for linen washing. Background Art

[0002] Linen washing refers to the process of cleaning various textiles used in hotels, restaurants and other places to keep them clean, hygienic and in good condition for use. However, the contamination status of textiles is unknown, so it is necessary to detect stains in textiles.

[0003] When the iterative threshold segmentation algorithm is used to detect the stain area in the image to be detected, the average of the maximum grayscale value and the minimum grayscale value in the image to be detected is used as the initial threshold to detect the stain area in the image to be detected. However, due to the various stains on textiles, the grayscale values ​​of different stain areas are different, and when the textile is uneven, it will also cause the existence of shadow areas in the collected image to be detected. The grayscale value of the shadow area is similar to the stain area. Therefore, the average of the maximum grayscale value and the minimum grayscale value in the image to be detected is directly used as the initial threshold to segment the stain area in the image to be detected. It is very likely that some stain areas with unclear grayscale values ​​will be misjudged as normal textile areas, resulting in incomplete stain segmentation, or the shadow area will be misjudged as the stain area, resulting in over-segmentation, which interferes with the accurate identification of stains. In addition, the inaccurate initial threshold will require more iterations for the iterative threshold segmentation algorithm to converge to a better threshold, resulting in low algorithm efficiency. Summary of the invention

[0004] In order to solve the problem that the initial threshold of the iterative threshold segmentation algorithm is used to segment the stain area in the image to be detected, it is likely to misjudge some stain areas with unclear gray values ​​as normal textile areas, resulting in incomplete stain segmentation, the present invention proposes a stain detection method for linen washing, the method comprising the following steps: Collecting a standard image and an image to be detected, and dividing the image to be detected into several areas according to the size of the standard image; Get the probability of each area containing stain defects , represents the probability of containing stain defects in the i-th region; represents the eigenvalue of the i-th region; Represents the sum of the number of corner points of all connected domains in the i-th region; Represents the number of connected domains in the i-th region; Representing the regularity of the kth connected domain of the ith region; obtaining each target region according to the probability of containing the stain defect; Get the initial threshold of the image to be detected ; Represents the number of target areas of the image to be detected; Represents the initial threshold of the u-th target area of ​​the image to be detected; Represents the weight of the initial threshold of the u-th target area of ​​the image to be detected; according to the initial threshold of the image to be detected, the stain area is segmented.

[0005] The innovation of the present invention lies in dividing the image to be detected into several areas, obtaining the characteristic value of each area according to the gray value characteristics of the stain, and then obtaining the regularity of each connected domain in each area according to the distinguishing features of the stain defect and the shadow, correcting the characteristic value of each area, and obtaining the probability of each area containing the stain defect, and then obtaining the target area, avoiding the influence of the shadow area on the selection of the initial threshold, and finally obtaining the weight of the initial threshold of each target area according to the gray value characteristics in each target area, and performing weighted summation on the initial threshold of each target area to obtain the initial threshold of the image to be detected, so that the stain defects with different gray values ​​can be segmented out later to obtain accurate stain defects.

[0006] Preferably, obtaining the characteristic value of the i-th region includes: Get the gray value set of the i-th area; ; In the formula, represents the eigenvalue of the i-th region; Represents the standard deviation of the grayscale values ​​of all pixels in the i-th region; Represents the number of pixels in the standard image with the j-th gray value in the gray value set of the i-th region; Represents the number of pixels in the i-th region with the j-th grayscale value in the i-th region’s grayscale value set; || represents the absolute value symbol; Represents the number of grayscale value types in the grayscale value set of the i-th region; Represents the difference between the standard image and the grayscale mean of the i-th region.

[0007] The area with a larger eigenvalue is more likely to contain stain defects, which facilitates the subsequent calculation of the probability of each area containing a stain defect.

[0008] Preferably, obtaining the grayscale value set of the i-th region includes: The union of the grayscale value types in the i-th region and the grayscale value types in the standard image is taken as the grayscale value set of the i-th region.

[0009] Preferably, obtaining the regularity of the kth connected domain of the i-th region includes: Obtain the edge segment of each connected domain of the i-th region and the corresponding straight line of the edge segment of each connected domain; ; In the formula, represents the regularity of the kth connected domain of the ith region; Represents the number of edge segments of the kth connected domain of the i-th region; Represents the mean deviation of all pixel points on the hth edge segment of the kth connected domain of the ith region from their corresponding straight line; exp() represents an exponential function with a natural constant as the base.

[0010] Shading can be distinguished from stain defects by their regularity.

[0011] Preferably, the step of obtaining the edge segment of each connected domain of the i-th region and the corresponding straight line of the edge segment of each connected domain comprises: Subtract the i-th region from the standard image to obtain the i-th difference image, and perform connected domain analysis on the pixels whose grayscale values ​​in the i-th difference image are not 0 to obtain several connected domains in the i-th region; Use the Harris corner detection algorithm to obtain the corner points of the connected domain of the ith region. According to the corner points of the connected domain of the ith region, divide the edge of the connected domain of the ith region into several edge segments to obtain the edge segments of the connected domain of the ith region. Connect the endpoints of the edge segments of the connected domain of the ith region to obtain the corresponding straight lines of each edge segment of the connected domain of the ith region.

[0012] Preferably, the acquiring each target area includes: A characteristic value threshold T is preset, and if the corrected characteristic value of any area is greater than or equal to the characteristic value threshold, the area is recorded as a target area.

[0013] This facilitates subsequent analysis of only the target area that is most likely to contain stain defects, obtains the initial threshold of the image to be detected, and avoids the influence of the shadow area on the acquisition of the initial threshold.

[0014] Preferably, obtaining the initial threshold of the u-th target area of ​​the image to be detected includes: The average of the maximum grayscale value and the minimum grayscale value in each target area is obtained as the initial threshold of each target area.

[0015] Preferably, the acquisition of the weight of the initial threshold of the u-th target area of ​​the image to be detected includes: ; In the formula, Represents the initial threshold attention level of the u-th target area; Represents the grayscale mean of all connected domains of the u-th target area; Represents the minimum value of the grayscale mean of all connected domains in all target areas; represents a hyperparameter; The attention levels of the initial thresholds of all target regions are subjected to Softmax normalization to obtain the weight of the initial threshold of each target region.

[0016] Preferably, segmenting the stain area according to the initial threshold of the image to be detected includes: According to the initial threshold of the image to be detected, the stain area in the image to be detected is segmented using the iterative threshold segmentation method to obtain the stain area.

[0017] Improved accuracy of stain defect detection.

[0018] Preferably, the acquisition of the standard image and the image to be detected includes: Use a camera to take a picture of an uncontaminated textile area to obtain a standard RGB image, and then grayscale the standard RGB image to record it as a standard image; A camera is used to take a picture of the used textile to obtain an RGB image to be detected. The RGB image to be detected is gray-scaled and recorded as the image to be detected.

[0019] The present invention has the following beneficial effects: the purpose of the present invention is to divide the image to be detected into several areas, obtain the characteristic value of each area according to the gray value characteristics of the stain, and then obtain the regularity of each connected domain in each area according to the distinguishing features of the stain defect and the shadow, correct the characteristic value of each area, and obtain the probability of each area containing the stain defect, and then obtain the target area, avoiding the influence of the shadow area on the selection of the initial threshold, and finally obtain the weight of the initial threshold of each target area according to the gray value characteristics in each target area, and perform weighted summation on the initial threshold of each target area to obtain the initial threshold of the image to be detected, so that the stain defects with different gray values ​​can be segmented out later to obtain accurate stain defects. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 The present invention is a flowchart of a stain detection method for linen washing according to an embodiment of the present invention. DETAILED DESCRIPTION

[0021] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0022] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0023] See also Figure 1 , which shows a flowchart of a stain detection method for linen washing provided by an embodiment of the present invention, the method comprising the following steps: S001. Collect standard images and images to be detected.

[0024] In an embodiment of the present invention, a camera is used to take pictures of an uncontaminated textile area to obtain a standard RGB image, which is gray-scaled and recorded as a standard image; a camera is used to take pictures of used textiles to obtain an RGB image to be detected, which is gray-scaled and recorded as an image to be detected.

[0025] S002. Divide the image to be detected into several areas according to the size of the standard image, and obtain the characteristic value of each area; obtain the connected domain of each area, and then obtain the regularity of each connected domain of each area, and correct the characteristic value of each area based on the regularity to obtain the probability of containing stain defects in each area, and obtain the target area according to the probability of containing stain defects in each area.

[0026] It should be noted that when using the iterative threshold segmentation algorithm to detect the stain area in the image to be detected, the average of the maximum and minimum grayscale values ​​in the image to be detected is used as the initial threshold to detect the stain area in the image to be detected. However, due to the various stains on textiles, the grayscale values ​​of different stain areas are different, and when the textile is uneven, it will also cause the presence of shadow areas in the collected image to be detected. The grayscale value of the shadow area is similar to the stain area. Therefore, directly using the average of the maximum and minimum grayscale values ​​in the image to be detected as the initial threshold to segment the stain area in the image to be detected, it is very likely that some stain areas with unclear grayscale values ​​will be misjudged as normal textile areas, resulting in incomplete stain segmentation, or the shadow area will be misjudged as the stain area, resulting in over-segmentation, interfering with the accurate identification of stains, and an inaccurate initial threshold will require the iterative threshold segmentation algorithm to require more iterations to converge to a better threshold, resulting in low algorithm efficiency.

[0027] Therefore, in an embodiment of the present invention, the image to be detected is first divided into several areas, the characteristic value of each area is analyzed, and then the shadow area caused by the unevenness of the textile is excluded according to the characteristic value, and the target area that is more likely to contain the stain area is obtained. Subsequently, each target area is analyzed separately, and the segmentation threshold of each target area is adaptively obtained, so that all stain areas with different grayscales can be accurately segmented.

[0028] In the embodiment of the present invention, the image to be detected is divided into a plurality of regions according to the size of the standard image.

[0029] It should be further explained that there is a certain grayscale difference between the grayscale value of the known stain area and the grayscale value of the normal area. Therefore, if the grayscale value distribution in any area is relatively chaotic and the grayscale value is low, then the area is more likely to contain a stain area; and because the standard image collected in step S001 is an uncontaminated textile, and the area is based on the size of the standard image, it is possible to determine whether each area contains a stain area by comparing the difference in the number of pixels corresponding to the grayscale value of the standard image and each area, and then obtain the characteristic value of each area based on the said feature.

[0030] In the embodiment of the present invention, the union of the grayscale value types in the i-th region and the grayscale value types in the standard image is used as the grayscale value set of the i-th region; Get the eigenvalues ​​for each region: ; In the formula, represents the eigenvalue of the i-th region; Represents the standard deviation of the grayscale values ​​of all pixels in the i-th region; Represents the number of pixels in the standard image with the j-th gray value in the gray value set of the i-th region; Represents the number of pixels in the i-th region with the j-th grayscale value in the i-th region’s grayscale value set; || represents the absolute value symbol; Represents the number of grayscale value types in the grayscale value set of the i-th region; Represents the difference between the grayscale mean of the standard image and the i-th region; The larger the value of is, the lower the grayscale in the ith region is compared with the grayscale value in the standard image, and the larger the eigenvalue of the ith region is. The larger the value of , the more complex the grayscale distribution of pixels in the ith region, that is, the larger the eigenvalue of the ith region; The larger the value of is, the more dissimilar the grayscale value distribution of the ith region is to that of the standard image, and the larger the eigenvalue of the ith region is.

[0031] It should be noted that when acquiring the image to be detected, a shadow may appear due to the unevenness of the textile. The grayscale feature of the shadow is similar to the grayscale feature of the stain defect. For the area containing the shadow and the area containing the stain defect, their feature values ​​are relatively similar. Therefore, the present invention needs to analyze the distinguishing features of the shadow caused by the unevenness of the textile and the stain defect, and then combine the feature values ​​of each area to obtain the probability of each area containing the stain defect; When any region contains shadows or stains, the connected domain formed by the pixels whose grayscale values ​​are not 0 in the difference image obtained after the region is subtracted from the standard image is recorded as the connected domain of the region. The connected domain may be the shadow or stain region. Then, the shape complexity and edge morphology of the connected domain of each region are analyzed. However, since the shape of the shadow area generated by the protrusion of the textile when shooting the image to be detected is relatively regular, and the edge is relatively smooth and closer to the straight line segment, the number of corner points on the edge of the shadow is relatively small, and the edge of the connected domain of the shadow is divided into several edge segments according to the corner points, and the deviation between the edge segment and the straight line formed by connecting the endpoints of the edge segment will be relatively small; It is known that during the formation and diffusion of stains on textiles, the edges of the stain defects will be uneven and not close to a straight line, and the shapes of some stains will also be relatively complex. Therefore, when the edges of the stains are uneven and the shapes are complex, there will be a large number of positions with sudden changes in edge direction and large changes in curvature on the edges of the stain defects. These positions are easily detected as corner points. Therefore, if the number of corner points of the connected domain of any region is greater, it means that the edges of the connected domain of the region are uneven and the shapes of the connected domain are more complex. In addition, the edges of the connected domain of the region will be divided into several edge segments according to the corner points, and the deviation between the edge segments and the straight lines formed by connecting the endpoints of the edge segments will also be greater. In the embodiment of the present invention, the ith region is subtracted from the standard image to obtain the ith difference image, and a connected domain analysis is performed on the pixels whose grayscale values ​​in the ith difference image are not 0 to obtain a plurality of connected domains in the ith region; Use the Harris corner detection algorithm to obtain the corner points of the connected domain of the i-th region, divide the edge of the connected domain of the i-th region into several edge segments according to the corner points of the connected domain of the i-th region, obtain the edge segments of the connected domain of the i-th region, connect the endpoints of the edge segments of the connected domain of the i-th region, and obtain the corresponding straight line of each edge segment of the connected domain of the i-th region; Get the regularity of the kth connected domain of the ith region: ; In the formula, represents the regularity of the kth connected domain of the ith region; Represents the number of edge segments of the kth connected domain of the i-th region; represents the mean of the deviations between all pixels on the hth edge segment of the kth connected domain of the ith region and their corresponding straight lines; exp() represents an exponential function with a natural constant as the base; The larger the value of , the less regularity of the kth connected domain in the i-th region is.

[0032] It should be noted that the method for obtaining the deviation from a pixel to a straight line, that is, the shortest distance from a pixel to a straight line is a well-known technique, and will not be described in detail in the embodiments of the present invention.

[0033] Get the probability of each region containing a stain defect: ; In the formula, represents the probability of containing stain defects in the i-th region; represents the eigenvalue of the i-th region; Represents the sum of the number of corner points of all connected domains in the i-th region; Represents the number of connected domains in the i-th region; represents the regularity of the kth connected domain of the ith region; The larger the value of is, the less smooth the edge of the i-th region is and the more irregular its shape is; The smaller the value of is, the smaller the regularity of the connected domain of the i-th region is, the edge of the connected domain of the i-th region is not smooth and the deviation between the edge and the straight line is large, and the probability of containing stain defects in the i-th region is greater; The larger the value of , the greater the probability that the i-th region contains stain defects.

[0034] The preset characteristic value threshold T=0.6, if the corrected characteristic value of any area is greater than or equal to the characteristic value threshold, the area is recorded as the target area. It should be noted that the target area is more likely to contain a stain area.

[0035] S003. Obtain an initial threshold value for each target area, obtain the weight of the initial threshold value of each target area according to the grayscale mean of all connected domains of each target area, perform weighted summation on the initial threshold value of each target area according to the weight of the initial threshold value of each target area, and obtain the initial threshold value of the image to be detected.

[0036] It should be noted that it is known that the acquired target area is more likely to contain a stain area, and due to the different types of stains, the grayscale values ​​of the stains are different. Therefore, the present invention needs to perform weighted summation on the initial threshold of each target area, obtain the initial threshold of the image to be detected, and then perform overall segmentation on the image to be detected. It can comprehensively consider the grayscale values ​​of different types of stains that may exist in different target areas, so that the final initial threshold of the image to be detected is more representative and adaptable, and all the stains can be segmented out later. When the stain area is segmented for each target area separately, the initial threshold of each target area may be selected relatively independently, while ignoring the continuity and correlation of the stains between the target areas, resulting in the stains showing a fragmentation phenomenon after segmentation. The overall segmentation can better maintain the integrity and continuity of the stains from a global perspective, so that the segmentation result is more in line with the actual situation. It is known that the initial threshold of the iterative threshold segmentation algorithm is the average of the maximum grayscale value and the minimum grayscale value in the image. Therefore, firstly, the initial threshold of each target area is obtained according to the method for obtaining the initial threshold. It is known that if the grayscale value of the connected domain of any target area is smaller, it means that the contrast between the connected domain in the target area and the normal area is large. At this time, the initial threshold of the target area can segment out the darker stains, but may not be able to segment out the lighter stains. Therefore, the weight of the initial threshold of the target area should be smaller. However, if the grayscale value of the connected domain of any target area is larger than the grayscale value of the connected domain of other target areas, it means that the contrast between the connected domain in the target area and the normal area is not very obvious, and the stain area in the target area may be a lighter stain. Therefore, in order to detect the stain defect in the target area later, more attention should be paid to the initial threshold of the target area, and the weight of the initial threshold of the target area should be larger.

[0037] In the embodiment of the present invention, the average of the maximum grayscale value and the minimum grayscale value in each target area is obtained as the initial threshold value of each target area; Get the initial threshold attention level for each target area: ; In the formula, Represents the initial threshold attention level of the u-th target area; Represents the grayscale mean of all connected domains of the u-th target area; Represents the minimum value of the grayscale mean of all connected domains in all target areas; represents a hyperparameter. In the embodiment of the present invention, , in order to avoid The value of is 0, The larger the value of , the larger the grayscale value of the stain defect that may be contained in the u-th target area is than the darkest grayscale value of the stain defect. In order to more accurately segment the stain defect that may be contained in the u-th target area, more attention should be paid to the initial threshold of the target area.

[0038] The attention levels of the initial thresholds of all target regions are subjected to Softmax normalization processing to obtain the weight of the initial threshold of each target region. It should be noted that the Softmax normalization processing method is a prior art, and will not be described in detail in the embodiments of the present invention.

[0039] Get the initial threshold of the image to be detected: ; Where W represents the initial threshold of the image to be detected; Represents the number of target areas of the image to be detected; Represents the initial threshold of the u-th target area of ​​the image to be detected; Represents the weight of the initial threshold of the u-th target area of ​​the image to be detected. The larger its value is, the more attention should be paid to the initial threshold of the u-th target area of ​​the image to be detected. It represents the initial threshold of the image to be detected obtained by weighted summing the initial threshold of each target area of ​​the image to be detected.

[0040] S004: Segment the stain area according to the initial threshold of the image to be detected.

[0041] In the embodiment of the present invention, the stain area in the image to be detected is segmented using an iterative threshold segmentation method according to the initial threshold of the image to be detected, so as to obtain the stain area.

[0042] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A stain detection method for linen washing, characterized in that: include: Collecting a standard image and an image to be detected, and dividing the image to be detected into several areas according to the size of the standard image; Get the probability of each area containing stain defects , represents the probability of containing stain defects in the i-th region; represents the eigenvalue of the i-th region; Represents the sum of the number of corner points of all connected domains in the i-th region; Represents the number of connected domains in the i-th region; represents the regularity of the kth connected domain of the ith region; Acquire each target area according to the probability of containing the stain defect; Get the initial threshold of the image to be detected ; Represents the number of target areas of the image to be detected; Represents the initial threshold of the u-th target area of ​​the image to be detected; Represents the weight of the initial threshold of the u-th target area of ​​the image to be detected; according to the initial threshold of the image to be detected, the stain area is segmented.

2. A stain detection method for linen washing according to claim 1, characterized in that: The acquisition of the characteristic value of the i-th region includes: Get the gray value set of the i-th area; ; In the formula, represents the eigenvalue of the i-th region; Represents the standard deviation of the grayscale values ​​of all pixels in the i-th region; Represents the number of pixels in the standard image with the j-th gray value in the gray value set of the i-th region; Represents the number of pixels in the i-th region with the j-th grayscale value in the i-th region’s grayscale value set; || represents the absolute value symbol; Represents the number of grayscale value types in the grayscale value set of the i-th region; Represents the difference between the standard image and the grayscale mean of the i-th region.

3. A stain detection method for linen washing according to claim 2, characterized in that: The step of obtaining a grayscale value set of the i-th region includes: The union of the grayscale value types in the i-th region and the grayscale value types in the standard image is taken as the grayscale value set of the i-th region.

4. A stain detection method for linen washing according to claim 1, characterized in that: The acquisition of the regularity of the kth connected domain of the i-th region includes: Obtain the edge segment of each connected domain of the i-th region and the corresponding straight line of the edge segment of each connected domain; ; In the formula, represents the regularity of the kth connected domain of the ith region; Represents the number of edge segments of the kth connected domain of the i-th region; Represents the mean deviation of all pixel points on the hth edge segment of the kth connected domain of the ith region from their corresponding straight line; exp() represents an exponential function with a natural constant as the base.

5. A stain detection method for linen washing according to claim 4, characterized in that: The step of obtaining the edge segment of each connected domain of the i-th region and the corresponding straight line of the edge segment of each connected domain comprises: Subtract the i-th region from the standard image to obtain the i-th difference image, and perform connected domain analysis on the pixels whose grayscale values ​​in the i-th difference image are not 0 to obtain several connected domains in the i-th region; Use the Harris corner detection algorithm to obtain the corner points of the connected domain of the ith region. According to the corner points of the connected domain of the ith region, divide the edge of the connected domain of the ith region into several edge segments to obtain the edge segments of the connected domain of the ith region. Connect the endpoints of the edge segments of the connected domain of the ith region to obtain the corresponding straight lines of each edge segment of the connected domain of the ith region.

6. A stain detection method for linen washing according to claim 1, characterized in that: The obtaining of each target area comprises: A characteristic value threshold T is preset, and if the corrected characteristic value of any area is greater than or equal to the characteristic value threshold, the area is recorded as a target area.

7. A stain detection method for linen washing according to claim 1, characterized in that: The acquisition of the initial threshold value of the u-th target area of ​​the image to be detected includes: The average of the maximum grayscale value and the minimum grayscale value in each target area is obtained as the initial threshold of each target area.

8. A stain detection method for linen washing according to claim 1, characterized in that: The acquisition of the weight of the initial threshold of the u-th target area of ​​the image to be detected includes: ; In the formula, Represents the initial threshold attention level of the u-th target area; Represents the grayscale mean of all connected domains of the u-th target area; Represents the minimum value of the grayscale mean of all connected domains in all target areas; represents a hyperparameter; The attention levels of the initial thresholds of all target regions are subjected to Softmax normalization to obtain the weight of the initial threshold of each target region.

9. A stain detection method for linen washing according to claim 1, characterized in that: The step of segmenting the stain area according to the initial threshold of the image to be detected includes: According to the initial threshold of the image to be detected, the stain area in the image to be detected is segmented using the iterative threshold segmentation method to obtain the stain area.

10. A stain detection method for linen washing according to claim 1, characterized in that: The collecting of the standard image and the image to be detected includes: Use a camera to take a picture of an uncontaminated textile area to obtain a standard RGB image, and then grayscale the standard RGB image to record it as a standard image; A camera is used to take a picture of the used textile to obtain an RGB image to be detected. The RGB image to be detected is gray-scaled and recorded as the image to be detected.

Citation Information

Patent Citations

  • Lampblack detection method and device, storage medium and electronic equipment

    CN115393286A

  • LED lamp wick defect detection method

    CN115601367A

  • Intelligent defect identification method for photoetching mask

    CN117173414A

  • Ink printing defect detection method based on image processing

    CN117830318A

  • Stain detection method, system and equipment based on image enhancement and medium

    CN118135548A

Cited By

  • Stain detection method for fresh egg cleaning

    CN120259310A