A visual inspection method for quality of digital school uniform production line
By performing area segmentation and edge detection on digital school uniform images, combining the complexity of the cloth area and local grayscale differences, adaptively adjusting the mapping grayscale level of histogram equalization, solving the problem of insufficient image detail enhancement in the prior art, and improving the accuracy and efficiency of school uniform quality detection.
Patent Information
- Application Number
- CN202410945749.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-07-15
AI Technical Summary
When performing visual inspection of digital school uniform images in the prior art, it is difficult to effectively enhance image details, resulting in low quality detection accuracy and efficiency.
By collecting the finished school uniform image and its grayscale image, area segmentation and edge detection are performed, the cloth area is screened, and the complexity of the cloth area and the local grayscale difference of pixel points are adaptively adjusted to the histogram equalization mapping grayscale level, image enhancement is performed, and input to the neural network to judge the school uniform quality level.
It improves the contrast and quality of school uniform images, enhances the accuracy and efficiency of quality visual inspection on the school uniform production line, and can more accurately analyze the fabric texture, color consistency and other characteristics of school uniforms.
Smart Images

Figure CN118822994B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of school uniform quality inspection, and in particular to a method for visual inspection of the quality of a digital school uniform processing production line. Background Art
[0002] Driven by the wave of digitalization, "intelligent production and processing of school uniforms" has become a major innovation in the educational equipment industry. With the help of intelligent equipment and information management, the production process has been optimized, and the quality and wearing experience of school uniforms have been greatly improved. The digital school uniform processing production line uses advanced technologies such as big data and the Internet of Things to realize the intelligence of the entire process of school uniform production testing, order tracking, and management, providing producers with fast and convenient production data entry and production process flow, and providing leaders with real-time and accurate production data, realizing the informatization of the production process, and improving production efficiency.
[0003] When visually inspecting the finished school uniforms after digital school uniform processing, the finished school uniform images are limited by the shooting equipment, lighting conditions and photography technology during the shooting process, and the school uniforms usually have various colors, patterns and textures. It is usually necessary to enhance the finished school uniform images so that the image details of the finished school uniforms are clearer and more visible, and the fabric texture, color consistency and other characteristics of the clothing can be analyzed more accurately, and it is easier to detect subtle quality problems. Histogram equalization is a common image enhancement technology. The local histogram and cumulative distribution function are calculated for the input image, and then the pixels in the image are histogram equalized based on the cumulative distribution function. In this process, it is usually necessary to set the grayscale parameters of the mapping. If the grayscale parameters of the mapping are too large, the image may be over-enhanced, resulting in too sharp edges, resulting in image distortion. If the grayscale parameters of the mapping are too small, the contrast enhancement effect will be limited, and the range of grayscale changes in the image will be limited, so that the subtle grayscale differences that should have been highlighted cannot be displayed. Summary of the invention
[0004] In order to solve the above technical problems, the present application provides a digital school uniform processing production line quality visual inspection method to solve the existing problems.
[0005] The present invention discloses a digital school uniform production line quality visual inspection method using the following technical solutions:
[0006] An embodiment of the present application provides a method for visually inspecting the quality of a digital school uniform production line, the method comprising the following steps:
[0007] Collect images of finished school uniforms and their grayscale images on the school uniform processing production line;
[0008] Perform region segmentation and edge detection on the grayscale image of the finished school uniform to obtain the school uniform region and its edge lines;
[0009] Based on the left-right symmetrical structure of the finished school uniform on the outermost edge line and the number of left-right symmetrical corner points, the edge line is selected to divide the school uniform area into several cloth areas;
[0010] The complexity of the cloth area is determined by combining the number of corner points in the cloth area and the number and length of the broken line segments appearing in the cloth area;
[0011] Combined with the complexity of the cloth area and the local grayscale difference of each pixel in the cloth area, the information richness of each pixel in the cloth area is determined;
[0012] Determine the adjusted mapping grayscale of each cloth area based on the information richness of all pixels in the cloth area and the preset mapping grayscale;
[0013] Based on the adjusted mapped grayscale, histogram equalization is used to enhance the finished school uniform image, and the enhanced finished school uniform image is input into the neural network to output the school uniform quality grade.
[0014] Preferably, the edge lines are screened out based on the left-right symmetrical structure of the finished school uniform on the outermost edge line and the number of left-right symmetrical corner points, so as to divide the school uniform area into several cloth areas, including:
[0015] Based on the left-right symmetrical structure of the finished school uniform on the outermost edge line, a symmetry line of the school uniform area is obtained, and the school uniform area is divided into a first area and a second area;
[0016] Determine corner points that are symmetrically located between the first region and the second region as feature corner points;
[0017] The edge lines are selected based on the number of characteristic corner points on the edge lines, and the school uniform area is divided into several cloth areas.
[0018] Preferably, the method for obtaining the symmetry line of the school uniform area includes:
[0019] Get the center point of the minimum circumscribed rectangle of the school uniform area as the center point of the school uniform area;
[0020] The symmetry line is a straight line passing through the center point of the school uniform area. At the same time, the straight line passing through the center point of the school uniform area needs to satisfy the following conditions as a symmetry line:
[0021] Record the straight line as a symmetry line to be selected;
[0022] Obtain a number of sampling points on the selected symmetry line, draw a perpendicular line through the sampling points to the selected symmetry line, and the perpendicular line intersects with the outermost edge line of the school uniform area at two intersection points;
[0023] Calculate the difference in distance between the two intersection points and the center point of the school uniform area respectively as the symmetric deviation value of the corresponding sampling point;
[0024] The accumulated sum of the symmetry deviation values of all sampling points is taken as the symmetry deviation degree of the symmetry line to be selected;
[0025] The candidate symmetry line with the smallest symmetry deviation is selected as the symmetry line of the school uniform area.
[0026] Preferably, determining the corner points that are symmetrical between the first area and the second area as feature corner points includes:
[0027] Get the corner points on the edge line of the school uniform area;
[0028] For any corner point, obtain the vector formed by it and the center point as the starting point, and obtain the angle between each vector and the symmetry line;
[0029] For any two corner points in two regions, the inverse of the product of the difference in modulus length and the difference in angle between the vectors of the two corner points is calculated as the consistency between the two corner points;
[0030] Take any two corner points with the greatest consistency as symmetric corner points;
[0031] All existing symmetrical corner points are recorded as feature corner points.
[0032] Preferably, the step of screening edge lines based on the number of characteristic corner points on the edge lines, thereby dividing the school uniform area into a plurality of cloth areas, includes:
[0033] An edge line with a preset number or more of characteristic corner points is recorded as a characteristic edge line;
[0034] The closed area enclosed by the characteristic edge line, the outermost edge line of the school uniform area, and the symmetry line are recorded as cloth areas respectively.
[0035] Preferably, the method for determining the complexity of the cloth region includes:
[0036] Based on the distribution characteristics of the line segments in the cloth area, the length of each broken line segment in the cloth area is determined;
[0037] Calculate the cumulative sum of the lengths of all broken line segments in the cloth area and record it as the first factor;
[0038] The number of corner points in the cloth area is recorded as the second factor;
[0039] The number of broken segments within the cloth area is recorded as the third factor;
[0040] The first, second and third factors are combined to obtain the complexity of the cloth area.
[0041] Preferably, the method for determining the length of each fracture line segment in the cloth area comprises:
[0042] Detect line segments within the cloth area;
[0043] Calculate the angle between each line segment in the cloth area and the symmetry line, and take the angle with the highest frequency as the texture angle of the cloth area;
[0044] Extend the line segment with the texture angle along the texture angle. If the extension line passes through other line segments with the texture angle in the cloth area, calculate the shortest distance between the line segments with the texture angle and record it as the length of the broken line segment.
[0045] Preferably, the method for determining the information richness includes:
[0046] The pixel points on the broken line segment in the cloth area are recorded as broken pixel points, and the pixel points in the cloth area other than the broken pixel points are recorded as normal pixel points;
[0047] For a normal pixel point in the cloth area, a preset number of pixel points adjacent to the normal pixel point on the straight line where the texture angle is located are obtained to form a neighborhood of the normal pixel point;
[0048] For the broken pixel point in the cloth area, the pixel points in a window of a preset size centered on the broken pixel point are obtained to form a neighborhood of the broken pixel point; wherein the number of pixel points in the two neighborhoods needs to be consistent;
[0049] Obtain the decimal value of the LBP value of each pixel in the cloth area in its corresponding neighborhood as the local grayscale difference of each pixel;
[0050] The local grayscale difference of each pixel in the cloth area and the complexity of the cloth area are fused to obtain the information richness of the corresponding pixel in the cloth area.
[0051] Preferably, the method for determining the adjusted mapping grayscale of each cloth region comprises:
[0052] Calculate the mean of the information richness of all pixels in the cloth area, calculate the sum of the normalized value of the mean and the preset adjustment coefficient, and use the product of the sum and the preset mapping grayscale as the adjusted mapping grayscale of the corresponding cloth area.
[0053] Preferably, the method of enhancing the finished school uniform image by using histogram equalization based on the adjusted mapped grayscale, and inputting the enhanced finished school uniform image into a neural network to determine the quality level of the school uniform comprises:
[0054] The adjusted mapping grayscale level of each cloth area is used as the grayscale mapping level of the corresponding cloth area in the histogram equalization process, and the remaining area is grayscale mapped using the preset mapping grayscale level. The finished school uniform image is histogram equalized to obtain an enhanced finished school uniform image.
[0055] This application has at least the following beneficial effects:
[0056] In the present application, the school uniform area and the edge lines therein are extracted through region segmentation and edge detection algorithms, and the school uniform is divided into different cloth areas through the symmetrical structural characteristics and school uniform identification information, so that the cloth area segmentation result is more in line with the actual school uniform structure; the fine line breakage phenomenon in the cloth is judged based on the cloth characteristics, and the complexity of the cloth area is constructed based on the fine line breakage and edge characteristics of the cloth, and the complexity of the cloth area is measured from an overall perspective; at the same time, the information richness of the pixel points is constructed in combination with the local texture information of the pixel points in the cloth area, and the degree of detail of the school uniform is measured from a local perspective; by combining the overall and local cloth area analysis, the mapping grayscale parameters are adaptively adjusted to obtain the optimal mapping grayscale parameters for each cloth area, and then the histogram equalization is completed based on the mapping grayscale parameters. While retaining the surface texture feature information and defect feature information of the school uniform, the enhanced finished school uniform image has improved image contrast and image quality, thereby improving the accuracy and efficiency of visual inspection of school uniform production quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0058] Figure 1 A flow chart of a method for visual inspection of quality of a digital school uniform processing production line provided in one embodiment of the present application;
[0059] Figure 2 A schematic diagram of a finished school uniform testing platform provided for one embodiment of the present application;
[0060] Figure 3 A flowchart of the steps of adaptively adjusting the mapping grayscale of histogram equalization provided in one embodiment of the present application;
[0061] Figure 4 A flow chart of a method for determining the complexity of a cloth region provided in accordance with an embodiment of the present application. DETAILED DESCRIPTION
[0062] In order to further explain the technical means and effects adopted by the present application to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, features and effects of a digital school uniform processing production line quality visual inspection method proposed in the present application in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0063] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
[0064] The specific scheme of the digital school uniform processing production line quality visual inspection method provided by the present application is described in detail below with reference to the accompanying drawings.
[0065] An embodiment of the present application provides a method for visually inspecting the quality of a digital school uniform processing production line.
[0066] Specifically, the following digital school uniform production line quality visual inspection method is provided, please refer to Figure 1 , the method comprises the following steps:
[0067] The first step is to collect images of finished school uniforms and their grayscale images on the school uniform processing production line.
[0068] The purpose of this application is to improve the accuracy and efficiency of visual inspection of school uniform quality on the school uniform processing production line by enhancing the images taken of finished school uniforms after digital school uniform processing and production.
[0069] The process of digital school uniform processing production line is usually divided into the following steps: order receiving, school uniform design, production preparation, cloth testing, cloth cutting, cloth sewing, ironing and shaping, finished product inspection, as well as packaging, storage and transportation.
[0070] The finished school uniform images are collected through the automatic visual inspection system installed on the digital school uniform processing production line. The automatic visual inspection system consists of multiple system components such as industrial cameras, lighting systems, and installation platforms. After the school uniforms are processed into finished products on the production line, the finished school uniforms are clamped to the inspection platform by the robotic arm installed on the production line for image collection to complete the corresponding appearance quality inspection, as shown in the attached Figure 2 shown.
[0071] According to the above steps, the collection of the finished school uniform image after the digital school uniform processing is completed. The collected finished school uniform image is an RGB image. In this application, the RGB image is grayed using a weighted graying method to obtain a gray image of the finished school uniform. Among them, the weighted graying method is a well-known technology and will not be repeated here.
[0072] At this point, the collection of finished school uniform images and their grayscale images can be completed.
[0073] In the second step, the mapping grayscale parameters in the histogram equalization are adaptively adjusted to improve the enhancement effect of the histogram equalization, thereby improving the accuracy and efficiency of school uniform quality detection.
[0074] Since the surface of finished school uniforms often has identification information such as school badges, school names, and label information. Histogram equalization is a common image enhancement technology. It calculates the local histogram and cumulative distribution function of the input image, and then performs histogram equalization on the pixels in the image based on the cumulative distribution function. In this process, it is usually necessary to set the grayscale parameters of the mapping. If the grayscale parameters of the mapping are too large, the image may be over-enhanced, resulting in overly sharp edges and image distortion. If the grayscale parameters of the mapping are too small, the contrast enhancement effect will be limited while limiting the range of grayscale changes in the image, making it impossible to show the subtle grayscale differences that should have been highlighted.
[0075] Therefore, by adaptively obtaining the optimal mapping grayscale parameters of histogram equalization, the image quality can be effectively improved, the texture characteristics and subtle details of the school uniform image can be retained while increasing the contrast, and the accuracy and efficiency of visual inspection of school uniform quality can be improved. The flowchart of the steps for adaptively adjusting the mapping grayscale of histogram equalization is shown in the attached figure. Figure 3 As shown, specifically:
[0076] The first small step is to perform region segmentation and edge detection on the grayscale image of the finished school uniform to obtain the school uniform area and its various edge lines.
[0077] For the grayscale image of the finished school uniform, this embodiment uses the Otsu threshold segmentation algorithm, takes the inspection platform as the background and the school uniform as the foreground to segment the grayscale image of the finished school uniform, and completes the extraction of the school uniform area in the image. The Otsu threshold segmentation algorithm is a well-known technology and will not be described here. In other embodiments of the present application, regional growth, clustering algorithms, etc. can also be used for regional segmentation.
[0078] The canny operator is used to detect the school uniform area to obtain the edge line in the school uniform area. The detection process of the canny operator is a well-known technology and will not be repeated here. In other embodiments of the present application, other methods such as the sobel operator can also be used for detection.
[0079] Since school uniform fabrics are usually made of materials such as cotton and polyester, these materials will be woven into filaments or threads during weaving, and then organized into cloth. Therefore, the fabrics used in school uniform production are essentially composed of thin threads or filaments. There are often certain gaps between thin threads or filaments. Therefore, when using the Canny operator for detection, the edge lines obtained not only include the edge lines obtained when different fabrics are sewn together during school uniform processing, but also the thin lines of the fabric itself.
[0080] Based on this, the present application performs corner point detection on the edge line. This embodiment adopts the SIFT corner point detection algorithm. The SIFT corner point detection algorithm is a well-known technology and will not be described in detail. The corner points on the edge line are obtained, and then the edge lines between the corner points can be connected to divide the school uniform area into different cloth areas. The specific segmentation process needs further analysis as follows.
[0081] However, since the school uniform contains school uniform identification information, such as school badges, school names, etc., the detected corner points may not be the actual corner points of the two cloth areas. Therefore, it is necessary to further filter the detected corner points to obtain the actual corner points.
[0082] The second small step is to screen out the edge lines based on the left-right symmetrical structure of the finished school uniform on the outermost edge line and the number of left-right symmetrical corner points, thereby dividing the school uniform area into several cloth areas.
[0083] According to the shape structure of the school uniform, the school uniform structure is a symmetrical structure, that is, except for the school emblem and school name and other information on the surface of the school uniform, the rest of the parts have symmetrical characteristics. This application further screens the diagonal points based on the symmetry of the school uniform structure, and then completes the segmentation of the school uniform area.
[0084] First, obtain the minimum circumscribed rectangle of the school uniform area, take the center point of the minimum circumscribed rectangle as the center point of the school uniform area, and obtain the symmetry line of the school uniform area, which is a straight line passing through the center point. The method for obtaining the straight line is as follows: draw an arbitrary straight line through the center point, record it as the symmetry line to be selected, and obtain K sampling points on the straight line. In this embodiment, the number of sampling points K is set to 10, which can be adjusted by the implementer. Draw a perpendicular line through each sampling point to the symmetry line to be selected, record it as a characteristic straight line. There are two endpoints between the characteristic straight line and the outermost edge line of the school uniform area. Obtain the number of pixels between the two endpoints and the sampling point respectively, take the absolute value of the difference between the number of pixels as the symmetry deviation value of the corresponding sampling point, and add up the symmetry deviation values as the symmetry deviation degree of the symmetry line to be selected. Select the straight line with the smallest symmetry deviation degree, which is the symmetry line of the school uniform area.
[0085] According to the above steps, the center point and the symmetry line of the school uniform area are obtained. The symmetry line divides the school uniform area into two areas, which are respectively recorded as the first area and the second area.
[0086] Based on the characteristics of school uniforms, it can be seen that the school name and school emblem on one side of the sleeve and the chest of the school uniform are usually not symmetrical, while the rest of the structural design is symmetrical. Therefore, the corner points detected in the first area often have corresponding corner points in the second area.
[0087] For any corner point, obtain the vector formed by it and the center point as the starting point, obtain the angle θ between each vector and the symmetry line and the modulus L of the vector, where the calculation of the angle between the vector and the straight line and the acquisition of the modulus L of the vector are well-known means and will not be repeated here.
[0088] In this embodiment, taking the corner point q in the first area as an example, the corner point p in the second area with the greatest consistency with q is obtained, wherein the consistency is calculated by the inverse of the product of the difference in module length and the difference in angle between the vectors of the corner point p and the point q.
[0089] In one embodiment of the present application, the module length difference is the absolute value of the difference between the module lengths, and the angle difference is the absolute value of the difference between the angles. In other embodiments of the present application, the difference between the module lengths can be used as the module length difference, and the difference between the angles can be used as the angle difference according to actual conditions.
[0090] It should be understood that the smaller the difference in module length and angle is, that is, the greater the consistency between the corner points is, the more likely it is that the two corner points are symmetrical corner points of the school uniform in the two areas.
[0091] At this point, for any corner point q, the corner point with the greatest consistency in another area can be obtained as the symmetric corner point of the corner point q.
[0092] If there are one-to-many, many-to-one, or many-to-many symmetrical corner points, the symmetrical corner points are matched between the corner points with the greatest consistency. The matched corner points cannot be used as symmetrical corner points for unmatched corner points.
[0093] For example: when the consistency between corner point a in the first area and corner point b in the second area is the greatest, and the consistency between corner point a in the first area and corner point c in the second area is also the greatest, that is, corner point a is the symmetrical corner point of both corner point b and corner point c, then the corner point with the greatest consistency with corner point a is selected from corner point b and corner point c as the symmetrical corner point of corner point a, and corner point c continues to match the remaining unpaired symmetrical corner points.
[0094] According to the above steps, the screening of symmetrical corner points between the first area and the second area is completed, and all corner points with symmetrical corner points are recorded as feature corner points.
[0095] For further analysis, here we take the feature corner points in the first area as an example, and complete the edge line detection of the school uniform area through the Canny operator according to the above steps. When different pieces of cloth are sewn together, there must be corresponding edge lines.
[0096] The edge line obtained in the first area is judged. If there are H or more characteristic corner points on the edge line, the edge line is a characteristic edge line. The closed area surrounded by the characteristic edge line, the outermost edge line of the school uniform area, and the symmetry line are respectively recorded as cloth areas. In this embodiment, the preset number H is set to 2, and the implementer can set it according to the actual situation.
[0097] The third small step is to determine the complexity of the cloth area by combining the number of corner points in the cloth area and the number and length of broken line segments appearing in the cloth area.
[0098] The cloth area is further analyzed, and a line segment detection algorithm is used for the edge lines in the cloth area to obtain the line segments in the cloth area. According to the characteristics of the cloth, the line segments in the cloth area are generally parallel to each other and have the same length. When there is school uniform identification information in the cloth area, some line segments are broken. Among them, the line segment detection algorithm is a well-known technology and will not be repeated. In other embodiments of the present application, Hough line detection can also be used to detect the edge lines in the cloth area.
[0099] In order to evaluate the complexity of the cloth area, this application needs to determine whether there is a line segment break phenomenon in the cloth area.
[0100] First, the angle between each line segment in the cloth area and the symmetry line is calculated; the angle with the highest frequency is taken as the texture angle of the cloth area;
[0101] Then, extend the line segment with the texture angle along the texture angle. If the extended line passes through other line segments with texture angles in the cloth area, it can be considered that the line segment is broken. At this time, calculate the shortest distance between the line segments with texture angles on the extended line and record it as the length of the broken line segment.
[0102] For broken line segments, they may contain detailed information such as school uniform logos or school uniform weaving defect information. In order to highlight the detailed information, the corresponding mapping grayscale should be larger when the histogram equalization is used for grayscale mapping to avoid loss of detailed information. For normal areas, there is only texture information of the cloth, and the detailed information contained is relatively small, which is easily disturbed, and the corresponding mapping grayscale should be smaller.
[0103] Based on this, for any cloth region, the complexity of the cloth region is constructed by the number of corner points of the cloth region and the number and length of the broken line segments. The flow chart of the method for determining the complexity of the cloth region is shown in the attached figure. Figure 4 As shown, specifically:
[0104] Calculate the sum of the lengths of all broken line segments in the cloth area, record it as the first factor; record the number of corner points in the cloth area as the second factor; record the number of broken line segments in the cloth area as the third factor; merge the first, second and third factors to get the complexity of the cloth area.
[0105] It can be understood that fusion can be divided into forward fusion and reverse fusion. This embodiment adopts the forward fusion method. Forward fusion is a fusion method such as addition and multiplication between data. The specific forward fusion method is determined by the implementer according to the actual situation. The application does not impose any special restrictions.
[0106] In one embodiment of the present application, the product of the first, second and third factors is taken as the complexity of the cloth area.
[0107] In another embodiment of the present application, the sum of the first, second and third factors is used as the complexity of the cloth area.
[0108] In other embodiments of the present application, the sum of the first and second factors can also be calculated as the exponent of an exponential function with the natural constant e as the base, and the product of the third factor and the calculated result of the exponential function can be used as the complexity of the cloth area.
[0109] It should be understood that the more broken line segments and corner points there are, and the longer the broken line segments are, the more complex the structural design in the current cloth area is, or the more defects and texture information there are, and the more complex the information inside it is, and the larger the grayscale level required for grayscale mapping should be, so as to retain more detailed features of the area.
[0110] The fourth small step is to determine the information richness of each pixel in the cloth area by combining the complexity of the cloth area and the local grayscale difference of each pixel in the cloth area.
[0111] For the cloth area, the pixel points on the broken line segment in the cloth area are recorded as broken pixel points, and the pixel points in the cloth area except the broken pixel points are recorded as normal pixel points.
[0112] The complexity of the cloth area calculated in the above steps is only analyzed at the overall texture level of the area, and no analysis is performed on the specific local texture details. Accordingly, this application combines the local grayscale difference of each pixel in the cloth area and the complexity of the cloth area to determine the information richness of each pixel in the cloth area, specifically:
[0113] For normal pixel points in the cloth area, a preset number of pixel points adjacent to the normal pixel point on the straight line where the texture angle is located are obtained to form the neighborhood of the normal pixel point; for broken pixel points in the cloth area, pixel points within a window of a preset size centered on the broken pixel point are obtained to form the neighborhood of the broken pixel point. It should be noted that this application needs to ensure that the number of neighboring pixel points of the normal pixel point is consistent with the number of neighboring pixel points of the broken pixel point. In this embodiment, the preset number of neighborhoods is set to 8, and the preset size of the window is set to 3×3. The implementer can set it according to the actual situation.
[0114] The decimal value of the LBP value of each pixel in the cloth area in its corresponding neighborhood is obtained as the local grayscale difference of each pixel. The process of obtaining the LBP value is a well-known technology and will not be described in detail.
[0115] The information richness of the corresponding pixel is obtained by fusing the local grayscale difference of the pixel and the complexity of the cloth area where the pixel is located.
[0116] In one embodiment of the present application, the product of the local grayscale difference of the pixel point and the complexity of the cloth area where the pixel point is located is used as the information richness of the corresponding pixel point.
[0117] In another embodiment of the present application, the sum of the local grayscale difference of the pixel and the complexity of the cloth area where the pixel is located is used as the information richness of the corresponding pixel.
[0118] In other embodiments of the present application, the normalized value of the local grayscale difference of the pixel point and the product of the complexity of the cloth area where the pixel point is located can also be used as the information richness of the corresponding pixel point.
[0119] The fifth sub-step is to determine the adjusted mapping grayscale level of each cloth area based on the information richness of all pixels in the cloth area and the preset mapping grayscale level.
[0120] If the grayscale of pixels is directly mapped, when the range of the mapped grayscale is small, the pixel values of pixels that are originally different from those of pixels in the neighborhood may be mapped to the same pixel value, resulting in the loss of local texture information of the pixels. When the range of the mapped grayscale is large, details that do not need to be enhanced will be over-enhanced.
[0121] Based on this, the present application adjusts the mapping grayscale of each cloth area in the histogram equalization by the information richness of all pixels in the cloth area, specifically:
[0122] Calculate the mean of the information richness of all pixels in the cloth area, calculate the sum of the normalized value of the mean and the preset adjustment coefficient, and use the product of the sum and the preset mapping grayscale as the adjusted mapping grayscale of the corresponding cloth area.
[0123] In this embodiment, the preset mapping grayscale is set to 16, and the preset adjustment coefficient is set to 0.5, and the implementer can adjust it according to the actual situation.
[0124] It should be noted that the purpose of setting the preset adjustment coefficient is to distinguish whether the cloth area is a richer area or a less rich area from an overall perspective based on the normalized mean of the information richness. By comparison, the mapping grayscale level of the richer area will be appropriately enlarged, and the mapping grayscale level of the less rich area will be appropriately reduced.
[0125] In the sixth step, the finished school uniform image is enhanced by using histogram equalization based on the adjusted mapped grayscale, and the enhanced finished school uniform image is input into the neural network to output the school uniform quality grade.
[0126] According to the above steps, the adaptive adjustment of the mapping grayscale in the histogram equalization is completed, the most suitable mapping grayscale for each cloth area is obtained, and the remaining area is grayscale mapped using the preset mapping grayscale. The finished school uniform image is enhanced by histogram equalization to obtain an enhanced finished school uniform image, thereby improving the quality of the finished school uniform image. Histogram equalization is a well-known technology and will not be described in detail here.
[0127] By collecting a large number of finished school uniform images covering different qualities, each image is manually labeled with four school uniform quality levels, namely "excellent", "good", "medium" and "poor", and all finished school uniform images are divided into training set, verification set and test set, and trained using neural network, the loss function is the cross entropy loss function, and the optimizer uses Adam. The specific training process is a well-known technology and will not be repeated here. In this embodiment, a convolutional neural network is used for training, and in other embodiments of the present application, a support vector machine and other suitable training models can also be used for training.
[0128] The enhanced finished school uniform image is input into the neural network, and the quality grade of the school uniform is output. If the quality grade of the school uniform is "excellent", it means that the quality of the school uniform is very good; if the quality grade of the school uniform is "good", it means that the quality of the school uniform is relatively good; if the quality grade of the school uniform is "medium", it means that the quality of the school uniform is acceptable; if the quality grade of the school uniform is "poor", it means that the quality of the school uniform is not good. Based on this, the visual quality evaluation of the school uniform on the processing production line is realized.
[0129] The various embodiments in the present application are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0130] It should be noted that, unless otherwise specified and limited, terms such as "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a circuit structure, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such article or device. In the absence of further restrictions, an element defined by the sentence "including one..." does not exclude the existence of other identical elements in the article or device including the element. In addition, the term "and\or" used herein includes any and all combinations of one or more related listed items.
[0131] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not invented by the present application.
[0132] It should be understood that the present application is not limited to the exact construction that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof.
Claims
1. A visual inspection method for the quality of a digital school uniform production line, characterized in that: The method comprises the following steps: Collect images of finished school uniforms and their grayscale images on the school uniform processing production line; Perform region segmentation and edge detection on the grayscale image of the finished school uniform to obtain the school uniform region and its edge lines; Based on the left-right symmetrical structure of the finished school uniform on the outermost edge line and the number of left-right symmetrical corner points, the edge line is selected to divide the school uniform area into several cloth areas; The complexity of the cloth area is determined by combining the number of corner points in the cloth area and the number and length of the broken line segments appearing in the cloth area; Combined with the complexity of the cloth area and the local grayscale difference of each pixel in the cloth area, the information richness of each pixel in the cloth area is determined; Determine the adjusted mapping grayscale of each cloth area based on the information richness of all pixels in the cloth area and the preset mapping grayscale; Based on the adjusted mapped grayscale, the finished school uniform image is enhanced by using histogram equalization, and the enhanced finished school uniform image is input into the neural network to output the school uniform quality grade; Based on the left-right symmetrical structure of the finished school uniform on the outermost edge line and the number of left-right symmetrical corner points, the edge line is screened out, so as to divide the school uniform area into several cloth areas, including: Based on the left-right symmetrical structure of the finished school uniform on the outermost edge line, a symmetry line of the school uniform area is obtained, and the school uniform area is divided into a first area and a second area; Determine corner points that are symmetrically located between the first region and the second region as feature corner points; The edge line is selected based on the number of characteristic corner points on the edge line, and the school uniform area is divided into a plurality of cloth areas by combining the symmetry line; The method for obtaining the symmetry line of the school uniform area includes: Get the center point of the minimum circumscribed rectangle of the school uniform area as the center point of the school uniform area; The symmetry line is a straight line passing through the center point of the school uniform area. At the same time, the straight line passing through the center point of the school uniform area as a symmetry line also needs to meet the following conditions: Record the straight line as a symmetry line to be selected; Obtain a number of sampling points on the selected symmetry line, draw a perpendicular line through the sampling points to the selected symmetry line, and the perpendicular line intersects with the outermost edge line of the school uniform area at two intersection points; Calculate the difference in distance between the two intersection points and the center point of the school uniform area respectively as the symmetric deviation value of the corresponding sampling point; The accumulated sum of the symmetry deviation values of all sampling points is taken as the symmetry deviation degree of the symmetry line to be selected; Select the candidate symmetry line with the smallest symmetry deviation as the symmetry line of the school uniform area; The step of determining the corner points that are symmetrical between the first region and the second region as feature corner points includes: Get the corner points on the edge line of the school uniform area; For any corner point, obtain the vector formed by it and the center point as the starting point, and obtain the angle between each vector and the symmetry line; For any two corner points in two regions, the inverse of the product of the difference in modulus length and the difference in angle between the vectors of the two corner points is calculated as the consistency between the two corner points; Take any two corner points with the greatest consistency as symmetric corner points; All existing symmetrical corner points are recorded as feature corner points; The method of selecting edge lines based on the number of characteristic corner points on the edge lines and combining the symmetry lines to divide the school uniform area into a plurality of cloth areas includes: An edge line with a preset number or more of characteristic corner points is recorded as a characteristic edge line; The closed area enclosed by the characteristic edge line, the outermost edge line of the school uniform area, and the symmetry line are recorded as cloth areas respectively.
2. A digital school uniform production line quality visual inspection method as described in claim 1, characterized in that: The method for determining the complexity of the cloth area includes: Based on the distribution characteristics of the line segments in the cloth area, the length of each broken line segment in the cloth area is determined; Calculate the cumulative sum of the lengths of all broken line segments in the cloth area and record it as the first factor; The number of corner points in the cloth area is recorded as the second factor; The number of broken segments within the cloth area is recorded as the third factor; The first, second and third factors are combined to obtain the complexity of the cloth area.
3. A digital school uniform production line quality visual inspection method as described in claim 2, characterized in that: The method for determining the length of each broken line segment in the cloth area comprises: Detect line segments within the cloth area; Calculate the angle between each line segment in the cloth area and the symmetry line, and take the angle with the highest frequency as the texture angle of the cloth area; Extend the line segment with the texture angle along the texture angle. If the extension line passes through other line segments with the texture angle in the cloth area, calculate the shortest distance between the line segments with the texture angle and record it as the length of the broken line segment.
4. A digital school uniform production line quality visual inspection method as described in claim 3, characterized in that: The method for determining the information richness includes: The pixel points on the broken line segment in the cloth area are recorded as broken pixel points, and the pixel points in the cloth area other than the broken pixel points are recorded as normal pixel points; For a normal pixel point in the cloth area, a preset number of pixel points adjacent to the normal pixel point on the straight line where the texture angle is located are obtained to form a neighborhood of the normal pixel point; For the broken pixel point in the cloth area, the pixel points in a window of a preset size centered on the broken pixel point are obtained to form a neighborhood of the broken pixel point; wherein the number of pixel points in the two neighborhoods needs to be consistent; Obtain the decimal value of the LBP value of each pixel in the cloth area in its corresponding neighborhood as the local grayscale difference of each pixel; The local grayscale difference of each pixel in the cloth area and the complexity of the cloth area are fused to obtain the information richness of the corresponding pixel in the cloth area.
5. A digital school uniform production line quality visual inspection method as claimed in claim 1, characterized in that: The method for determining the adjusted mapping grayscale of each cloth region includes: Calculate the mean of the information richness of all pixels in the cloth area, calculate the sum of the normalized value of the mean and the preset adjustment coefficient, and use the product of the sum and the preset mapping grayscale as the adjusted mapping grayscale of the corresponding cloth area.
6. A digital school uniform production line quality visual inspection method as claimed in claim 1, characterized in that: The method of enhancing the finished school uniform image by using histogram equalization based on the adjusted mapped grayscale includes: The adjusted mapping grayscale level of each cloth area is used as the grayscale mapping level of the corresponding cloth area in the histogram equalization process, and the remaining area is grayscale mapped using the preset mapping grayscale level. The finished school uniform image is histogram equalized to obtain an enhanced finished school uniform image.
Citation Information
Patent Citations
Textile fabric quality evaluation method and system based on image recognition
CN115115615A
Wire rod roller flaw detection method and system for enameled wire
CN116309517A