Disclosure of Invention
The invention aims to provide a data line detection system and a data line detection method based on weighted calculation, which are used for preprocessing an acquired target scene image to enhance contrast and extracting features on the basis to identify potential data line areas so as to solve the problems in the prior art in the background art.
In order to achieve the above objective, an aspect of the present invention provides a data line detection method based on weighted calculation, including the following steps:
The method comprises the steps of obtaining a digital image of a target scene, preprocessing the obtained image to enhance contrast, then carrying out feature extraction operation to identify potential data line areas, determining candidate data line paragraphs based on the extracted features, configuring preliminary weight factors according to the identified data line paragraphs, optimizing the extraction accuracy of data line contours by using the set weight factors, carrying out calibration weight distribution according to the optimized contours, and accurately positioning and tracing the data lines by using the calibrated weights.
Preferably, after acquiring a digital image of the target scene, the following sub-steps are included:
performing histogram equalization to improve local contrast of image by adopting formulaWherein I represents an original gray level Ienhanced, which is a new gray level after equalization, and L is a maximum value of gray levels;
On the basis of enhancing contrast, the structural element E is utilized to perform morphological open operation on the image Ienhanced to remove small object interference, and the formula is expressed asThen execute againWherein the method comprises the steps ofAndRepresenting corrosion and expansion operations, respectively;
From the resulting image Iopen, gaussian smoothing H is applied to reduce noise effects, the smoothed image Ismooth is denoted as Ismooth=Iopen H, where x represents the convolution operation, and this image is used for subsequent processing.
Preferably, preprocessing is applied to the acquired image to enhance contrast, comprising the sub-steps of:
Converting the acquired image into a gray space to obtain a gray image Ig, and using a formula Ig =0.299R+0.587G+0.114B, wherein R, G and B respectively represent red, green and blue channel values of an original image;
Applying histogram equalization to the converted gray-scale image Ig, calculating an equalized image Ieq by the formula Ieq(x,y)=cum(Ig (x, y))× (L-1), wherein cut (z) represents a cumulative distribution function, L is the number of gray-scale levels;
extracting a main feature by adaptive threshold segmentation T using the obtained image Ieq, setting a threshold T (x, y) =m (x, y) +k.s (x, y), wherein m (x, y) and s (x, y) are respectively a local average value and a standard deviation, and k is a constant, and finally obtaining a binarized image Ib, wherein
Based on the binarized image Ib, a connected component analysis is performed, different object regions are marked and separated, and clear object boundary information is provided for subsequent steps.
Preferably, performing the feature extraction operation identifies potential data line regions, comprising the sub-steps of:
Gradient operation is applied to the image Ienh with enhanced contrast, gradient intensities Gx and Gy in the horizontal and vertical directions are calculated, and a gradient image G is obtained by using the formula Gx=Ienh(x+1,y)-Ienh(x-1,y),Gy=Ienh(x,y+1)-Ienh (x, y-1), respectively, wherein
On the calculated gradient image G, non-maximum suppression is applied to emphasize edge pixels, i.e., for each pixel p, checking whether it is a local maximum, i.e., G (p) > G (p+Δd) and G (p) > G (p- Δd), where Δd refers to one small step along the gradient direction, preserving pixels meeting the condition as candidate edge points;
According to the selected candidate edge points, setting thresholds Th and Tl, wherein Th is a high threshold, Tl is a low threshold, selecting points with intensity higher than Th as strong edge points, and selecting points with intensity between Tl and Th as weak edge points;
a continuous line of edges is formed by connecting strong and weak edge points, and if a strong edge point is near a weak edge point, the weak edge point is considered to be part of the data line and marked as a potential data line region.
Preferably, determining a candidate data line segment based on the extracted features comprises the sub-steps of:
calculating a directional gradient θ for each pixel point in the identified potential data line region, which may be formulated byDeriving, wherein Gy and Gx are gradients in the vertical and horizontal directions, respectively;
According to the obtained direction gradient theta, clustering the pixel points in the potential area according to the gradient direction to form a plurality of pixel clusters with similar directions, and setting an angle threshold delta theta to enable the pixel points i and j of |thetai-θj | < delta theta to belong to the same cluster;
For the pixel clusters formed, the center coordinates C of each cluster are calculated using the formulaWhere n is the number of pixels in the cluster, (xi,yi) is the position coordinates of the pixels in the cluster;
And selecting the cluster with the calculated central coordinate C within a certain range as the basis of the candidate data line paragraph, and setting a distance threshold D so that when the distance between centers of two adjacent clusters is |Ci-Cj | < D, the two clusters are regarded as parts of the same paragraph, thereby determining the candidate data line paragraph.
Preferably, the preliminary weighting factors are configured according to the identified data line segments, comprising the sub-steps of:
Calculating the length L of each determined candidate data line paragraph, and distributing basic weights according to the lengths, wherein f is a monotonically increasing function, and the weights are larger as the paragraphs are longer;
On the basis of the allocated basic weight, adjusting the weight according to the importance degree of the position of the paragraph, setting a position weight factor Wp, if the paragraph is in the central area of the image, Wp = 1+ alpha, otherwise Wp = 1, wherein alpha is a positive constant, and represents the importance increasing coefficient of the central area;
combining the basic weight Wb and the position weight factor Wp, calculating the comprehensive weight Wc, and using a formula Wc=Wb×Wp as a preliminary weight factor of the candidate data line paragraph;
And sorting all paragraphs according to the obtained preliminary weight factors, selecting the top N paragraphs with higher weight as high-confidence paragraphs, and setting N as a percentage value smaller than 100.
Preferably, the extraction accuracy of the data line profile is optimized by using a set weight factor, comprising the following substeps:
Assigning a corresponding weight value to each pixel point in the candidate data line paragraph by using the determined preliminary weight factor, and calculating the weighted intensity Iw(p)=I(p)×We (p) of the pixel point p, wherein I (p) is an original intensity value;
Based on the resulting weighted intensities Iw (p), recalculating the total weight S for each candidate data line segment, using the formula s= Σp∈segmentIw (p), where p represents the pixel point in the segment;
Comparing the total weight S of all the paragraphs, selecting the paragraphs with higher total weight S as the component parts of the data line, setting a threshold value Ts, and considering the paragraphs as effective data line paragraphs only when S > Ts;
According to the selected valid data line segments, a complete data line profile is constructed by connecting adjacent and consistently oriented segments, ensuring that there is overlap or spacing between adjacent segments that does not exceed a given threshold Dt, i.e., |dij | < Dt, where Dij is the distance between segments i and j.
Preferably, the calibration weight allocation is performed according to the optimized profile, comprising the following sub-steps:
For each pixel point in the optimized data line contour, calculating the weighted intensity sum Sw (p) in the surrounding neighborhood N (p) of the pixel point, and using a formula Sw(p)=∑q∈N(q)Iw (q), wherein Iw (q) is the weighted intensity of the neighbor pixel point q;
Based on the obtained weighted intensity and Sw (p), the weight factor Wa (p) of the pixel point p is adjusted, and a formula is adoptedReflecting the relative importance of the pixel point in the neighborhood;
Recalculating the integrated weight for each paragraph on the data line profile Sa using the updated weight factor Wa (p), using the formula Sa(segment)=∑p∈segmentI(p)×Wa (p), where I (p) is the raw intensity value;
And according to the updated comprehensive weight Sa, the importance of the paragraph on the outline is again estimated and calibrated, so that the boundary of the data line is ensured to reflect the actual position more accurately.
Preferably, the data line is precisely positioned and routed using calibrated weights, comprising the sub-steps of:
Determining a contribution degree C (p) of each pixel point p in the outline of the data line according to the calibrated weight Wa, and using a formula C (p) =i (p) ×wa (p), wherein I (p) is an intensity value of the pixel point p;
based on the contribution degree C (p) of each pixel point, selecting the pixel points with the contribution degree higher than a set threshold Tc as salient points of the data line, namely C (p) > Tc, wherein the salient points form a basic frame of the data line;
forming a main path of the data line by connecting the determined salient points, calculating the fitting degree F of each straight line or curve segment on the path, and using a formulaTo ensure continuity and rationality of the path;
and correcting any discontinuous or unreasonable parts on the path according to the calculated fitting degree F, ensuring the smoothness and continuity of the whole path, and finally obtaining the precisely positioned data line path.
On the other hand, the invention provides a data line detection system based on weighted calculation, which comprises the following steps:
The image acquisition module is used for acquiring a digital image of the target scene;
the preprocessing and feature extraction module is used for preprocessing the acquired image to enhance contrast, and then performing feature extraction operation to identify potential data line areas;
the preliminary weight configuration module is used for determining candidate data line paragraphs based on the extracted features and configuring preliminary weight factors according to the identified data line paragraphs;
The weight calibration module is used for optimizing the extraction accuracy of the data line contour by using the set weight factors and carrying out calibration weight distribution according to the optimized contour;
And the path drawing module is used for accurately positioning and drawing the path of the data line by using the calibrated weight.
The data line detection system and the method based on weighted calculation have the following advantages compared with the prior art:
The invention enhances contrast by preprocessing the acquired target scene image and performs feature extraction on the basis to identify potential data line areas. Candidate data line segments are then determined by analysis of the extracted features and preliminary weighting factors are configured based on these segments. And further optimizing the extraction accuracy of the data line contour by using the set weight factors, and calibrating weight distribution according to the optimized contour. Finally, the calibrated weights are used to achieve accurate positioning of the data lines and to trace their paths. The method can dynamically adjust the weight according to the image content, thereby improving the detection precision and reducing the situations of false detection and missing detection.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. The specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The invention provides a data line detection method based on weighted calculation, which is shown in fig. 1 and comprises the following steps:
S1, acquiring a digital image of a target scene, and further comprising the following substeps:
performing histogram equalization to improve local contrast of image by adopting formulaWherein I represents an original gray level Ienhanced, which is a new gray level after equalization, and L is a maximum value of gray levels;
On the basis of enhancing contrast, the structural element E is utilized to perform morphological open operation on the image Ienhanced to remove small object interference, and the formula is expressed asThen execute againWherein the method comprises the steps ofAnd ∈ represents corrosion and expansion operations, respectively;
From the resulting image Iopen, gaussian smoothing H is applied to reduce noise effects, the smoothed image Ismooth is denoted as Ismooth=Iopen H, where x represents the convolution operation, and this image is used for subsequent processing.
By implementing histogram equalization to improve the local contrast of the image, the visibility of details in the image can be enhanced, and particularly under the condition of uneven illumination, the overall contrast of the image can be more uniform, thereby being beneficial to the accurate extraction of subsequent features.
The morphological open operation is performed on the image by using the structural elements, so that small object interference in the image can be effectively removed, main characteristics of the image are kept unchanged, and the influence of noise is reduced, which is important for separating target characteristics (such as data lines) from complex background.
Finally, the Gaussian smoothing H is applied to reduce the influence of noise, so that the image can be further smoothed, and tiny irregularities are eliminated, which is not only helpful for improving the accuracy of subsequent feature extraction, but also for enhancing the continuity and integrity of target features such as data lines.
In conclusion, the series of preprocessing steps can improve the image quality in a complex environment, and provide clearer and cleaner basic images for subsequent data line detection, so that the detection accuracy and robustness are improved.
S2, preprocessing the acquired image to enhance the contrast ratio, and then performing feature extraction operation to identify potential data line areas, wherein the acquired image is converted into a gray space and histogram equalization is applied to remarkably enhance the contrast ratio of the image, so that the area with original darkness or lower contrast ratio becomes clearer, and the extraction of subsequent features is facilitated.
Specifically, pre-processing the acquired image to enhance contrast further comprises the sub-steps of:
Converting the acquired image into a gray space to obtain a gray image Ig, and using a formula Ig =0.299R+0.587G+0.114B, wherein R, G and B respectively represent red, green and blue channel values of an original image;
Applying histogram equalization to the converted gray-scale image Ig, calculating an equalized image Ieq by the formula Ieq(x,y)=cum(Ig (x, y))× (L-1), wherein cut (z) represents a cumulative distribution function, L is the number of gray-scale levels;
extracting a main feature by adaptive threshold segmentation T using the obtained image Ieq, setting a threshold T (x, y) =m (x, y) +k.s (x, y), wherein m (x, y) and s (x, y) are respectively a local average value and a standard deviation, and k is a constant, and finally obtaining a binarized image Ib, wherein
Based on the binarized image Ib, a connected component analysis is performed, different object regions are marked and separated, and clear object boundary information is provided for subsequent steps. The self-adaptive threshold segmentation technology can automatically adjust the threshold according to the characteristics of the local area of the image, so that the main features in the image can be extracted more accurately.
The connected component analysis can further help identify and separate different object regions in the image, noise and insignificant small features can be effectively removed by marking each connected component, leaving a larger connected region associated with the data line, providing a more accurate basis for subsequent feature extraction and data line location.
In general, the series of preprocessing steps can effectively improve the quality of an image, enhance the contrast ratio and remove noise, and through self-adaptive threshold segmentation and communication component analysis, potential data line areas can be identified more accurately, so that a solid foundation is laid for subsequent feature extraction and accurate positioning.
Specifically, performing the feature extraction operation to identify potential data line regions further includes the substeps of:
Applying a gradient operation to the obtained contrast-enhanced image Ienh, calculating gradient intensities Gx and Gy in the horizontal and vertical directions, and obtaining a gradient image G using the formula Gx=Ienh(x+1,y)-Ienh(x-1,y),Gy=Ienh(x,y+1)-Ienh (x, y-1), respectively, wherein
On the calculated gradient image G, non-maximum suppression is applied to emphasize edge pixels, i.e., for each pixel p, checking whether it is a local maximum, i.e., G (p) > G (p+Δd) and G (p) > G (p- Δd), where Δd refers to one small step along the gradient direction, preserving pixels meeting the condition as candidate edge points;
According to the selected candidate edge points, setting thresholds Th and Tl, wherein Th is a high threshold, Tl is a low threshold, selecting points with intensity higher than Th as strong edge points, and selecting points with intensity between Tl and Th as weak edge points;
a continuous line of edges is formed by connecting strong and weak edge points, and if a strong edge point is near a weak edge point, the weak edge point is considered to be part of the data line and marked as a potential data line region.
By applying gradient operations to the contrast enhanced image, edge information in the image can be effectively captured, highlighting potential data line regions. The gradient strength in the horizontal direction and the vertical direction is calculated, and the gradient image is synthesized, so that the characteristic of the edge in the image can be enhanced, and a foundation is provided for subsequent edge detection.
The application of non-maximum suppression (NMS) may further highlight edge pixels, ensuring that only locally maximum edge pixels are preserved, which may reduce unnecessary edge responses and make the detected edges more sharp and accurate.
By setting the high and low thresholds, a point with an intensity higher than the high threshold is selected as a strong edge point, and a point with an intensity between the high and low thresholds is selected as a weak edge point. This dual threshold technique is able to preserve points that may be true edges but are weaker due to noise or other factors, while removing most of the noise points.
Finally, by connecting the strong edge points and the weak edge points to form a continuous edge line, a complete data line path can be constructed. Particularly when there are strong edge points in the vicinity of the weak edge points, these are considered to be part of the data line, so that the shape of the data line can be more completely traced.
In a word, the series of feature extraction steps can effectively identify potential data line areas, reduce noise interference, ensure that the detected data line edges are more accurate and continuous, and improve the overall performance of data line detection.
S3, determining candidate data line paragraphs based on the extracted features, and configuring preliminary weight factors according to the identified data line paragraphs;
specifically, determining the candidate data line segment based on the extracted features further comprises the sub-steps of:
calculating a directional gradient θ for each pixel point in the identified potential data line region, which may be formulated byDeriving, wherein Gy and Gx are gradients in the vertical and horizontal directions, respectively;
According to the obtained direction gradient theta, clustering the pixel points in the potential area according to the gradient direction to form a plurality of pixel clusters with similar directions, and setting an angle threshold delta theta to enable the pixel points i and j of |thetai-θj | < delta theta to belong to the same cluster;
For the pixel clusters formed, the center coordinates C of each cluster are calculated using the formulaWhere n is the number of pixels in the cluster, (xi,yi) is the position coordinates of the pixels in the cluster;
And selecting the cluster with the calculated central coordinate C within a certain range as the basis of the candidate data line paragraph, and setting a distance threshold D so that when the distance between centers of two adjacent clusters is |Ci-Cj | < D, the two clusters are regarded as parts of the same paragraph, thereby determining the candidate data line paragraph.
By calculating a directional gradient for each pixel in the potential data line area, the edge information can be further refined, enabling the system to more accurately understand the directional properties of the individual pixels. This step facilitates subsequent pixel clustering because pixels in similar directions are more likely to belong to the same data line.
And clustering the pixel points according to the gradient direction by using the direction gradient to form pixel clusters with similar directions. The step can combine the pixel points with the same direction, thereby reducing the influence of stray pixels and improving the accuracy of data line detection.
By calculating the center coordinates of each cluster, the geometric center position of each cluster can be obtained, which facilitates subsequent analysis of the relationships between clusters. The calculation of the center coordinates is based on the positions of all pixels within the cluster, which makes the determined center position more reliable.
And according to the set distance threshold, treating the cluster with the center coordinates within a certain range as a part of the same paragraph. Such a method can help the system identify which clusters may belong to the same data line, thereby determining candidate data line paragraphs. The method not only can identify the continuous data line segments, but also can eliminate clusters with inconsistent directions or too far distance, thereby improving the accuracy and reliability of identification.
In summary, the steps can effectively separate potential data line segments from a complex background, improve recognition accuracy, reduce false alarm rate, and provide reliable basis for subsequent data line analysis and processing through preliminary weight factor configuration.
Specifically, configuring the preliminary weighting factor according to the identified data line segment specifically further includes the following sub-steps:
Calculating the length L of each determined candidate data line paragraph, and distributing basic weights according to the lengths, wherein f is a monotonically increasing function, and the weights are larger as the paragraphs are longer;
On the basis of the allocated basic weight, adjusting the weight according to the importance degree of the position of the paragraph, setting a position weight factor Wp, if the paragraph is in the central area of the image, Wp = 1+ alpha, otherwise Wp = 1, wherein alpha is a positive constant, and represents the importance increasing coefficient of the central area;
combining the basic weight Wb and the position weight factor Wp, calculating the comprehensive weight Wc, and using a formula Wc=Wb×Wp as a preliminary weight factor of the candidate data line paragraph;
And sorting all paragraphs according to the obtained preliminary weight factors, selecting the top N paragraphs with higher weight as high-confidence paragraphs, and setting N as a percentage value smaller than 100.
By calculating the length of each candidate data line segment and assigning a base weight to the length, it is possible to ensure that longer data line segments have higher base weights. This is because longer segments generally represent more coherent data line features, and therefore they should take a more important role in final data line detection.
The position weight factor is introduced to adjust the weight of the segments so that the segments of the data line located in the central region of the image have a higher weight. This is because the center of the image is typically the focus area of interest to the viewer, so the data line features located at the center are more likely to be features of interest to the user. This method can increase the correlation and importance of the detection results.
The importance of the data line segments falling on the length and the position can be reflected more comprehensively by combining the basic weight and the position weight factor to calculate the comprehensive weight. By using the integrated weights, each paragraph can be better assessed for importance in the overall detection and ranked accordingly.
By sorting all paragraphs and selecting the top N percent paragraphs with higher weight as high confidence paragraphs, the detection accuracy can be further improved. This approach ensures that the system focuses on those paragraphs that are most likely to represent real data lines, thereby reducing the likelihood of false positives.
In summary, by dynamically configuring the preliminary weight factors, the method can effectively distinguish the importance of different data line segments, improves the detection accuracy and reliability, and is particularly suitable for application scenes requiring high-precision data line detection.
S4, optimizing the extraction accuracy of the profile of the data line by using the set weight factors, and performing calibration weight distribution according to the optimized profile;
specifically, optimizing the extraction accuracy of the data line profile using the set weight factor further includes the sub-steps of:
Assigning a corresponding weight value to each pixel point in the candidate data line paragraph by using the determined preliminary weight factor, and calculating the weighted intensity Iw(p)=I(p)×We (p) of the pixel point p, wherein I (p) is an original intensity value;
Based on the resulting weighted intensities Iw (p), recalculating the total weight S for each candidate data line segment, using the formula s= Σp∈segmentIw (p), where p represents the pixel point in the segment;
Comparing the total weight S of all the paragraphs, selecting the paragraphs with higher total weight S as the component parts of the data line, setting a threshold value Ts, and considering the paragraphs as effective data line paragraphs only when S > Ts;
According to the selected valid data line segments, a complete data line profile is constructed by connecting adjacent and consistently oriented segments, ensuring that there is overlap or spacing between adjacent segments that does not exceed a given threshold Dt, i.e., |dij | < Dt, where Dij is the distance between segments i and j.
By assigning a corresponding weight value to each pixel point in the candidate data line segment and calculating the weighting intensity Iw (p) thereof, it is ensured that those pixels points with higher weights in the preliminary weighting factors occupy more important positions in the subsequent processing. The weighted intensity reflects the importance of the pixel point in the detection of the data line, and is helpful for more accurately extracting the outline of the data line.
Recalculating the total weight of each candidate data line segment may further emphasize those segments that have higher weights in both length and position. This step ensures that the system can identify the most representative data line features and ignore those paragraphs that are less weighted and unlikely to be real data lines.
By comparing the total weight of the paragraphs and selecting the paragraphs with higher total weight as the component parts of the data line, the high-quality data line paragraphs can be effectively screened out. The threshold is set, and the paragraph is considered as a valid data line paragraph only when S > Ts, which is helpful for reducing false detection and missing detection and improving detection accuracy.
Finally, by connecting adjacent segments with consistent directions, a complete data line profile is constructed, so that the overlapping or the interval between the adjacent segments is ensured not to exceed a given threshold value, and the finally obtained data line profile can be ensured to be consistent and reasonable. The method not only improves the integrity of the outline, but also ensures the continuity and consistency of the data line path.
In summary, by optimizing the extraction accuracy of the data line profile by using the set weight factor and performing calibration weight distribution according to the optimized profile, the method can remarkably improve the accuracy and reliability of data line detection, reduce the situations of false detection and missing detection, and is suitable for the data line detection requirements in various complex environments.
Specifically, the calibration weight allocation according to the optimized profile further includes the following sub-steps:
For each pixel point in the optimized data line contour, calculating the weighted intensity sum Sw (p) in the surrounding neighborhood N (p) of the pixel point, and using a formula Sw(p)=∑q∈N(q)Iw (q), wherein Iw (q) is the weighted intensity of the neighbor pixel point q;
Based on the obtained weighted intensity and Sw (p), the weight factor Wa (p) of the pixel point p is adjusted, and a formula is adoptedReflecting the relative importance of the pixel point in the neighborhood;
Recalculating the integrated weight for each paragraph on the data line profile Sa using the updated weight factor Wa (p), using the formula Sa(segment)=∑p∈segmentI(p)×Wa (p), where I (p) is the raw intensity value;
And according to the updated comprehensive weight Sa, the importance of the paragraph on the outline is again estimated and calibrated, so that the boundary of the data line is ensured to reflect the actual position more accurately.
The integrated intensity of the pixel points in the neighborhood can be reflected more finely by calculating the weighted intensity sum in the neighborhood around each pixel point in the optimized data line contour. This approach may enhance the understanding of local features, ensuring that the weight of each pixel point is more consistent with its importance in the local environment.
And adjusting the weight factor of the pixel point to reflect the relative importance of the pixel point in the neighborhood. This step enables the system to dynamically adjust the weights according to the features around the pixel points so that important pixel points occupy more important positions in the final contour construction.
The importance assessment of the paragraphs may be further optimized by recalculating the comprehensive weights for each paragraph on the data line profile using the updated weight factors. This step ensures that the weight of the paragraph is not only based on its own characteristics, but also takes into account the influence of the surrounding environment, thereby making the comprehensive weight of the paragraph more reasonable.
The importance of the paragraphs on the contour is again assessed and calibrated according to the updated comprehensive weights, so that the boundary of the data line can be ensured to reflect the actual position more accurately. The method improves the accuracy and consistency of the data line profile and reduces errors caused by insufficient consideration of local features.
In summary, by performing calibration weight distribution according to the optimized contour, the method can further improve the precision of data line detection, ensure more accurate and coherent boundaries of the data line contour, reduce false detection and missing detection, and is suitable for application scenes requiring high-precision data line detection.
S5, accurately positioning and tracing the data line by using the calibrated weight, and further comprising the following substeps:
Determining a contribution degree C (p) of each pixel point p in the outline of the data line according to the calibrated weight Wa, and using a formula C (p) =i (p) ×wa (p), wherein I (p) is an intensity value of the pixel point p;
based on the contribution degree C (p) of each pixel point, selecting the pixel points with the contribution degree higher than a set threshold Tc as salient points of the data line, namely C (p) > Tc, wherein the salient points form a basic frame of the data line;
forming a main path of the data line by connecting the determined salient points, calculating the fitting degree F of each straight line or curve segment on the path, and using a formulaTo ensure continuity and rationality of the path;
and correcting any discontinuous or unreasonable parts on the path according to the calculated fitting degree F, ensuring the smoothness and continuity of the whole path, and finally obtaining the precisely positioned data line path.
By using calibrated weights for each pixel in the data line profile to determine its contribution, it is possible to identify which pixels are more critical to constructing the data line profile. Such a quantitative analysis enables the algorithm to selectively focus on those pixels that have higher intensity values and are more likely to be part of the actual component of the data line.
Pixel points with contribution degrees higher than a set threshold value are selected as salient points of the data line, and the salient points form a basic framework of the data line. This method ensures that only those points that are truly characteristic of the data line will be selected, thereby improving the accuracy and reliability of data line identification.
The continuity and rationality of the path can be effectively evaluated by connecting the salient points to form a main path of the data line and calculating the fitting degree of each straight line or curve segment on the path. Paths with high fitting degree mean that the path segments are more in line with the shape characteristics of the actual data line, so that the quality of the paths is ensured.
Any discontinuous or unreasonable parts on the path are corrected according to the calculated fitting degree, and the process is helpful for eliminating abrupt changes or wrong connection in the path, and the smoothness and continuity of the whole path are ensured. After correction, the finally obtained precisely positioned data line path not only accords with the actual situation, but also has higher visual and geometric consistency.
In summary, the technical means improves the accuracy of positioning the data line, ensures the continuity and rationality of the path, and reduces the possibility of error positioning, thereby being applicable to the fields of application scenes such as automatic visual detection, image recognition and the like which need high-accuracy positioning of the data line.
On the other hand, the invention provides a data line detection system based on weighted calculation, which is shown in fig. 2 and comprises an image acquisition module, a preprocessing and feature extraction module, a preliminary weight configuration module, a weight calibration module and a path drawing module. The method comprises the following steps:
The image acquisition module is used for acquiring a digital image of the target scene;
the preprocessing and feature extraction module is used for preprocessing the acquired image to enhance contrast, and then performing feature extraction operation to identify potential data line areas;
the preliminary weight configuration module is used for determining candidate data line paragraphs based on the extracted features and configuring preliminary weight factors according to the identified data line paragraphs;
the weight calibration module is used for optimizing the extraction accuracy of the data line contour by using the set weight factors and performing calibration weight distribution according to the optimized contour;
the path drawing module is used for accurately positioning and drawing the path of the data line by using the calibrated weight.
In addition, the image acquisition module, the preprocessing and feature extraction module, the preliminary weight configuration module, the weight calibration module and the path drawing module are further configured to implement other steps of the data line detection method based on weighted calculation when executing, which are not described in detail herein.
In summary, the present invention enhances contrast by preprocessing the acquired target scene image, and performs feature extraction based thereon to identify potential data line regions. Candidate data line segments are then determined by analysis of the extracted features and preliminary weighting factors are configured based on these segments. And further optimizing the extraction accuracy of the data line contour by using the set weight factors, and calibrating weight distribution according to the optimized contour. Finally, the calibrated weights are used to achieve accurate positioning of the data lines and to trace their paths. The method can dynamically adjust the weight according to the image content, thereby improving the detection precision and reducing the situations of false detection and missing detection.
It should be noted that the foregoing description is only a preferred embodiment of the present invention, and although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood that modifications, equivalents, improvements and modifications to the technical solution described in the foregoing embodiments may occur to those skilled in the art, and all modifications, equivalents, and improvements are intended to be included within the spirit and principle of the present invention.