Method for testing detergency of detergent to textile fabric based on image processing
Through the image processing method, the problems of low manual detection efficiency and large subjective errors in the prior art are solved, and efficient and accurate evaluation of textile detergent power is achieved, providing technical support for quality control in the textile industry.
Patent Information
- Application Number
- CN202411826952.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2044-12-12
AI Technical Summary
The manual detection methods in the prior art are inefficient and subjective errors are large, which makes it impossible to accurately evaluate the decontamination power of textiles.
Using an image-based processing method, by controlling the drip and camera to work simultaneously, the original image is intercepted, the outline of the liquid diffusion circle is found, grayscale, blurring and image difference is performed, the radius and decontamination index of the liquid diffusion circle are calculated, and the detection results are analyzed.
The efficiency and accuracy of test detergents on textile detergents have been improved, providing solid technical support for quality control in the textile industry.
Smart Images

Figure CN119827486A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of textile testing, and in particular to a method for testing the detergency of detergents on textiles based on image processing. Background Art
[0002] Textiles play an indispensable role in daily life and also occupy a pivotal position in industrial production. The quality of textiles is directly related to the user experience and the competitiveness of products in the market. Especially in the fields of home decoration, clothing and accessories, and automotive interiors, the ability of textiles to easily remove dirt is regarded as a crucial quality indicator of textiles. The ability of textiles to easily remove dirt after being stained is determined by the binding force between the dirt and the textile, and is affected by the dissolution and cleaning effects of detergents. Therefore, it is necessary to test the detergency of detergents on textiles. However, the manual detection methods in related technologies are inefficient and have large subjective errors, which makes it impossible to accurately evaluate the product quality of textiles. Summary of the invention
[0003] The following is a summary of the subject matter of the detailed description of the present disclosure. This summary is not intended to limit the scope of the claims.
[0004] The disclosed embodiments provide a method for testing the detergency of detergents on textiles based on image processing, which can improve the efficiency and accuracy of testing the detergency of detergents on textiles and can provide solid technical support for quality control in the textile industry.
[0005] The embodiment of the first aspect of the present disclosure is a method for testing the detergency of a detergent on textiles based on image processing, comprising:
[0006] Control the dripping tube and the camera to start working at the same time, control the dripping tube to drip the detergent in the dripping tube into the dirty cloth, and intercept an original image taken by the camera at a certain interval;
[0007] Finding the contour of the liquid diffusion circle in the original image to obtain a contour image;
[0008] Performing grayscale processing on the contour image to convert the contour image into a first grayscale image;
[0009] Performing blur processing on the first grayscale image;
[0010] Performing image difference on the first grayscale image after the blur processing;
[0011] polarizing the first grayscale image after the image difference, and converting the first grayscale image after the image difference into a black and white image;
[0012] Acquire the longitudinal and transverse diameters of the liquid diffusion circle from the black-and-white image, and calculate the first radius of the liquid diffusion circle according to the longitudinal and transverse diameters of the liquid diffusion circle;
[0013] The target radius of the liquid diffusion circle is determined according to the first radius, a fitting straight line graph is obtained according to the square of the target radius of the liquid diffusion circle and the image acquisition time, and the decontamination index k value of the detergent is obtained according to the fitting straight line graph. The detection result is obtained by analysis based on the decontamination index k value of the detergent.
[0014] According to certain embodiments of the first aspect of the present disclosure, the step of acquiring the longitudinal and transverse diameters of the liquid diffusion circle from the black-and-white image, calculating a first radius of the liquid diffusion circle according to the longitudinal and transverse diameters of the liquid diffusion circle; determining a target radius of the liquid diffusion circle according to the first radius, and calculating a fitting straight line graph according to the square of the target radius of the liquid diffusion circle and the image acquisition time comprises:
[0015] Acquire the longitudinal and transverse diameters of the liquid diffusion circle from the black-and-white image, and calculate the first radius of the liquid diffusion circle according to the longitudinal and transverse diameters of the liquid diffusion circle;
[0016] Acquire the area of the liquid diffusion circle from the black-and-white image, and calculate the second radius of the liquid diffusion circle according to the area of the liquid diffusion circle;
[0017] Calculating errors between the first radius and the second radius;
[0018] Compare the sizes of the errors of the first radius and the second radius, determine the target radius of the liquid diffusion circle according to the first radius or the second radius with the smaller error, and calculate the fitting straight line graph according to the square of the target radius of the liquid diffusion circle and the image acquisition time.
[0019] According to certain embodiments of the first aspect of the present disclosure, the step of searching for the contour of the liquid diffusion circle in the original image to obtain the contour image includes:
[0020] Use the findContours function of OpenCV to find the contour of the liquid diffusion circle in the original image, calculate the area of the contour of the liquid diffusion circle found, compare the sizes of the areas of the contours of the liquid diffusion circle found, obtain the contour of the liquid diffusion circle with the largest area, and draw the contour of the liquid diffusion circle with the largest area on the original image or a blank image to obtain the contour image.
[0021] According to some embodiments of the first aspect of the present disclosure, the blurring the first grayscale image includes:
[0022] Take each first pixel point in the first grayscale image as the center point, calculate the distance between each second pixel point within a certain range of the center point and the center point, substitute the distance into a Gaussian function to obtain the weight of each second pixel point, normalize the weights of all the second pixel points, calculate a weighted average value according to the weights of the second pixel points and the pixel values of the second pixel points, and use the weighted average value to replace the pixel value of the center point to perform the blurring process on the first grayscale image.
[0023] According to certain embodiments of the first aspect of the present disclosure, the step of obtaining the decontamination index k value of the detergent according to the fitted straight line graph comprises:
[0024] The decontamination index k value of the detergent is obtained according to the fitted straight line graph through a first formula, wherein the first formula is obtained by taking a partial derivative of the Washburn equation, and the first formula is:
[0025] r 2 =kt,
[0026] Wherein, r is the target radius of the liquid diffusion circle, k is the decontamination index of the detergent, and t is the time of image acquisition.
[0027] According to certain embodiments of the first aspect of the present disclosure, the step of analyzing the decontamination index k value of the detergent to obtain a test result comprises:
[0028] The larger the decontamination index k value of the detergent is, the stronger the decontamination power of the detergent on textiles is, and the detection result is obtained by analyzing the size of the decontamination index k value of the detergent.
[0029] According to certain embodiments of the first aspect of the present disclosure, before searching for the contour in the original image to obtain the contour image, the method for testing the detergency of a detergent on textiles based on image processing further includes:
[0030] The original image is subjected to the grayscale processing to convert the original image into a second grayscale image; the pixel grayscale greater than a critical grayscale value in the second grayscale image is set to a grayscale maximum value, and the pixel grayscale less than the critical grayscale value is set to a grayscale minimum value to obtain a binary image; an erosion kernel is defined, and an erosion operation is used to reduce the white area in the binary image.
[0031] An embodiment of the second aspect of the present disclosure is an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method for testing the detergency of detergents on textiles based on image processing as described above is implemented.
[0032] An embodiment of the third aspect of the present disclosure is a storage medium storing a computer program, which, when executed by a processor, implements the above-mentioned method for testing the detergency of detergents on textiles based on image processing.
[0033] The disclosed embodiment includes at least the following beneficial effects: controlling the drip tube and the camera to start working at the same time, controlling the drip tube to drip the detergent in the drip tube into the dirty cloth, and intercepting an original image taken by the camera at regular intervals; finding the outline of the liquid diffusion circle in the original image to obtain a contour image; graying the contour image and converting the contour image into a first gray image; blurring the first gray image; performing image difference on the blurred first gray image; polarizing the first gray image after image difference, and converting the first gray image after image difference into a black and white image; obtaining the longitudinal and transverse diameters of the liquid diffusion circle from the black and white image, and calculating the first radius of the liquid diffusion circle according to the longitudinal and transverse diameters of the liquid diffusion circle; determining the target radius of the liquid diffusion circle according to the first radius, calculating a fitting straight line graph according to the square of the target radius of the liquid diffusion circle and the image acquisition time, and calculating the detergent removal index k value according to the fitting straight line graph, and analyzing the detergent removal index k value to obtain the test result, thereby improving the efficiency and accuracy of testing the detergent's detergency on textiles, and providing solid technical support for quality control in the textile industry.
[0034] Other features and advantages of the present disclosure will be set forth in the following description, and in part will be apparent from the description, or may be learned by practicing the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings are used to provide further understanding of the technical solution of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the technical solution of the present disclosure and do not constitute a limitation on the technical solution of the present disclosure.
[0036] Figure 1 An optional flow chart of a method for testing the detergency of a detergent on textiles based on image processing provided in an embodiment of the present disclosure;
[0037] Figure 2 A schematic diagram of an original image captured according to an embodiment of the present disclosure;
[0038] Figure 3A schematic diagram of a contour image provided by an embodiment of the present disclosure;
[0039] Figure 4 A schematic diagram of a black and white image provided for an embodiment of the present disclosure;
[0040] Figure 5 A schematic diagram of a fitted straight line graph provided in an embodiment of the present disclosure;
[0041] Figure 6 A schematic diagram of the interface of a rapid detergency tester provided in an embodiment of the present disclosure;
[0042] Figure 7 A schematic diagram of performing an erosion operation on an original image provided by an embodiment of the present disclosure;
[0043] Figure 8 A schematic diagram of a length variation table of the longitudinal and transverse diameters of a liquid diffusion circle provided in an embodiment of the present disclosure;
[0044] Fig. 9 A schematic diagram of a length change table of a first radius and a second radius provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present disclosure more clear, the present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not used to limit the present disclosure.
[0046] In the embodiments of the present disclosure, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0047] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present disclosure belongs. The terms used herein are only for the purpose of describing the embodiments of the present disclosure and are not intended to limit the present disclosure.
[0048] To facilitate understanding of the technical solution provided by the embodiments of the present disclosure, some key terms used in the embodiments of the present disclosure are explained here:
[0049] The open source computer vision library (OpenCV) consists of a series of C functions and a small number of C++ classes. It provides interfaces for languages such as Python, Ruby, and MATLAB, and implements many common algorithms in image processing and computer vision.
[0050] The embodiments of the present disclosure are further described below in conjunction with the accompanying drawings.
[0051] Reference Figure 1 As shown, Figure 1 An optional flow chart of a method for testing the detergency of a detergent on a textile based on image processing provided in an embodiment of the present disclosure, the method for testing the detergency of a detergent on a textile based on image processing includes but is not limited to steps 101 to 108, and each step is introduced in turn below.
[0052] Step 101: Control the drip tube and the camera to start working at the same time, control the drip tube to drip the detergent in the drip tube into the dirty cloth, and capture an original image taken by the camera at a certain interval.
[0053] Specifically, the camera can be a CCD camera, a CMOS camera, or other types of cameras capable of recording video, and can be set according to actual conditions, and this embodiment does not impose specific restrictions on it.
[0054] Reference Figure 2 As shown, Figure 2 The schematic diagram of the captured original image provided in the embodiment of the present disclosure is that an original image captured by a camera is automatically captured every 10 seconds, and the original images captured by the camera at the 10th, 20th, 30th, 40th, 50th, and 60th seconds are captured respectively. Specifically, an original image captured by a camera can be automatically captured every 15 seconds, and the original images captured by the camera at the 15th, 30th, 45th, 60th, 75th, 90th, 105th, 120th, and 135th seconds are captured respectively. It can also be that an original image captured by a camera is automatically captured every 10 seconds, and the original images captured by the camera at the 10th, 20th, 30th, 40th, 50th, and 60th seconds are captured respectively. The interval for capturing the original image and the number of captured original images can be set according to actual conditions, and this embodiment does not impose specific restrictions on them.
[0055] Step 102: Find the contour of the liquid diffusion circle in the original image to obtain a contour image.
[0056] Reference Figure 3 As shown, Figure 3A schematic diagram of a contour image provided by an embodiment of the present disclosure. Specifically, when detergent is dropped on a dirty cloth, the detergent diffuses in the pores of the textile while driving away the oil stains, and its diffusion trace forms a liquid diffusion circle.
[0057] Among them, the detergency performance of textiles is mainly determined based on the curling mechanism. Before the detergent is dripped into the dirty cloth, the interface of the textile is the oil-air of the dirty cloth. When the detergent is dripped onto the dirty cloth, due to the penetration of the surfactant, the surfactant first drives the air in the capillary out and then contacts the oil. Therefore, the adsorption of the surfactant changes the original contact angle, and the interface changes. The contact angle is transformed from the oil-air interface when immersed in oil to the detergent solution-oil-air interface. Through the interfacial adsorption of the detergent penetration front and the oil and pore wall, the energy and shape of the three-phase interface change, and the concave liquid surface on the oil side becomes a convex liquid surface, that is, the oil curls up, which is the curling mechanism. According to the Laplace equation, if the liquid surface is curved, the pressure inside the liquid will be different from the pressure outside the liquid, and a pressure difference will be generated on both sides of the liquid surface. This pressure difference causes the detergent in the capillary pores to continue to move forward and drive the oily liquid under the pull of the concave liquid surface, resulting in the detergent replacing the oil that has occupied the capillary pores under the action of the curling mechanism.
[0058] In some embodiments, finding the contour of the liquid diffusion circle in the original image to obtain the contour image includes:
[0059] Use OpenCV's findContours function to find the contour of the liquid diffusion circle in the original image, calculate the area of the contour of the liquid diffusion circle found, compare the areas of the contours of the liquid diffusion circle found, obtain the contour of the liquid diffusion circle with the largest area, and draw the contour of the liquid diffusion circle with the largest area on the original image or a blank image to obtain a contour image.
[0060] It can be understood that when using OpenCV's findContours function to find the contour of the liquid diffusion circle in the original image, OpenCV's findContours function will return a list of the contours of the liquid diffusion circle found, as well as the hierarchy of the contours. The area of the contours of the liquid diffusion circle found is calculated, and the size of the area of the contours of the liquid diffusion circle found is compared to obtain the contour of the liquid diffusion circle with the largest area, and the contour of the liquid diffusion circle with the largest area is drawn on the original image or blank image to obtain a contour image. Using OpenCV's findContours function can accurately extract the contour of the object, improving the accuracy of extracting the contour of the liquid diffusion circle in the original image.
[0061] It is understandable that the findContours function of OpenCV provides a variety of contour retrieval modes, for example, RETR_EXTERNAL, which only retrieves the outermost contour, RETR_LIST, which retrieves all contours and stores them as a list, RETR_CCOMP, which retrieves all contours and organizes them into a two-layer hierarchical structure, and RETR_TREE, which retrieves all contours and completely reconstructs the contour hierarchy. It can be set according to actual conditions, and this embodiment does not impose specific restrictions on it. The findContours function of OpenCV provides a variety of contour retrieval modes, which can be flexibly selected according to needs, and the contour of the liquid diffusion circle that meets the requirements in the original image is extracted, which improves the accuracy of extracting the contour of the liquid diffusion circle in the original image, and also increases the flexibility of extracting the contour of the liquid diffusion circle in the original image.
[0062] Step 103: grayscale the contour image to convert the contour image into a first grayscale image.
[0063] Specifically, the RGB value of a pixel in the contour image is obtained, the grayscale value of the pixel is calculated using the weighted average method for the RGB value of the pixel, the grayscale value of the pixel is used to replace the pixel value of the pixel in the contour image, and the grayscale values of all pixels are calculated to replace the pixel values of the corresponding pixels in the contour image to obtain a first grayscale image.
[0064] It can be understood that the first grayscale image is an image containing only brightness information, and each pixel is represented by only one value. Compared with a color image, the first grayscale image is processed faster and requires fewer computing resources. Converting the contour image to the first grayscale image simplifies the image information and speeds up the image processing.
[0065] Step 104: performing blur processing on the first grayscale image.
[0066] In some embodiments, blurring the first grayscale image includes: taking each first pixel in the first grayscale image as the center point, calculating the distance between each second pixel within a certain range of the center point and the center point, substituting the distance into a Gaussian function to obtain the weight of each second pixel, normalizing the weights of all second pixels, calculating a weighted average based on the weights of the second pixels and the pixel values of the second pixels, and using the weighted average to replace the pixel value of the center point to blur the first grayscale image.
[0067] Specifically, the first grayscale image is blurred to reduce the noise in the first grayscale image so that the first grayscale image becomes smoother. Noise will interfere with the accuracy of subsequent image processing and increase the computational complexity of subsequent image processing. Reducing the noise in the first grayscale image and making the first grayscale image smoother can reduce the computational complexity of subsequent image processing, thereby improving the efficiency and accuracy of subsequent image processing.
[0068] In some embodiments, mean filtering or median filtering may be used to perform blur processing on the first grayscale image. This may be set based on actual conditions, and this embodiment does not impose any specific limitation thereto.
[0069] Step 105: performing image difference on the blurred first grayscale image.
[0070] Specifically, image difference is performed on the first grayscale image after blur processing, the image difference is calculated, and key edge information is retained.
[0071] In some embodiments, an original image captured by a camera is automatically captured every 10 seconds, and the original images captured by the camera at 10s, 20s, 30s, 40s, 50s, and 60s are captured respectively, for a total of 6 original images. The outline of the liquid diffusion circle in the original image is searched to obtain 6 outline images. The outline image is grayed and converted into a first gray image to obtain 6 first gray images. The 6 first gray images are blurred, and image differences are performed on the 6 blurred first gray images to calculate the image differences, and the key edge information in each blurred first gray image is retained.
[0072] Step 106: converting the first grayscale image after the polarization image difference into a black and white image.
[0073] Reference Figure 4 As shown, Figure 4 A schematic diagram of a black and white image provided for an embodiment of the present disclosure. Specifically, the grayscale value of a pixel on the first grayscale image after image difference is set to 0, that is, the pixel is set to black; the grayscale value of a pixel on the first grayscale image after image difference is set to 255, that is, the pixel is set to white. A threshold is set, and the grayscale value of the pixel on the first grayscale image after image difference is compared with the threshold. If the grayscale value of the pixel is greater than the threshold, the grayscale value of the pixel is set to 255; if the grayscale value of the pixel is less than the threshold, the grayscale value of the pixel is set to 0 to obtain a black and white image.
[0074] Step 107: Obtain the longitudinal and transverse diameters of the liquid diffusion circle from the black-and-white image, and calculate the first radius of the liquid diffusion circle according to the longitudinal and transverse diameters of the liquid diffusion circle.
[0075] Specifically, the longitudinal and transverse diameters of the liquid diffusion circle are obtained from the black-and-white image, the longitudinal diameter and the transverse diameter of the liquid diffusion circle are averaged, and the average value is used as the first radius of the liquid diffusion circle to obtain the first radius of the liquid diffusion circle.
[0076] Step 108: Determine the target radius of the liquid diffusion circle based on the first radius, obtain a fitting straight line graph based on the square of the target radius of the liquid diffusion circle and the image acquisition time, and obtain the detergent removal index k value based on the fitting straight line graph, and obtain the test result based on the detergent removal index k value.
[0077] Specifically, the target radius of the liquid diffusion circle is determined according to the first radius, and the fitting straight line graph is obtained according to the square of the target radius of the liquid diffusion circle and the time of image acquisition. The square of the target radius of the liquid diffusion circle and the time of image acquisition are used to form coordinate points, and the fitting straight line graph is obtained according to the coordinate points.
[0078] In some embodiments, the decontamination index k value of the detergent is obtained according to the fitted straight line graph, including: using a first formula to obtain the decontamination index k value of the detergent according to the fitted straight line graph, the first formula is obtained by taking a partial derivative of the Washburn equation, and the first formula is:
[0079] r 2 =kt,
[0080] Where r is the target radius of the liquid diffusion circle, k is the decontamination index of the detergent, and t is the time of image acquisition.
[0081] Specifically, k in the first formula is the decontamination index of the detergent, and the k value determined according to the first formula represents the decontamination index of the detergent. The decontamination index k value of the detergent is obtained according to the fitted straight line graph through the first formula. After the decontamination index k value of the detergent is obtained, the decontamination power of the detergent on the textile is judged according to the decontamination index k value. Compared with manual observation of the decontamination power of the detergent on the textile, judging the decontamination power of the detergent on the textile according to the decontamination index k value improves the efficiency of detecting the decontamination power of the detergent on the textile, and improves the accuracy of detecting the decontamination power of the detergent on the textile.
[0082] In some embodiments, the test result is obtained by analyzing the detergent's stain removal index k value, including: the larger the detergent's stain removal index k value, the stronger the detergent's stain removal ability on textiles, and the test result is obtained by analyzing the size of the detergent's stain removal index k value.
[0083] Specifically, the greater the detergent's decontamination index k value is, the stronger the detergent's decontamination power on textiles is. Analyzing and obtaining the test results based on the detergent's decontamination index k value can improve the accuracy of the test results.
[0084] In some embodiments, the longitudinal and transverse diameters of the liquid diffusion circle are obtained from the black-and-white image, and a first radius of the liquid diffusion circle is calculated according to the longitudinal and transverse diameters of the liquid diffusion circle; a target radius of the liquid diffusion circle is determined according to the first radius, and a fitting straight line graph is calculated according to the square of the target radius of the liquid diffusion circle and the image acquisition time, including:
[0085] The longitudinal and transverse diameters of the liquid diffusion circle are obtained from the black-and-white image, and the first radius of the liquid diffusion circle is calculated according to the longitudinal and transverse diameters of the liquid diffusion circle; the area of the liquid diffusion circle is obtained from the black-and-white image, and the second radius of the liquid diffusion circle is calculated according to the area of the liquid diffusion circle; the error between the first radius and the second radius is calculated; the error between the first radius and the second radius is compared, and the target radius of the liquid diffusion circle is determined according to the first radius or the second radius with the smaller error, and a fitting straight line graph is calculated according to the square of the target radius of the liquid diffusion circle and the image acquisition time.
[0086] Specifically, the longitudinal diameter and the transverse diameter of the liquid diffusion circle are averaged, and the average value is used as the first radius of the liquid diffusion circle to obtain the first radius of the liquid diffusion circle. According to the area of the liquid diffusion circle, the second radius of the liquid diffusion circle is calculated using the circle area formula. The errors of the first radius and the second radius are calculated, and the magnitudes of the errors of the first radius and the second radius are compared. The target radius of the liquid diffusion circle is determined according to the first radius or the second radius with the smaller error, and the fitting straight line graph is obtained according to the square of the target radius of the liquid diffusion circle and the image acquisition time. The magnitudes of the errors of the first radius and the second radius are calculated, and according to the magnitudes of the errors, the first radius and the second radius are supplemented with each other, which can reduce the errors and improve the accuracy of the obtained fitting straight line graph.
[0087] Refer to Table 1, which is an experimental data table of the method for testing the detergency of detergents on textiles based on image processing provided by the embodiment of the present disclosure. An original image taken by a camera is automatically captured every 10 seconds, and the original images taken by the camera at 10s, 20s, 30s, 40s, 50s, and 60s are captured respectively, that is, the time t of image acquisition is 10s, 20s, 30s, 40s, 50s, and 60s respectively. The longitudinal diameter Dy and the transverse diameter Dx of the liquid diffusion circle are obtained from the black and white image, and the longitudinal diameter Dy and the transverse diameter Dx of the liquid diffusion circle are averaged, and the average value is used as the first radius Rd of the liquid diffusion circle to obtain the first radius Rd of the liquid diffusion circle. The area S of the liquid diffusion circle is obtained from the black and white image, and the second radius Ra of the liquid diffusion circle is calculated based on the area S of the liquid diffusion circle.
[0088] Table 1 Experimental data of the method for testing the detergency of detergents on textiles based on image processing
[0089] t(s) Area S(mm2) Rd(mm) Ra(mm) Dy(mm) Dx(mm) 10 1359.26 23.16 20.81 22.71 23.61 20 3766.52 36.2 34.63 34.74 37.67 30 5445.35 44.77 41.64 43.68 45.86 40 7049.71 49.7 47.38 50.6 48.8 50 8329.9 54.77 51.51 57.89 51.65 60 9985.71 57.41 56.39 60.38 54.44
[0090] In some embodiments, reference Figure 5 As shown, Figure 5 The schematic diagram of the fitted straight line graph provided by the embodiment of the present disclosure is as follows: the target radius r of the liquid diffusion circle is determined according to the first radius Rd, and the fitted straight line graph is obtained according to the square of the target radius r of the liquid diffusion circle (i.e. the aforementioned first radius Rd) and the image acquisition time t.
[0091] In some embodiments, before finding the outline of the liquid diffusion circle in the original image and obtaining the outline image, the method for testing the detergency of a detergent on textiles based on image processing further includes:
[0092] The original image is grayed and converted into a second gray image; the pixel grayscale greater than the critical grayscale value in the second gray image is set to the grayscale maximum value, and the pixel grayscale less than the critical grayscale value is set to the grayscale minimum value to obtain a binary image; an erosion kernel is defined, and an erosion operation is used to reduce the white area in the binary image.
[0093] Reference Figure 7 As shown, Figure 7 A schematic diagram of an erosion operation on an original image provided in an embodiment of the present disclosure. The original image is grayed to convert the original image into a second gray image; the grayscale of pixels in the second gray image that are greater than a critical gray value is set to a grayscale maximum value, and the grayscale of pixels that are less than the critical gray value is set to a grayscale minimum value to obtain a binary image; an erosion kernel is defined, and an erosion operation is used to reduce the white area in the binary image.
[0094] It can be understood that converting the original image into a second grayscale image first and then converting the second grayscale image into a binary image can facilitate the erosion operation and reduce the white area. Using the erosion operation to reduce the white area can make the outline of the liquid diffusion circle in the original image clearer and more prominent, and improve the accuracy and efficiency of the subsequent search for the outline of the liquid diffusion circle in the original image to obtain the outline image.
[0095] It can be seen that the control dropper and the camera start working at the same time, the control dropper drips the detergent in the dropper into the dirty cloth, and captures an original image taken by the camera at regular intervals; the outline of the liquid diffusion circle in the original image is found to obtain a contour image; the contour image is grayed and converted into a first gray image; the first gray image is blurred; the blurred first gray image is image differentiated; the first gray image after polarization image differentiation is converted into a black and white image; the longitudinal and transverse diameters of the liquid diffusion circle are obtained from the black and white image, and the first radius of the liquid diffusion circle is calculated according to the longitudinal and transverse diameters of the liquid diffusion circle; the target radius of the liquid diffusion circle is determined according to the first radius, and a fitting straight line graph is calculated according to the square of the target radius of the liquid diffusion circle and the image acquisition time, and the detergent decontamination index k value is calculated according to the fitting straight line graph, and the detection result is obtained by analysis according to the detergent decontamination index k value. Testing the detergency of detergents on textiles based on image processing does not require manual inspection, can improve the efficiency and accuracy of testing the detergency of detergents on textiles, and can provide solid technical support for quality control in the textile industry.
[0096] In some embodiments, reference Figure 6 As shown, Figure 6 A schematic diagram of the interface of the detergency rapid tester provided in the embodiment of the present disclosure. The detergency rapid tester includes a real-time video window, a contour window, a grayscale window, an operation button area, and a data window. The video captured by the camera is displayed in the real-time video window, the contour image is displayed in the contour window, the first grayscale image is displayed in the grayscale window, the function buttons are displayed in the operation button area, and the fitted straight line graph is displayed in the data window.
[0097] Specifically, by controlling the rapid detergency detector, the dropper and the camera are controlled to start working at the same time, the dropper is controlled to drip the detergent in the dropper into the dirty cloth, and an original image taken by the camera is intercepted at regular intervals. Use the findContours function of OpenCV to find the contour of the liquid diffusion circle in the original image, select the contour of the liquid diffusion circle with the largest area and draw the contour of the liquid diffusion circle with the largest area to obtain the contour image. Grayscale the contour image and convert the contour image into a first grayscale image. Blur the first grayscale image. Perform image difference on the blurred first grayscale image. The first grayscale image after polarization image difference is converted into a black and white image. The first formula is obtained by calculating the partial derivative according to the Washburn equation. The longitudinal and transverse diameters of the liquid diffusion circle are obtained from the black and white image, and the first radius of the liquid diffusion circle is calculated according to the longitudinal and transverse diameters of the liquid diffusion circle. The target radius of the liquid diffusion circle is determined according to the first radius, a fitting straight line graph is obtained according to the square of the target radius of the liquid diffusion circle and the image acquisition time, and the detergent decontamination index k value is obtained according to the fitting straight line graph by the first formula. The first formula is: 2 =kt, where r is the target radius of the liquid diffusion circle, k is the decontamination index of the detergent, and t is the time for image acquisition. Finally, a test report is obtained and displayed on the detergency rapid tester. The test results are obtained by analyzing the test report. Among them, the test report contains an experimental data table, a fitted straight line graph, a length change table of the longitudinal and transverse diameters of the liquid diffusion circle, and a length change table of the first radius and the second radius. Among them, the experimental data table is shown in Table 1, and the fitted straight line graph is shown in Table 2. Figure 5 See Figure 8 As shown, Figure 8 A schematic diagram of a length variation table of the longitudinal and transverse diameters of a liquid diffusion circle provided in an embodiment of the present disclosure, with Figure 8 As Time (i.e., the aforementioned image acquisition time t) changes, the lengths of the longitudinal diameter Dy and the transverse diameter Dx of the liquid diffusion circle also change. Fig. 9 As shown, Fig. 9 A schematic diagram of a length variation table of a first radius and a second radius provided in an embodiment of the present disclosure, with Fig. 9 When Time (i.e., the aforementioned image acquisition time t) changes, the lengths of the first radius Rd and the second radius Ra also change. According to the length change table of the longitudinal and transverse diameters of the liquid diffusion circle and the length change table of the first radius and the second radius, the difference degree of the longitudinal and transverse diameters of the liquid diffusion circle and the difference degree of the first radius and the second radius can be determined, and the change degree of the longitudinal and transverse diameters of the liquid diffusion circle and the change degree of the first radius and the second radius can also be determined.
[0098] Use the findContours function of OpenCV to find the contour of the liquid diffusion circle in the original image, select the contour of the liquid diffusion circle with the largest area and draw the contour of the liquid diffusion circle with the largest area. Before obtaining the contour image, it also includes: graying the original image to convert the original image into a second grayscale image; setting the grayscale of pixels greater than the critical grayscale value in the second grayscale image to the grayscale maximum value, and setting the grayscale of pixels less than the critical grayscale value to the grayscale minimum value to obtain a binary image; defining an erosion kernel, and using an erosion operation to reduce the white area in the binary image.
[0099] The disclosed embodiment also provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the above-mentioned method for testing the detergency of detergent on textiles based on image processing when executing the computer program. The electronic device can be any intelligent terminal including a computer.
[0100] The embodiment of the present disclosure further provides a storage medium storing a computer program, which, when executed by a processor, implements the above-mentioned method for testing the detergency of detergents on textiles based on image processing.
[0101] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate to describe the embodiments of the present disclosure, such as being able to be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0102] It should be understood that in the present disclosure, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0103] It should be understood that in the description of the embodiments of the present disclosure, the meaning of multiple (or multiple items) is more than two, greater than, less than, exceed, etc. are understood to not include the number, and above, below, within, etc. are understood to include the number.
[0104] It should also be understood that the various implementations provided in the embodiments of the present disclosure can be combined arbitrarily to achieve different technical effects.
[0105] The above is a specific description of the preferred implementation of the present disclosure, but the present disclosure is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions under the shared conditions without violating the spirit of the present disclosure. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present disclosure.
Claims
1. A method for testing the detergency of detergents on textiles based on image processing, characterized in that: include: Control the dripping tube and the camera to start working at the same time, control the dripping tube to drip the detergent in the dripping tube into the dirty cloth, and intercept an original image taken by the camera at a certain interval; Finding the contour of the liquid diffusion circle in the original image to obtain a contour image; Performing grayscale processing on the contour image to convert the contour image into a first grayscale image; Performing blur processing on the first grayscale image; Performing image difference on the first grayscale image after the blur processing; polarizing the first grayscale image after the image difference, and converting the first grayscale image after the image difference into a black and white image; Acquire the longitudinal and transverse diameters of the liquid diffusion circle from the black-and-white image, and calculate the first radius of the liquid diffusion circle according to the longitudinal and transverse diameters of the liquid diffusion circle; The target radius of the liquid diffusion circle is determined according to the first radius, a fitting straight line graph is obtained according to the square of the target radius of the liquid diffusion circle and the image acquisition time, and the decontamination index k value of the detergent is obtained according to the fitting straight line graph. The detection result is obtained by analysis based on the decontamination index k value of the detergent.
2. The method for testing the detergency of detergent on textiles based on image processing according to claim 1, characterized in that: The method comprises: obtaining the longitudinal and transverse diameters of the liquid diffusion circle from the black-and-white image, calculating a first radius of the liquid diffusion circle according to the longitudinal and transverse diameters of the liquid diffusion circle; determining a target radius of the liquid diffusion circle according to the first radius, and calculating a fitting straight line graph according to the square of the target radius of the liquid diffusion circle and the image acquisition time, comprising: Acquire the longitudinal and transverse diameters of the liquid diffusion circle from the black-and-white image, and calculate the first radius of the liquid diffusion circle according to the longitudinal and transverse diameters of the liquid diffusion circle; Acquire the area of the liquid diffusion circle from the black-and-white image, and calculate the second radius of the liquid diffusion circle according to the area of the liquid diffusion circle; Calculating errors between the first radius and the second radius; Compare the sizes of the errors of the first radius and the second radius, determine the target radius of the liquid diffusion circle according to the first radius or the second radius with the smaller error, and calculate the fitting straight line graph according to the square of the target radius of the liquid diffusion circle and the image acquisition time.
3. The method for testing the detergency of detergent on textiles based on image processing according to claim 1, characterized in that: The step of searching for the contour of the liquid diffusion circle in the original image to obtain the contour image comprises: Use the findContours function of OpenCV to find the contour of the liquid diffusion circle in the original image, calculate the area of the contour of the liquid diffusion circle found, compare the sizes of the areas of the contours of the liquid diffusion circle found, obtain the contour of the liquid diffusion circle with the largest area, and draw the contour of the liquid diffusion circle with the largest area on the original image or a blank image to obtain the contour image.
4. The method for testing the detergency of detergents on textiles based on image processing according to claim 1, characterized in that: The blurring the first grayscale image comprises: Take each first pixel point in the first grayscale image as the center point, calculate the distance between each second pixel point within a certain range of the center point and the center point, substitute the distance into a Gaussian function to obtain the weight of each second pixel point, normalize the weights of all the second pixel points, calculate a weighted average value according to the weights of the second pixel points and the pixel values of the second pixel points, and use the weighted average value to replace the pixel value of the center point to perform the blurring process on the first grayscale image.
5. The method for testing the detergency of detergent on textiles based on image processing according to claim 1, characterized in that: The step of obtaining the decontamination index k value of the detergent according to the fitted straight line graph comprises: The decontamination index k value of the detergent is obtained according to the fitted straight line graph through a first formula, wherein the first formula is obtained by taking a partial derivative of the Washburn equation, and the first formula is: r 2 =kt, Wherein, r is the target radius of the liquid diffusion circle, k is the decontamination index of the detergent, and t is the time of image acquisition.
6. The method for testing the detergency of detergent on textiles based on image processing according to claim 1, characterized in that: The step of analyzing the cleaning index k value of the detergent to obtain the test result includes: The larger the decontamination index k value of the detergent is, the stronger the decontamination power of the detergent on textiles is, and the detection result is obtained by analyzing the size of the decontamination index k value of the detergent.
7. The method for testing the detergency of detergent on textiles based on image processing according to claim 1, characterized in that: Before searching for the outline of the liquid diffusion circle in the original image to obtain the outline image, the method for testing the detergency of a detergent on textiles based on image processing further includes: The original image is subjected to the grayscale processing to convert the original image into a second grayscale image; the pixel grayscale greater than a critical grayscale value in the second grayscale image is set to a grayscale maximum value, and the pixel grayscale less than the critical grayscale value is set to a grayscale minimum value to obtain a binary image; an erosion kernel is defined, and an erosion operation is used to reduce the white area in the binary image.
8. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method for testing the detergency of a detergent on textiles based on image processing according to any one of claims 1 to 7 is implemented.
9. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for testing the detergency of detergent on textiles based on image processing according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Rapid measuring method of detergency of washing agents on fabric, and measuring device thereof
CN105628563A
Visual-perception-based objective evaluation apparatus and method for washing detergency
CN106485257A
Fabric moisture-transmitting performance testing instrument and testing method based on image processing technology
CN106525665A
Method of treating fabrics with automated pre-treatment of water
CN113348236A
Wiping detergent composition for textile products
US20220025307A1