CN114926429A - Method, device and equipment for detecting trace length and readable storage medium - Google Patents

Method, device and equipment for detecting trace length and readable storage medium Download PDF

Info

Publication number
CN114926429A
CN114926429A CN202210525937.5A CN202210525937A CN114926429A CN 114926429 A CN114926429 A CN 114926429A CN 202210525937 A CN202210525937 A CN 202210525937A CN 114926429 A CN114926429 A CN 114926429A
Authority
CN
China
Prior art keywords
image
length
detected
pixel
thinned
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210525937.5A
Other languages
Chinese (zh)
Inventor
王万千
邓宏贵
阮旭生
何军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Kangyu Technology Co ltd
Central South University
Original Assignee
Hunan Kangyu Technology Co ltd
Central South University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Kangyu Technology Co ltd, Central South University filed Critical Hunan Kangyu Technology Co ltd
Priority to CN202210525937.5A priority Critical patent/CN114926429A/en
Publication of CN114926429A publication Critical patent/CN114926429A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a method, a device and equipment for detecting the length of a trace and a readable storage medium, wherein the method comprises the following steps: acquiring an image to be detected, reading the image to be detected by adopting a first color mode, reserving image information of the image to be detected, reading the image to be detected by adopting 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; acquiring the horizontal and longitudinal pixel sizes of the thinned image, and generating the real length of the side length of a single pixel point in the thinned image; and calling a length calculation model, and calculating pixel points meeting conditions in the refined image to generate the stitch length of the complete graph. The method improves the efficiency and the accuracy of the path length detection of the complex graph and lightens the burden of workers.

Description

