A data line detection system and method based on weighted calculation
By preprocessing and feature extraction of the target scene image, and configuring weight factors to optimize the data line profile, the problem of low data line detection accuracy in complex backgrounds is solved, and high-precision data line detection is achieved.
Patent Information
- Application Number
- CN202411369182.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2044-09-29
AI Technical Summary
The existing data line detection technology is not very accurate when facing light changes and complex backgrounds, and it is prone to missed detection or missed detection.
By preprocessing the target scene image to enhance contrast, and feature extraction is performed to identify potential data line areas, configuring preliminary weight factors, optimizing the extraction accuracy of the data line contour, and calibrating weight allocation is performed based on the optimized contour, ultimately realizing the precise positioning and path delineation of the data line.
It improves the accuracy of data line detection, reduces false detection and missed detection, and is suitable for detection needs in complex contexts.
Smart Images

Figure CN119359609B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and particularly relates to a data line detection system and method based on weighted calculation. Background Art
[0002] In the field of modern image processing, especially in applications such as power systems, industrial automation, and intelligent transportation systems, accurately detecting data lines in images is an important task. Traditional methods usually rely on fixed threshold segmentation or predefined template matching to detect data lines. Such methods first convert the original image into a grayscale image and enhance the contrast through methods such as histogram equalization for subsequent feature extraction. Then, edge detection and other means are used to identify areas that may contain data lines. However, in complex backgrounds, due to factors such as light changes and shadow interference, fixed thresholds or templates are difficult to adapt to diverse application scenarios, resulting in low detection accuracy.
[0003] Existing data line detection technologies often have difficulty achieving ideal detection accuracy when faced with light changes and complex backgrounds due to the limitations of fixed threshold selection or template matching. Especially when data lines are mixed with other image features, traditional detection methods are prone to false detection or missed detection problems. Summary of the Invention
[0004] The purpose of the present invention is to provide a data line detection system and method based on weighted calculation, which preprocesses the acquired target scene image to enhance the contrast, and on this basis, performs feature extraction to identify potential data line areas, so as to solve the problems in the existing technology mentioned in the above background art.
[0005] To achieve the above purpose, on the one hand, the present invention proposes a data line detection method based on weighted calculation, including the following steps:
[0006] Obtain a digital image of the target scene; perform preprocessing on the acquired image to enhance the contrast, and then perform feature extraction operations to identify potential data line areas; determine candidate data line segments based on the extracted features, and configure initial weight factors according to the identified data line segments; use the set weight factors to optimize the extraction accuracy of the data line contour, and perform calibrated weight distribution according to the optimized contour; use the calibrated weight to achieve precise positioning of the data line and depict its path.
[0007] Preferably, after obtaining the digital image of the target scene, it includes the following sub-steps:
[0008] Perform histogram equalization to enhance the local contrast of the image, using the formula where I represents the original grayscale I enhancedThe level is the new gray level after equalization, and L is the maximum value of the gray levels;
[0009] On the basis of enhancing the contrast, use the structuring element E to process the image I enhanced Perform morphological opening operation to remove small object interference, and the formula is expressed as Then perform where and represent erosion and dilation operations respectively;
[0010] According to the obtained image I open , apply Gaussian smoothing H to reduce the noise influence. The smoothed image I smooth is denoted as I smooth = I open *H, where * represents the convolution operation, and this image is used for subsequent processing.
[0011] Preferably, perform preprocessing on the obtained image to enhance the contrast, including the following sub-steps:
[0012] Convert the obtained image to the gray space to obtain the gray image I g , and use the formula I g = 0.299R + 0.587G + 0.114B, where R, G, and B represent the red, green, and blue channel values of the original image respectively;
[0013] Apply histogram equalization to the converted gray image I g , and calculate the equalized image I eq (x, y) = cum(I g (x, y)) × (L - 1), where cum(z) represents the cumulative distribution function and L is the number of gray levels; eq
[0014] Use the obtained image I eq , extract the main features through adaptive threshold segmentation T, and set the threshold T(x, y) = m(x, y) + k·s(x, y), where m(x, y) and s(x, y) are the local average and standard deviation respectively, and k is a constant. Finally, obtain the binary image I b where
[0015]
[0016] Based on the binary image I b , perform connected component analysis to label and separate different object regions, providing clear object boundary information for subsequent steps.
[0017] Preferably, perform feature extraction operations to identify potential data line regions, including the following sub-steps:
[0018] Apply a gradient operation to the enhanced contrast image Ienh, calculate the gradient intensities Gx and Gy in the horizontal and vertical directions respectively, and use the formula G x = I enh (x + 1, y) - I enh (x - 1, y), G y = I enh (x, y + 1) - I enh (x, y - 1), to obtain the gradient image G, where
[0019] On the calculated gradient image G, apply non-maximum suppression to highlight the edge pixels. That is, for each pixel p, check whether it is a local maximum, i.e., G(p) > G(p + Δd) and G(p) > G(p - Δd), where Δd refers to a small step along the gradient direction, and retain the pixels that meet the conditions as candidate edge points;
[0020] According to the selected candidate edge points, set the thresholds T h and T l , where T h is the high threshold and T l is the low threshold. Select those points with intensities higher than T h as strong edge points, and select those points with intensities between T l and T h as weak edge points;
[0021] Form continuous edge lines by connecting strong edge points and weak edge points. If there is a strong edge point near a weak edge point, then consider this weak edge point as part of the data line and mark it as the potential data line area.
[0022] Preferably, determine the candidate data line segments based on the extracted features, including the following sub-steps:
[0023] Calculate the directional gradient θ for each pixel point in the identified potential data line area. The directional gradient can be obtained by the formula where G y and G x are the gradients in the vertical and horizontal directions respectively;
[0024] According to the obtained directional gradient θ, cluster the pixel points in the potential area according to the gradient direction to form multiple pixel clusters with similar directions. Set the angle threshold Δθ such that the pixel points i and j with ∣θ i - θ j ∣ < Δθ belong to the same cluster;
[0025] For the formed pixel clusters, calculate the center coordinates C of each cluster, using the formula where n is the number of pixels in the cluster, and (x i , y i ) are the position coordinates of the pixels in the cluster;
[0026] Select the clusters whose calculated central coordinates C are within a certain range as the basis for the candidate data line segments, and set a distance threshold D such that when the distance ∣C i - C j ∣ < D, these two clusters are regarded as parts of the same paragraph, thereby determining the candidate data line segments.
[0027] Preferably, configure the preliminary weight factors according to the recognized data line segments, including the following sub-steps:
[0028] For each determined candidate data line segment, calculate its length L and assign a basic weight according to the length. Set the basic weight W b = f(L), where f is a monotonically increasing function, reflecting that the longer the paragraph, the greater its weight;
[0029] On the basis of the assigned basic weight, adjust the weight according to the importance of the position where the paragraph is located, and set the position weight factor W p , if the paragraph is in the central region of the image, then W p = 1 + α, otherwise W p = 1, where α is a positive constant representing the importance increase coefficient of the central region;
[0030] Combine the basic weight W b and the position weight factor W p , calculate the comprehensive weight W c , use the formula W c = W b × W p , and use this as the preliminary weight factor of the candidate data line segment;
[0031] According to the obtained preliminary weight factors, sort all paragraphs, and select the top N percentage of paragraphs with higher weights as the high-confidence paragraphs, where N is a percentage value less than 100.
[0032] Preferably, optimize the extraction accuracy of the data line profile using the set weight factors, including the following sub-steps:
[0033] Use the determined preliminary weight factors to assign corresponding weight values to each pixel point in the candidate data line segment, and calculate the weighted intensity I w (p) = I(p) × W e (p), where I(p) is the original intensity value;
[0034] Based on the obtained weighted intensity I w(p), recalculate the total weight S of each candidate data segment using the formula S = ∑ p∈segment I w (p), where p represents the pixel points in the segment;
[0035] Compare the total weights S of each segment, select the segment with a higher total weight S as a component of the data line, and set a threshold Ts. Only when S > Ts is the segment considered a valid data segment;
[0036] According to the selected valid data segments, construct the complete data line profile by connecting adjacent segments with the same direction, ensuring that there is an overlap or the distance between adjacent segments does not exceed a given threshold Dt, i.e., ∣D ij ∣ < Dt, where D ij is the distance between segments i and j.
[0037] Preferably, perform calibrated weight assignment according to the optimized profile, including the following sub-steps:
[0038] For each pixel point in the optimized data line profile, calculate the weighted intensity sum S w (p) in its surrounding neighborhood N(p) using the formula S w (p) = ∑ q∈N(q) I w (q), where I w (q) is the weighted intensity of the neighbor pixel point q;
[0039] Based on the obtained weighted intensity sum S w (p), adjust the weight factor W a (p) of the pixel point p using the formula to reflect the relative importance of the pixel point in the neighborhood;
[0040] Using the updated weight factor W a (p), recalculate the comprehensive weight S a of each segment on the data line profile using the formula S a (segment) = ∑ p∈segment I(p) × W a (p), where I(p) is the original intensity value;
[0041] According to the updated comprehensive weight S a , re-evaluate and calibrate the importance of the segments on the profile again to ensure that the boundary of the data line more accurately reflects the actual position.
[0042] Preferably, use the calibrated weights to achieve precise positioning of the data line and depict its path, including the following sub-steps:
[0043] According to the calibrated weight Wa , determine the contribution C(p) of each pixel point p in the data line profile, using the formula C(p) = I(p) × Wa(p), where I(p) is the intensity value of pixel point p;
[0044] Based on the contribution C(p) of each pixel, pixels with contribution higher than the set threshold Tc are selected as the salient points of the data line, that is, C(p)>Tc. These salient points constitute the basic framework of the data line.
[0045] By connecting the identified significant points, the main path of the data line is formed, and the fitting degree F of each straight line or curve segment on the path is calculated using the formula To ensure the consistency and rationality of the path;
[0046] According to the calculated fitting degree F, any discontinuous or unreasonable parts on the path are corrected to ensure the smoothness and continuity of the entire path, and finally obtain a precisely positioned data line path.
[0047] On the other hand, the present invention provides a data line detection system based on weighted calculation, comprising:
[0048] An image acquisition module, used to acquire a digital image of a target scene;
[0049] A preprocessing and feature extraction module is used to preprocess the acquired image to enhance contrast, and then perform feature extraction operations to identify potential data line areas;
[0050] A preliminary weight configuration module, for determining candidate data line segments based on the extracted features and configuring preliminary weight factors according to the identified data line segments;
[0051] The weight calibration module is used to optimize the extraction accuracy of the data line contour using the set weight factor and to perform calibration weight allocation according to the optimized contour;
[0052] The path depiction module is used to use the calibrated weights to accurately locate the data line and depict its path.
[0053] Technical effects and advantages of the present invention: Compared with the prior art, the data line detection system and method based on weighted calculation proposed by the present invention have the following advantages:
[0054] The present invention preprocesses the acquired target scene image to enhance the contrast, and on this basis, extracts features to identify potential data line regions. Subsequently, candidate data line segments are determined by analyzing the extracted features, and preliminary weight factors are configured according to these segments. The extraction accuracy of the data line contour is further optimized using the set weight factors, and the weight distribution is calibrated according to the optimized contour. Finally, the calibrated weights are used to accurately locate the data line and depict its path. This method can dynamically adjust the weights according to the image content, thereby improving the detection accuracy and reducing the cases of false detection and missed detection. Brief Description of the Drawings
[0055] Figure 1 is a flowchart of the data line detection method based on weighted calculation of the present invention;
[0056] Figure 2 is a block diagram of the data line detection system based on weighted calculation of the present invention. Detailed Embodiment
[0057] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. The specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0058] The present invention provides a data line detection method based on weighted calculation, as Figure 1 shown, including the following steps:
[0059] S1: Obtain a digital image of the target scene, which further includes the following sub-steps:
[0060] Implement histogram equalization to enhance the local contrast of the image, using the formula where I represents the original gray level I enhanced level, is the new gray level after equalization, and L is the maximum value of the gray level;
[0061] On the basis of enhancing the contrast, use the structural element E to perform a morphological opening operation on the image I enhanced to remove small object interference, and the formula is expressed as and then perform where and ⊕ represent erosion and dilation operations respectively;
[0062] According to the obtained image I open , apply Gaussian smoothing H to reduce the noise influence, and the smoothed image Ismooth Denoted as I smooth = I open * H, where * represents the convolution operation, and this image is used for subsequent processing.
[0063] By implementing histogram equalization to enhance the local contrast of the image, the visibility of details in the image can be enhanced. Especially in the case of uneven illumination, it can make the overall contrast of the image more uniform, which helps to accurately extract subsequent features.
[0064] Performing morphological opening operation on the image using a structuring element can effectively remove small object interference in the image, keep the main features of the image unchanged, and at the same time reduce the influence of noise, which is crucial for separating target features (such as data lines) from complex backgrounds.
[0065] Finally, applying Gaussian smoothing H to reduce the influence of noise can further smooth the image and eliminate small irregularities, which not only helps to improve the accuracy of subsequent feature extraction, but also enhances the continuity and integrity of target features such as data lines.
[0066] In summary, this series of preprocessing steps can improve the image quality in a complex environment, provide a clearer and cleaner base image for subsequent data line detection, thereby improving the accuracy and robustness of the detection.
[0067] S2: Preprocess the acquired image to enhance the contrast, and then perform feature extraction operations to identify potential data line regions; by converting the acquired image to the grayscale space and applying histogram equalization, the contrast of the image can be significantly enhanced, making the originally dim or low-contrast regions clearer, which is beneficial for subsequent feature extraction.
[0068] Specifically, preprocessing the acquired image to enhance the contrast further includes the following sub-steps:
[0069] Convert the acquired image to the grayscale space to obtain the grayscale image I g , using the formula I g = 0.299R + 0.587G + 0.114B, where R, G, B represent the red, green, and blue channel values of the original image respectively;
[0070] Apply histogram equalization to the converted grayscale image I g using the formula I eq (x, y) = cum(I g (x, y)) × (L - 1) to calculate the equalized image I eq , where cum(z) represents the cumulative distribution function and L is the number of gray levels;
[0071] Using the obtained image Ieq , the main features are extracted through adaptive threshold segmentation T. The threshold T(x, y) = m(x, y) + k·s(x, y) is set, where m(x, y) and s(x, y) are the local mean and standard deviation respectively, and k is a constant. Finally, the binary image I is obtained. b , where
[0072]
[0073] Based on the binary image I b , connected component analysis is performed to label and separate different object regions, providing clear object boundary information for subsequent steps. The adaptive threshold segmentation technique can automatically adjust the threshold according to the characteristics of local regions of the image, thus more accurately extracting the main features in the image. This method can better adapt to the changes in brightness and contrast in the image compared to the global threshold, ensuring effective segmentation of target features even under uneven lighting conditions.
[0074] Connected component analysis can further help identify and separate different object regions in the image. By labeling each connected component, noise and insignificant small features can be effectively removed, leaving larger connected regions related to the data lines, providing a more accurate basis for subsequent feature extraction and data line positioning.
[0075] Overall, this series of preprocessing steps can effectively improve the quality of the image, enhance the contrast, remove noise, and through adaptive threshold segmentation and connected component analysis, can more accurately identify potential data line regions, laying a solid foundation for subsequent feature extraction and precise positioning.
[0076] Specifically, the operation of feature extraction to identify potential data line regions further includes the following sub-steps:
[0077] Apply gradient operation to the obtained image Ienh with enhanced contrast, calculate the gradient intensities Gx and Gy in the horizontal and vertical directions respectively, and use the formulas G x = I enh (x + 1, y) - I enh (x - 1, y), G y = I enh (x, y + 1) - I enh (x, y - 1) to obtain the gradient image G, where
[0078] On the calculated gradient image G, apply non-maximum suppression to highlight edge pixels, that is, for each pixel p, check whether it is a local maximum, that is, G(p) > G(p + Δd) and G(p) > G(p - Δd), where Δd refers to a small step along the gradient direction, and retain the pixels that meet the conditions as candidate edge points;
[0079] Set a threshold T based on the selected candidate edge points h and T l , where T h is the high threshold and T l is the low threshold. Select those points with intensity higher than T h as strong edge points, and select those points with intensity between T l and T h as weak edge points;
[0080] Form continuous edge lines by connecting strong edge points and weak edge points. If there is a strong edge point near a weak edge point, then this weak edge point is considered to be part of the data line and is marked as a potential data line area.
[0081] By applying gradient operations to the image with enhanced contrast, edge information in the image can be effectively captured, thereby highlighting potential data line areas. Calculate the gradient intensities in the horizontal and vertical directions and synthesize a gradient image. This process can strengthen the features of the edges in the image and provide a basis for subsequent edge detection.
[0082] The application of non-maximum suppression (NMS) can further highlight edge pixels, ensuring that only the edge pixels of local maxima are retained. This can reduce unnecessary edge responses and make the detected edges clearer and more accurate.
[0083] By setting high and low thresholds, select points with intensity higher than the high threshold as strong edge points, and select points with intensity between the high and low thresholds as weak edge points. This dual-threshold technique can retain those points that may be real edges but have weak intensity due to noise or other factors, while removing most of the noise points.
[0084] Finally, by connecting strong edge points and weak edge points to form continuous edge lines, a complete data line path can be constructed. Especially when there is a strong edge point near a weak edge point, these weak edge points are considered to be part of the data line, so that the shape of the data line can be more completely depicted.
[0085] In summary, this 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.
[0086] S3: Determine candidate data line segments based on the extracted features and configure preliminary weight factors according to the identified data line segments;
[0087] Specifically, determining candidate data line segments based on the extracted features further includes the following sub-steps:
[0088] Calculate the directional gradient θ for each pixel point in the potential data line region. The directional gradient can be obtained from the formula where G y and G x are the gradients in the vertical and horizontal directions respectively;
[0089] According to the obtained directional gradient θ, cluster the pixel points in the potential region according to the gradient direction to form multiple pixel clusters with similar directions. Set an angular threshold Δθ such that pixel points i and j with ∣θ i - θ j ∣ < Δθ belong to the same cluster;
[0090] For the formed pixel clusters, calculate the center coordinates C of each cluster using the formula where n is the number of pixels in the cluster, and (x i , y i ) are the position coordinates of the pixels in the cluster;
[0091] Select the clusters whose calculated center coordinates C are within a certain range as the basis for candidate data line segments. Set a distance threshold D such that when the distance ∣C i - C j ∣ < D between the centers of two adjacent clusters, these two clusters are regarded as parts of the same segment, thereby determining the candidate data line segments.
[0092] By calculating the directional gradient for each pixel point in the potential data line region, the edge information can be further refined, enabling the system to more accurately understand the directional attributes of each pixel point. This step helps with subsequent pixel clustering because pixel points with similar directions are more likely to belong to the same data line.
[0093] Use the directional gradient to cluster the pixel points according to their gradient directions to form pixel clusters with similar directions. This step can combine pixel points with consistent directions, thereby reducing the influence of stray pixels and improving the accuracy of data line detection.
[0094] By calculating the center coordinates of each cluster, the geometric center position of each cluster can be obtained, which helps with subsequent analysis of the relationships between clusters. The calculation of the center coordinates is based on the positions of all pixels within the cluster, making the determined center position more reliable.
[0095] According to the set distance threshold, consider the clusters with center coordinates within a certain range as parts of the same segment. Such a method can help the system identify which clusters may belong to the same data line, thereby determining the candidate data line segments. This method can not only identify coherent data line segments but also exclude those clusters with inconsistent directions or excessive distances, thereby improving the accuracy and reliability of the identification.
[0096] In summary, the above steps can effectively isolate potential data line segments from complex backgrounds, improve recognition accuracy, reduce false alarm rates, and through preliminary weight factor configuration, provide a reliable basis for subsequent data line analysis and processing.
[0097] Specifically, configuring the preliminary weight factors based on the recognized data line segments further includes the following sub-steps:
[0098] For each determined candidate data line segment, calculate its length L, and assign a basic weight according to the length, and set the basic weight W b = f(L), where f is a monotonically increasing function, reflecting that the longer the paragraph, the greater its weight;
[0099] On the basis of the assigned basic weight, adjust the weight according to the importance of the position where the paragraph is located, and set the position weight factor W p , if the paragraph is in the central area of the image, then W p = 1 + α, otherwise W p = 1, where α is a positive constant representing the importance increase coefficient of the central area;
[0100] Combine the basic weight W b and the position weight factor W p , calculate the comprehensive weight W c , use the formula W c = W b ×W p , and use this as the preliminary weight factor for the candidate data line segment;
[0101] According to the obtained preliminary weight factors, sort all paragraphs, and select the top N percentage of paragraphs with higher weights as high-confidence paragraphs, where N is a percentage value less than 100.
[0102] By calculating the length of each candidate data line segment and assigning a basic weight according to the length, it can be ensured that longer data line segments have higher basic weights. This is because longer paragraphs usually represent more coherent data line features, so they should play a more important role in the final data line detection.
[0103] Introduce a position weight factor to adjust the weight of the paragraph, so that the data line segments located in the central area of the image have higher weights. This is because the center of the image is usually the key area that observers focus on, so the data line features located in the center are more likely to be the features that users are interested in. This method can improve the relevance and importance of the detection results.
[0104] Calculating the comprehensive weight by combining the basic weight and the position weight factor can more comprehensively reflect the importance of the data line segments in terms of length and position. By using the comprehensive weight, the importance of each segment in the overall detection can be better evaluated and sorted accordingly.
[0105] By sorting all the segments and selecting the top N percentage of segments with higher weights as high-confidence segments, the accuracy of the detection can be further improved. This method ensures that the system focuses on those segments that are most likely to represent the true data lines, thus reducing the possibility of false detection.
[0106] In summary, by dynamically configuring the preliminary weight factor, this method can effectively distinguish the importance of different data line segments, improve the accuracy and reliability of the detection, and is particularly suitable for application scenarios that require high-precision data line detection.
[0107] S4: Optimize the extraction accuracy of the data line profile using the set weight factor, and calibrate the weight distribution according to the optimized profile;
[0108] Specifically, optimizing the extraction accuracy of the data line profile using the set weight factor further includes the following sub-steps:
[0109] Using the determined preliminary weight factor, assign corresponding weight values to each pixel point in the candidate data line segments, and calculate the weighted intensity I of pixel point p w (p) = I(p) × W e (p), where I(p) is the original intensity value;
[0110] Based on the obtained weighted intensity I w (p), recalculate the total weight S of each candidate data line segment, using the formula S = ∑ p∈segment I w (p), where p represents the pixel points in the segment;
[0111] Compare the total weights S of each segment, select the segments with higher total weights S as the components of the data line, and set a threshold Ts. Only when S > Ts is the segment considered a valid data line segment;
[0112] According to the selected valid data line segments, construct a complete data line profile by connecting adjacent segments with the same direction, ensuring that there is an overlap between adjacent segments or the spacing does not exceed a given threshold Dt, i.e., ∣D ij ∣ < Dt, where D ij is the distance between segments i and j.
[0113] By assigning corresponding weight values to each pixel point in the candidate data line segment and calculating its weighted intensity Iw(p), it can be ensured that those pixel points with higher weights in the preliminary weight factor play a more important role in subsequent processing. The weighted intensity reflects the importance of the pixel point in the data line detection, which helps to more accurately extract the data line contour.
[0114] Recalculating the total weight of each candidate data line segment can further emphasize those segments with higher weights in both length and position. This step ensures that the system can identify the most representative data line features and ignore those segments with lower weights that are less likely to be real data lines.
[0115] By comparing the total weights of each segment and selecting the segments with higher total weights as the components of the data line, high-quality data line segments can be effectively screened out. Setting a threshold, only when S > Ts is the segment considered a valid data line segment, which helps to reduce false detections and missed detections and improve the accuracy of the detection.
[0116] Finally, by connecting adjacent segments with the same direction, a complete data line contour is constructed. Ensuring that there is overlap between adjacent segments or the spacing does not exceed a given threshold can ensure that the finally obtained data line contour is coherent and reasonable. This method not only improves the integrity of the contour but also guarantees the continuity and consistency of the data line path.
[0117] In summary, by using the set weight factor to optimize the extraction accuracy of the data line contour and calibrating the weight distribution according to the optimized contour, this method can significantly improve the accuracy and reliability of data line detection, reduce false detections and missed detections, and is applicable to the data line detection requirements in various complex environments.
[0118] Specifically, calibrating the weight distribution according to the optimized contour further includes the following sub-steps:
[0119] For each pixel point in the optimized data line contour, calculate the sum of the weighted intensities S w (p) within its surrounding neighborhood N(p), using the formula S w (p) = ∑ q∈N(q) I w (q), where I w (q) is the weighted intensity of the neighbor pixel point q;
[0120] Based on the obtained sum of the weighted intensities S w (p), adjust the weight factor W a (p) of the pixel point p, using the formula to reflect the relative importance of this pixel point within the neighborhood;
[0121] Using the updated weight factor W a (p), recalculate the comprehensive weight S of each paragraph on the data line profile a , using the formula S a (segment) = ∑ p∈segment I(p) × W a (p), where I(p) is the original intensity value;
[0122] According to the updated comprehensive weight S a , re-evaluate and calibrate the importance of the paragraphs on the profile to ensure that the boundaries of the data line more accurately reflect the actual positions.
[0123] By calculating the weighted intensity sum within the surrounding neighborhood for each pixel point in the optimized data line profile, the comprehensive intensity of the pixel point within the neighborhood can be more finely reflected. This method can enhance the understanding of local features and ensure that the weight of each pixel point is more in line with its importance in the local environment.
[0124] Adjust the weight factor of the pixel point to reflect its relative importance within the neighborhood. This step enables the system to dynamically adjust the weights based on the features around the pixel point, such that important pixel points occupy more important positions in the final profile construction.
[0125] Using the updated weight factor, recalculating the comprehensive weight of each paragraph on the data line profile can further optimize the importance evaluation of the paragraphs. This step ensures that the weight of the paragraph is not only based on its own features but also takes into account the influence of the surrounding environment, thus making the comprehensive weight of the paragraph more reasonable.
[0126] According to the updated comprehensive weight, re-evaluate and calibrate the importance of the paragraphs on the profile to ensure that the boundaries of the data line more accurately reflect the actual positions. This method improves the accuracy and coherence of the data line profile and reduces errors caused by insufficient consideration of local features.
[0127] In summary, by calibrating the weight distribution according to the optimized profile, this method can further improve the accuracy of data line detection, ensure that the boundaries of the data line profile are more accurate and coherent, reduce false detections and missed detections, and is applicable to application scenarios that require high-precision data line detection.
[0128] S5: Use the calibrated weights to achieve precise positioning of the data line and depict its path, further including the following sub-steps:
[0129] According to the calibrated weight W a , determine the contribution degree C(p) of each pixel point p in the data line profile, using the formula C(p) = I(p) × Wa(p), where I(p) is the intensity value of pixel point p;
[0130] Based on the contribution degree C(p) of each pixel point, select the pixel points with a contribution degree higher than the set threshold Tc as the significant points of the data line, that is, C(p)>Tc, and these significant points constitute the basic framework of the data line;
[0131] By connecting the determined significant points, form the main path of the data line, and calculate the fitting degree F of each straight line or curve segment on the path, using the formula to ensure the coherence and rationality of the path;
[0132] According to the calculated fitting degree F, correct any discontinuous or unreasonable parts on the path to ensure the smoothness and continuity of the entire path, and finally obtain an accurately positioned data line path.
[0133] By determining the contribution degree of each pixel point in the data line contour using the calibrated weight, it is possible to identify which pixel points are more critical for constructing the data line contour. Such quantitative analysis enables the algorithm to selectively focus on those pixel points with higher intensity values and more likely to belong to the actual components of the data line.
[0134] Select the pixel points with a contribution degree higher than the set threshold as the significant points of the data line, and these significant points constitute the basic framework of the data line. This method ensures that only those points that truly represent the characteristics of the data line are selected, thereby improving the accuracy and reliability of data line recognition.
[0135] By connecting these significant points to form the main path of the data line and calculating the fitting degree of each straight line or curve segment on the path, the coherence and rationality of the path can be effectively evaluated. A path with a high fitting degree means that these path segments are more in line with the shape characteristics of the actual data line, thus ensuring the quality of the path.
[0136] According to the calculated fitting degree, correct any discontinuous or unreasonable parts on the path. This process helps to eliminate abrupt changes or incorrect connections in the path, ensuring the smoothness and continuity of the entire path. After correction, the finally obtained accurately positioned data line path not only conforms more to the actual situation but also has higher visual and geometric consistency.
[0137] In summary, this technical means improves the accuracy of data line positioning, ensures the coherence and rationality of the path, reduces the possibility of mispositioning, and thus is applicable to application scenarios that require high-precision data line positioning, such as automated visual inspection, image recognition, and other fields.
[0138] On the other hand, the present invention proposes a data line detection system based on weighted calculation, such as Figure 2As shown in the figure, it includes: an image acquisition module, a preprocessing and feature extraction module, a preliminary weight configuration module, a weight calibration module, and a path description module. Specifically as follows:
[0139] The image acquisition module is used to acquire a digital image of the target scene;
[0140] The preprocessing and feature extraction module is used to preprocess the acquired image to enhance the contrast, and then perform feature extraction operations to identify potential data line regions;
[0141] The preliminary weight configuration module is used to determine candidate data line segments based on the extracted features, and configure preliminary weight factors according to the identified data line segments;
[0142] The weight calibration module is used to optimize the extraction accuracy of the data line contour using the set weight factors, and calibrate the weight distribution according to the optimized contour;
[0143] The path description module is used to achieve precise positioning of the data line and describe its path using the calibrated weights.
[0144] In addition, the above-mentioned image acquisition module, preprocessing and feature extraction module, preliminary weight configuration module, weight calibration module, and path description module are also used to implement other steps of the above-mentioned data line detection method based on weighted calculation when executed, which will not be elaborated one by one here.
[0145] To sum up, the present invention preprocesses the acquired target scene image to enhance the contrast, and on this basis, performs feature extraction to identify potential data line regions. Subsequently, candidate data line segments are determined by analyzing the extracted features, and preliminary weight factors are configured according to these segments. The extraction accuracy of the data line contour is further optimized using the set weight factors, and the weight distribution is calibrated according to the optimized contour. Finally, precise positioning of the data line is achieved using the calibrated weights and its path is described. This method can dynamically adjust the weights according to the image content, thereby improving the detection accuracy and reducing the situations of false detection and missed detection.
[0146] Finally, it should be noted that the above are only the preferred embodiments of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A data line detection method based on weighted calculation, characterized in that Including the following steps: Obtain a digital image of the target scene; Perform preprocessing on the obtained image to enhance the contrast, and then perform a feature extraction operation to identify potential data line regions; Determine candidate data line paragraphs based on the extracted features, and configure preliminary weight factors according to the identified data line paragraphs, including the following sub-steps: For each determined candidate data line paragraph, calculate its length L, and assign a basic weight according to the length, and set the basic weight W b = f(L), where f is a monotonically increasing function, reflecting that the longer the paragraph, the greater its weight; On the basis of the assigned basic weight, adjust the weight according to the importance of the position where the paragraph is located, and set the position weight factor W p , if the paragraph is in the central area of the image, then W p = 1 + α, otherwise W p = 1, where α is a positive constant representing the importance increase coefficient of the central area; Combine the basic weight W b and the position weight factor W p , calculate the comprehensive weight W c , use the formula W c = W b ×W p , and use this as the preliminary weight factor of the candidate data line paragraph; According to the obtained preliminary weight factor, sort all paragraphs, and select the top N percentage of paragraphs with higher weights as high-confidence paragraphs, where N is a percentage value less than 100; Utilize the set weight factor to optimize the extraction accuracy of the data line contour, and perform calibrated weight allocation according to the optimized contour, including the following sub-steps: For each pixel point in the optimized data line profile, calculate the weighted intensity sum S within its surrounding neighborhood N(p). w (p), using the formula S w (p) = ∑ q∈N(q) I w (q), where I w (q) is the weighted intensity of the neighbor pixel point q; based on the obtained weighted intensity sum S w (p), adjust the weight factor W a (p) of the pixel point p, using the formula to reflect the relative importance of this pixel point within the neighborhood; utilize the updated weight factor W a (p) to recalculate the comprehensive weight S of each segment on the data line profile a , using the formula S a (segment) = ∑ p∈segment I(p) × W a (p), where I(p) is the original intensity value; according to the updated comprehensive weight S a , re-evaluate and calibrate the importance of the segments on the profile again to ensure that the boundary of the data line more precisely reflects the actual position. Use the calibrated weight to achieve precise positioning of the data line and depict its path.
2. The data line detection method based on weighted calculation according to claim 1, wherein: After obtaining the digital image of the target scene, including the following sub-steps: Implement histogram equalization to enhance the local contrast of the image, using the formula where I represents the original gray level, and I enhanced is the new gray level after equalization, and L is the maximum value of the gray level; On the basis of enhancing the contrast, the structural element E is used to perform morphological opening operation on the image I to remove the interference of small objects, and the formula is expressed as enhanced Then perform where and represent erosion and dilation operations respectively; Based on the obtained image I open , apply Gaussian smoothing H to reduce the influence of noise. The smoothed image I smooth is denoted as I smooth = I open * H, where * represents the convolution operation, and this image is used for subsequent processing.
3. A data line detection method based on weighted calculation according to claim 2, characterized in that: Perform preprocessing on the obtained image to enhance the contrast, including the following sub-steps: Convert the acquired image to the grayscale space to obtain the grayscale image I g , and use the formula I g = 0.299R + 0.587G + 0.114B, where R, G, and B respectively represent the red, green, and blue channel values of the original image; For the converted grayscale image I g Apply histogram equalization to the formula I eq (x, y) = cum(I g (x, y)) × (L - 1) to calculate the equalized image I eq , where cum(z) represents the cumulative distribution function and L is the number of gray levels; Using the obtained image I eq , the main features are extracted by adaptive threshold segmentation T. The threshold T(x, y) = m(x, y) + k·s(x, y) is set, where m(x, y) and s(x, y) are the local mean and standard deviation respectively, and k is a constant. Finally, the binary image I is obtained b , where Based on the binary image I b , perform connected component analysis to label and separate different object regions, providing clear object boundary information for subsequent steps.
4. The data line detection method based on weighted calculation according to claim 3, wherein: Perform a feature extraction operation to identify potential data line regions, including the following sub-steps: For the obtained image I with enhanced contrast enhanced Apply gradient operation to calculate the gradient intensities Gx and Gy in the horizontal and vertical directions respectively using the formulas G x = I enhanced (x + 1, y) - I enhanced (x - 1, y), G y = I enhanced (x, y + 1) - I enhanced (x, y - 1), to obtain the gradient image G, where On the calculated gradient image G, apply non-maximum suppression to highlight edge pixels, that is, for each pixel p, check whether it is a local maximum, that is, G(p)>G(p + Δd) and G(p)>G(p - Δd), where Δd refers to a small step along the gradient direction, and retain the pixels that meet the conditions as candidate edge points; Set a threshold T based on the selected candidate edge points h and T l , where T h is the high threshold and T l is the low threshold. Select those points with intensity higher than T h as strong edge points, and select those points with intensity between T l and T h as weak edge points; Form continuous edge lines by connecting strong edge points and weak edge points. If there are strong edge points near a weak edge point, it is considered that the weak edge point belongs to a part of the data line and is marked as a potential data line region.
5. The data line detection method based on weighted calculation according to claim 4, wherein: Determine candidate data line segments based on the extracted features, including the following sub-steps: Calculate the direction gradient θ for each pixel point in the potential data line area of the identifier. The direction gradient can be obtained from the formula where G<o000053>and G x are the gradients in the vertical and horizontal directions respectively; It should be noted that there seems to be an incorrect "o000053" in your original text which should probably be " y ". This translation has been made based on the provided content with that assumption. According to the obtained directional gradient θ, the pixel points within the potential region are clustered according to the gradient direction to form multiple pixel clusters with similar directions. An angle threshold Δθ is set such that pixel points i and j for which ∣θ i - θ j ∣ < Δθ belong to the same cluster; For the formed pixel clusters, calculate the center coordinates C of each cluster using the formula where n is the number of pixels in the cluster, and (x i , y i ) are the position coordinates of the pixels in the cluster; Select the clusters whose calculated center coordinates C are within a certain range as the basis for candidate data line segments, and set a distance threshold D such that when the distance ∣C i - C j ∣ < D between the centers of two adjacent clusters, these two clusters are regarded as parts of the same paragraph, thereby determining the candidate data line segments.
6. The data line detection method based on weighted calculation according to claim 5, wherein: Utilize the set weight factor to optimize the extraction accuracy of the data line contour, including the following sub-steps: Using the determined initial weight factor, assign corresponding weight values to each pixel point in the candidate data line segment, and calculate the weighted intensity I of pixel point p w (p) = I(p) × W e (p), where I(p) is the original intensity value; Based on the obtained weighted intensity I w (p), recalculate the total weight S of each candidate data segment using the formula S = ∑ p∈segment I w (p), where p represents the pixel points in the segment; Compare the total weight S of each segment, select the segment with a higher total weight S as a component of the data line, and set a threshold Ts. Only when S>Ts is the segment considered a valid data line segment; Based on the selected valid data line segments, construct a complete data line profile by connecting adjacent segments with the same direction, ensuring that there is an overlap between adjacent segments or the spacing does not exceed a given threshold Dt, i.e., ∣D ij ∣ < Dt, where D ij is the distance between segments i and j.
7. A data line detection method based on weighted calculation according to claim 6, characterized in that: Use the calibrated weight to achieve precise positioning of the data line and depict its path, including the following sub-steps: According to the calibrated weight W a , determine the contribution C(p) of each pixel point p in the data line profile, using the formula C(p) = I(p) × Wa(p), where I(p) is the intensity value of pixel point p; Based on the contribution degree C(p) of each pixel point, select the pixel points with a contribution degree higher than the set threshold Tc as the significant points of the data line, that is, C(p)>Tc, and these significant points constitute the basic framework of the data line; By connecting the determined significant points, the main path of the data line is formed, and the fitting degree F of each straight line or curve segment on the path is calculated using the formula to ensure the coherence and rationality of the path; According to the calculated fitness F, correct any discontinuous or unreasonable parts on the path to ensure the smoothness and continuity of the entire path, and finally obtain the precisely positioned data line path.
8. A data line detection system based on weighted calculation, characterized in that: Including: An image acquisition module for obtaining a digital image of the target scene; A preprocessing and feature extraction module for performing preprocessing on the obtained image to enhance the contrast, and then performing a feature extraction operation to identify potential data line regions; The preliminary weight configuration module is used to determine candidate data line segments based on the extracted features and configure preliminary weight factors according to the identified data line segments, including the following sub-steps: For each determined candidate data line segment, calculate its length L, and allocate a basic weight according to the length, and set the basic weight W b = f(L), where f is a monotonically increasing function, indicating that the longer the paragraph, the greater its weight; On the basis of the allocated basic weight, adjust the weight according to the importance of the position where the paragraph is located, and set the position weight factor W p , if the paragraph is in the central region of the image, then W p = 1 + α, otherwise W p = 1, where α is a positive constant representing the importance increase coefficient of the central region; Combine the basic weight W b and the position weight factor W p , calculate the comprehensive weight W c , use the formula W c = W b ×W p , and use this as the preliminary weight factor of the candidate data line segment; According to the obtained preliminary weight factors, sort all paragraphs, and select the top N percentage of paragraphs with higher weights as high-confidence paragraphs, where N is a percentage value less than 100; A weight calibration module for utilizing the set weight factor to optimize the extraction accuracy of the data line contour, and performing calibrated weight allocation according to the optimized contour, including the following sub-steps: For each pixel point in the optimized data line profile, calculate the weighted intensity sum S w (p) within its surrounding neighborhood N(p), using the formula S w (p) = ∑ q∈N(q) I w (q), where I w (q) is the weighted intensity of the neighbor pixel point q; Based on the obtained weighted intensity sum S w (p), adjust the weight factor W a (p) of the pixel point p, using the formula to reflect the relative importance of this pixel point within the neighborhood; Utilize the updated weight factor W a (p) to recalculate the comprehensive weight S a of each paragraph on the data line profile, using the formula S a (segment) = ∑ p∈segment I(p) × W a (p), where I(p) is the original intensity value; According to the updated comprehensive weight S a , re-evaluate and calibrate the importance of the paragraphs on the profile again to ensure that the boundaries of the data line more accurately reflect the actual positions; A path depiction module for using the calibrated weight to achieve precise positioning of the data line and depict its path.
Citation Information
Patent Citations
Visual detection method and system for cable laying and computer readable storage medium
CN118674748A
Image processing apparatus, an image processing method, a medium on which an image processing control program is recorded, an image evaluation device, an image evaluation method and a medium on which an image evaluation program is recorded
US20020025079A1