Data line detection system and method based on weighted calculation
By preprocessing and feature extraction of the target scene image, combined with weighted calculation technology, the extraction accuracy of data line contours is optimized, solving the problem of low data line detection accuracy in the existing technology, achieving higher detection accuracy and lower false detection rate.
Patent Information
- Application Number
- CN202411369182.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-09-29
AI Technical Summary
When faced with lighting changes and complex backgrounds, existing data line detection technology is difficult to achieve ideal detection accuracy, which is prone to missed detection or missed detection.
A data cable detection method based on weighted calculation is proposed to enhance the contrast by pre -processing the target scenario image and the feature extraction to identify the potential data cable area. Then, the selected data line segment is determined based on the extracted features, the preliminary weight factor is configured, the accuracy of the extraction of the data line contour is optimized, and the calibration weight is allocated based on the optimized contour, and the accurate positioning and path depiction of the data cable will be finally implemented.
By dynamically adjusting weights, improve the accuracy of detection, reduce the situation of misunderstanding and missed inspection, and apply data line detection requirements in complex environments.
Smart Images

Figure CN119359609A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and in particular 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 the applications of 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. This type of method first converts the original image into a grayscale image and enhances the contrast through methods such as histogram equalization to facilitate subsequent feature extraction. Then, edge detection and other methods 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 technology often has difficulty achieving ideal detection accuracy when facing lighting changes and complex backgrounds due to the limitations of fixed threshold selection or template matching. In particular, when data lines are mixed with other image features, traditional detection methods are prone to false detection or missed detection. Summary of the invention
[0004] The object 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 performs feature extraction on this basis to identify potential data line areas, so as to solve the problems in the prior art raised in the above background technology.
[0005] To achieve the above object, the present invention provides a data line detection method based on weighted calculation, comprising the following steps:
[0006] Acquire a digital image of the target scene; preprocess the acquired image to enhance contrast, and then perform feature extraction to identify potential data line areas; determine candidate data line segments based on the extracted features, and configure preliminary weight factors based on the identified data line segments; use the set weight factors to optimize the extraction accuracy of the data line contour, and calibrate the weight allocation based on the optimized contour; use the calibrated weights to accurately locate the data line and depict its path.
[0007] Preferably, after acquiring the digital image of the target scene, the following sub-steps are included:
[0008] Implement histogram equalization to improve the local contrast of the image, using the formula Where I represents the original grayscale I enhancedLevel is the new gray level after equalization, and L is the maximum gray level;
[0009] On the basis of enhancing the contrast, the structural element E is used to enhance the image I enhanced Perform morphological opening operation to remove small object interference. The formula is expressed as Then execute in and represent the erosion and dilation operations respectively;
[0010] Based on the image I open , apply Gaussian smoothing H to reduce the impact of noise, and the smoothed image I smooth Represented as I smooth =I open *H, where * indicates a convolution operation, and this image is used for subsequent processing.
[0011] Preferably, preprocessing the acquired image to enhance contrast comprises the following sub-steps:
[0012] Convert the acquired image to grayscale space to obtain grayscale image I g , using 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] For the converted grayscale image I g Apply histogram equalization, using Formula I eq (x,y)=cum(I g (x,y))×(L-1) calculates the equalized image I eq , where cum(z) represents the cumulative distribution function and L is the number of gray levels;
[0014] Using the obtained image I eq , extract the main features through adaptive threshold segmentation T, set the threshold T(x,y) = m(x,y) + k·s(x,y), where m(x,y) and s(x,y) are the local mean and standard deviation respectively, and k is a constant, and finally get the binary image I b ,in
[0015]
[0016] Based on the binary image I b , perform connected component analysis, mark and separate different object regions, and provide clear object boundary information for subsequent steps.
[0017] Preferably, performing a feature extraction operation to identify potential data line areas includes the following sub-steps:
[0018] Apply gradient operation to the contrast-enhanced image Ienh and calculate the gradient strength Gx and Gy in the horizontal and vertical directions, respectively using 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), and get the gradient image G, where
[0019] On the calculated gradient image G, non-maximum suppression is applied 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 pixels that meet the conditions are retained as candidate edge points;
[0020] According to the selected candidate edge points, set the threshold T h and T l , where T h is the high threshold, T l For the low threshold, select those whose intensity is above T h The points with strength between T l and T h The points between are regarded as weak edge points;
[0021] A continuous edge line is formed by connecting strong edge points and weak edge points. If there is a strong edge point near a weak edge point, the weak edge point is considered to be part of the data line and is marked as a potential data line area.
[0022] Preferably, determining the candidate data line segments based on the extracted features comprises the following sub-steps:
[0023] Calculate the directional gradient θ for each pixel in the identified potential data line area. The directional gradient can be expressed by the formula It is concluded that G y and G x are the gradients in the vertical and horizontal directions respectively;
[0024] According to the obtained directional gradient θ, the pixels in the potential area are clustered according to the gradient direction to form multiple pixel clusters with similar directions, and the angle threshold Δθ is set so that |θ i -θ j Pixels i and j with |<Δθ 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 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, these two clusters are regarded as parts of the same paragraph, thereby determining the candidate data line segments.
[0027] Preferably, configure the initial weight factor 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. 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;
[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 initial weight factor of the candidate data line segment;
[0031] According to the obtained initial weight factor, sort all paragraphs, and select the top N percentage of paragraphs with higher weights as high-confidence paragraphs. Set N as a percentage value less than 100.
[0032] Preferably, optimize the extraction accuracy of the data line profile using the set weight factor, including the following sub-steps:
[0033] Use the determined initial weight factor 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 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.
[0037] Preferably, perform calibrated weight distribution 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 within the neighborhood;
[0040] Utilize the updated weight factor W a (p) to 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 to ensure that the boundary of the data line more precisely 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, the 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 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 continuity and rationality of the path;
[0046] According to the calculated fit 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 the 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] A weight calibration module is used to optimize the extraction accuracy of the data line profile using the set weight factor and to distribute the calibration weight according to the optimized profile;
[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 extracts features on this basis to identify potential data line areas. Subsequently, candidate data line segments are determined by analyzing the extracted features, and preliminary weight factors are configured based on these segments. The set weight factors are used to further optimize the extraction accuracy of the data line contour, 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 false detection and missed detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a flow chart of the data line detection method based on weighted calculation of the present invention;
[0056] Figure 2 The block diagram of the data line detection system based on weighted calculation of the present invention. DETAILED DESCRIPTION
[0057] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0058] The present invention provides a data line detection method based on weighted calculation, such as Figure 1 As shown, the following steps are included:
[0059] S1: Acquire a digital image of a target scene, further comprising the following sub-steps:
[0060] Implement histogram equalization to improve the local contrast of the image, using the formula Where I represents the original grayscale I enhanced Level is the new gray level after equalization, and L is the maximum gray level;
[0061] On the basis of enhancing the contrast, the structural element E is used to enhance the image I enhanced Perform morphological opening operation to remove small object interference. The formula is expressed as Then execute in and ⊕ represent the erosion and dilation operations, respectively;
[0062] Based on the image I open , apply Gaussian smoothing H to reduce the impact of noise, and the smoothed image Ismooth Represented as I smooth =I open *H, where * indicates a convolution operation, and this image is used for subsequent processing.
[0063] By implementing histogram equalization to improve the local contrast of the image, the visibility of details in the image can be enhanced, especially in the case of uneven lighting, which can make the overall contrast of the image more uniform and help the accurate extraction of subsequent features.
[0064] Using structural elements to perform morphological opening operations on images can effectively remove interference from small objects in the image, keep the main features of the image unchanged, and reduce the impact 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 impact 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 image quality in complex environments and provide a clearer and cleaner basic image for subsequent data line detection, thereby improving the accuracy and robustness of detection.
[0067] S2: Preprocess the acquired image to enhance the contrast, and then perform feature extraction to identify potential data line areas; by converting the acquired image to grayscale space and applying histogram equalization, the contrast of the image can be significantly enhanced, making the originally dark or low-contrast areas clearer, which is conducive to the 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 grayscale space to obtain grayscale image I g , using 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;
[0070] For the converted grayscale image I g Apply histogram equalization, using Formula I eq (x,y)=cum(I g (x,y))×(L-1) calculates 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 , extract the main features through adaptive threshold segmentation T, set the threshold T(x,y) = m(x,y) + k·s(x,y), where m(x,y) and s(x,y) are the local mean and standard deviation respectively, and k is a constant, and finally get the binary image I b ,in
[0072]
[0073] Based on the binary image I b , perform connected component analysis, mark and separate different object areas, and provide clear object boundary information for subsequent steps. Adaptive threshold segmentation technology can automatically adjust the threshold according to the characteristics of the local area of the image, so as to more accurately extract the main features in the image. Compared with the global threshold, this method is more adaptable to the changes in brightness and contrast in the image, ensuring that the target features can be effectively segmented even under uneven lighting conditions.
[0074] Connected component analysis can further help identify and separate different object areas in the image. By marking each connected component, noise and insignificant small features can be effectively removed, leaving larger connected areas related to the data lines, providing a more accurate basis for subsequent feature extraction and data line positioning.
[0075] In general, this series of preprocessing steps can effectively improve the image quality, enhance contrast, remove noise, and more accurately identify potential data line areas through adaptive threshold segmentation and connected component analysis, laying a solid foundation for subsequent feature extraction and precise positioning.
[0076] Specifically, performing feature extraction operations to identify potential data line areas further includes the following sub-steps:
[0077] Apply gradient operation to the obtained contrast-enhanced image Ienh to calculate the gradient strength Gx and Gy in the horizontal and vertical directions, respectively using 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), and get the gradient image G, where
[0078] On the calculated gradient image G, non-maximum suppression is applied 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 pixels that meet the conditions are retained as candidate edge points;
[0079] According to the selected candidate edge points, set the threshold T h and T l , where T h is the high threshold, T l For the low threshold, select those whose intensity is above T h The points with strength between T l and T h The points between are regarded as weak edge points;
[0080] A continuous edge line is formed by connecting strong edge points and weak edge points. If there is a strong edge point near a weak edge point, the 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 contrast-enhanced image, the edge information in the image can be effectively captured, thereby highlighting the potential data line area. The gradient strength in the horizontal and vertical directions is calculated and the gradient image is synthesized. This process can strengthen the edge features in the image and provide a basis for subsequent edge detection.
[0082] The application of non-maximum suppression (NMS) can further highlight edge pixels and ensure that only edge pixels with local maximum values are retained, which can reduce unnecessary edge responses and make the detected edges clearer and more accurate.
[0083] By setting high and low thresholds, points with intensities higher than the high threshold are selected as strong edge points, and points with intensities between the high and low thresholds are selected as weak edge points. This dual thresholding technique can retain points that may be true edges but are weak 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. In particular, when there are strong edge points near weak edge points, these weak edge points are considered to be part of the data line, thereby being able to more completely depict the shape of the data line.
[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: determining candidate data line segments based on the extracted features, and configuring preliminary weight factors according to the identified data line segments;
[0087] Specifically, determining the 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 area. 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 area according to the gradient direction to form multiple pixel clusters with similar directions. Set an angle threshold Δθ such that pixel points i and j where ∣θ 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 two adjacent cluster centers, 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 area, 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 the same direction, 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, regard the clusters whose center coordinates are 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 identification.
[0096] In summary, the above steps can effectively separate potential data line segments from complex backgrounds, improve recognition accuracy, reduce false alarm rates, and provide a reliable basis for subsequent data line analysis and processing through preliminary weight factor configuration.
[0097] Specifically, configuring the preliminary weight factor according to the identified data line segment further includes the following sub-steps:
[0098] For each candidate data line segment determined, calculate its length L, and assign a basic weight based on the length, setting 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 top of the assigned base weight, adjust the weight according to the importance of the paragraph’s location and set the position weight factor W p , if the paragraph is in the center of the image, then W p =1+α, otherwise W p =1, where α is a positive constant, indicating the importance increase coefficient of the central area;
[0100] Combined with the basic weight W b and the position weight factor W p , calculate the comprehensive weight W c , using the formula W c =W b ×W p , which is used as the preliminary weight factor of the candidate data line segment;
[0101] According to the obtained preliminary weight factors, all paragraphs are sorted, and the first N percentages of paragraphs with higher weights are selected as high-confidence paragraphs, and N is set to a percentage value less than 100.
[0102] By calculating the length of each candidate data line segment and assigning a basis weight based on the length, it is ensured that longer data line segments have higher basis weights. This is because longer segments usually represent more coherent data line features, so they should occupy a more important position in the final data line detection.
[0103] The position weight factor is introduced to adjust the weight of the paragraph so that the data line paragraph located in the center area of the image has a higher weight. This is because the center of the image is usually the focus area of the observer's attention, so the data line features located in the center are more likely to be the features that the user is 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 segment 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 the high-confidence segments, the detection accuracy can be further improved. This method ensures that the system focuses on those segments that are most likely to represent the real data line, 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 detection accuracy and reliability, 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 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;
[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 point 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 overlap or the distance between adjacent segments does not exceed the given threshold Dt, i.e., ∣D ij ∣ < Dt, where D ij is the distance between segment i and j.
[0113] By assigning a corresponding weight value to each pixel in the candidate data line segment and calculating its weighted strength Iw(p)Iw(p), it can be ensured that those pixels with higher weights in the preliminary weight factor occupy a more important position in subsequent processing. The weighted strength reflects the importance of the pixel in data line detection and helps to extract the data line contour more accurately.
[0114] Recalculating the total weight of each candidate data line paragraph can further emphasize those paragraphs 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 paragraphs with lower weights that are unlikely to be real data lines.
[0115] By comparing the total weights of each paragraph and selecting the paragraphs with higher total weights as the components of the data line, high-quality data line paragraphs can be effectively screened out. By setting a threshold, only when S>Ts is the paragraph considered as a valid data line paragraph, which helps to reduce false detection and missed detection and improve the accuracy of detection.
[0116] Finally, by connecting adjacent and directional paragraphs, a complete data line outline is constructed, ensuring that there is no overlap or spacing between adjacent paragraphs that does not exceed a given threshold, so that the final data line outline is coherent and reasonable. This method not only improves the integrity of the outline, but also ensures 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 allocation according to the optimized contour, this method can significantly improve the accuracy and reliability of data line detection, reduce false detection and missed detection, and is suitable for data line detection needs in various complex environments.
[0118] Specifically, the calibration weight allocation according to the optimized profile further includes the following sub-steps:
[0119] For each pixel in the optimized data line profile, calculate the weighted intensity and S in 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 neighbor pixel q;
[0120] Based on the obtained weighted strength and S w (p), adjust the weight factor W of pixel p a (p), using the formula To reflect the relative importance of the pixel in the neighborhood;
[0121] Using the updated weight factor W a (p), recalculate the comprehensive weight S of each paragraph on the data line contour 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 , again evaluate and calibrate the importance of the segments on the contour, ensuring that the boundaries of the data lines more accurately reflect the actual locations.
[0123] By calculating the weighted sum of the intensity of each pixel in the optimized data line contour in the surrounding neighborhood, the comprehensive intensity of the pixel in the neighborhood can be reflected more carefully. This method can enhance the understanding of local features and ensure that the weight of each pixel is more consistent with its importance in the local environment.
[0124] Adjust the weight factor of the pixel to reflect the relative importance of the pixel in the neighborhood. This step allows the system to dynamically adjust the weight based on the features around the pixel, so that important pixels occupy a more important position in the final contour construction.
[0125] Using the updated weight factor, the comprehensive weight of each paragraph on the data line contour is recalculated to further optimize the importance assessment of the paragraph. 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, making the comprehensive weight of the paragraph more reasonable.
[0126] Based on the updated comprehensive weights, the importance of the segments on the contour is re-evaluated and calibrated to ensure that the boundaries of the data line more accurately reflect the actual location. This method improves the accuracy and coherence of the data line contour and reduces the errors caused by inadequate consideration of local features.
[0127] In summary, by allocating calibration weights according to the optimized contour, this method can further improve the accuracy of data line detection, ensure that the boundaries of the data line contour are more accurate and coherent, reduce false detections and missed detections, and is suitable for application scenarios that require high-precision data line detection.
[0128] S5: using the calibrated weights to accurately locate the data line and depict its path, further comprising the following sub-steps:
[0129] 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;
[0130] Based on the contribution C(p) of each pixel, the 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.
[0131] 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 continuity and rationality of the path;
[0132] According to the calculated fit 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.
[0133] By using calibrated weights to determine the contribution of each pixel in the data line profile, it is possible to identify which pixels are more critical to constructing the data line profile. This quantitative analysis allows the algorithm to selectively focus on pixels with higher intensity values that are more likely to be actual components of the data line.
[0134] Pixels with contribution higher than the set threshold are selected as the salient points of the data line, and these salient 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 will be 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 fit of each straight line or curve segment on the path, the coherence and rationality of the path can be effectively evaluated. Paths with high fit mean that these path segments are more consistent with the shape characteristics of the actual data line, thus ensuring the quality of the path.
[0136] Based on the calculated fit, any discontinuities or unreasonable parts of the path are corrected. This process helps eliminate abrupt changes or incorrect connections in the path, ensuring the smoothness and continuity of the entire path. After correction, the final precisely located data line path is not only more in line with the actual situation, but also has higher visual and geometric consistency.
[0137] In summary, this technical means improves the accuracy of data cable positioning, ensures the continuity and rationality of the path, and reduces the possibility of incorrect positioning, making it suitable for application scenarios that require high-precision positioning of data cables, 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, it includes: image acquisition module, preprocessing and feature extraction module, preliminary weight configuration module, weight calibration module and path drawing module. The details are as follows:
[0139] The image acquisition module is used to acquire a digital image of a 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 areas;
[0141] The preliminary weight configuration module is used to determine the candidate data line segments based on the extracted features and configure the 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 profile using the set weight factor and to distribute the calibration weight according to the optimized profile;
[0143] The path depiction module is used to use the calibrated weights to accurately locate the data line and depict its path.
[0144] In addition, the above-mentioned image acquisition module, preprocessing and feature extraction module, preliminary weight configuration module, weight calibration module and path depiction module are also used to implement the other steps of the above-mentioned data line detection method based on weighted calculation when executed, which will not be described one by one here.
[0145] In summary, 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 areas. Subsequently, candidate data line segments are determined by analyzing the extracted features, and preliminary weight factors are configured based on these segments. The set weight factors are used to further optimize the extraction accuracy of the data line contour, 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 false detections and missed detections.
[0146] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A data line detection method based on weighted calculation, characterized in that: The following steps are involved: Acquire a digital image of a target scene; Preprocessing the acquired image to enhance contrast, and then perform feature extraction to identify potential data line areas; Determine candidate data line segments based on the extracted features, and configure preliminary weight factors according to the identified data line segments; The extraction accuracy of the data line profile is optimized using the set weight factor, and the calibration weight is allocated according to the optimized profile; Use the calibrated weights to accurately locate the data lines and depict their paths.
2. The data line detection method based on weighted calculation according to claim 1, characterized in that: After acquiring the digital image of the target scene, the following sub-steps are included: Implement histogram equalization to improve the local contrast of the image, using the formula Where I represents the original grayscale I enhanced Level is the new gray level after equalization, and L is the maximum gray level; On the basis of enhancing the contrast, the structural element E is used to enhance the image I enhanced Perform morphological opening operation to remove small object interference. The formula is expressed as Then execute in and represent the erosion and dilation operations respectively; Based on the image I open , apply Gaussian smoothing H to reduce the impact of noise, and the smoothed image I smooth Represented as I smooth =I open *H, where * indicates a convolution operation, and this image is used for subsequent processing.
3. The data line detection method based on weighted calculation according to claim 2, characterized in that: The acquired images were preprocessed to enhance contrast, including the following sub-steps: Convert the acquired image to grayscale space to obtain grayscale image I g , using 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; For the converted grayscale image I g Apply histogram equalization, using Formula I eq (x,y)=cum(I g (x,y))×(L-1) calculates 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 , extract the main features through adaptive threshold segmentation T, set the threshold T(x,y) = m(x,y) + k·s(x,y), where m(x,y) and s(x,y) are the local mean and standard deviation respectively, and k is a constant, and finally get the binary image I b ,in Based on the binary image I b , perform connected component analysis, mark and separate different object regions, and provide clear object boundary information for subsequent steps.
4. The data line detection method based on weighted calculation according to claim 3, characterized in that: Perform feature extraction to identify potential data line areas, including the following sub-steps: Apply gradient operation to the obtained contrast-enhanced image Ienh to calculate the gradient strength Gx and Gy in the horizontal and vertical directions, respectively using 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), and get the gradient image G, where On the calculated gradient image G, non-maximum suppression is applied 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 pixels that meet the conditions are retained as candidate edge points; According to the selected candidate edge points, set the threshold T h and T l , where T h is the high threshold, T l For the low threshold, select those whose intensity is above T h The points with strength between T l and T h The points between are regarded as weak edge points; A continuous edge line is formed by connecting strong edge points and weak edge points. If there is a strong edge point near a weak edge point, the weak edge point is considered to be part of the data line and is marked as a potential data line area.
5. The data line detection method based on weighted calculation according to claim 4, characterized in that: Determining candidate data line segments based on the extracted features includes the following sub-steps: Calculate the directional gradient θ for each pixel in the identified potential data line area. The directional gradient can be expressed by the formula It is concluded that G y and G x are the gradients in the vertical and horizontal directions respectively; According to the obtained directional gradient θ, the pixels in the potential area are clustered according to the gradient direction to form multiple pixel clusters with similar directions, and the angle threshold Δθ is set so that |θ i -θ j Pixels i and j with |<Δθ 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, (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, characterized in that: Configuring a preliminary weight factor based on the identified data line segments includes the following sub-steps: For each candidate data line segment determined, calculate its length L, and assign a basic weight based on the length, setting 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 top of the assigned base weight, adjust the weight according to the importance of the paragraph’s location and set the position weight factor W p , if the paragraph is in the center of the image, then W p =1+α, otherwise W p =1, where α is a positive constant, indicating the importance increase coefficient of the central area; Combined with the basic weight W b and the position weight factor W p , calculate the comprehensive weight W c , using the formula W c =W b ×W p , which is used as the preliminary weight factor of the candidate data line segment; According to the obtained preliminary weight factors, all paragraphs are sorted, and the first N percentages of paragraphs with higher weights are selected as high-confidence paragraphs, and N is set to a percentage value less than 100.
7. The data line detection method based on weighted calculation according to claim 6, characterized in that: The extraction accuracy of the data line contour is optimized using the set weight factor, including the following sub-steps: Using the determined preliminary weight factor, assign a corresponding weight value to each pixel in the candidate data line segment, and calculate the weighted intensity I of the pixel 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 line segment, using the formula S = ∑ p∈segment I w (p), where p represents the pixel in the paragraph; Compare the total weights S of each paragraph, select the paragraph with higher total weight S as the component of the data line, set a threshold Ts, and only when S>Ts is the paragraph considered as a valid data line paragraph; 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.
8. The data line detection method based on weighted calculation according to claim 7, characterized in that: Calibration weight assignment is performed based on the optimized profile, including the following sub-steps: For each pixel in the optimized data line profile, calculate the weighted intensity and S in 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 neighbor pixel q; Based on the obtained weighted strength and S w (p), adjust the weight factor W of pixel p a (p), using the formula To reflect the relative importance of the pixel in the neighborhood; Using the updated weight factor W a (p), recalculate the comprehensive weight S of each paragraph on the data line contour 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 , again evaluate and calibrate the importance of the segments on the contour, ensuring that the boundaries of the data lines more accurately reflect the actual locations.
9. The data line detection method based on weighted calculation according to claim 8, characterized in that: Using the calibrated weights to accurately locate the data line and depict its path includes 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 C(p) of each pixel, the 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. 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 continuity and rationality of the path; According to the calculated fit 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.
10. A data line detection system based on weighted calculation, characterized in that: include: An image acquisition module, used to acquire a digital image of a target scene; A 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 areas; 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; A weight calibration module is used to optimize the extraction accuracy of the data line profile using the set weight factor and to distribute the calibration weight according to the optimized profile; The path depiction module is used to use the calibrated weights to accurately locate the data line and depict its path.
Citation Information
Patent Citations
Adaptive threshold edge detection algorithm based on canny
CN104700421A
Target detection method and device
CN115131262A
Visual detection method and system for cable laying and computer readable storage medium
CN118674748A
Method, apparatus, and system for wireless tracking, scanning and monitoring
EP3739356A1
Image processing method, image processing device, image forming device, image pickup device, and computer program
JP2004312387A
Cited By
Biological feature recognition method and system
CN119992671A
Blind sidewalk identification method based on image processing
CN121121690A