Method, device and equipment for detecting trace length and readable storage medium
Technical Field
The present invention relates to the field of image detection, and in particular, to a method, an apparatus, a device, and a readable storage medium for detecting a length of a trace.
Background
With the acceleration of the urban modernization process and the improvement of the living standard of people, neon lamps are widely applied to the fields of entertainment places, outdoor scene rendering, advertising and the like. Compared with the traditional glass neon lamp, the flexible neon lamp has the advantages of difficult breakage, safety, reliability, long service life and the like, and is widely used at present.
In the design and manufacturing process of the flexible neon lamp, how to calculate the real lamp strip length required by manufacturing the finished neon lamp according to the design drawing provided by the customer and the corresponding size and give a reference quotation is a very important process. At present, the trace length of a line in a design drawing is usually obtained by adopting a manual tracing mode, a worker repeatedly measures and averages the trace length on a computer screen by using auxiliary tools such as a ruler and the like, and the method has serious defects: heavy work, low measurement efficiency and large result error, especially the blue light and ultraviolet light from the screen can cause serious damage to eyes of measurement personnel. Therefore, the industry urgently needs a method for automatically detecting the trace length of the complex graph to improve the efficiency and the accuracy of the detection of the path length of the complex graph and reduce the burden of workers.
In view of this, the present application is presented.
Disclosure of Invention
The invention provides a trace length detection method, a trace length detection device, trace length detection equipment and a readable storage medium, and aims to improve the efficiency and accuracy of path length detection of a complex graph and reduce the burden of workers.
A first embodiment of the present invention provides a trace length detection method, including:
acquiring an image to be detected, reading the image to be detected by adopting a first color mode, and reserving image information of the image to be detected, wherein the image to be detected is in a first color space, and the image information comprises the real length and width of the image to be detected;
reading the image to be detected by adopting a second color mode so as to enable the image to be detected to enter a second color space from the first color space and generate 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;
traversing the thinned image, acquiring the horizontal and longitudinal pixel sizes of the thinned image, and generating the real length of the side length of a single pixel point in the thinned image according to the horizontal and longitudinal pixel sizes of the thinned image and the real length and width of the image to be detected;
and calling a length calculation model, and calculating pixel points meeting conditions in the refined image to generate the stitch length of the complete graph.
Preferably, the processing the S-channel image to generate a refined image specifically includes:
calling a weighted average method model to perform graying processing on the S-channel image and generating a second image;
calling an Otsu method model to carry out binarization processing on the second image and generate a third image;
and calling an improved Zhang _ Suen thinning algorithm model to perform image thinning processing on the third image and generate the thinned image.
Preferably, the traversing the thinned image to obtain the horizontal and longitudinal pixel sizes of the thinned image, and the generating of the real length of the side length of a single pixel point in the thinned image according to the horizontal and longitudinal pixel sizes of the thinned image and the real length and width of the image to be detected specifically comprises:
scanning the pixel points of the refined image, screening out pixel points P1 with a pixel value of 1 and 8 neighborhoods, and marking the surrounding pixel points according to the 8-neighborhood model;
counting the number of pixels with a pixel value of 1 in the 8 neighborhoods, and recording the number as B (P), wherein B (P) is P2+ P3+ P4+ P5+ P6+ P7+ P8+ P9;
counting the number of pixel points with a pixel value of 1 in four pixel points directly adjacent to the P1, and marking as N, wherein N is P2+ P4+ P6+ P8;
counting the number of pixels with a pixel value of 1 in four pixels diagonally adjacent to the P1, and marking as C, wherein C is P3+ P5+ P7+ P9;
judging the actual length represented by the pixel point P1 according to the value of B (P) and the size relationship between N and C;
and calculating the real length of the pixel point P1 according to the actual length of the pixel point P1 and the real length and width of the image to be detected.
Preferably, the invoking of the length calculation model, calculating the pixel points meeting the condition in the refined image to generate the trace length of the complete graph specifically comprises:
acquiring all pixel points which accord with a preset condition in the thinned image, wherein the preset condition is that the pixel point P1 has a pixel value of 1 and has an 8-neighborhood;
and calling a length calculation model to sum all the pixel points meeting the preset condition to form the trace length of the complete graph.
A second embodiment of the present invention provides a trace length detection apparatus, including:
the device comprises an image acquisition unit to be detected, a color matching unit and a color matching unit, wherein the image acquisition unit to be detected is used for acquiring an image to be detected, reading the image to be detected by adopting a first color mode and retaining the image information of the image to be detected, the image to be detected is positioned in a first color space, and the image information comprises the real length and the real width of the image to be detected;
the first image generation unit is used for reading the image to be detected by adopting a second color mode so as to enable the image to be detected to enter 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;
the actual length generating unit is used for traversing the thinned image, acquiring the horizontal and longitudinal pixel sizes of the thinned image, and generating the real length of the side length of a single pixel point in the thinned image according to the horizontal and longitudinal pixel sizes of the thinned image and the real length and width of the image to be detected;
and the stitch length generating unit is used for calling a length calculation model and calculating pixel points meeting conditions in the thinned image so as to generate the stitch length of the complete graph.
Preferably, the refined image generation unit is specifically configured to:
calling a weighted average method model to perform graying processing on the S-channel image and generating a second image;
invoking an Otsu method model to carry out binarization processing on the second image and generate a third image;
and calling an improved Zhang _ Suen thinning algorithm model to carry out image thinning processing on the third image and generate the thinned image.
Preferably, the real length generating unit is specifically configured to:
scanning the pixel points of the refined image, screening out pixel points P1 with pixel values of 1 and 8 neighborhoods, and marking the surrounding pixel points according to the 8-neighborhood model;
counting the number of pixels with a pixel value of 1 in the 8 neighborhoods, and recording the number as B (P), wherein B (P) is P2+ P3+ P4+ P5+ P6+ P7+ P8+ P9;
counting the number of pixel points with a pixel value of 1 in four pixel points directly adjacent to the P1, and marking as N, wherein N is P2+ P4+ P6+ P8;
counting the number of pixels with a pixel value of 1 in four pixels diagonally adjacent to the P1, and marking as C, wherein C is P3+ P5+ P7+ P9;
judging the actual length represented by the pixel point P1 according to the value of B (P) and the size relation of N and C;
and calculating the real length of the pixel point P1 according to the actual length of the pixel point P1 and the real length and width of the image to be detected.
Preferably, the stitch length generating unit is specifically configured to:
acquiring all pixel points which accord with a preset condition in the thinned image, wherein the preset condition is that the pixel point P1 has a pixel value of 1 and has 8 neighborhoods;
and calling a length calculation model to sum all the pixel points meeting the preset condition to form the trace length of the complete graph.
A third embodiment of the present invention provides a trace length detection apparatus, including 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 trace length detection method as described in any one of the above.
A fourth embodiment of the present invention provides a readable storage medium, where the computer-readable storage medium includes a stored computer program, where when the computer program runs, a device on which the computer-readable storage medium is located is controlled to execute a trace length detection method as described in any one of the above.
Based on the method, the device and the equipment for detecting the length of the trace and the readable storage medium, the image to be detected is read through a first color mode, the image information of the image to be detected is reserved, the image to be detected is read through a second color mode, so that the image to be detected enters a second color space from the first color space, and a first image corresponding to the image to be detected is generated; and finally, calling a length calculation model to calculate pixel points meeting conditions in the thinned image so as to generate the stitch length of the complete graph. The method aims to improve the efficiency and accuracy of the path length detection of the complex graph and reduce the burden of workers.
Drawings
Fig. 1 is a schematic flowchart of a trace length detection method according to a first embodiment of the present invention;
FIG. 2 is a schematic diagram of an image to be detected provided by the present invention;
FIG. 3 is a schematic diagram of a first image provided by the present invention;
FIG. 4 is a schematic diagram of an S-channel image provided by the present invention;
FIG. 5 is a schematic diagram of a second image provided by the present invention;
FIG. 6 is a schematic diagram of a third image provided by the present invention;
FIG. 7 is a schematic diagram of a refined image provided by the present invention;
FIG. 8 is a schematic diagram of an 8-neighborhood model provided by the present invention;
FIGS. 9-16 are schematic diagrams of neighborhood models corresponding to values according to B (P) provided by the present invention;
FIG. 17 is a block diagram of a trace length detection apparatus according to a second embodiment;
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For better understanding of the technical solutions of the present invention, the following detailed descriptions of the embodiments of the present invention are provided with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the description of the invention and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely a relationship that describes an associated object, meaning that three relationships may exist, e.g., a and/or B, may represent: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
The word "if," as used herein, may be interpreted as "at … …" or "when … …" or "in response to a determination" or "in response to a detection," depending on the context. Similarly, the phrase "if determined" or "if detected (a stated condition or event)" may be interpreted as "upon determining" or "in response to determining" or "upon detecting (a stated condition or event)" or "in response to detecting (a stated condition or event)", depending on the context.
In the embodiments, the references to "first \ second" merely distinguish similar objects and do not represent a specific ordering for the objects, and it is to be understood that "first \ second" may interchange a specific order or sequence where permitted. It should be understood that "first \ second" distinct objects may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced in sequences other than those illustrated or described herein.
The following detailed description of specific embodiments of the invention refers to the accompanying drawings.
The invention provides a trace length detection method, a trace length detection device, trace length detection equipment and a readable storage medium, and aims to improve the efficiency and accuracy of path length detection of a complex graph and reduce the burden of workers.
Referring to fig. 1, a first embodiment of the present invention provides a trace length detection method, which can be executed by a trace length detection device (hereinafter referred to as a detection device), and in particular, executed by one or more processors in the detection device, so as to implement the following steps:
s101, acquiring an image to be detected, reading the image to be detected by adopting a first color mode, and reserving image information of the image to be detected, wherein the image to be detected is in a first color space, as shown in figure 2, and the image information comprises the real length and the real width of the image to be detected;
in this embodiment, the detection device may be located at a processing terminal (e.g., a computer, a tablet computer, or a smart phone), and may receive an input signal of another electronic device, such as a picture signal.
Particularly, in this embodiment, data for detecting the stitch length may be stored in the processing terminal, and the other electronic devices may obtain the stitch length value in the image by sending the image to be detected.
In this embodiment, the image to be detected may be read through an RGB color mode (i.e., a first color mode), and RGB information of each pixel point of the image to be detected and a real length and a real width of the image to be detected are obtained, where the image to be detected is in an RGB color space (i.e., a first color space);
s102, reading the image to be detected by adopting a second color mode so as to enable the image to be detected to enter a second color space from the first color space, and generating a first image corresponding to the image to be detected, as shown in FIG. 3;
in this embodiment, the image in the RGB color space may be converted into the HSV color space (i.e., the second color space), and it should be noted that the picture information is not changed when the image to be detected is converted from the RGB color space into the HSV color space.
S103, 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 (as shown in FIG. 4) to generate a refined image;
in this embodiment, the first image, i.e., the composite HSV three-channel image, may be converted into three single-channel images of "H", "S", and "V" by a channel separation technique.
Then, calling a weighted average method model to perform graying processing on the S-channel image, and generating a second image (as shown in fig. 5), wherein the second image is a grayscale image;
invoking an Otsu method model to perform binarization processing on the second image and generate a third image (as shown in FIG. 6), wherein the second image processed by the Otsu method model can obtain the best processing effect;
calling an improved Zhang _ Suen thinning algorithm model to perform image thinning processing on the third image, and generating the thinned image (as shown in FIG. 7), wherein the thinned image is an image with a line skeleton.
S104, traversing the thinned image, acquiring the horizontal and longitudinal pixel sizes of the thinned image, and generating the real length of the side length of a single pixel point in the thinned image according to the horizontal and longitudinal pixel sizes of the thinned image and the real length and width of the image to be detected;
in this embodiment, scanning the pixel points of the refined image, screening out a pixel point P1 with a pixel value of 1 and 8 neighborhoods, and marking the surrounding pixel points according to an 8-neighborhood model (as shown in fig. 8);
counting the number of pixels with a pixel value of 1 in the 8 neighborhoods, and recording the number as B (P), wherein B (P) is P2+ P3+ P4+ P5+ P6+ P7+ P8+ P9;
counting the number of pixels with a pixel value of 1 in four pixels directly adjacent to the P1, and recording the number as N, wherein N is P2+ P4+ P6+ P8;
counting the number of pixels with a pixel value of 1 in four pixels diagonally adjacent to the P1, and marking as C, wherein C is P3+ P5+ P7+ P9;
judging the actual length represented by the pixel point P1 according to the value of B (P) and the size relation of N and C;
and calculating the real length of the pixel point P1 according to the real length of the pixel point P1 and the real length and width of the image to be detected.
The values of B (P) are illustrated below, 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;
as shown in fig. 9, if b (p) is 1, there are:
Figure BDA0003644451020000111
thus:
L=N*A+C*B
as shown in fig. 10, when b (p) is 2, there are:
Figure BDA0003644451020000112
thus:
Figure BDA0003644451020000113
as shown in fig. 11, if b (p) is 3, there are:
Figure BDA0003644451020000114
thus:
Figure BDA0003644451020000121
as shown in fig. 12, if b (p) is 4, there are:
Figure BDA0003644451020000122
thus:
Figure BDA0003644451020000123
as shown in fig. 13, if b (p) is 5, there are:
Figure BDA0003644451020000124
thus:
Figure BDA0003644451020000131
as shown in fig. 14, if b (p) is 6, there are:
Figure BDA0003644451020000132
thus:
Figure BDA0003644451020000133
as shown in fig. 15, when b (p) is 7, there are:
Figure BDA0003644451020000134
thus:
Figure BDA0003644451020000135
as shown in fig. 16, when b (p) is 8:
Figure BDA0003644451020000141
thus:
Figure BDA0003644451020000142
and S105, calling a length calculation model, and calculating pixel points meeting conditions in the thinned image to generate the stitch length of the complete graph.
Specifically in this embodiment:
acquiring all pixel points which accord with a preset condition in the thinned image, wherein the preset condition is that the pixel point P1 has a pixel value of 1 and has an 8-neighborhood;
and calling a length calculation model to sum all the pixel points meeting the preset condition to form the stitch length of the complete graph.
Referring to fig. 17, a second embodiment of the present invention provides a trace length detection apparatus, including:
the image acquisition unit 201 to be detected is used for acquiring an image to be detected, reading the image to be detected by adopting a first color mode, and reserving image information of the image to be detected, wherein the image to be detected is in a first color space, and the image information comprises the real length and the real width of the image to be detected;
a first image generating unit 202, configured to read the image to be detected by 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 203, 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;
the actual length generating unit 204 is configured to traverse the refined image, obtain horizontal and longitudinal pixel sizes of the refined image, and generate a true length of a side length of a single pixel point in the refined image according to the horizontal and longitudinal pixel sizes of the refined image and the true length and width of the image to be detected;
the trace length generating unit 205 is configured to invoke a length calculation model, and perform operation on the pixel points in the refined image that meet the condition to generate the trace length of the complete graph.
Preferably, the pair of refined image generating units is specifically configured to:
calling a weighted average method model to perform graying processing on the S-channel image and generating a second image;
calling an Otsu method model to carry out binarization processing on the second image and generate a third image;
and calling an improved Zhang _ Suen thinning algorithm model to carry out image thinning processing on the third image and generate the thinned image.
Preferably, the real length generating unit is specifically configured to:
scanning the pixel points of the refined image, screening out pixel points P1 with a pixel value of 1 and 8 neighborhoods, and marking the surrounding pixel points according to the 8-neighborhood model;
counting the number of pixels with a pixel value of 1 in the 8 neighborhoods, and recording the number as B (P), wherein B (P) is P2+ P3+ P4+ P5+ P6+ P7+ P8+ P9;
counting the number of pixels with a pixel value of 1 in four pixels directly adjacent to the P1, and recording the number as N, wherein N is P2+ P4+ P6+ P8;
counting the number of pixels with a pixel value of 1 in four pixels diagonally adjacent to the P1, and marking as C, wherein C is P3+ P5+ P7+ P9;
judging the actual length represented by the pixel point P1 according to the value of B (P) and the size relationship between N and C;
and calculating the real length of the pixel point P1 according to the actual length of the pixel point P1 and the real length and width of the image to be detected.
Preferably, the stitch length generating unit is specifically configured to:
acquiring all pixel points which accord with a preset condition in the thinned image, wherein the preset condition is that the pixel point P1 has a pixel value of 1 and has 8 neighborhoods;
and calling a length calculation model to sum all the pixel points meeting the preset condition to form the trace length of the complete graph.
A third embodiment of the present invention provides a trace-length detection apparatus, including 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 trace-length detection method as described in any one of the above.
A fourth embodiment of the present invention provides a readable storage medium, where the readable storage medium includes a stored computer program, where the computer program, when running, controls an apparatus where the readable storage medium is located to execute a trace length detection method as described in any one of the above.
Based on the method, the device and the equipment for detecting the length of the trace and the readable storage medium provided by the invention, the image to be detected is read through a first color mode, the image information of the image to be detected is reserved, and the image to be detected is read through a second color mode, so that the image to be detected enters a second color space from the first color space and a first image corresponding to the image to be detected is generated; and finally, calling a length calculation model to calculate pixel points meeting conditions in the thinned image so as to generate the stitch length of the complete graph. The method aims to improve the efficiency and accuracy of the path length detection of the complex graph and reduce the burden of workers.
While the invention has been described with reference to specific preferred embodiments, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention as defined in the following claims. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A trace length detection method, comprising:
acquiring an image to be detected, reading the image to be detected by adopting a first color mode, and reserving image information of the image to be detected, wherein the image to be detected is in a first color space, and the image information comprises the real length and width of the image to be detected;
reading the image to be detected by adopting a second color mode so as to enable the image to be detected to enter a second color space from the first color space and generate 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;
traversing the thinned image, acquiring the transverse and longitudinal pixel sizes of the thinned image, and generating the real length of the side length of a single pixel point in the thinned image according to the transverse and longitudinal pixel sizes of the thinned image and the real length and width of the image to be detected;
and calling a length calculation model, and calculating pixel points meeting conditions in the refined image to generate the stitch length of the complete image.
2. The trace length detection method according to claim 1, wherein the processing the S-channel image to generate the refined image specifically comprises:
calling a weighted average method model to perform graying processing on the S-channel image and generating a second image;
invoking an Otsu method model to carry out binarization processing on the second image and generate a third image;
and calling an improved Zhang _ Suen thinning algorithm model to carry out image thinning processing on the third image and generate the thinned image.
3. The trace length detection method according to claim 1, wherein 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 specifically comprises:
scanning the pixel points of the refined image, screening out pixel points P1 with pixel values of 1 and 8 neighborhoods, and marking the surrounding pixel points according to the 8-neighborhood model;
counting the number of pixels with a pixel value of 1 in the 8 neighborhoods, and recording the number as B (P), wherein B (P) is P2+ P3+ P4+ P5+ P6+ P7+ P8+ P9;
counting the number of pixel points with a pixel value of 1 in four pixel points directly adjacent to the P1, and marking as N, wherein N is P2+ P4+ P6+ P8;
counting the number of pixels with a pixel value of 1 in four pixels diagonally adjacent to the P1, and marking as C, wherein C is P3+ P5+ P7+ P9;
judging the actual length represented by the pixel point P1 according to the value of B (P) and the size relationship between N and C;
and calculating the real length of the pixel point P1 according to the actual length of the pixel point P1 and the real length and width of the image to be detected.
4. The trace length detection method according to claim 1, wherein the invoking of the length calculation model operates on eligible pixels in the refined image to generate a trace length of the complete graph specifically comprises:
acquiring all pixel points which accord with a preset condition in the thinned image, wherein the preset condition is that the pixel point P1 has a pixel value of 1 and has an 8-neighborhood;
and calling a length calculation model to sum all the pixel points meeting the preset condition to generate the trace length of the complete graph.
5. A trace length detection device, comprising:
the device comprises an image acquisition unit to be detected, a color matching unit and a color matching unit, wherein the image acquisition unit to be detected is used for acquiring an image to be detected, reading the image to be detected by adopting a first color mode and retaining the image information of the image to be detected, the image to be detected is positioned in a first color space, and the image information comprises the real length and the real width of the image to be detected;
the first image generation unit is used for reading the image to be detected by adopting a second color mode so as to enable the image to be detected to enter a second color space from the first color space and generate a first image corresponding to the image to be detected;
the thinned image generating unit is used for carrying out channel separation on the first image so as to obtain an H channel image, an S channel image and a V channel image, and processing the S channel image to generate a thinned image;
the real length generating unit is used for traversing the thinned image, acquiring the horizontal and longitudinal pixel sizes of the thinned image, and generating the real length of the side length of a single pixel point in the thinned image according to the horizontal and longitudinal pixel sizes of the thinned image and the real length and width of the image to be detected;
and the stitch length generating unit is used for calling a length calculation model and calculating pixel points which meet the conditions in the thinned image so as to generate the stitch length of the complete graph.
6. The trace length detection apparatus according to claim 5, wherein the refined image generation unit is specifically configured to:
calling a weighted average method model to perform graying processing on the S-channel image and generating a second image;
calling an Otsu method model to carry out binarization processing on the second image and generate a third image;
and calling an improved Zhang _ Suen thinning algorithm model to perform image thinning processing on the third image and generate the thinned image.
7. The trace length detection device according to claim 5, wherein the real length generation unit is specifically configured to:
scanning the pixel points of the refined image, screening out pixel points P1 with a pixel value of 1 and 8 neighborhoods, and marking the surrounding pixel points according to the 8-neighborhood model;
counting the number of pixels with a pixel value of 1 in the 8 neighborhoods, and recording the number as B (P), wherein B (P) is P2+ P3+ P4+ P5+ P6+ P7+ P8+ P9;
counting the number of pixel points with a pixel value of 1 in four pixel points directly adjacent to the P1, and marking as N, wherein N is P2+ P4+ P6+ P8;
counting the number of pixels with a pixel value of 1 in four pixels diagonally adjacent to the P1, and marking as C, wherein C is P3+ P5+ P7+ P9;
judging the actual length represented by the pixel point P1 according to the value of B (P) and the size relationship between N and C;
and calculating the real length of the pixel point P1 according to the actual length of the pixel point P1 and the real length and width of the image to be detected.
8. The trace length detection device according to claim 5, wherein the trace length generation unit is specifically configured to:
acquiring all pixel points which accord with a preset condition in the thinned image, wherein the preset condition is that the pixel point P1 has a pixel value of 1 and has 8 neighborhoods;
and calling a length calculation model to sum all the pixel points meeting the preset condition to form the trace length of the complete graph.
9. A trace-length detection apparatus comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor executing the computer program to implement a trace-length detection method as claimed in any one of claims 1 to 4.
10. A computer-readable storage medium comprising a stored computer program, wherein the computer program when executed controls an apparatus in which the computer-readable storage medium is located to perform a trace length detection method as claimed in any one of claims 1 to 4.
CN202210525937.5A 2022-05-16 2022-05-16 Method, device and equipment for detecting trace length and readable storage medium Pending CN114926429A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210525937.5A CN114926429A (en) 2022-05-16 2022-05-16 Method, device and equipment for detecting trace length and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210525937.5A CN114926429A (en) 2022-05-16 2022-05-16 Method, device and equipment for detecting trace length and readable storage medium

