A peak positioning method, system and electronic device for multi-peak superimposed curves
Patent Information
- Application Number
- CN202610737417.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-27
- Publication Date
- 2026-09-08
AI Technical Summary
[0004]考虑到多层信号叠加因素,不同层反射后形成的像素值曲线信号往往不再符合独立峰状分布,无法直接提取出各层反射的峰值信号
本申请提供了一种用于多峰叠加曲线的峰值定位方法,包括:
Smart Images

Figure CN122714533A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing, and particularly relates to a method, system and electronic device for peak location of multi-peak superimposed curves. Background Technology
[0002] When using spectral confocal microscopy or 3D line laser to detect single-layer or multi-layer transparent objects, the resulting dispersive or light bar images are formed by superimposing multiple layers of reflection signals. The grayscale curve formed by a row or column of pixels in the dispersive or light bar image is a multi-peak curve formed by superimposing multiple single-peak curves. Here, a single-peak curve represents the grayscale curve formed by a single layer of reflection signal, corresponding to the bell-shaped curve of this application.
[0003] Therefore, in the process of peak extraction or line center extraction, it is necessary to extract the peak value or light stripe center corresponding to different reflective surfaces to obtain the height information of different reflective layers.
[0004] Considering the superposition of multiple signal layers, the pixel value curves formed after reflection from different layers often no longer conform to independent peak distributions, making it impossible to directly extract the peak signals of each layer's reflection. Similarly, in fields other than spectral confocal microscopy and 3D line lasers, such as pharmaceutical analysis, component analysis, environmental monitoring, and biosignal recognition, spectral peak curves also exhibit multi-peak superposition curves formed by the superposition of multiple bell-shaped curves, requiring the separate location of the peak values of different curves.
[0005] Therefore, there is an urgent need for a peak location method to locate different peaks in a multi-peak superimposed curve. Summary of the Invention
[0006] This application proposes a peak location method, system, and electronic device for multi-peak superimposed curves, which is used to locate the corresponding peak values of each reflective surface in a multi-layer reflection scene.
[0007] To achieve the above objectives, this application proposes the following technical solutions: In a first aspect of this application, a method for peak localization of multi-peak superimposed curves is provided, comprising: Obtain a multi-peak superimposed curve; wherein the multi-peak superimposed curve is formed by superimposing multiple single-peak curves with different peak points; the single-peak curve is a centrally symmetrical bell-shaped curve; Based on the first-order gradient method, the rising edge inflection point and the falling edge inflection point in the multi-peak superimposed curve are calculated; wherein, the rising edge inflection point is a data point whose gradient value of the preceding multiple consecutive data points is positive and whose own gradient value is not positive; the falling edge inflection point is a data point whose gradient value of the following multiple consecutive data points is negative and whose own gradient value is not negative. Determine whether adjacent inflection points satisfy the condition that the data difference is lower than the first threshold and the spacing is lower than the second threshold; if so, the adjacent inflection points are classified into the same category; if not, they are divided into two categories; where the data difference represents the difference in values among the data points, and the spacing represents the number of data points between two data points, and the first threshold and the second threshold are obtained after pre-calibration; The total number of peaks to be located is determined based on the quantity of all types, and r consecutive data points adjacent to the inflection points of the same type are selected as the consecutive data segments of the same type of inflection points; where r is a preset value and r≥3; Each peak value is calculated based on different types of continuous data segments.
[0008] Optionally, selecting r consecutive data points adjacent to the same type of inflection point as a continuous data segment of the same type of inflection point includes: If there is only one rising edge inflection point of the same type, then the r consecutive data points adjacent to the rising edge inflection point are obtained as a continuous data segment. If there is only one falling edge inflection point of the same type, then the r consecutive data points adjacent to the falling edge inflection point are obtained as a continuous data segment. If the same type of inflection point consists of a rising edge inflection point and a falling edge inflection point, then the data segment composed of the rising edge inflection point and the falling edge inflection point will be extended to both sides to obtain a data segment containing r consecutive data points, which will be used as a continuous data segment. If the same type of inflection point consists of two rising edge inflection points, two falling edge inflection points, or more than two inflection points, then the filtered and denoised multi-peak superposition curve should be re-acquired.
[0009] Optionally, the multi-peak superposition curve is formed by a row or column of pixel values in the detection image; the detection image represents a dispersive image formed by multi-layer reflection in spectral confocal detection, or a light stripe image formed by multi-layer reflection in online structured light measurement.
[0010] Optionally, the peak location method further includes: If the pixel values of data points between adjacent inflection points are all overexposed, then the adjacent inflection points are classified into the same category.
[0011] Optionally, obtain multi-peak superimposed curves, including: Obtain a column or a row of pixels from the detection image; the selection of the pixel column or pixel row is determined based on the dispersion direction in the dispersion image and the distribution direction of the light stripes in the light stripe image. Remove pixels below the image background threshold from the column or row of pixels and perform filtering and noise reduction processing to obtain the multi-peak superposition curve.
[0012] Optionally, the process of calculating the peak value based on continuous data segments is as follows: Based on a preset curve model, curve fitting is performed on continuous data segments, and the maximum point obtained after fitting is taken as the peak value; wherein, the preset curve model includes: quadratic curve fitting model and Gaussian curve fitting model. Alternatively, the peak value within a continuous data segment can be calculated based on the gray-scale centroid method.
[0013] Optionally, after determining the total number of peaks to be located based on the quantity of all types, the peak location method further includes: Obtain all the trough points in the multi-peak superimposed curve; Determine if the total number of trough points is n-1; where n represents the total number of peaks to be located; If so, the data segment between adjacent troughs is taken as the continuous data segment corresponding to the intermediate peak, the data segment between the first trough and the preceding isopleths is taken as the continuous data segment corresponding to the first peak, and the data segment between the last trough and the following isopleths is taken as the continuous data segment corresponding to the last peak. The corresponding peak value is calculated based on each continuous data segment.
[0014] Optionally, after determining whether the total number of troughs is n-1, the peak location method further includes: If the total number of troughs is less than n-1, then the multi-peak superimposed curve is sharpened to obtain a multi-peak superimposed curve with n-1 troughs. The data segment between adjacent troughs is taken as the continuous data segment corresponding to the intermediate peak, and the data segment between the first trough and the preceding isopleths is taken as the continuous data segment corresponding to the first peak. The data segment between the last trough and the following isopleths is taken as the continuous data segment corresponding to the last peak. Each peak value is calculated based on each continuous data segment.
[0015] In a second aspect of this application, a peak localization system for multi-peak superimposed curves is provided, comprising: The curve acquisition module is used to acquire multi-peak superimposed curves; wherein, the multi-peak superimposed curves are formed by superimposing multiple single-peak curves with different peak points; the single-peak curves are centrally symmetrical bell-shaped curves; The inflection point calculation module is used to calculate the rising edge inflection point and the falling edge inflection point within the multi-peak superimposed curve based on the first-order gradient method; wherein, the rising edge inflection point is a data point whose gradient value of the preceding multiple consecutive data points is positive and whose own gradient value is not positive; the falling edge inflection point is a data point whose gradient value of the following multiple consecutive data points is negative and whose own gradient value is not negative. The inflection point classification module is used to determine whether adjacent inflection points meet the conditions that the data difference is lower than the first threshold and the spacing is lower than the second threshold. If so, the adjacent inflection points are classified into the same category; otherwise, they are divided into two categories. Here, the data difference represents the difference in values among the data points, and the spacing represents the number of data points between two data points. The first threshold and the second threshold are obtained after pre-calibration. The data segmentation module is used to determine the total number of peaks to be located based on the quantity of all types, and select r consecutive data points adjacent to the inflection points of the same type as the consecutive data segments of the same type of inflection points; where r is a preset value and r≥3; The peak calculation module is used to calculate the peak values based on different types of continuous data segments.
[0016] In a third aspect of this application, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the peak localization method described in any of the first aspects.
[0017] The beneficial effects of this application are as follows: This application provides a method for peak location of multi-peak superimposed curves, including: Obtain a multi-peak superimposed curve; wherein the multi-peak superimposed curve is formed by superimposing multiple single-peak curves with different peak points; the single-peak curve is a centrally symmetrical bell-shaped curve; based on the first-order gradient method, calculate the rising edge inflection point and the falling edge inflection point within the multi-peak superimposed curve; wherein the rising edge inflection point is a data point whose gradient value of multiple consecutive preceding data points is positive and whose own gradient value is not positive; the falling edge inflection point is a data point whose gradient value of multiple consecutive subsequent data points is negative and whose own gradient value is not negative; determine whether adjacent inflection points satisfy the condition that the data difference is lower than a first threshold and the spacing is lower than a second threshold; if yes, then the adjacent inflection points are classified into the same category; if not, they are divided into two categories; wherein the data difference represents the difference in values among the data points, and the spacing represents the number of data points between two data points, and the first threshold and the second threshold are obtained after pre-calibration; determine the total number of peaks to be located based on the total number of all types, and select r consecutive data points adjacent to the inflection points of the same category as the continuous data segments of the same category of inflection points; wherein r is a preset value and r≥3; calculate each peak based on the continuous data segments of different types.
[0018] Based on the above processing, this application calculates the rising edge inflection point and the falling edge inflection point as peak candidate points corresponding to different single-peak curves. Considering that the same single-peak curve may have both rising edge inflection points and falling edge inflection points at the same time, the same type of inflection points are divided according to the difference in gray value and the difference in pixel coordinates of adjacent inflection points, which correspond to peak candidate points formed by the same single-peak curve.
[0019] Therefore, not only can the total amount of the types in the inflection points be used as the total amount of the peak to be located, but also, based on the same type of inflection points, r adjacent consecutive data points can be selected to calculate the peak at different locations, thereby locating the peak corresponding to different single-peak curves. Attached Figure Description
[0020] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings: Figure 1 This is a flowchart illustrating a peak location method provided in this application; Figure 2 This is a schematic diagram of a multi-peak superimposed curve provided in this application; Figure 3 This is another schematic diagram of a multi-peak superimposed curve provided in this application; Figure 4 This is another schematic diagram of a multi-peak superimposed curve provided in this application; Figure 5 This is another schematic diagram of a multi-peak superimposed curve provided in this application; Figure 6 This is another schematic diagram of a multi-peak superimposed curve provided in this application; Figure 7 This is an experimental diagram of a light bar image and grayscale curve provided in this application; Figure 8 This is an experimental diagram of another light bar image and grayscale curve provided in this application; Figure 9 This is a schematic diagram of the structure of a peak positioning system provided in this application; Figure 10 This is a structural diagram of an electronic device provided in this application. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of this application, but not all embodiments.
[0022] Spectral confocal measurement and line structured light measurement, as important non-contact measurement methods, are widely used in machine vision inspection scenarios. The basic principle of line structured light measurement is to project a series of parallel, narrow light stripes onto the surface of the object being measured, and to obtain the surface morphology and height information by measuring the degree of distortion of the light stripes. Spectral confocal measurement, on the other hand, is based on the principle of spectral dispersion. After passing through a dispersive objective lens, light forms a series of continuously distributed focused spots with different spectral peak values along the optical axis. There is a one-to-one quantitative mapping relationship between the spectral peak values and the focusing distance. By decoding this mapping relationship, the corresponding focusing distance can be obtained after obtaining the spectral peak values.
[0023] In spectral confocal measurement, spectral peaks need to be extracted to accurately locate the spectral wavelength to be reflected from the side. In online structured light measurement, the peak points of the brightness distribution on the cross-section of the light stripe (corresponding to the brightest pixels) need to be extracted as the center of the light stripe. Therefore, both spectral confocal measurement and online structured light measurement require accurate location of pixel peaks.
[0024] However, in the process of detecting multi-layered transparent objects, due to the presence of multiple layers of reflected light, the obtained dispersive image or light stripe image is formed by the superposition of multiple layers of reflected signals, and the corresponding spectral curve is a multi-peak superposition curve, making it impossible to directly extract the peak signals of each layer of reflection.
[0025] Therefore, a peak location method is urgently needed to extract each peak in a multi-peak superimposed curve.
[0026] To solve the above problems, such as Figure 1 As shown, this application provides a method for peak location of multi-peak superimposed curves, including the following steps: S1. Obtain the multi-peak superimposed curve. The multi-peak superimposed curve is formed by superimposing multiple single-peak curves with different peak points; the single-peak curve is a centrally symmetrical bell-shaped curve.
[0027] S2. Based on the first-order gradient method, calculate the rising edge inflection point and the falling edge inflection point within the multi-peak superimposed curve. The rising edge inflection point is a data point where the gradient values of the preceding consecutive data points are positive and its own gradient value is not positive; the falling edge inflection point is a data point where the gradient values of the following consecutive data points are negative and its own gradient value is not negative.
[0028] S3. Determine whether adjacent inflection points satisfy the condition that the data difference is lower than the first threshold and the spacing is lower than the second threshold. If yes, classify the adjacent inflection points into the same category; otherwise, classify them into two categories. Here, the data difference represents the difference in values among the data points, and the spacing represents the number of data points between two data points. The first and second thresholds are obtained after pre-calibration.
[0029] S4. Determine the total number of peaks to be located based on the quantity of all types, and select r consecutive data points adjacent to the inflection points of the same type as the consecutive data segments of the same type of inflection points. Where r is a preset value and r≥3.
[0030] S5. Calculate each peak value based on different types of continuous data segments.
[0031] Based on the above processing, this application calculates the rising edge inflection point and the falling edge inflection point as peak candidate points corresponding to different single-peak curves. Considering that the same single-peak curve may have both rising edge inflection points and falling edge inflection points at the same time, the same type of inflection points are divided according to the difference in gray value and the difference in pixel coordinates of adjacent inflection points, which correspond to peak candidate points formed by the same single-peak curve.
[0032] Therefore, not only can the total amount of the types in the inflection points be used as the total amount of the peak to be located, but also, based on the same type of inflection points, r adjacent consecutive data points can be selected to calculate the peak at different locations, thereby locating the peak corresponding to different single-peak curves.
[0033] For step S1, the multi-peak superposition curve is formed by superimposing multiple bell-shaped curves with different peak points. Taking spectral confocal or 3D line laser scenarios as examples, the multi-peak superposition curve is formed by a row or column of pixel values within the detection image. The detection image refers to a dispersive image formed by multiple reflections in spectral confocal detection, or a light stripe image formed by multiple reflections in online structured light measurement.
[0034] The dispersive image obtained by the spectral confocal sensor during the detection of a transparent object can be obtained by projecting a point spectrum or a line spectrum onto the transparent object and then reflecting it. No specific limitation is made here, but it can be referred to the description in Chinese Patent CN116989664A.
[0035] In spectral confocal or 3D line laser scenarios, step S1 includes the following: S101. Obtain a column or a row of pixels from the detection image. The selection of the pixel column or row is determined based on the dispersion direction in the dispersion image and the distribution direction of the light stripes in the light stripe image.
[0036] S102. Remove pixels below the image background threshold from the column or row of pixels, and perform filtering and denoising processing to obtain a multi-peak superimposed curve. It is understood that in this application, pixels are data points, and pixel values are the numerical values of the data points. All data points within the multi-peak superimposed curve are composed of the remaining pixels after removing pixels below the image background threshold and performing filtering and denoising.
[0037] Regarding step S101, for the dispersive image acquired at the CCD receiver of the spectral confocal displacement sensor, a row or column of pixels parallel to the dispersive direction is selected to form a multi-peak superposition curve. Taking Chinese patent CN116989664A as an example, its dispersive direction coincides with the horizontal direction of the CCD at the sensor end, so a row of pixels is selected as the multi-peak superposition curve. For light stripe images, a column or row of pixels parallel to the cross-section of the light stripe is selected to form a multi-peak superposition curve, as shown in Chinese patent CN118587272A, where the lines are distributed along the row direction of the original image data, and a column of pixels is selected to extract the line center.
[0038] In most image processing software and programming libraries, image data is stored in the form of a two-dimensional array, corresponding to an image data matrix. To reduce the impact of noise on the multi-peak superposition curve, referring to CN116989664A, the image data matrix can be denoised. The denoised image data is then filtered, and the row of data in the image data matrix that is closest to the effective peak curve is selected as the multi-peak superposition curve of this application.
[0039] Alternatively, to eliminate image noise interference, a noise threshold can be set for the detection image. Pixels exceeding the threshold retain their original pixel values, while pixels below the threshold are set to 0. Noise denoising can also be achieved using filtering methods, such as median filtering, low-pass filtering, and mean filtering, which are not limited here.
[0040] It should be noted that each of the single-peak curves used for superposition is a centrally symmetrical bell-shaped curve, exhibiting a monotonically increasing trend on the left and a decreasing trend on the right. Therefore, in the multi-peak superposition curve, the peak value of the original single-peak curve may simultaneously be both an upward and downward inflection point, or a single upward or downward inflection point.
[0041] Taking spectral confocal or 3D line laser multilayer reflection scenarios as examples, each layer of reflection signal belongs to a monotonically changing single-peak curve with increasing left and decreasing right. For example, in double-layer reflection, the curve after the two layers are superimposed still increases on the left and decreases on the right, with an overall trend of first increasing and then decreasing, containing only one trough or no trough in the middle. When there is no trough, the possible situations are: the peak value corresponding to the first layer of reflection signal is near the rising edge inflection point, or the peak value corresponding to the second layer of reflection signal is near the falling edge inflection point.
[0042] That is, in a double-layer reflection scenario, for the multi-peak superposition curve obtained in step S1, when the distance between two adjacent layers is small (below a certain thickness), the grayscale curves formed by the reflection signals of different layers overlap to a high degree, resulting in no trough points in the filtered and denoised multi-peak superposition curve, and only one rising edge inflection point or one falling edge inflection point near the actual peak point. When the distance between two adjacent layers exceeds a certain thickness, the grayscale curves formed by the reflection signals of different layers overlap to a low degree, resulting in a trough in the filtered and denoised multi-peak superposition curve, and simultaneously one rising edge inflection point and one falling edge inflection point near the actual peak point.
[0043] Taking spectral confocal laser or 3D line laser as an example, for step S2, the gradient value is calculated as follows: d i =P i -P i-1. Where i represents the sequence number of the data point in the multi-peak superimposed curve, 1≤i≤n, and n represents the total number of data points in the multi-peak superimposed curve; d i P represents the gradient value of the i-th data point; i The value of the i-th data point can be found in Chinese Patent CN116989664A.
[0044] Alternatively, the gradient value in this application can also be the pixel state corresponding to the scheme disclosed in Chinese Patent CN120495388A. It can be understood that a positive gradient value corresponds to an increasing pixel state, a negative gradient value corresponds to a decreasing pixel state, a non-positive gradient value corresponds to a non-increasing pixel state, and a non-negative gradient value corresponds to a non-decreasing pixel state.
[0045] In one implementation, to avoid the adverse effects of data value fluctuations on gradient recognition results, a difference threshold judgment method can be introduced. For example, when the gradient value d... i The gradient value is positive only when it is greater than the first difference threshold thrUp; when the gradient value d i The gradient value is negative only when it is less than the second difference threshold thrDown; when the gradient value d i When the gradient value falls between the second difference threshold (thrDown) and the first difference threshold (thrUp), the gradient value is 0. The first difference threshold (thrUp) is not less than the second difference threshold (thrDown), and its specific value can be obtained through pre-calibration. In practice, thrUp = 0, and thrDown = 0.
[0046] Regarding step S3, in this application, the inflection point is either a rising edge inflection point or a falling edge inflection point. If the data difference is lower than a first threshold and the interval is lower than a second threshold, it indicates that the grayscale values of two adjacent inflection points are close and the interval is small, corresponding to inflection points formed by peak values in the same single-peak curve. If the data difference between two adjacent inflection points is not lower than the first threshold, or the interval is not lower than the second threshold, it indicates that the two adjacent inflection points are peak values in two different single-peak curves. Taking a multi-layered reflection scene as an example, it corresponds to inflection points formed by reflections from different reflection layers.
[0047] In this application, a data point can be both a rising edge inflection point and a falling edge inflection point. It is understood that if a data point is both a rising edge inflection point and a falling edge inflection point, the data difference and spacing between adjacent inflection points are both 0. Therefore, in this application, the total number of peak values to be located can be determined based on the total number of inflection point types.
[0048] like Figure 2 As shown, the multi-peak superimposed curve includes two rising edge inflection points and one falling edge inflection point. The data values of the rising edge inflection point and the falling edge inflection point on the right are close and the interval is extremely small, corresponding to the peak values in the same single-peak curve. It can be seen that this multi-peak superimposed curve is formed by the superposition of two single-peak curves, and there are two peak values to be located. Similarly, Figure 3 The multi-peak curve shown is formed by the superposition of two single-peak curves, and there are two peaks to be located. Figure 4 The multi-peak curve shown is formed by the superposition of three single-peak curves, and there are three peaks to be located.
[0049] In spectral confocal or 3D line laser scenarios, for multi-peak superimposed curves formed by multiple layers of reflection, if the peak value formed by a certain layer of reflection signal is an overexposed pixel, the data difference between the rising and falling edge inflection points of that layer's reflection signal will be 0, but the spacing will be too large, thus mistakenly identifying them as two inflection points formed by two layers of reflection signals. To avoid the aforementioned situation, this application stipulates that if the pixels between adjacent inflection points are all overexposed pixels, then adjacent inflection points are classified into the same category, regardless of the data difference and spacing. Figure 5 In the multi-peak superposition curve shown, the pixels between the rising edge inflection point and the falling edge inflection point are overexposed pixels, belonging to the same category, and are formed by reflection from two reflective layers. There are two peaks to be determined.
[0050] In practice, the specific values of the first and second thresholds are obtained after pre-calibration. Taking a multi-peak superposition curve formed by multi-layer reflection as an example, if the shortest distance between two adjacent layers in the multi-layer reflection is too small, the values of the first and second thresholds can be appropriately reduced to facilitate the differentiation of inflection points formed by reflection signals from different layers. If the shortest distance between two adjacent layers in the multi-layer reflection is too large, the values of the first and second thresholds can be appropriately increased.
[0051] Regarding step S4, this application can classify the total number of inflection point types and determine the total number n of peaks to be located. This corresponds to the number of reflection layers in a multi-layer reflection scene.
[0052] In some embodiments, the method of dividing the continuous data segments in step S4 includes the following: If there is only one rising edge inflection point of the same type, then the r consecutive data points preceding the rising edge inflection point are obtained as a continuous data segment.
[0053] If there is only one falling edge inflection point of the same type, then the r consecutive data points adjacent to the falling edge inflection point are obtained as a continuous data segment.
[0054] If the same type of inflection point consists of a rising edge inflection point and a falling edge inflection point, then the data segment composed of the rising edge inflection point and the falling edge inflection point will be extended to both sides to obtain a data segment containing r consecutive data points, which will be used as a continuous data segment.
[0055] If the same type of inflection point consists of two rising edge inflection points, two falling edge inflection points, or more than two inflection points, then the filtered and denoised multi-peak superposition curve should be re-acquired.
[0056] The continuous data segments used to calculate the peak values in the aforementioned steps are all constructed using inflection points. In some embodiments, this application can also use trough points to construct continuous data segments. Specifically, after determining the total number of peak values to be located based on the quantity of all types, the peak location method provided by this application further includes the following: S6. Obtain all the trough points in the multi-peak superimposed curve.
[0057] S7. Determine if the total number of trough points is n-1; if yes, proceed to step S8; otherwise, proceed to step S9. Where n represents the total number of peaks to be located.
[0058] S8. Take the data segment between adjacent troughs as the continuous data segment corresponding to the intermediate peak, take the data segment between the first trough and the preceding isopleth as the continuous data segment corresponding to the first peak, and take the data segment between the last trough and the following isopleth as the continuous data segment corresponding to the last peak.
[0059] S9. If the total number of troughs is less than n-1, then the multi-peak superimposed curve is sharpened to obtain a multi-peak superimposed curve with n-1 troughs.
[0060] S10. Take the data segment between adjacent troughs as the continuous data segment corresponding to the intermediate peak, take the data segment between the first trough and the preceding isopleth as the continuous data segment corresponding to the first peak, and take the data segment between the last trough and the following isopleth as the continuous data segment corresponding to the last peak.
[0061] S11. Calculate each peak value based on each continuous data segment.
[0062] For step S6, the trough information of the multi-peak superimposed curve can be extracted using methods such as neighborhood comparison, zero-crossing detection, and morphological operations (e.g., erosion, dilation), thus obtaining the trough points and completing the judgment. Among these methods, the zero-crossing detection method usually requires prior smoothing of the multi-peak superimposed curve and its use in conjunction with methods such as the Hessian matrix.
[0063] In practice, this application typically uses a neighborhood comparison method based on gradient values to locate and determine trough points. Specifically, in this application, a trough point is defined as follows: for a given data point, if the gradients of multiple consecutive data points preceding it are negative and the gradients of multiple consecutive data points following it are positive, then that data point is a trough point. To avoid the influence of residual noise points after filtering and denoising, this application uses multiple consecutive data points with both negative and positive gradients, typically set to 3, 5, or more.
[0064] In step S7, by determining whether the total number of trough points is n-1, it can be determined whether adjacent peaks to be located contain trough points. If the total number is n-1, it indicates that trough points exist on both sides of the middle peak. Therefore, the current peak can be directly calculated using the data segment between the trough points on both sides. Since the first peak only has one trough point on its right side (i.e., the first trough point of the multi-peak superposition curve), the data segment between the first trough point and the preceding isopleths can be selected to calculate the first peak. The last peak only has one trough point on its left side (i.e., the last trough point of the multi-peak superposition curve), so the data segment between the last trough point and the following isopleths can be selected to calculate the last peak. Figure 6 As shown, the continuous data segment used to calculate the first peak is from trough point 1 to the isopleth point in front of it; the continuous data segment used to calculate the second peak is from trough point 1 to trough point 2; and the continuous data segment used to calculate the third peak is from trough point 2 to the isopleth point behind it.
[0065] If the total value is not n-1, it indicates that in the multi-peak superposition curve, there is only a single rising edge inflection point or falling edge inflection point near some peaks, and there may be multiple peaks in the data segment between adjacent troughs, which cannot be directly used to calculate the peak value. Therefore, in step S9, n-1 troughs are constructed by sharpening to reduce the width of the peaks.
[0066] Specifically, image sharpening methods can be based on convolutional filtering, such as Gaussian sharpening, or gradient-based sharpening, as well as deconvolution.
[0067] Taking convolution as an example, for a multi-peak superposition curve formed by double-layer reflection, a one-dimensional Gaussian filter can be performed first to obtain an ambiguous signal. The ambiguous signal is then subtracted from the original data to obtain a high-frequency signal. This high-frequency signal is amplified and superimposed onto the original data. Finally, non-mask sharpening amplifies noise, so another one-dimensional Gaussian filter is performed. For ease of hardware implementation, the above process can be combined into a single convolution operation. The light stripe signal before the experiment is as follows: Figure 7 As shown, the light stripe signal after sharpening is as follows: Figure 8 As shown. Among them, Figure 7 and Figure 8 The image on the left is a light stripe image, and the curve on the right is the multi-peak superposition curve in this application.
[0068] The gradient-based sharpening method can be described as follows: calculate the first-order gradient of the multi-peak superimposed curve and take its absolute value. Subtract the absolute value of the first-order gradient from the original data to reduce the peak width radius, thus obtaining a multi-peak superimposed curve containing a trough point, without increasing the pixel value of the light stripe center.
[0069] In this application, taking a multi-peak superposition curve formed by multiple reflections as an example in spectral confocal or 3D line laser scenarios, the data points in the pixel value curve are ordered according to the order of light reflection from top to bottom of the object under test. That is, for a transparent object under test, the first peak in the pixel value curve corresponds to the reflection formed by the upper surface, and the second peak is formed by the reflection from the bottom surface.
[0070] Furthermore, since the total number of peaks to be located, n, is obtained based on the number of rising edge inflection points and falling edge inflection points in this application, combined with the selection criteria for rising edge inflection points, falling edge inflection points, and trough points, as well as the curve characteristics, it can be known that there will not be a situation where the number of trough points in a multi-peak superimposed curve is greater than n-1. If, in step S9, the number of trough points in the multi-peak superimposed curve after sharpening is greater than n-1, it indicates that there is an error in the sharpening method, and the sharpening process needs to be repeated.
[0071] In step S5 or S11, based on the ascending order of the coordinates of the data points in the continuous data segments, continuous data segments corresponding to each peak from left to right (i.e., from front to back) are generated. The process of calculating the peak based on the data segments can include the following methods: Based on a preset curve model, curve fitting is performed on continuous data segments, and the maximum point obtained after fitting is taken as the peak value; among which, the preset curve model includes: quadratic curve fitting model and Gaussian curve fitting model.
[0072] Alternatively, the peak value within a continuous data segment can be calculated based on the gray-scale centroid method.
[0073] Specifically, taking the quadratic curve fitting model as an example, there are a total of [number] data segments in the current data interval.N Data points, N The row coordinates of the points are The corresponding grayscale value is The quadratic curve fitting model is as follows:
[0074] in P Represents data values, Indicates the parameter to be determined. y Represents row coordinates, i = 1,2,..., N .
[0075] Based on the data from different coordinate points, construct a system of equations: Substituting the coordinates and data values of the peak interval into the above formula, the coordinates of the line center can be calculated. y center That is, the peak value of this application.
[0076]
[0077] The following example uses a Gaussian curve fitting model to construct a model for Gaussian curve fitting: in p Represents data values, y Represents row coordinates, h 1. h 2 and y center For unknown parameters, i = 1,2,..., N .
[0078] Take the natural logarithm of both sides of the above equation and let: The Gaussian fitting model is then transformed into a quadratic fitting model, as shown below: Based on the data from different coordinate points, construct a system of linear equations: The coordinates of the line center are thus calculated, which is the peak value of this application. .
[0079] Alternatively, the Gaussian fitting method provided by Chinese patent CN116989664A can be directly referenced for peak value calculation within the peak range.
[0080] In some embodiments, this application also provides a peak positioning system for multi-layer reflections, such as Figure 9 As shown, it includes: The curve acquisition module 901 is used to acquire multi-peak superimposed curves. The multi-peak superimposed curve is formed by superimposing multiple single-peak curves with different peak points; the single-peak curve is a centrally symmetrical bell-shaped curve.
[0081] The inflection point calculation module 902 is used to calculate the rising edge inflection point and the falling edge inflection point within the multi-peak superimposed curve based on the first-order gradient method. The rising edge inflection point is a data point where the gradient values of the preceding consecutive data points are positive and its own gradient value is not positive; the falling edge inflection point is a data point where the gradient values of the following consecutive data points are negative and its own gradient value is not negative.
[0082] The inflection point classification module 903 is used to determine whether adjacent inflection points meet the conditions that the data difference is lower than a first threshold and the spacing is lower than a second threshold. If so, the adjacent inflection points are classified into the same category; otherwise, they are divided into two categories. Here, the data difference represents the difference in values among the data points, and the spacing represents the number of data points between two data points. The first threshold and the second threshold are obtained after pre-calibration.
[0083] The data segmentation module 904 is used to determine the total number of peaks to be located based on the quantity of all types, and select r consecutive data points adjacent to the same type of inflection point as a continuous data segment of the same type of inflection point. Here, r is a preset value and r≥3.
[0084] Peak calculation module 905 is used to calculate each peak based on different types of continuous data segments.
[0085] This application also provides an electronic device, such as... Figure 10 As shown, it includes a processor 1001, a communication interface 1002, a memory 1003, and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004. Memory 1003 is used to store computer programs; The processor 1001 is used to execute any of the above peak location methods when executing the program stored in the memory 1003.
[0086] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not indicate that there is only one bus or one type of bus.
[0087] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0088] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0089] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0090] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements any of the peak localization method steps described above.
[0091] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the peak localization method steps in the above embodiments.
[0092] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for peak location of multi-peak superimposed curves, characterized in that, include: Obtain a multi-peak superimposed curve; wherein the multi-peak superimposed curve is formed by superimposing multiple single-peak curves with different peak points; the single-peak curve is a centrally symmetrical bell-shaped curve; Based on the first-order gradient method, the rising edge inflection point and the falling edge inflection point in the multi-peak superimposed curve are calculated; wherein, the rising edge inflection point is a data point whose gradient value of the preceding multiple consecutive data points is positive and whose own gradient value is not positive; the falling edge inflection point is a data point whose gradient value of the following multiple consecutive data points is negative and whose own gradient value is not negative. Determine whether adjacent inflection points satisfy the condition that the data difference is lower than the first threshold and the spacing is lower than the second threshold; if so, the adjacent inflection points are classified into the same category; if not, they are divided into two categories; where the data difference represents the difference in values among the data points, and the spacing represents the number of data points between two data points, and the first threshold and the second threshold are obtained after pre-calibration; The total number of peaks to be located is determined based on the quantity of all types, and r consecutive data points adjacent to the inflection points of the same type are selected as the consecutive data segments of the same type of inflection points; where r is a preset value and r≥3; Each peak value is calculated based on different types of continuous data segments.
2. The peak location method according to claim 1, characterized in that, The step of selecting r consecutive data points adjacent to the same type of inflection point as a consecutive data segment of the same type of inflection point includes: If there is only one rising edge inflection point of the same type, then the r consecutive data points preceding the rising edge inflection point are obtained as a continuous data segment. If there is only one falling edge inflection point of the same type, then the r consecutive data points adjacent to the falling edge inflection point are obtained as a continuous data segment. If the same type of inflection point consists of a rising edge inflection point and a falling edge inflection point, then the data segment composed of the rising edge inflection point and the falling edge inflection point will be extended to both sides to obtain a data segment containing r consecutive data points, which will be used as a continuous data segment. If the same type of inflection point consists of two rising edge inflection points, two falling edge inflection points, or more than two inflection points, then the filtered and denoised multi-peak superposition curve should be re-acquired.
3. The peak location method according to claim 1, characterized in that, The multi-peak superposition curve is formed by a row or column of pixel values in the detection image; the detection image represents a dispersive image formed by multi-layer reflection in spectral confocal detection, or a light stripe image formed by multi-layer reflection in online structured light measurement.
4. The peak location method according to claim 3, characterized in that, The peak location method further includes: If the pixel values of data points between adjacent inflection points are all overexposed, then the adjacent inflection points are classified into the same category.
5. The peak location method according to claim 3, characterized in that, Obtain multi-peak superposition curves, including: Obtain a column or a row of pixels from the detection image; the selection of the pixel column or pixel row is determined based on the dispersion direction in the dispersion image and the distribution direction of the light stripes in the light stripe image. Remove pixels below the image background threshold from the column or row of pixels and perform filtering and noise reduction processing to obtain the multi-peak superposition curve.
6. The peak location method according to claim 1, characterized in that, The process of calculating the peak value based on continuous data segments is as follows: Based on a preset curve model, curve fitting is performed on continuous data segments, and the maximum point obtained after fitting is taken as the peak value; wherein, the preset curve model includes: quadratic curve fitting model and Gaussian curve fitting model. Alternatively, the peak value within a continuous data segment can be calculated based on the gray-scale centroid method.
7. The peak location method according to claim 1, characterized in that, After determining the total number of peaks to be located based on the quantity of all types, the peak location method further includes: Obtain all the trough points in the multi-peak superimposed curve; Determine if the total number of trough points is n-1; where n represents the total number of peaks to be located; If so, the data segment between adjacent troughs is taken as the continuous data segment corresponding to the intermediate peak, the data segment between the first trough and the preceding isopleths is taken as the continuous data segment corresponding to the first peak, and the data segment between the last trough and the following isopleths is taken as the continuous data segment corresponding to the last peak. The corresponding peak value is calculated based on each continuous data segment.
8. The peak location method according to claim 1, characterized in that, After determining whether the total number of troughs is n-1, the peak location method further includes: If the total number of troughs is less than n-1, the multi-peak superimposed curve is sharpened to obtain a multi-peak superimposed curve with n-1 troughs. The data segment between adjacent troughs is taken as the continuous data segment corresponding to the intermediate peak, and the data segment between the first trough and the preceding isopleths is taken as the continuous data segment corresponding to the first peak. The data segment between the last trough and the following isopleths is taken as the continuous data segment corresponding to the last peak. Each peak value is calculated based on each continuous data segment.
9. A peak location system for multi-peak superimposed curves, characterized in that, include: The curve acquisition module is used to acquire multi-peak superimposed curves; wherein, the multi-peak superimposed curves are formed by superimposing multiple single-peak curves with different peak points; the single-peak curves are centrally symmetrical bell-shaped curves; The inflection point calculation module is used to calculate the rising edge inflection point and the falling edge inflection point within the multi-peak superimposed curve based on the first-order gradient method; wherein, the rising edge inflection point is a data point whose gradient value of the preceding multiple consecutive data points is positive and whose own gradient value is not positive; the falling edge inflection point is a data point whose gradient value of the following multiple consecutive data points is negative and whose own gradient value is not negative. The inflection point classification module is used to determine whether adjacent inflection points meet the conditions that the data difference is lower than the first threshold and the spacing is lower than the second threshold. If so, the adjacent inflection points are classified into the same category; otherwise, they are divided into two categories. Here, the data difference represents the difference in values among the data points, and the spacing represents the number of data points between two data points. The first threshold and the second threshold are obtained after pre-calibration. The data segmentation module is used to determine the total number of peaks to be located based on the quantity of all types, and select r consecutive data points adjacent to the inflection points of the same type as the consecutive data segments of the same type of inflection points; where r is a preset value and r≥3; The peak calculation module is used to calculate the peak values based on different types of continuous data segments.
10. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the peak localization method according to any one of claims 1-8.
Citation Information
Patent Citations
Spectral confocal displacement sensor-based spectral peak-to-peak value calculation method and system
CN116989664A
Line center extraction method and system suitable for FPGA (Field Programmable Gate Array) parallel operation and medium
CN118587272A
Light stripe center extraction method and system and medium
CN120495388A