A drill pipe image acquisition method for explosion-proof drilling
By using the reduction coefficient to adjust the sharpening value of the drill pipe area in the explosion-proof drilling image, the problem that the drill pipe area is difficult to distinguish from other areas in the existing technology is solved, and more accurate identification of the drill pipe area is achieved.
Patent Information
- Application Number
- CN202410978121.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-07-22
AI Technical Summary
Existing image acquisition methods are not specific enough in sharpening and enhancing the drill pipe area during the explosion-proof drilling process, making it difficult to accurately identify the drill pipe area and other scene areas.
By obtaining the sharpening value of each pixel in the grayscale image of the drill pipe image, and using the pre-calculated reduction coefficient to perform a product operation on the sharpening value, the sharpening degree of the drill pipe area in the image is adjusted to make it consistent with the non-drill pipe The degree of sharpening of the region is relatively reduced, thereby distinguishing the drill pipe region in the edge connected domain.
It effectively improves the sharpening degree of the drill pipe area, making it more obvious in the image, reduces the excessive enhancement of non-drill pipe areas, and improves the recognition accuracy of the drill pipe area.
Smart Images

Figure CN118521795B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and more specifically, to a method for collecting drill pipe images for explosion-proof drilling. Background Art
[0002] For the acquisition of drill pipe images during explosion-proof drilling, the acquired drill pipe images contain many elements that interfere with the identification of the drill pipe area due to the complex working environment. It is necessary to pre-process the acquired images to make the acquired images more accurate and convenient for subsequent identification of the drill pipe area. In the image acquisition process, it is difficult to identify the position of the drill pipe from the image due to the complex background of the drill pipe. Therefore, sharpening the drill pipe area in the image is an important means to more accurately identify the drill pipe area from the image.
[0003] The existing image acquisition method can perform basic explosion-proof drilling image acquisition and enhance the acquired images for explosion-proof drilling image analysis. When enhancing the acquired images, there are usually the following two image processing methods:
[0004] 1. Non-targeted image enhancement: This method does not perform targeted processing on explosion-proof drilling images, but directly sharpens the image through the Laplace sharpening algorithm to enhance the overall contrast of the image. The conventional Laplace sharpening algorithm performs a convolution operation on all pixels in the grayscale image according to the Laplace operator to obtain a sharpening value, and then adds the sharpening value to the original grayscale value of the pixel in the grayscale image to obtain the adjusted pixel grayscale value, so that the grayscale difference between the pixel with a large gradient and the surrounding pixels is further enlarged to achieve the purpose of enhancing the contrast of the local area of the image. However, the scene elements existing in the drill rod image collected by explosion-proof drilling will also be sharpened to a large extent, resulting in the inability to accurately distinguish the drill rod area from other scene areas when identifying the drill rod area in the image through edge detection and other algorithms, thereby causing interference.
[0005] Second, directly apply the image processing of the filtering algorithm. This image processing method directly performs image enhancement based on a suitable existing algorithm, but ignores the main purpose of the drill pipe image and fails to achieve the purpose of improving the subsequent image processing effect. For example, the Chinese patent application document with application publication number CN115019030A and titled "A method for visual detection and identification of drilling line flow anomalies" discloses a threshold-limited mean filtering of the collected image, obtaining the grayscale difference between the average grayscale value of other pixels in the neighborhood of the pixel point in the grayscale image and the grayscale value of the pixel point itself, comparing the grayscale difference with the preset threshold, and if the grayscale difference is greater than the preset threshold, replacing the pixel point grayscale value with the grayscale value average, otherwise keeping the original grayscale value unchanged, which can effectively filter out noise points in the grayscale image and improve image quality.
[0006] In the process of image processing, the above two image processing methods often directly enhance the image according to the existing algorithm, which does not take into account the actual purpose of collecting images for identifying the drill rod area, and may have the problem of insufficient targeting.
[0007] Therefore, in the process of explosion-proof drilling image acquisition, it is particularly important to sharpen and enhance the image of the drill pipe area in a targeted manner. Summary of the invention
[0008] The purpose of the present invention is to provide a method for collecting images of drill pipes for explosion-proof drilling, so as to solve the problem that the existing image collection and image enhancement process is not targeted and the image enhancement effect of the drill pipe area is poor. To this end, the present invention provides the following solution.
[0009] The present invention provides a method for collecting drill pipe images for explosion-proof drilling, comprising the following steps:
[0010] Obtaining a sharpening value of each pixel in the grayscale image of the drill pipe image according to the Laplace operator;
[0011] The product of the reduction coefficient and the sharpening value of each pixel point obtained in advance is used as the pixel point sharpening value, and the grayscale image is sharpened and enhanced by using the pixel point sharpening value;
[0012] The process of obtaining the reduction coefficient is as follows:
[0013] Obtain the edge connected domain of the grayscale image, perform Hough transform on the edge pixels in the same edge connected domain to obtain the fitted straight line, and calculate the straightness of the edge connected domain. The straightness is positively correlated with the distance between the edge pixel and the fitted straight line.
[0014] The product of the number of pixels in the edge connected domain, the straightness degree and the periodicity degree is taken as the target degree of the edge connected domain, wherein the number of pixels is the ratio of the number of pixels in the edge connected domain to the pixel number threshold, and the periodicity degree is positively correlated with the periodicity of the maximum difference between the Gaussian filter value and the original gray value of the edge pixel in the edge connected domain;
[0015] The normalized value of the target degree of all edge connected domains is used as the reduction coefficient of edge pixels, and the reduction coefficient of the edge connected domain with the smallest weighted Euclidean distance to non-edge pixels is used as the reduction coefficient of non-edge pixels.
[0016] By adjusting the sharpness of pixels in different regions according to the characteristics of the edge connected domain in the image, the sharpness of the drill rod region in the image can be greater, while the sharpness of the non-drill rod region can be less, so that the drill rod region can be more easily identified from the image.
[0017] Optionally, the step of performing Hough transform on edge pixels in the same edge connected domain to obtain a fitting straight line is specifically as follows:
[0018] Hough transform is performed on each edge pixel point in the edge connected domain. The straight lines obtained by Hough transform of all edge pixels in the same edge connected domain constitute a straight line set. The point in the Hough space with the smallest sum of distances to all straight lines in the straight line set is obtained, and the straight line corresponding to this point in the image coordinate system is recorded as the fitting straight line of the edge connected domain.
[0019] In this way, the closest straight line of all edge connected domains, that is, the fitting straight line, can be obtained indiscriminately. The fitting straight line of the edge connected domain can be obtained more conveniently and quickly through Hough transform.
[0020] Optionally, the straightness degree of the edge connected domain satisfies the expression:
[0021] ;
[0022] in, Indicates The straightness of the edge connected domain, Indicates The number of edge pixels contained in the edge connected domain, Represents the preset fitting straight line distance threshold, Indicates The edge connected domain The distance between an edge pixel and its corresponding fitted line.
[0023] It should be noted that the straightness degree only represents the linearity of the edge connected domain. The above formula is only an optimal method for obtaining the straightness degree of the edge connected domain. The implementer can use other methods to obtain the straightness degree of the edge connected domain, as long as the obtained straightness degree can represent the linearity of the edge connected domain.
[0024] The linearity of the edge connected domain can be measured more accurately according to the degree of deviation between the edge pixel points and their corresponding fitted straight lines in each edge connected domain. The larger the difference between the pixel points in the edge connected domain and their fitted straight lines, the more it can be considered that the edge connected domain is not linear. By comparing the pixel points in the edge connected domain and their corresponding fitted straight lines, the degree of linearity of the edge connected domain can be measured more accurately.
[0025] Optionally, the periodicity of the edge connected domain satisfies the expression:
[0026] ;
[0027] in, Indicates The number of maximum values in the Gaussian difference value sequence of edge connected domains, Indicates The periodicity of the edge connected domain, Indicates The number of edge pixels contained in the edge connected domain, Indicates The index difference sequence of the edge connected components Index difference values.
[0028] It should be noted that the periodicity only represents the The distribution uniformity of the maximum value in the Gaussian difference value sequence. The above formula is only an optimal way to obtain the periodicity of the edge connected domain. The implementer can use other methods to obtain the periodicity of the edge connected domain. The obtained periodicity can characterize the first The uniformity of distribution of the maximum values in the Gaussian difference sequence is sufficient.
[0029] According to the distribution of the maximum value of the Gaussian difference value of the edge connected domain in the sequence, it is possible to obtain whether the change period of the Gaussian difference value of the edge connected domain is uniform. The more uniform the change period of the Gaussian difference value is, the more likely it is that the edge connected domain is the drill rod area in the image. Therefore, according to this indicator, the possibility of the edge connected domain being the edge of the drill rod can be measured more accurately.
[0030] Optionally, the process of acquiring the Gaussian difference value sequence is:
[0031] From An edge pixel point in the edge connected domain is selected as the starting point for boundary tracing, and the Gaussian filter values of all the pixels in the edge connected domain are obtained in sequence. The Gaussian filter values are sorted according to the boundary tracing order to obtain a filter value sequence, and the difference between each Gaussian filter value in the filter value sequence and the grayscale value of the pixel point at the corresponding position is used to obtain a Gaussian difference value sequence.
[0032] Optionally, the index difference sequence is specifically:
[0033] Get the index of the maximum value in the Gaussian difference value sequence. The indexes of all maximum value points constitute the maximum value index sequence. Subtract each index value in the maximum value index sequence from the previous index value to obtain the index difference. All index differences constitute the index difference sequence.
[0034] Optionally, the weighted Euclidean distance satisfies the expression:
[0035] ;
[0036] in, Indicates the location The pixels and The weighted Euclidean distance between edge connected regions, Indicates The number of edge pixels in the edge connected domain, represents the linear normalization function, Indicates the location The pixel point and The Euclidean distance between connected domains.
[0037] By weighting the Euclidean distance according to the number of edge pixels in the edge connected domain, the number of pixels contained in the edge connected domain can be taken into account when calculating the Euclidean distance between the pixel point and the edge connected domain, thereby eliminating the interference of the edge connected domain containing too few pixels on the calculation of the pixel reduction coefficient.
[0038] Optionally, the position is The pixel point and The Euclidean distance between connected domains is:
[0039] Get the location as The pixel point and The Euclidean distance of all edge pixels in the edge connected domain is recorded as the minimum value of the Euclidean distance. The pixel point and The Euclidean distance between connected domains.
[0040] The beneficial effects of the present invention are:
[0041] In order to solve the problem that conventional Laplace sharpening will also sharpen the non-drill rod area in the image, resulting in some unimportant areas also being sharpened to a high degree, the present invention distinguishes the target degree of edge pixel points in image edge detection, and reduces the Laplace sharpening degree according to the target degree of the edge pixel points, so as to achieve the beneficial effect of making the drill rod area in the image more obviously enhanced while other areas are not over-enhanced, so as to make the acquired image more easily identify the drill rod area. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0043] Figure 1 A flowchart of the steps of a drill pipe image acquisition method for explosion-proof drilling in this embodiment is schematically shown. DETAILED DESCRIPTION
[0044] The following will be combined with the 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 part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0045] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0046] The present invention aims at the fact that conventional Laplace sharpening will sharpen the non-drill rod area in the explosion-proof drilling image, resulting in some unimportant areas also being sharpened to a high degree, thereby failing to accurately distinguish the drill rod area. Therefore, the present invention proposes an image sharpening enhancement method that can be applied to explosion-proof drilling images to ensure that the drill rod area can be more accurately distinguished from the image later.
[0047] Figure 1 A flowchart of the steps of a drill pipe image acquisition method for explosion-proof drilling in this embodiment is schematically shown.
[0048] like Figure 1 As shown, a drill pipe image acquisition method for explosion-proof drilling in this embodiment includes the following steps:
[0049] S001: Collect explosion-proof drilling images, and pre-process the images to obtain explosion-proof drilling grayscale images.
[0050] Specifically, all explosion-proof drilling work images are collected. In order to ensure that the subsequent image processing and drill pipe identification are more accurate, the explosion-proof drilling site should be photographed by a high-definition camera to obtain explosion-proof drilling images. The acquired images should be clear and contain as little debris as possible.
[0051] It should be noted that in order to ensure the texture characteristics of the explosion-proof drilling image and reduce the impact of color contrast on the image enhancement algorithm, it is necessary to grayscale the image and operate the grayscale image so that the image enhancement can achieve better results.
[0052] Specifically, the collected explosion-proof drilling image is grayed to obtain a grayed image, which is recorded as a gray image. , as a grayscale image The pixel point at row 1 and column 1 is the coordinate , with right and downward as the positive direction and 1 pixel as the unit length, construct a plane rectangular coordinate system and convert the position in the grayscale image to The gray value of the pixel is recorded as .
[0053] S002: Obtain edge detection results and sharpening values of each pixel in the grayscale image according to the grayscale image.
[0054] In one embodiment, since the drill rod region and the background region in the grayscale image show obvious gradient changes, edge pixel points in the grayscale image can be obtained through an edge detection algorithm to determine the edge region of the drill rod.
[0055] Specifically, the Canny operator is used to perform edge detection on the grayscale image to obtain an edge image, which is composed of edge pixels. The number of edge pixels contained in the edge image is recorded as , according to the eight-neighbor relationship of edge pixels in the edge image, all edge connected domains in the image are obtained, and the number of edge connected domains in the edge image is recorded as , will The number of edge pixels contained in a connected domain is recorded as .
[0056] It should be noted that in the process of explosion-proof drilling image acquisition, enhancing the grayscale image can make it easier to identify defects such as corrosion in the drill pipe area. For the pixel points at the boundary of the grayscale image, all the pixel points with grayscale values in the window can be selected for convolution calculation of the Laplace operator.
[0057] Preset a Laplace operator window size, the empirical value is This embodiment does not limit the Laplace operator window size, and the implementer can set the Laplace operator window size according to the actual implementation situation.
[0058] Specifically, according to The Laplace operator of the window obtains the Laplace gradient of each data point as the sharpening value of the grayscale image pixel. For the pixel points at the boundary of the grayscale image, since its neighboring pixel points cannot form a complete window, the sharpening value of the boundary pixel point is obtained according to the Laplace operator principle and the grayscale value of the pixel points in the neighborhood of the boundary pixel point, the grayscale values of other pixel points in the boundary pixel point area are obtained, the absolute value of the difference between the grayscale values of the other pixel points and the grayscale value of the boundary pixel point is obtained, and the average value of all the absolute values of the difference is recorded as the sharpening value of the boundary pixel point. The pixel sharpening value is recorded as .
[0059] At this point, the sharpening values of all edge pixels and all data points in the grayscale image are obtained.
[0060] S003: Obtain the target degree of each edge according to the straightness degree of each edge connected domain and the periodicity of the effect of Gaussian filtering of the pixels in the grayscale image on the grayscale image.
[0061] It should be noted that since the edge of the drill rod is a straight line, for any edge connected domain in the grayscale image edge detection result, the closer its shape is to a straight line, the more likely it is the edge of the drill rod. Therefore, the linearity of the edge connected domain in the image can be judged by Hough line detection.
[0062] Specifically, each edge connected domain is taken as the target connected domain in turn, all edge pixels in the target connected domain are represented in the Hough space through the Hough transform, and the straight lines corresponding to all edge pixels in the target connected domain in the Hough space are obtained. The edge connected domain The corresponding straight line of edge pixels in Hough space is recorded as , No. The straight lines corresponding to all edge pixels of the edge connected domain in Hough space constitute the Get the distance in Hough space. The point with the smallest straight line distance in the edge connected domain straight line set is recorded as the fitting point, and its coordinates are marked as The coordinates of this point are the slope and intercept of the line closest to the edge connected domain. Get the fitting points corresponding to all edge connected domains and convert the first The straight line corresponding to the plane rectangular coordinate system of the edge connected domain fitting point is recorded as The fitted straight line of the edge connected domain.
[0063] It should be noted that for all edge connected domains, there will be a certain deviation between them and the fitting straight line. If the deviation between an edge connected domain and its fitting straight line is larger, it means that the straightness of the edge connected domain is lower, and the edge connected domain with lower straightness is more likely not to be the edge of the drill rod area. Therefore, the straightness of each edge connected domain can be quantified to measure the target degree of the edge connected domain.
[0064] Preset a fitting straight line distance threshold , the experience value is , this embodiment does not limit the fitting straight line distance threshold, and the implementer can set the fitting straight line distance threshold according to the actual implementation situation.
[0065] Specifically, obtain the The Euclidean distance between each pixel point and its corresponding fitting line in the edge connected domain is The edge connected domain The edge pixels and The distance between the fitted straight lines of the edge connected domains is recorded as . Then the distance between each pixel point in the edge connected domain and its corresponding fitting straight line and the straightness of the edge connected domain satisfy the following formula:
[0066] ;
[0067] in, Indicates The straightness of the edge connected domain, Indicates The number of edge pixels contained in the edge connected domain, Represents the preset fitting straight line distance threshold, Indicates The edge connected domain The distance between an edge pixel and its corresponding fitted line.
[0068] What needs to be explained about the straightness degree formula is that, for any edge connected domain, the larger the Euclidean distance between the pixel point and the fitting straight line, the greater the deviation of the connected domain from the fitting straight line. The deviation from the fitting straight line indicates that the edge connected domain is not a linear type, and the straightness degree of the edge connected domain is also low.
[0069] At this point, the straightness of all edge connected domains in the edge detection image is obtained.
[0070] It should be noted that in grayscale images, in addition to the edge of the drill rod, there are also many scenes with straight lines in the non-drill rod area. The straightness of these straight lines is relatively high, which will interfere with the identification of the edge of the drill rod. Analysis of the images of the drill rod straight area and the non-drill rod straight area shows that the grayscale changes on the surface of the drill rod area are more drastic and the grayscale changes have a certain periodicity due to the existence of threads on the surface of the drill rod, while the non-drill rod straight area belongs more to other straight rods and mechanical edges in the image. The grayscale changes near these areas are chaotic and there is no obvious periodic change. Therefore, the target degree of each straight line edge can be obtained according to the periodic change degree of the grayscale value of the pixel points near each straight line edge.
[0071] It should be further explained that the Gaussian filter kernel takes into account the distance between pixels to smooth high-gradient pixels in the image. The degree of smoothing mainly depends on the difference between the grayscale value of the pixel and the grayscale values of other surrounding pixels. Therefore, the gradient characteristics of the edge pixels can be characterized according to the difference in grayscale values of the pixels before and after Gaussian filtering in the edge connected domain, and then the target degree of the edge connected domain can be judged according to the periodicity of the changes in the gradient characteristics of the pixels in the edge connected domain.
[0072] Preset a Gaussian filter kernel size, the empirical value is This embodiment does not limit the Gaussian filter kernel size, and the implementer can set the Gaussian filter kernel size according to the actual implementation situation.
[0073] Specifically, according to the edge detection result, all edge pixels in the edge image are convolved in the grayscale image through the Gaussian filter kernel to obtain the convolution result. For any edge connected domain, the pixels in the connected domain are traversed from one end of the connected domain to obtain the Gaussian filter kernel convolution result and the grayscale value of each pixel. The Gaussian filtering results of all edge pixels in the edge connected domain are constructed in the order of traversal. The filtering result sequence of edge connected regions , the first in the sequence The data is recorded as , No. The gray values of all edge pixels in the edge connected domain form the first Gray sequence of edge connected regions , the first The data is recorded as .
[0074] It should be noted that the area around the edge of the drill pipe will show certain periodic changes due to the presence of threads, and the periodic changes are mainly reflected in the filtering results as the existence of extreme points. Therefore, the target degree of the edge connectivity domain can be judged based on the periodicity of the gap between the Gaussian filter of the edge connectivity domain and the original grayscale value.
[0075] From Select an endpoint in the edge connected domain as the starting point for boundary tracking, and obtain the Gaussian filter values of all pixels in the edge connected domain at the corresponding position of the grayscale image. The Gaussian filter values of all edge pixels in the edge connected domain form a filter value sequence in the order of boundary tracing, and the Gaussian difference value is obtained by subtracting each Gaussian filter value in the filter value sequence from the grayscale value of the pixel at the corresponding position. All Gaussian difference values of the edge connected regions form the first The Gaussian difference value sequence of edge connected domains is obtained. The number of the maximum value points is recorded as the number of the maximum value in the Gaussian difference value sequence of the edge connected domain. ;
[0076] Get the The maximum value in the Gaussian difference sequence of the edge connected domain is The index value in the Gaussian difference value sequence of the edge connected domain, the index of all maximum points constitutes the The maximum index sequence of the edge connected domain, In the maximum index sequence of the edge connected domain, except for the first data, each data is related to the The previous data in the maximum index sequence of the edge connected domain is subtracted, and all the differences constitute the first Index difference sequence of edge connected components ;
[0077] The first The periodicity of the edge connected domain satisfies the expression:
[0078] ;
[0079] in, Indicates The periodicity of the edge connected domain, Indicates The number of edge pixels contained in the edge connected domain, Indicates The index difference sequence of the edge connected components Index difference values.
[0080] It should be noted that, according to the distribution of the maximum value of the Gaussian difference value of the edge connected domain in the sequence, it is possible to obtain whether the change period of the Gaussian difference value of the edge connected domain is uniform. The more uniform the change period of the Gaussian difference value is, the more likely it is that the edge connected domain is the drill rod area in the image. Therefore, according to this indicator, the possibility of the edge connected domain being the edge of the drill rod can be measured more accurately.
[0081] Preset a threshold value for the number of pixels in an edge connected region , the experience value is , This embodiment does not limit the pixel point number threshold, and the implementer can set the pixel point number threshold according to the actual implementation situation.
[0082] It should be noted that the preset pixel point number threshold of the edge connected domain represents the minimum number of edge pixel points contained in the connected domain as the edge of the drill pipe. The pixel point number index of the edge connected domain can be obtained by comparing the number of edge pixel points contained in any edge connected domain with the pixel point number threshold, and then the target degree of the edge connected domain can be obtained.
[0083] Specifically, the product of the number of pixel points of the edge connected domain, the straightness degree of the edge connected domain, and the periodicity degree of the edge connected domain is taken as the target degree of the edge connected domain.
[0084] At this point, the target degree of all edge connected domains is obtained.
[0085] S004: reducing the sharpness of the edge area according to the target degree of each straight line, and obtaining the sharpening value of the pixel point after the reduction.
[0086] It should be noted that in the grayscale image, the drill rod area image needs to be sharpened to a high degree to ensure that it has a high degree of recognizability in the image, so as to facilitate the subsequent processing of the drill rod area of the image. Correspondingly, the non-drill rod area in the image is sharpened to a lower degree to blur the background area that is not of concern in the image.
[0087] Specifically, linear normalization is performed according to the target degree of all edge connected domains to obtain the reduction coefficient of the edge connected domain, and the first The reduction coefficient of the edge connected domain is recorded as .
[0088] It should be noted that the edge reduction coefficient is obtained according to the target degree of each edge. However, there are edge connected domains with a small number of pixels in the edge detection image. Such connected domains are not considered to be a complete edge. Therefore, when the Laplace sharpening degree is reduced for other pixels, the influence of the reduction degree obtained by some connected domains with fewer pixels should be appropriately abandoned.
[0089] Specifically, the sharpening value of the edge pixels is adjusted according to the reduction coefficient. For edge pixels on an edge connected domain, the adjusted pixel sharpness value is obtained by directly multiplying the reduction degree of the edge connected domain where it is located with the sharpness value of the edge pixel, which is recorded as , ,in, Indicates The coordinates of the connected domain are The edge pixels of Indicates the target degree of the edge connected domain where the edge pixel is located. For other pixels that are not in the edge connected domain, the sharpening value of the pixel is adjusted according to the reduction coefficient of the connected domain that is closest to it and contains a sufficient number of pixels.
[0090] It should be noted that, for any pixel in the grayscale image that is not on the edge connected domain, the pixel sharpening value is adjusted according to the reduction coefficient corresponding to the edge connected domain closest to it in the grayscale image. In the process of calculating the Euclidean distance, the edge connected domain to which the reduction coefficient of the pixel should correspond can be obtained through the number of pixels contained in the edge connected domain and the Euclidean distance.
[0091] Specifically, for the grayscale image at position , obtain the minimum value of the distance between the pixel and all the edge pixels in any edge connected domain, record it as the distance between the pixel and the edge connected domain, obtain the minimum value of the distance between it and all the connected domains in the edge image, record the edge connected domain corresponding to the minimum value of the distance as the connected domain to which the pixel belongs, and record the Euclidean distance between the pixel and its connected domain as , then the minimum Euclidean distance and the number of pixels contained in the edge connected domain are Pixels and The weighted Euclidean distance of an edge connected domain satisfies the following relationship:
[0092] ;
[0093] in, Indicates the location The pixels and The weighted Euclidean distance between edge connected regions, Indicates The number of edge pixels in the edge connected domain, represents the linear normalization function, Indicates the location The pixel point and The Euclidean distance between connected domains.
[0094] What needs to be explained about the weighted Euclidean distance formula is that the minimum distance from a pixel to an edge connected domain is weighted by the number of edge pixels in the edge connected domain, so that the weighted Euclidean distance of other pixels in the grayscale image when calculating the edge connected domain containing fewer pixels is smaller, so that when obtaining the edge connected domain that should be referred to for the reduction degree of each pixel, the connected domain containing fewer edge pixels is excluded and the connected domain containing more edge pixels is referred to.
[0095] Specifically, the weighted Euclidean distance of all non-edge area pixels in the grayscale image from each edge connected domain is obtained. For each pixel in the grayscale image that is not on an edge connected domain, the reduction degree of the pixel is recorded as the reduction degree of the edge connected domain with the smallest weighted Euclidean distance. If there are multiple edge connected domains with equal and smallest weighted Euclidean distances, the one containing the most pixels is taken as the reduction degree reference. In this way, the reduction degree of all non-edge pixels is obtained, and the pixel reduction degree and the pixel sharpening value are multiplied to obtain the adjusted pixel sharpening value.
[0096] At this point, all adjusted pixel sharpening values in the grayscale image are obtained.
[0097] S005: sharpening and enhancing the grayscale image according to the adjusted pixel sharpening value.
[0098] The adjusted sharpening value is added to the grayscale value of the pixel at the corresponding position in the grayscale image to obtain the sharpened grayscale value of the pixel. For the sharpened grayscale values that may exceed the maximum grayscale value 255 and are less than 0, they are set to 255 and 0 respectively.
[0099] The solution of the present invention can start from the edge pixels and pixel neighborhoods in the grayscale image, so as to perform targeted sharpening to different degrees on different areas in the grayscale image, and perform adaptive enhancement of the grayscale image, so as to more accurately distinguish the area that may be the drill rod from the grayscale image.
[0100] Although the present specification has shown and described the embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will think of many changes, modifications and alternatives without departing from the thought and spirit of the present invention. It should be understood that in the process of practicing the present invention, various alternatives to the embodiments of the present invention described herein may be adopted.
Claims
1. A drill pipe image acquisition method for explosion-proof drilling, characterized in that: include: Obtaining a sharpening value of each pixel in the grayscale image of the drill pipe image according to the Laplace operator; The product of the reduction coefficient and the sharpening value of each pixel point obtained in advance is used as the pixel point sharpening value, and the grayscale image is sharpened and enhanced by using the pixel point sharpening value; The process of obtaining the reduction coefficient is as follows: Obtain the edge connected domain of the grayscale image, perform Hough transform on the edge pixels in the same edge connected domain to obtain the fitted straight line, and calculate the straightness of the edge connected domain. The straightness is positively correlated with the distance between the edge pixel and the fitted straight line. The product of the number of pixels in the edge connected domain, the straightness degree and the periodicity degree is taken as the target degree of the edge connected domain, wherein the number of pixels is the ratio of the number of pixels in the edge connected domain to the pixel number threshold, and the periodicity degree is positively correlated with the periodicity of the maximum difference between the Gaussian filter value and the original gray value of the edge pixel in the edge connected domain; The normalized value of the target degree of all edge connected domains is used as the reduction coefficient of edge pixels, and the reduction coefficient of the edge connected domain with the smallest weighted Euclidean distance to non-edge pixels is used as the reduction coefficient of non-edge pixels; The periodicity of the edge connected domain satisfies the expression: ;in, Indicates The number of maximum values in the Gaussian difference value sequence of edge connected domains, Indicates The periodicity of the edge connected domain, Indicates The number of edge pixels contained in the edge connected domain, Indicates The index difference sequence of the edge connected components index difference value; the period degree represents the The uniformity of distribution of maximum values in the Gaussian difference sequence; The process of obtaining the Gaussian difference value sequence is as follows: An edge pixel point is selected as the starting point for edge tracing in the edge connected domain, and the Gaussian filter values of all the pixels in the edge connected domain are obtained in sequence. The Gaussian filter values are sorted according to the boundary tracing order to obtain a filter value sequence, and each Gaussian filter value in the filter value sequence is subtracted from the gray value of the pixel point at the corresponding position to obtain a Gaussian difference value sequence; The index difference sequence is specifically as follows: the index of the maximum value in the Gaussian difference value sequence is obtained, the indexes of all the maximum value points constitute the maximum value index sequence, each index value in the maximum value index sequence is subtracted from the previous index value to obtain the index difference value, and all the index difference values constitute the index difference sequence.
2. The method for collecting drill pipe images for explosion-proof drilling according to claim 1, characterized in that: The Hough transform is performed on the edge pixels in the same edge connected domain to obtain the fitting straight line, specifically: Hough transform is performed on each edge pixel point in the edge connected domain. The straight lines obtained by Hough transform of all edge pixels in the same edge connected domain constitute a straight line set. The point in the Hough space with the smallest sum of distances to all straight lines in the straight line set is obtained, and the straight line corresponding to this point in the image coordinate system is recorded as the fitting straight line of the edge connected domain.
3. The method for collecting drill pipe images for explosion-proof drilling according to claim 1, characterized in that: The straightness degree of the edge connected domain satisfies the expression: ; in, Indicates The straightness of the edge connected domain, Indicates The number of edge pixels contained in the edge connected domain, Represents the preset fitting straight line distance threshold, Indicates The edge connected domain The distance between an edge pixel and its corresponding fitted line.
4. The method for collecting drill pipe images for explosion-proof drilling according to claim 1, characterized in that: The weighted Euclidean distance satisfies the expression: ; in, Indicates the location The pixels and The weighted Euclidean distance between edge connected regions, Indicates The number of edge pixels in the edge connected domain, represents the linear normalization function, Indicates the location The pixel point and The Euclidean distance between connected domains.
5. The method for collecting drill pipe images for explosion-proof drilling according to claim 4, characterized in that: The location is The pixel point and The Euclidean distance between connected domains is: Get the location as The pixel point and The Euclidean distance of all edge pixels in the edge connected domain is recorded as the minimum value of the Euclidean distance. The pixel point and The Euclidean distance between connected domains.