Publications (1)

Publication Number Publication Date
CN114926429A true CN114926429A (en) 2022-08-19

Family

ID=82808421

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210525937.5A Pending CN114926429A (en) 2022-05-16 2022-05-16 Method, device and equipment for detecting trace length and readable storage medium

Country Status (1)

Country Link
CN (1) CN114926429A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116664664A (en) * 2023-08-01 2023-08-29 苏州高视半导体技术有限公司 Method for detecting length of substrate dark line, electronic device and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116664664A (en) * 2023-08-01 2023-08-29 苏州高视半导体技术有限公司 Method for detecting length of substrate dark line, electronic device and storage medium
CN116664664B (en) * 2023-08-01 2023-11-10 苏州高视半导体技术有限公司 Method for detecting length of substrate dark line, electronic device and storage medium

Similar Documents

Publication Publication Date Title
CN113592886B (en) Drawing examining method and device for building drawing, electronic equipment and medium
CN108764352B (en) Method and device for detecting repeated page content
CN106709484B (en) Digital identification method of digital instrument
CN111899270A (en) Card frame detection method, device and equipment and readable storage medium
CN111259891B (en) Method, device, equipment and medium for identifying identity card in natural scene
CN113962306A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
CN112052782A (en) Around-looking-based parking space identification method, device, equipment and storage medium
KR101842535B1 (en) Method for the optical detection of symbols
US20200388017A1 (en) System, apparatus and method for facilitating inspection of a target object
CN112396050B (en) Image processing method, device and storage medium
CN116844177A (en) Table identification method, apparatus, device and storage medium
CN110909568A (en) Image detection method, apparatus, electronic device, and medium for face recognition
CN114926429A (en) Method, device and equipment for detecting trace length and readable storage medium
CN110310341B (en) Method, device, equipment and storage medium for generating default parameters in color algorithm
CN109977910B (en) Rapid bill positioning method and system based on color line segments
CN117115171B (en) Slight bright point defect detection method applied to subway LCD display screen
CN116091503B (en) Method, device, equipment and medium for discriminating panel foreign matter defects
CN112967224A (en) Electronic circuit board detection system, method and medium based on artificial intelligence
CN115546219B (en) Detection plate type generation method, plate card defect detection method, device and product
CN117557536A (en) Multi-channel-based pixel filtering defect measurement method, system, equipment and medium
WO2020107196A1 (en) Photographing quality evaluation method and apparatus for photographing apparatus, and terminal device
CN116128867A (en) Method, device, equipment and storage medium for detecting edge sealing defect of plate
CN115578551A (en) Household ammeter state checking method based on image recognition
CN114418951A (en) Pad detection method and device, computer equipment and storage medium
CN114549499B (en) High-speed camera standard-reaching detection method, system and medium for terminal equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination