Method, system and terminal for extracting surface contour line of semitransparent objectTechnical Field
The invention relates to an object surface contour line extraction method, in particular to a semi-transparent object surface contour line extraction method, a semi-transparent object surface contour line extraction system and a semi-transparent object surface contour line extraction terminal.
Background
The contour measurement plays an important role in the industrial manufacturing process, is widely applied to the fields of optical precision engineering, aerospace, robots, chip manufacturing, automobile manufacturing, underwater detection and the like, and becomes an essential link for function realization, equipment data acquisition, part data acquisition, precision analysis, quality detection and the like in more and more industrial application fields. With higher and higher manufacturing accuracy, non-contact profile measurement is becoming the mainstream trend. Among them, the laser profile sensor based on the line structured light method gradually becomes a hot spot. The method has the outstanding advantages of non-contact, high precision, high speed, wide applicability and the like, and becomes the mainstream trend of contour measurement.
The existing line structured light measuring method works based on the reflection principle of the measured target surface to the line laser stripe, and is only suitable for targets with diffuse reflection surfaces. However, for a semitransparent target, such as a glue strip produced by an automatic dispenser, linear structured light is not only directly diffused on the surface of the incident position, but also transmitted and enters the inside of an object to be scattered on the sub-surface, the scattered light finally exits from a surface position different from the incident position, and the direct reflected component on the surface is interfered by the scattered component on the sub-surface. This not only results in the reduction of the signal-to-noise ratio of the laser stripe image, but also causes the gray scale distribution rule of the laser stripe image to change seriously, and further causes the accuracy of the existing contour line extraction algorithm to be reduced seriously, even errors occur, and the contour line of the surface of the object cannot be extracted accurately.
At present, for line structured light measurement of a semitransparent object, a learner combines phase shift and polarization filtering technologies to separate a direct reflection component and a sub-surface scattering component, and can realize profile measurement of the semitransparent object. However, this method requires a high-frequency projection grating, a polarizing plate, and the like, and is complicated in structure, high in cost, and low in efficiency.
Therefore, profiling of translucent objects becomes one of the bottleneck problems in the industry.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a method, a system and a terminal for extracting the surface contour line of a semitransparent object.
According to an aspect of the present invention, there is provided a method for extracting a surface contour line of a translucent object, including:
scanning the gray scale of each column of the imaging points of the laser stripe image formed on the surface of the measured target to obtain a gray scale sequence
For the obtained gray sequence, extracting the position area of the direct reflection component wave crest by adopting a method of mathematical morphology and a gray threshold value;
calculating the coordinates of the contour points by adopting a gray scale gravity center method according to the position area of the wave crest of the direct reflection component;
and finally obtaining the whole contour line of the surface of the semitransparent object according to the obtained contour point coordinates.
Preferably, the acquiring of the gray level sequence refers to: and extracting the gray value of a certain column of pixel points of the laser stripe image, and analyzing the gray value as an independent one-dimensional gray array.
Preferably, the extracting the position region of the peak of the direct reflection component by using mathematical morphology and a gray threshold includes:
extracting an envelope curve, and filtering abrupt clutter with smaller width by closed operation aiming at the gray sequence to obtain the envelope curve of a gray distribution curve;
extracting a baseline, cutting off a convex peak of the envelope curve through open operation, and smoothing a signal from the bottom to obtain the baseline of a gray distribution curve;
acquiring characteristic peaks, and carrying out differential operation on the envelope curve and the base line to obtain a plurality of gray characteristic peaks, wherein one characteristic peak is a direct reflection peak of the surface of the target to be detected, and the other characteristic peaks are reflection peaks of the secondary surface;
selecting a direct reflection peak, analyzing the plurality of gray characteristic peaks from left to right in sequence, and selecting a first characteristic peak meeting a threshold condition as the direct reflection peak;
calculating the coordinate of the direct reflection peak, and for the direct reflection characteristic peak, the coordinate of the characteristic peak is the coordinate value corresponding to the peak value, and meanwhile, calculating the width of the characteristic peak;
intercepting direct reflection peak data, and intercepting a section of data from the gray sequence as direct reflection peak data according to the direct reflection characteristic peak coordinate as a center and the range of twice the width of the direct reflection characteristic peak.
According to a second aspect of the present invention, there is provided a translucent object surface contour line extraction system comprising:
the gray sequence acquisition unit is used for scanning the gray of each line of the imaging points of the laser stripe image formed on the surface of the measured target to acquire a gray sequence;
the direct reflection component wave crest extraction unit is used for extracting a position area of the direct reflection component wave crest by adopting a method of mathematical morphology and a gray threshold value for the acquired gray sequence;
a contour point coordinate obtaining unit which calculates a contour point coordinate by a gray scale gravity center method according to the position area of the direct reflection component wave peak extracting unit;
and the contour line acquisition unit is used for finally acquiring the whole contour line of the surface of the semitransparent object according to the calculated contour point coordinates obtained by the contour point coordinate acquisition unit.
Preferably, the direct reflection component peak extraction unit includes:
an envelope sub-unit is extracted, and the abrupt clutter with smaller width is filtered by closed operation aiming at the gray sequence to obtain an envelope of a gray distribution curve;
a baseline extraction subunit, wherein convex peaks of the envelope are cut off through open operation, and signals are smoothed from the bottom to obtain a baseline of a gray distribution curve;
a characteristic peak acquisition subunit, which performs differential operation on the envelope curve and the base line to acquire a plurality of gray characteristic peaks, wherein one characteristic peak is a direct reflection peak of the surface of the target to be detected, and the other characteristic peaks are reflection peaks of the subsurface;
selecting a direct reflection peak subunit, analyzing the plurality of gray characteristic peaks from left to right in sequence, and selecting a first characteristic peak meeting a threshold condition as a direct reflection peak;
calculating a direct reflection peak coordinate subunit, wherein for the direct reflection characteristic peak, the coordinate of the characteristic peak is a coordinate value corresponding to the peak value, and meanwhile, the width of the characteristic peak is calculated;
and intercepting a direct reflection peak data subunit, and intercepting a section of data from the gray sequence as direct reflection peak data according to the direct reflection characteristic peak coordinate as a center and the range of twice the width of the direct reflection characteristic peak.
According to a third aspect of the present invention, there is provided a translucent object surface contour line extraction terminal comprising: the device comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor can be used for executing the semi-transparent object surface contour line extraction method when executing the program.
Compared with the prior art, the invention has at least one of the following beneficial effects:
the method, the system and the terminal can effectively extract the laser stripe contour line of the surface of the semitransparent target represented by the adhesive tape, have more accurate measurement results, provide a new solution for the contour measurement of the semitransparent target in an industrial field, have wide practicability and universality and are suitable for contour calibration of any type.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
FIG. 1 is a schematic diagram of a laser profile sensor measuring a translucent target according to an embodiment of the present invention;
FIG. 2 is an actual laser fringe image of a translucent target according to one embodiment of the present invention;
FIG. 3 is a flowchart of a contour line extraction method according to an embodiment of the present invention;
FIG. 4 is a gray scale distribution diagram of a laser stripe image according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of an envelope and a baseline of a gray scale profile of a laser stripe image according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a characteristic peak of a gray scale distribution of a laser stripe image according to an embodiment of the present invention;
FIG. 7 is a schematic diagram illustrating a method for calculating the peak value and width of a direct reflection peak according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of an embodiment of the present invention for intercepting direct reflectance peak data;
FIG. 9 is a comparison of the effect of the contour line extraction method and other methods according to an embodiment of the present invention;
in the figure, 1-line laser, 2-measured object, 3-lens and 4-camera.
Detailed Description
The present invention will be described in detail with reference to specific examples. The following examples will assist those skilled in the art in further understanding the invention, but are not intended to limit the invention in any way. It should be noted that variations and modifications can be made by persons skilled in the art without departing from the spirit of the invention. All falling within the scope of the present invention. Portions not described in detail in the following embodiments may be implemented by using a conventional technology.
Fig. 1 is a schematic diagram of a laser profile sensor measuring a translucent target according to an embodiment of the present invention.
Referring to fig. 1, the method for extracting the surface contour line of the semitransparent object in the embodiment may include:
s1, scanning the gray scale of each line of the imaging points of the laser stripe image formed on the surface of the detected target to obtain a gray scale sequence;
s2, for the gray level sequence, extracting the position area of the direct reflection component wave crest by adopting the methods of mathematical morphology and gray level threshold value;
s3, calculating the coordinates of the contour points by a gray scale gravity center method according to the position area of the wave crest of the direct reflection component;
and S4, finally obtaining the whole contour line of the surface of the semitransparent object according to the obtained contour point coordinates.
FIG. 2 is an actual laser fringe image of a translucent target according to one embodiment of the present invention.
Referring to fig. 2, in the above-mentioned S1, the laser emitted from theline laser 1 may be projected onto the surface of the measuredobject 2 and form a laser stripe, and the laser stripe is imaged onto the imaging surface of thecamera 4 through thelens 3 to form laser stripe image data, as shown in fig. 2. Through reasonable data processing, the section profile and the characteristic parameters of the measuredtarget 2 can be obtained.
Fig. 3 is a flowchart of a contour line extraction method according to an embodiment of the present invention.
Referring to fig. 3, in some preferred embodiments, in step S2, for obtaining the gray scale sequence, extracting the position region of the peak of the direct reflection component by using mathematical morphology and a gray scale threshold, which may be sequentially implemented by extracting an envelope curve, extracting a baseline, obtaining a characteristic peak, selecting a direct reflection peak, calculating coordinates of the direct reflection peak, and intercepting data of the direct reflection peak.
Specifically, referring to fig. 4-8, in a preferred embodiment, S2 may be performed according to the following steps:
s21, acquiring a gray sequence: extracting the gray value of a certain column of pixel points of the laser stripe image, and analyzing the gray value as an independent one-dimensional gray array, wherein the gray distribution curve of the gray array is shown in FIG. 4;
s22, extracting envelope: for the gray sequence, filtering out the abrupt clutter with smaller width through closed operation to obtain an envelope curve of a gray distribution curve, as shown in fig. 5;
s23, extracting baseline: for the gray distribution envelope curve, the convex peak is cut off through the opening operation, and the signal is smoothed from the bottom to obtain the baseline of the gray distribution curve, as shown in fig. 5;
s24, obtaining a characteristic peak: the envelope curve and the base line are subjected to difference operation, so that a plurality of gray characteristic peaks can be obtained, such as M1, M2 and M3 shown in FIG. 6; one characteristic peak is a direct reflection peak of the surface of the measured target, and the other characteristic peaks are reflection peaks of the subsurface;
s25, selecting a direct reflection peak: sequentially analyzing the gray characteristic peaks from left to right, and selecting the first characteristic peak meeting the threshold condition as a direct reflection peak, as shown in fig. 7;
s26, calculating coordinates of direct reflection peak: for the above-mentioned direct reflection characteristic peak, the coordinate of the characteristic peak is the coordinate value corresponding to the peak value, and at the same time, the width of the characteristic peak is calculated, as shown in fig. 7;
and S27, intercepting the direct reflection peak data: based on the above-mentioned direct reflection characteristic peak coordinate as the center and the range of twice the width of the direct reflection characteristic peak, a piece of data is cut out from the gray scale sequence as direct reflection peak data, as shown in fig. 8. The range of the specific data interception can be determined according to actual requirements.
Compared with the existing contour line extraction method, the method of the embodiment of the invention considers the false characteristic peak formed by the reflection component of the surface, and identifies the surface direct reflection peak really representing the surface contour position through threshold value comparison, thereby avoiding the error method of mixing the conventional method into one time and obviously improving the contour line extraction precision.
In some preferred embodiments, in S3, the coordinates of the contour points are calculated by using a gray scale centroid method, which may be: and extracting the sub-pixel coordinate value of the characteristic peak by adopting a gray scale gravity center method according to the intercepted direct reflection peak data to be used as the position coordinate of the outline point of the row of stripes.
In some preferred embodiments, in S4, the contour line is obtained and may be: and repeating the process for each line of data of the laser stripe image, sequentially obtaining the contour point coordinates of the line of stripes, and further obtaining the coordinate sequence of the whole contour line.
Optionally, in the above embodiment, the threshold condition for selecting the direct reflection peak may be: the peak value of the characteristic peak is larger than or equal to the average value of all the characteristic peak values, and the width of the characteristic peak is larger than or equal to the average value of all the characteristic peak widths. Assuming that the peak values of the n characteristic peaks are a1, a2, … and An, and the widths are W1, W2, … and Wn, the peak threshold value of the direct reflection peak is determined as (a1+ a2+ … + An)/n, and the width threshold value is determined as (W1+ W2+ … + Wn)/n.
Optionally, in the above embodiment, the gray scale gravity center method for calculating the coordinates of the contour points is as follows: and taking the abscissa of the gravity center of the intercepted direct reflection peak gray scale data curve as a contour point coordinate. Assuming that the intercepted m direct reflection peak gray scale data are G1, G2, … and Gm in sequence, the central coordinate thereof is
In another embodiment of the present invention, a system for extracting a surface contour line of a semitransparent object is further provided, which is used for implementing the method for extracting a surface contour line of a semitransparent object. Specifically, the system comprises:
the gray sequence acquisition unit is used for scanning the gray of each line of the imaging points of the laser stripe image formed on the surface of the measured target to acquire a gray sequence;
the direct reflection component wave crest extraction unit is used for extracting a position area of the direct reflection component wave crest by adopting a method of mathematical morphology and a gray threshold value for the acquired gray sequence;
a contour point coordinate obtaining unit which calculates a contour point coordinate by a gray scale gravity center method according to the position area of the direct reflection component wave peak extracting unit;
and the contour line acquisition unit is used for finally acquiring the whole contour line of the surface of the semitransparent object according to the calculated contour point coordinates obtained by the contour point coordinate acquisition unit.
Correspondingly, the direct reflection component peak extracting unit comprises:
extracting an envelope subunit, and filtering abrupt clutter with smaller width by closed operation aiming at the gray level sequence to obtain an envelope of a gray level distribution curve; filtering out clutter having a width less than the average width of 1/2 may generally be considered;
a baseline extraction subunit, wherein a convex peak of the envelope curve is cut off through an opening operation, and a signal is smoothed from the bottom to obtain a baseline of a gray distribution curve;
a characteristic peak acquisition subunit, which performs differential operation on the envelope curve and the base line to acquire a plurality of gray characteristic peaks, wherein one characteristic peak is a direct reflection peak of the surface of the target to be detected, and the other characteristic peaks are reflection peaks of the subsurface;
selecting a direct reflection peak subunit, analyzing the plurality of gray characteristic peaks from left to right in sequence, and selecting a first characteristic peak meeting a threshold condition as a direct reflection peak;
calculating a direct reflection peak coordinate subunit, wherein for the direct reflection characteristic peak, the coordinate of the characteristic peak is a coordinate value corresponding to the peak value, and meanwhile, the width of the characteristic peak is calculated;
and intercepting a direct reflection peak data subunit, and intercepting a section of data from the gray sequence as direct reflection peak data according to the direct reflection characteristic peak coordinate as a center and the range of twice the width of the direct reflection characteristic peak.
In another embodiment of the present invention, there is also provided a semi-transparent object surface contour line extraction terminal, including: the device comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, and the processor can be used for executing the semi-transparent object surface contour line extraction method when executing the program.
According to the method, the system and the terminal for extracting the surface contour of the semitransparent target in the embodiment of the invention, the extracted surface contour of the semitransparent target is most consistent with the actual surface contour of the semitransparent target, and the actual contour of the surface of the semitransparent target can be truly reflected. Compared with other existing methods, the method has more accurate measurement results, as shown in fig. 9. The technique of the invention has general practicability and can meet the requirements of profile measurement of most semitransparent targets.
The foregoing description of specific embodiments of the present invention has been presented. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes and modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention. The above-described preferred features may be used in any combination without conflict with each other.