A method, device, apparatus and readable storage medium for detecting stitch length

Through color mode conversion and image processing algorithms, the stitch length in flexible neon light design is automatically detected, which solves the problems of low measurement efficiency and large errors, and realizes efficient and accurate stitch length calculation, reducing damage to the eyes.

CN114926429BActive Publication Date: 2025-08-08HUNAN KANGXUAN TECH CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210525937.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-16
Publication Date
2025-08-08
Estimated Expiration
2042-05-16

AI Technical Summary

Technical Problem

In the prior art, during the design and manufacturing of flexible neon lights, the measurement efficiency of stitch length is low, the error is large, and it is harmful to the eyes. A method of automatically detecting the length of complex graphic paths is needed to improve efficiency and accuracy and reduce the burden on staff.

Method used

The image to be detected is read using the first color mode, converted to the second color space for channel separation, and the weighted average method, Otsu method and the improved Zhang_Suen algorithm are used to generate a refined image, calculate the true length of the pixel points in the refined image, and call the length calculation model to generate the complete stitch length.

Benefits of technology

It improves the efficiency and accuracy of path length detection of complex graphics, reduces the burden on staff, and avoids the damage to the eyes caused by blue light and ultraviolet rays.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114926429B_ABST
    Figure CN114926429B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, equipment, and readable storage medium for detecting stitch length. The method comprises: obtaining an image to be detected, reading the image to be detected using a first color mode, retaining image information of the image to be detected, reading the image to be detected using a second color mode so that the image to be detected enters a second color space from the first color space, and generating a first image corresponding to the image to be detected; performing channel separation on the first image, and processing the S-channel image to generate a refined image; obtaining the horizontal and vertical pixel dimensions of the refined image, and generating the true length of the side length of a single pixel in the refined image; calling a length calculation model, and performing calculations on qualified pixels in the refined image to generate the stitch length of the complete graphic. This method improves the efficiency and accuracy of path length detection for complex graphics and reduces the burden on staff.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image detection, and in particular to a stitch length detection method, device, equipment and readable storage medium. Background Art

[0002] With the acceleration of urban modernization and the improvement of people's living standards, neon lights have been widely used in entertainment venues, outdoor rendering, advertising and other fields. Compared with traditional glass neon lights, flexible neon lights have the advantages of being unbreakable, safe and reliable, and having a long service life. Therefore, they are now widely used.

[0003] In the design and manufacturing of flexible neon lights, calculating the actual length of the light strip required to manufacture the finished neon lights based on the design drawings and corresponding dimensions provided by the customer, and providing a reference quote, is a very important process. Currently, the trace length of the lines in the design drawings is usually obtained by manual tracing. Workers use auxiliary tools such as rulers to repeatedly measure and average the length on the computer screen. This method has serious drawbacks: heavy workload, low measurement efficiency, and large error in the results. In particular, the blue light and ultraviolet rays from the screen can cause serious damage to the eyes of the measurement personnel. Therefore, the industry urgently needs a method that can automatically detect the trace length of complex graphics to improve the efficiency and accuracy of complex graphic path length detection and reduce the burden on workers.

[0004] In view of this, this application is filed. Summary of the Invention

[0005] The present invention provides a method, device, equipment and readable storage medium for detecting trace length, which aims to improve the efficiency and accuracy of complex graphic path length detection and reduce the burden on staff.

[0006] A first embodiment of the present invention provides a method for detecting stitch length, comprising:

[0007] Acquire an image to be detected, read the image to be detected using a first color mode, and retain image information of the image to be detected, wherein the image to be detected is in a first color space, and wherein the image information includes the true length and width of the image to be detected;

[0008] Reading the image to be detected using a second color mode so that the image to be detected enters a second color space from the first color space, and generating a first image corresponding to the image to be detected;

[0009] Performing channel separation on the first image to obtain an H channel image, an S channel image, and a V channel image, and processing the S channel image to generate a refined image;

[0010] Traversing the refined image, obtaining the horizontal and vertical pixel sizes of the refined image, and generating the real length of the side length of a single pixel point in the refined image according to the horizontal and vertical pixel sizes of the refined image and the real length and width of the image to be detected;

[0011] The length calculation model is called to perform calculations on the pixels that meet the conditions in the refined image to generate the trace length of the complete graphic.

[0012] Preferably, the processing of the S channel image to generate a refined image is specifically as follows:

[0013] Calling a weighted average method model to grayscale the S channel image and generate a second image;

[0014] Calling the Otsu method model to perform binarization processing on the second image and generate a third image;

[0015] The improved Zhang_Suen thinning algorithm model is called to perform image thinning processing on the third image, and generate the thinned image.

[0016] Preferably, traversing the refined image to obtain the horizontal and vertical pixel sizes of the refined image, and generating the real length of the side length of a single pixel point in the refined image according to the horizontal and vertical pixel sizes of the refined image and the real length and width of the image to be detected is specifically:

[0017] Scan the pixels of the refined image, select the pixel P1 with a pixel value of 1 and an 8-neighborhood, and mark the pixels around it according to the 8-neighborhood model;

[0018] Count the number of pixels with a pixel value of 1 in the 8-neighborhood, and record it as B(P), where B(P)=P2+P3+P4+P5+P6+P7+P8+P9;

[0019] Count the number of pixels with a pixel value of 1 among the four pixels directly adjacent to P1, denoted as N, where N = P2 + P4 + P6 + P8;

[0020] Count the number of pixels with a pixel value of 1 among the four pixels diagonally adjacent to P1, denoted as C, where C = P3 + P5 + P7 + P9;

[0021] Determine the actual length represented by pixel point P1 based on the value of B(P) and the relationship between N and C;

[0022] The actual length of the pixel point P1 is calculated according to the actual length of the pixel point P1 and the real length and width of the image to be detected.

[0023] Preferably, the calling of the length calculation model to perform calculations on the pixels that meet the conditions in the thinned image to generate the trace length of the complete graphic is specifically:

[0024] Acquire all pixel points in the refined image that meet a preset condition, wherein the preset condition is a pixel point P1 with a pixel value of 1 and an 8-neighborhood;

[0025] The length calculation model is called to sum all the pixel points that meet the preset conditions to obtain the trace length of the complete graphic.

[0026] A second embodiment of the present invention provides a stitch length detection device, comprising:

[0027] an image acquisition unit for acquiring an image to be detected, configured to acquire the image to be detected, read the image to be detected using a first color mode, and retain image information of the image to be detected, wherein the image to be detected is in a first color space, and wherein the image information includes a true length and width of the image to be detected;

[0028] a first image generating unit, configured to read the image to be detected using a second color mode so that the image to be detected enters a second color space from the first color space, and generate a first image corresponding to the image to be detected;

[0029] a refined image generating unit, configured to perform channel separation on the first image to obtain an H channel image, an S channel image, and a V channel image, and process the S channel image to generate a refined image;

[0030] an actual length generating unit, configured to traverse the refined image, obtain the horizontal and vertical pixel dimensions of the refined image, and generate the actual length of the side length of a single pixel point in the refined image according to the horizontal and vertical pixel dimensions of the refined image and the actual length and width of the image to be detected;

[0031] The stitch length generating unit is used to call the length calculation model and perform calculations on the pixels that meet the conditions in the refined image to generate the stitch length of the complete graphic.

[0032] Preferably, the refinement image generation unit is specifically used to:

[0033] Calling a weighted average method model to grayscale the S channel image and generate a second image;

[0034] Calling the Otsu method model to perform binarization processing on the second image and generate a third image;

[0035] The improved Zhang_Suen thinning algorithm model is called to perform image thinning processing on the third image, and generate the thinned image.

[0036] Preferably, the real length generating unit is specifically used for:

[0037] Scan the pixels of the refined image, select the pixel P1 with a pixel value of 1 and an 8-neighborhood, and mark the pixels around it according to the 8-neighborhood model;

[0038] Count the number of pixels with a pixel value of 1 in the 8-neighborhood, and record it as B(P), where B(P)=P2+P3+P4+P5+P6+P7+P8+P9;

[0039] Count the number of pixels with a pixel value of 1 among the four pixels directly adjacent to P1, denoted as N, where N = P2 + P4 + P6 + P8;

[0040] Count the number of pixels with a pixel value of 1 among the four pixels diagonally adjacent to P1, denoted as C, where C = P3 + P5 + P7 + P9;

[0041] Determine the actual length represented by pixel point P1 based on the value of B(P) and the relationship between N and C;

[0042] The actual length of the pixel point P1 is calculated according to the actual length of the pixel point P1 and the real length and width of the image to be detected.

[0043] Preferably, the stitch length generating unit is specifically configured to:

[0044] Acquire all pixel points in the refined image that meet a preset condition, wherein the preset condition is a pixel point P1 with a pixel value of 1 and an 8-neighborhood;

[0045] The length calculation model is called to sum all the pixel points that meet the preset conditions to obtain the trace length of the complete graphic.

[0046] A third embodiment of the present invention provides a stitch length detection device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement a stitch length detection method as described above.

[0047] A fourth embodiment of the present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute a stitch length detection method as described in any one of the above.

[0048] The present invention provides a method, device, equipment, and readable storage medium for detecting stitch length. The method comprises reading the image to be detected in a first color mode, retaining the image information of the image to be detected, and reading the image to be detected in a second color mode so that the image to be detected enters the second color space from the first color space, thereby generating a first image corresponding to the image to be detected. The method then performs channel separation on the first image to generate a three-channel image, processes the S-channel image to generate a refined image, traverses the refined image, and generates the true length of the side length of each pixel in the refined image. Finally, a length calculation model is called to perform calculations on the pixels in the refined image that meet the requirements to generate the stitch length of the complete graphic. The method aims to improve the efficiency and accuracy of path length detection for complex graphics and reduce the burden on staff. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 1 is a flow chart of a stitch length detection method provided by the first embodiment of the present invention;

[0050] Figure 2 is a schematic diagram of an image to be detected provided by the present invention;

[0051] Figure 3 is a first image schematic diagram provided by the present invention;

[0052] Figure 4 Schematic diagram of the S channel image provided by the present invention;

[0053] Figure 5 is a second image schematic diagram provided by the present invention;

[0054] Figure 6 is a third image schematic diagram provided by the present invention;

[0055] Figure 7 is a schematic diagram of a thinned image provided by the present invention;

[0056] Figure 8 It is a schematic diagram of the 8-neighborhood model provided by the present invention;

[0057] Figure 9-16 Schematic diagram of the neighborhood model corresponding to the value of B(P) provided by the present invention;

[0058] Figure 17 A schematic diagram of a module of a stitch length detection device provided by a second embodiment; DETAILED DESCRIPTION

[0059] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0060] In order to better understand the technical solution of the present invention, the embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0061] It should be understood that the embodiments described are only a portion of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative work are within the scope of protection of the present invention.

[0062] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The singular forms "a", "an", "the" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise.

[0063] It should be understood that the term "and / or" as used herein is merely a description of the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the associated objects are in an "or" relationship.

[0064] The word "if," as used herein, may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to the determination" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)," depending on the context.

[0065] The "first" and "second" mentioned in the embodiments are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that the specific order or precedence of "first" and "second" can be interchanged where appropriate. It should be understood that the objects distinguished by "first" and "second" can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein.

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

[0067] The present invention provides a method, device, equipment and readable storage medium for detecting trace length, which aims to improve the efficiency and accuracy of complex graphic path length detection and reduce the burden on staff.

[0068] See also Figure 1 A first embodiment of the present invention provides a stitch length detection method, which can be performed by a stitch length detection device (hereinafter referred to as the detection device), and in particular, by one or more processors in the detection device to implement the following steps:

[0069] S101, obtaining an image to be detected, reading the image to be detected using a first color mode, and retaining image information of the image to be detected, wherein the image to be detected is in a first color space, such as Figure 2 As shown, the image information includes the real length and width of the image to be detected;

[0070] In this embodiment, the detection device may be located in a processing terminal (such as a computer, a tablet computer, or a smart phone), and may receive input signals from other electronic devices, such as image signals.

[0071] In particular, in this embodiment, the processing terminal may store data for performing stitch length detection, and other electronic devices may obtain the stitch length value in the image by sending the image to be detected.

[0072] In this embodiment, the image to be detected can be read using the RGB color mode (i.e., the first color mode) to obtain the RGB information of each pixel of the image to be detected, as well as the actual length and width of the image to be detected, wherein the image to be detected is in the RGB color space (i.e., the first color space);

[0073] S102, read the image to be detected using a second color mode, so that the image to be detected enters the second color space from the first color space, and generates a first image corresponding to the image to be detected, such as Figure 3 As shown;

[0074] In this embodiment, the image in the RGB color space may be converted to the HSV color space (ie, the second color space). It should be noted that the image information is not changed when the image to be detected is converted from the RGB color space to the HSV color space.

[0075] S103, performing channel separation on the first image to obtain an H channel image, an S channel image, and a V channel image, and performing channel separation on the S channel image (such as Figure 4 As shown) is processed to generate a refined image;

[0076] In this embodiment, the first image, ie, the composite HSV three-channel image, may be converted into three single-channel images of "H", "S", and "V" by using a channel separation technology.

[0077] Then, the weighted average method model is called to grayscale the S channel image and generate a second image (such as Figure 5 As shown), wherein the second image is a grayscale image;

[0078] Call the Otsu method model to perform binarization on the second image and generate a third image (such as Figure 6 As shown), wherein the second image processed by the Otsu method model can obtain the best processing effect;

[0079] Call the improved Zhang_Suen thinning algorithm model to perform image thinning processing on the third image and generate the thinned image (such as Figure 7 As shown), wherein the refined image is an image with a line skeleton.

[0080] S104, traversing the refined image, obtaining the horizontal and vertical pixel sizes of the refined image, and generating the real length of the side of a single pixel point in the refined image according to the horizontal and vertical pixel sizes of the refined image and the real length and width of the image to be detected;

[0081] In this embodiment, the pixels of the thinned image are scanned to select the pixel points P1 with a pixel value of 1 and an 8-neighborhood, and the pixel points P1 are selected according to the 8-neighborhood model (e.g. Figure 8 (as shown) mark the pixels around it;

[0082] Count the number of pixels with a pixel value of 1 in the 8-neighborhood, and record it as B(P), where B(P)=P2+P3+P4+P5+P6+P7+P8+P9;

[0083] Count the number of pixels with a pixel value of 1 among the four pixels directly adjacent to P1, denoted as N, where N = P2 + P4 + P6 + P8;

[0084] Count the number of pixels with a pixel value of 1 among the four pixels diagonally adjacent to P1, denoted as C, where C = P3 + P5 + P7 + P9;

[0085] Determine the actual length represented by pixel point P1 based on the value of B(P) and the relationship between N and C;

[0086] The actual length of the pixel point P1 is calculated according to the actual length of the pixel point P1 and the real length and width of the image to be detected.

[0087] The following example illustrates the value of B(P): where A represents the width of a single pixel, B represents the diagonal length of a single pixel, and L represents the actual length represented by pixel P1;

[0088] like Figure 9 As shown, if B(P)=1, then:

[0089]

[0090] therefore:

[0091] L=N*A+C*B

[0092] like Figure 10 As shown, if B(P)=2, then:

[0093]

[0094] therefore:

[0095]

[0096] like Figure 11 As shown, if B(P)=3, then:

[0097]

[0098] therefore:

[0099]

[0100] like Figure 12 As shown, if B(P)=4, then:

[0101]

[0102] therefore:

[0103]

[0104] like Figure 13 As shown, if B(P)=5, then:

[0105]

[0106] therefore:

[0107]

[0108] like Figure 14 As shown, if B(P)=6, then:

[0109]

[0110] therefore:

[0111]

[0112] like Figure 15 As shown, if B(P)=7, then:

[0113]

[0114] therefore:

[0115]

[0116] like Figure 16 As shown, if B(P)=8, then:

[0117]

[0118] therefore:

[0119]

[0120] S105 , calling a length calculation model to perform calculations on the pixels that meet the conditions in the refined image to generate the trace length of the complete graphic.

[0121] Specifically in this embodiment:

[0122] Acquire all pixel points in the refined image that meet a preset condition, wherein the preset condition is a pixel point P1 with a pixel value of 1 and an 8-neighborhood;

[0123] The length calculation model is called to sum all the pixel points that meet the preset conditions to obtain the trace length of the complete graphic.

[0124] See also Figure 17 A second embodiment of the present invention provides a stitch length detection device, comprising:

[0125] The image acquisition unit 201 is configured to acquire an image to be detected, read the image to be detected in a first color mode, and retain image information of the image to be detected, wherein the image to be detected is in a first color space, and the image information includes the actual length and width of the image to be detected;

[0126] a first image generating unit 202 configured to read the image to be detected using a second color mode so that the image to be detected enters a second color space from the first color space, and generate a first image corresponding to the image to be detected;

[0127] A refined image generating unit 203 is configured to perform channel separation on the first image to obtain an H channel image, an S channel image, and a V channel image, and process the S channel image to generate a refined image;

[0128] an actual length generating unit 204 configured to traverse the refined image, obtain the horizontal and vertical pixel dimensions of the refined image, and generate the actual length of the side length of a single pixel point in the refined image according to the horizontal and vertical pixel dimensions of the refined image and the actual length and width of the image to be detected;

[0129] The stitch length generating unit 205 is configured to call a length calculation model and perform calculations on the pixels meeting the conditions in the thinned image to generate the stitch length of the complete graphic.

[0130] Preferably, the refinement image generation unit is specifically used to:

[0131] Calling a weighted average method model to grayscale the S channel image and generate a second image;

[0132] Calling the Otsu method model to perform binarization processing on the second image and generate a third image;

[0133] The improved Zhang_Suen thinning algorithm model is called to perform image thinning processing on the third image, and generate the thinned image.

[0134] Preferably, the real length generating unit is specifically used for:

[0135] Scan the pixels of the refined image, select the pixel P1 with a pixel value of 1 and an 8-neighborhood, and mark the pixels around it according to the 8-neighborhood model;

[0136] Count the number of pixels with a pixel value of 1 in the 8-neighborhood, and record it as B(P), where B(P)=P2+P3+P4+P5+P6+P7+P8+P9;

[0137] Count the number of pixels with a pixel value of 1 among the four pixels directly adjacent to P1, denoted as N, where N = P2 + P4 + P6 + P8;

[0138] Count the number of pixels with a pixel value of 1 among the four pixels diagonally adjacent to P1, denoted as C, where C = P3 + P5 + P7 + P9;

[0139] Determine the actual length represented by pixel point P1 based on the value of B(P) and the relationship between N and C;

[0140] The actual length of the pixel point P1 is calculated according to the actual length of the pixel point P1 and the real length and width of the image to be detected.

[0141] Preferably, the stitch length generating unit is specifically configured to:

[0142] Acquire all pixel points in the refined image that meet a preset condition, wherein the preset condition is a pixel point P1 with a pixel value of 1 and an 8-neighborhood;

[0143] The length calculation model is called to sum all the pixel points that meet the preset conditions to obtain the trace length of the complete graphic.

[0144] A third embodiment of the present invention provides a stitch length detection device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement a stitch length detection method as described above.

[0145] A fourth embodiment of the present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute a stitch length detection method as described in any one of the above.

[0146] The present invention provides a method, device, equipment, and readable storage medium for detecting stitch length. The method comprises reading the image to be detected in a first color mode, retaining the image information of the image to be detected, and reading the image to be detected in a second color mode so that the image to be detected enters the second color space from the first color space, thereby generating a first image corresponding to the image to be detected. The method then performs channel separation on the first image to generate a three-channel image, processes the S-channel image to generate a refined image, traverses the refined image, and generates the true length of the side length of each pixel in the refined image. Finally, a length calculation model is called to perform calculations on the pixels in the refined image that meet the requirements to generate the stitch length of the complete graphic. The method aims to improve the efficiency and accuracy of path length detection for complex graphics and reduce the burden on staff.

[0147] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A method for detecting stitch length, characterized in that: include: Acquire an image to be detected, read the image to be detected using a first color mode, and retain image information of the image to be detected, wherein the image to be detected is in a first color space, and wherein the image information includes the actual length and width of the image to be detected; Reading the image to be detected using a second color mode so that the image to be detected enters a second color space from the first color space, and generating a first image corresponding to the image to be detected; Performing channel separation on the first image to obtain an H channel image, an S channel image, and a V channel image, and processing the S channel image to generate a refined image; Traverse the refined image to obtain the horizontal and vertical pixel sizes of the refined image, and generate the real length of the side length of a single pixel in the refined image according to the horizontal and vertical pixel sizes of the refined image and the real length and width of the image to be detected; wherein, specifically: scan the pixels of the refined image, filter out the pixel P1 with a pixel value of 1 and an 8-neighborhood, and mark the pixels around it according to the 8-neighborhood model; count the number of pixels with a pixel value of 1 in the 8-neighborhood, recorded as B(P), where B(P)=P2+P3+P4 +P5+P6+P7+P8+P9; count the number of pixels with a pixel value of 1 among the four pixels directly adjacent to P1, denoted as N, where N=P2+P4+P6+P8; count the number of pixels with a pixel value of 1 among the four pixels diagonally adjacent to P1, denoted as C, where C=P3+P5+P7+P9; determine the actual length represented by the pixel point P1 based on the value of B(P) and the relationship between N and C; calculate the actual length of the pixel point P1 based on the actual length of the pixel point P1 and the actual length and width of the image to be detected; The length calculation model is called to perform calculations on the pixels that meet the conditions in the refined image to generate the trace length of the complete graphic.

2. A stitch length detection method according to claim 1, characterized in that: The processing of the S channel image to generate a refined image is specifically as follows: Calling a weighted average method model to grayscale the S channel image and generate a second image; Calling the Otsu method model to perform binarization processing on the second image and generate a third image; The improved Zhang_Suen thinning algorithm model is called to perform image thinning processing on the third image, and generate the thinned image.

3. A stitch length detection method according to claim 1, characterized in that: The length calculation model is called to calculate the pixel points that meet the conditions in the thinned image to generate the trace length of the complete graphic: Acquire all pixel points in the refined image that meet a preset condition, wherein the preset condition is a pixel point P1 with a pixel value of 1 and an 8-neighborhood; The length calculation model is called to sum all the pixel points that meet the preset conditions to generate the trace length of the complete graphic.

4. A stitch length detection device, characterized in that: include: an image acquisition unit for acquiring an image to be detected, configured to acquire the image to be detected, read the image to be detected using a first color mode, and retain image information of the image to be detected, wherein the image to be detected is in a first color space, and wherein the image information includes a true length and width of the image to be detected; a first image generating unit, configured to read the image to be detected using a second color mode so that the image to be detected enters a second color space from the first color space, and generate a first image corresponding to the image to be detected; a refined image generating unit, configured to perform channel separation on the first image to obtain an H channel image, an S channel image, and a V channel image, and process the S channel image to generate a refined image; A real length generating unit is used to traverse the refined image, obtain the horizontal and vertical pixel sizes of the refined image, and generate the real length of the side length of a single pixel point in the refined image according to the horizontal and vertical pixel sizes of the refined image and the real length and width of the image to be detected; wherein the real length generating unit is specifically used to: scan the pixel points of the refined image, screen out the pixel point P1 with a pixel value of 1 and an 8-neighborhood, and mark the pixel points around it according to the 8-neighborhood model; count the number of pixel points with a pixel value of 1 in the 8-neighborhood, and record it as B(P), wherein B(P )=P2+P3+P4+P5+P6+P7+P8+P9; count the number of pixels with a pixel value of 1 among the four pixels directly adjacent to P1, denoted as N, where N=P2+P4+P6+P8; count the number of pixels with a pixel value of 1 among the four pixels diagonally adjacent to P1, denoted as C, where C=P3+P5+P7+P9; determine the actual length represented by the pixel point P1 according to the value of B(P) and the relationship between N and C; calculate the actual length of the pixel point P1 according to the actual length of the pixel point P1 and the actual length and width of the image to be detected; The stitch length generating unit is used to call the length calculation model and perform calculations on the pixels that meet the conditions in the refined image to generate the stitch length of the complete graphic.

5. A stitch length detection device according to claim 4, characterized in that: The refined image generation unit is specifically configured to: Calling a weighted average method model to grayscale the S channel image and generate a second image; Calling the Otsu method model to perform binarization processing on the second image and generate a third image; The improved Zhang_Suen thinning algorithm model is called to perform image thinning processing on the third image, and generate the thinned image.

6. A stitch length detection device according to claim 4, characterized in that: The stitch length generating unit is specifically used for: Acquire all pixel points in the refined image that meet a preset condition, wherein the preset condition is a pixel point P1 with a pixel value of 1 and an 8-neighborhood; The length calculation model is called to sum all the pixel points that meet the preset conditions to obtain the trace length of the complete graphic.

7. A stitch length detection device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement a stitch length detection method according to any one of claims 1 to 3.

8. A readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the stitch length detection method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Area selection-based automatic crack size measurement method

    CN103528527A

  • Visual navigation path identification method for farmland spraying robot

    CN108710840A

  • Workpiece size measurement method and device based on global segmentation network, and storage medium

    CN114322793A