Image enhancement method for detecting cracks in building water supply pipes
By performing threshold segmentation, adaptive uniform segmentation, and Gaussian blurring on X-ray flaw detection images, and combining brightness, clutter, and distance feature analysis, the enhancement coefficient was determined. This solved the problem of poor image enhancement effect caused by gray-level histogram equalization, and enabled accurate detection of cracks in water supply pipes.
Patent Information
- Application Number
- CN202310540754.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-05
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2043-01-05
AI Technical Summary
Existing grayscale histogram equalization methods tend to cause loss of detail when enhancing images of building water supply pipes, resulting in poor image enhancement effects.
By performing threshold segmentation, adaptive uniform segmentation, and Gaussian blurring on X-ray flaw detection images, combined with relevant brightness, clutter, and pipe distance feature analysis, the enhancement coefficient of each segmented region is determined, and adaptive image enhancement is performed.
It improves image enhancement, reduces detail loss, achieves precise enhancement of X-ray flaw detection images, and enhances the detection accuracy of cracks in water supply pipes.
Smart Images

Figure CN116703754B_ABST
Abstract
Description
[0001] The application is a divisional application of the invention patent application entitled "Image enhancement method for detecting cracks in building water supply pipeline", the parent application number is 202310009477.5, and the filing date is January 5, 2023. TECHNICAL FIELD
[0002] The application relates to the technical field of image data processing, in particular to an image enhancement method for detecting cracks in a building water supply pipeline. BACKGROUND
[0003] Since the building water supply pipeline is mainly installed inside the wall, the method for detecting cracks in the building water supply pipeline is mainly: through X-ray detection, collecting the water supply pipeline image, and judging whether the water supply pipeline has cracks according to the collected water supply pipeline image. The collected water supply pipeline image often cannot clearly reflect the detailed information of the water supply pipeline due to the influence of noise and wall structure, thereby leading to low accuracy of crack detection of the water supply pipeline according to the water supply pipeline image. Therefore, it is often necessary to enhance the image of the water supply pipeline. At present, when enhancing the image, the commonly used method is to use gray level histogram equalization to enhance the image.
[0004] However, when using gray level histogram equalization to enhance the image of the water supply pipeline, the following technical problems often exist:
[0005] Since the gray level histogram equalization is often based on the statistical image enhancement of the gray level value distribution of the image, the gray level of the water supply pipeline image after gray level histogram equalization is often reduced, which often leads to the loss of some details of the water supply pipeline, thereby leading to low image enhancement effect. SUMMARY
[0006] The summary part of the application is used to introduce the concepts in a simple form, which will be described in detail in the specific embodiment part. The summary part of the application is not intended to identify the key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0007] In order to solve the technical problem of low image enhancement effect, the application provides an image enhancement method for detecting cracks in a building water supply pipeline.
[0008] The application provides an image enhancement method for detecting cracks in a building water supply pipeline, which comprises:
[0009] An X-ray detection image of a target water supply pipeline is obtained; wherein the target water supply pipeline is a pipeline for water supply in a building to be detected for cracks;
[0010] Threshold segmentation is performed on the X-ray flaw detection image to obtain a target pipeline region image;
[0011] According to the gray value corresponding to the pixel point in the target pipeline region image, the target pipeline region image is adaptively and uniformly segmented to obtain a segmentation region set;
[0012] The segmentation region set is subjected to Gaussian blur processing to obtain a target segmentation region set;
[0013] Each target segmentation region in the target segmentation region set is subjected to relevant brightness, confusion and pipeline distance feature analysis processing to obtain relevant brightness indicators, confusion indicators and pipeline distance indicators corresponding to the target segmentation region;
[0014] For each target segmentation region in the target segmentation region set, according to the relevant brightness indicators, confusion indicators and pipeline distance indicators corresponding to the target segmentation region, a target segmentation region corresponding enhancement coefficient is determined;
[0015] According to the enhancement coefficients corresponding to each target segmentation region in the target segmentation region set, each target segmentation region is enhanced to generate a target enhancement image;
[0016] The relevant brightness, confusion and pipeline distance feature analysis processing of each target segmentation region in the target segmentation region set to obtain the relevant brightness indicators, confusion indicators and pipeline distance indicators corresponding to the target segmentation region, comprises:
[0017] According to the gray value corresponding to each pixel point in the target segmentation region in the target segmentation region set, a relevant brightness indicator corresponding to each target segmentation region is determined;
[0018] According to the gray value corresponding to each pixel point in each target segmentation region and the standard deviation of the gray value corresponding to each neighborhood pixel point in the reference neighborhood set, a pixel confusion degree corresponding to the pixel point is determined;
[0019] The mean value of the pixel confusion degrees corresponding to the pixel points in the target segmentation region is determined as the confusion indicator corresponding to the target segmentation region;
[0020] An edge of a target pipeline region is filtered out from the target pipeline region image as a target pipeline edge;
[0021] The Euclidean distance between each pixel point in the target segmentation region and the target pipeline edge is determined as the pixel pipeline distance corresponding to the pixel point;
[0022] The mean value of the pixel pipeline distance corresponding to the pixel points in the target segmentation region is determined as the pipeline distance index corresponding to the target segmentation region.
[0023] Further, the target pipeline region image is adaptively and uniformly segmented according to the gray values corresponding to the pixel points in the target pipeline region image to obtain a segmentation region set, including:
[0024] The target pipeline region image is equally divided into a preset number of initial regions to obtain an initial region set;
[0025] The discrete degree corresponding to each initial region in the initial region set is determined according to the gray value corresponding to the pixel points in the initial region;
[0026] When the discrete degree corresponding to the initial region is less than or equal to a preset discrete threshold, the initial region is determined as a segmentation region;
[0027] When the discrete degree corresponding to the initial region is greater than the discrete threshold, the initial region is equally divided into a preset number of sub-regions, the discrete degree corresponding to each sub-region is determined, when the discrete degree corresponding to the sub-region is less than or equal to the discrete threshold, the sub-region is determined as a segmentation region, when the discrete degree corresponding to the sub-region is greater than the discrete threshold, the sub-region is determined as an initial region, the step is repeated until the discrete degree corresponding to the initial region is less than or equal to the discrete threshold, and the initial region is determined as a segmentation region.
[0028] Further, the formula for determining the discrete degree corresponding to the initial region is:
[0029]
[0030] wherein, μ n is the discrete degree corresponding to the nth initial region in the initial region set, N is the number of pixel points in the nth initial region in the initial region set, n is the serial number of the initial region in the initial region set, is the gray value corresponding to the ith pixel point in the nth initial region in the initial region set, i is the serial number of the pixel point in the nth initial region in the initial region set, is the mean value of the gray values corresponding to the pixel points in the nth initial region in the initial region set.
[0031] Further, the related brightness index corresponding to each target segmentation region is determined according to the gray values corresponding to the pixel points in each target segmentation region in the target segmentation region set, including:
[0032] For each target segmentation region in the target segmentation region set, according to the Euclidean distance between the target segmentation region and other target segmentation regions in the target segmentation region set except the target segmentation region, the target segmentation regions satisfying the distance condition are screened out from the target segmentation region set as adjacent segmentation regions, to obtain a set of adjacent segmentation regions corresponding to the target segmentation region, wherein the distance condition is that the Euclidean distance between two target segmentation regions is less than or equal to a pre-set distance threshold;
[0033] For each target segmentation region in the target segmentation region set, the mean value of the gray values corresponding to each pixel point in the set of adjacent segmentation regions corresponding to the target segmentation region is determined as the adjacent gray mean value corresponding to the target segmentation region.
[0034] For each target segmentation region in the target segmentation region set, the mean value of the gray values corresponding to each pixel point in the target segmentation region is determined as the target gray mean value corresponding to the target segmentation region.
[0035] According to the adjacent gray mean value and the target gray mean value corresponding to each target segmentation region in the target segmentation region set, the relevant brightness index corresponding to the target segmentation region is determined.
[0036] Further, the determination of the relevant brightness index corresponding to each target segmentation region according to the gray values corresponding to each pixel point in the target segmentation region includes:
[0037] According to the gray value corresponding to each pixel point in each target segmentation region and the gray values corresponding to each neighborhood pixel point in a pre-set target neighborhood, the relative brightness index corresponding to the pixel point is determined.
[0038] According to the relative brightness index corresponding to each pixel point in each target segmentation region, the relevant brightness index corresponding to the target segmentation region is determined.
[0039] Further, the determination of the relative brightness index corresponding to each pixel point according to the gray value corresponding to the pixel point and the gray values corresponding to each neighborhood pixel point in a pre-set target neighborhood includes:
[0040] The mean value of the gray values corresponding to the neighborhood pixel points in the target neighborhood corresponding to the pixel point is determined as the neighborhood mean value corresponding to the pixel point.
[0041] The ratio of the gray value corresponding to the pixel point and the target neighborhood mean value is determined as the relative brightness index corresponding to the pixel point, wherein the target neighborhood mean value corresponding to the pixel point is the sum of the neighborhood mean value corresponding to the pixel point and a pre-set gray value greater than 0.
[0042] Further, the formula for determining the enhancement coefficient corresponding to the target segmentation region is:
[0043]
[0044] Wherein, ε t is the enhancement coefficient corresponding to the tth target segmentation region in the target segmentation region set, t is the serial number of the target segmentation region in the target segmentation region set, e is a natural constant, L t is the related brightness index corresponding to the tth target segmentation region in the target segmentation region set, δ t is the confusion index corresponding to the tth target segmentation region in the target segmentation region set, d t is the pipeline distance index corresponding to the tth target segmentation region in the target segmentation region set.
[0045] Further, the target segmentation region set is enhanced according to the enhancement coefficient corresponding to each target segmentation region in the target segmentation region set, and a target enhancement image is generated.
[0046] According to the gray value corresponding to each pixel point in the target segmentation region, the enhancement gray value corresponding to each pixel point is determined.
[0047] The formula for determining the enhancement gray value corresponding to each pixel point is:
[0048] f t,a =ε t ×h t,a
[0049] Wherein, f t,a is the enhancement gray value corresponding to the ath pixel point in the tth target segmentation region in the target segmentation region set, t is the serial number of the target segmentation region in the target segmentation region set, a is the serial number of the pixel point in the tth target segmentation region in the target segmentation region set, ε t is the enhancement coefficient corresponding to the tth target segmentation region in the target segmentation region set, h t,a is the gray value corresponding to the ath pixel point in the tth target segmentation region in the target segmentation region set.
[0050] The gray value corresponding to each pixel point in the target segmentation region set is updated to the enhancement gray value corresponding to each pixel point, and a target enhancement image is obtained.
[0051] The present application has the following advantages:
[0052] The image enhancement method for detecting building water supply pipeline cracks of the present application realizes the enhancement of the X-ray flaw detection image by image data processing of the X-ray flaw detection image, solves the technical problem of low image enhancement effect, and improves the image enhancement effect. First, the X-ray flaw detection image of the target water supply pipeline to be detected for crack conditions is obtained, and the X-ray flaw detection image is threshold segmented to obtain a target pipeline region image. Since the building water supply pipeline is often installed inside the wall, the X-ray flaw detection image obtained by X-ray flaw detection often contains information of the target water supply pipeline, which can facilitate subsequent detection of the crack condition of the target water supply pipeline. Then, the target pipeline region image is adaptively and uniformly segmented according to the gray value corresponding to the pixel point in the target pipeline region image to obtain a segmentation region set. In actual conditions, the definition of each position of the target pipeline region image is often different, and the degree of enhancement is often different, so the target pipeline region image is adaptively and uniformly segmented to obtain a segmentation region set, which can facilitate subsequent analysis of each segmentation region in the segmentation region set and accurate image enhancement of each segmentation region. Then, the segmentation region set is subjected to Gaussian blur processing to obtain a target segmentation region set. In actual conditions, Gaussian blur processing of the segmentation region set can greatly remove noise in the segmentation region set and reduce the influence of noise on the segmentation region set. After that, each target segmentation region in the target segmentation region set is subjected to relevant brightness, confusion and pipeline distance feature analysis processing to obtain relevant brightness indicators, confusion indicators and pipeline distance indicators corresponding to the target segmentation region. Since the enhancement degree of the target segmentation region is often related to the relevant brightness, confusion degree and distance from the pipeline of the target segmentation region. Therefore, determining the relevant brightness indicators, confusion indicators and pipeline distance indicators corresponding to the target segmentation region can facilitate subsequent determination of the enhancement coefficient corresponding to the target segmentation region. Then, for each target segmentation region in the target segmentation region set, the enhancement coefficient corresponding to the target segmentation region is determined according to the relevant brightness indicators, confusion indicators and pipeline distance indicators corresponding to the target segmentation region. Comprehensive consideration of the relevant brightness indicators, confusion indicators and pipeline distance indicators corresponding to the target segmentation region can improve the accuracy of determination of the enhancement coefficient corresponding to the target segmentation region. Finally, each target segmentation region is enhanced according to the enhancement coefficient corresponding to each target segmentation region in the target segmentation region set to generate a target enhancement image.Therefore, the application realizes the enhancement of the X-ray flaw detection image by image data processing of the X-ray flaw detection image, and compared with the existing histogram equalization algorithm, the target pipeline region image is adaptively and uniformly segmented, and the Gaussian blur processing is performed, the related brightness index, the confusion index and the pipeline distance index corresponding to the target segmentation region are comprehensively considered, the enhancement coefficient of the target segmentation region at different positions can be accurately determined, the adaptive detail enhancement of each target segmentation region can be realized, the detail loss is reduced, and therefore the image enhancement effect can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art and the advantages thereof, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor based on these drawings.
[0054] Figure 1 The flowchart of the image enhancement method for detecting cracks in building water supply pipeline according to the present application;
[0055] Figure 2 The equidivision diagram of the target pipeline region image according to the present application;
[0056] Figure 3 The adjacent segmentation region diagram according to the present application.
[0057] Among them, the reference signs include: target pipeline region image 201, first initial region 202, second initial region 203, third initial region 204, fourth initial region 205, first target segmentation region 301, second target segmentation region 302, third target segmentation region 303, fourth target segmentation region 304, fifth target segmentation region 305 and sixth target segmentation region 306. DETAILED DESCRIPTION
[0058] In order to further illustrate the technical means and effects adopted by the present application to achieve the predetermined object, the specific implementation, structure, features and effects of the technical solutions according to the present application are described in detail below in combination with the drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.
[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs.
[0060] The present application provides an image enhancement method for detecting cracks in building water supply pipes, comprising the following steps:
[0061] An X-ray flaw detection image of a target water supply pipe to be detected for cracks is obtained, and the X-ray flaw detection image is threshold segmented to obtain a target pipe region image;
[0062] According to the gray value corresponding to the pixel point in the target pipe region image, the target pipe region image is adaptively and uniformly segmented to obtain a segmentation region set;
[0063] The segmentation region set is subjected to Gaussian blur processing to obtain a target segmentation region set;
[0064] Each target segmentation region in the target segmentation region set is subjected to relevant brightness, confusion and pipe distance feature analysis processing to obtain relevant brightness indicators, confusion indicators and pipe distance indicators corresponding to the target segmentation region;
[0065] For each target segmentation region in the target segmentation region set, according to the relevant brightness indicators, confusion indicators and pipe distance indicators corresponding to the target segmentation region, the enhancement coefficient corresponding to the target segmentation region is determined;
[0066] According to the enhancement coefficients corresponding to each target segmentation region in the target segmentation region set, each target segmentation region is enhanced to generate a target enhancement image.
[0067] The above steps will be described in detail as follows:
[0068] Reference Figure 1 , shows the flow of some embodiments of the image enhancement method for detecting cracks in building water supply pipes according to the present application. The image enhancement method for detecting cracks in building water supply pipes comprises the following steps:
[0069] Step S1, obtaining an X-ray flaw detection image of a target water supply pipe to be detected for cracks, and threshold segmenting the X-ray flaw detection image to obtain a target pipe region image.
[0070] In some embodiments, an X-ray flaw detection image of a target water supply pipe to be detected for cracks can be obtained, and the X-ray flaw detection image is threshold segmented to obtain a target pipe region image.
[0071] Wherein, the target water supply pipe can be a pipe for water supply in a building to be detected for cracks. The X-ray flaw detection image can be an image of the target water supply pipe obtained by X-ray flaw detection. The target pipe region image can be an image of the region where the target water supply pipe is located.
[0072] As an example, this step can include the following steps:
[0073] Firstly, an X-ray flaw detection image of the target water supply pipeline is acquired.
[0074] For example, the X-ray flaw detection image of the target water supply pipeline in the building can be acquired by an X-ray flaw detection device.
[0075] Secondly, threshold segmentation is performed on the X-ray flaw detection image to obtain a target pipeline region image.
[0076] For example, the X-ray flaw detection image can be segmented by the Otsu threshold method, and the segmented foreground is the target pipeline region image.
[0077] In step S2, the target pipeline region image is adaptively and uniformly segmented according to the gray values of the pixel points in the target pipeline region image to obtain a segmentation region set.
[0078] In some embodiments, the target pipeline region image can be adaptively and uniformly segmented according to the gray values of the pixel points in the target pipeline region image to obtain a segmentation region set.
[0079] As an example, this step can include the following steps:
[0080] Firstly, the target pipeline region image is equally divided into a preset number of initial regions to obtain an initial region set.
[0081] The preset number can be a preset number. For example, the preset number can be 4.
[0082] For example, when the preset number is 4, as shown in FIG. 2, the target pipeline region image 201 can be equally divided into four initial regions, i.e., a first initial region 202, a second initial region 203, a third initial region 204, and a fourth initial region 205. Figure 2
[0083] Secondly, the discrete degree corresponding to each initial region in the initial region set is determined according to the gray values of the pixel points in the initial region.
[0084] For example, the formula for determining the discrete degree corresponding to the initial region can be:
[0085]
[0086] wherein, μ n is the discrete degree corresponding to the nth initial region in the initial region set. N is the number of pixel points in the nth initial region in the initial region set. n is the serial number of the initial region in the initial region set. is a gray value corresponding to an i-th pixel point in an n-th initial region in the initial region set. i is a serial number of the pixel point in the n-th initial region in the initial region set. is a mean value of the gray values corresponding to the pixel points in the n-th initial region in the initial region set.
[0087] In actual fact, the dispersion degree corresponding to an initial region can represent the dispersion condition of the pixel points in the initial region. The greater the dispersion degree corresponding to the initial region, the more dispersed, chaotic and non-uniform the pixel points in the initial region are. Therefore, the variance of the gray values corresponding to the pixel points in the initial region can be used to represent the dispersion degree corresponding to the initial region. Moreover, the more uniform the pixel points in a region in the target pipe region image are, the more similar the pixel points in the region are, and thus the same enhancement coefficient can be set for the pixel points in the region. Therefore, determining the dispersion degree corresponding to the initial region can facilitate obtaining a segmented region in which the enhancement coefficients corresponding to the pixel points are the same.
[0088] In a third step, when the dispersion degree corresponding to the initial region is less than or equal to a pre-set dispersion threshold, the initial region is determined as a segmented region.
[0089] The dispersion threshold can be the maximum dispersion degree allowed when the initial region is uniform. For example, the dispersion threshold can be 0.4.
[0090] In a fourth step, when the dispersion degree corresponding to the initial region is greater than the dispersion threshold, the initial region is equally divided into a pre-set number of sub-regions, the dispersion degree corresponding to each sub-region is determined, when the dispersion degree corresponding to the sub-region is less than or equal to the dispersion threshold, the sub-region is determined as a segmented region, when the dispersion degree corresponding to the sub-region is greater than the dispersion threshold, the sub-region is determined as an initial region, and the step is repeated until the dispersion degree corresponding to the initial region is less than or equal to the dispersion threshold, and the initial region is determined as a segmented region.
[0091] The method for determining the dispersion degree corresponding to the initial region can be referred to when determining the dispersion degree corresponding to the sub-region, that is, the dispersion degree corresponding to the initial region determined when the sub-region is determined as the initial region is the dispersion degree corresponding to the sub-region.
[0092] In step S3, the set of segmented regions is subjected to Gaussian blur processing to obtain a target segmented region set.
[0093] In some embodiments, the set of segmented regions described above can be subjected to Gaussian blur processing to obtain a target segmented region set.
[0094] As an example, each segmented region in the set of segmented regions can be subjected to Gaussian blur to obtain a target segmented region corresponding to each segmented region.
[0095] As a further example, a target pipe region image can be Gaussian blurred to obtain a target Gaussian blurred image. Wherein, a segmented region in the target pipe region image is Gaussian blurred to obtain a target segmented region.
[0096] Step S4, performing relevant brightness, chaos and pipe distance feature analysis processing on each target segmented region in the target segmented region set to obtain relevant brightness indicators, chaos indicators and pipe distance indicators corresponding to the target segmented region.
[0097] In some embodiments, the relevant brightness, chaos and pipe distance feature analysis processing can be performed on each target segmented region in the target segmented region set to obtain the relevant brightness indicators, chaos indicators and pipe distance indicators corresponding to the target segmented region.
[0098] As an example, the present step can include the following steps:
[0099] First, according to the gray value corresponding to each pixel point in the target segmented region in the target segmented region set, determine the relevant brightness indicators corresponding to each target segmented region.
[0100] For example, according to the gray value corresponding to each pixel point in the target segmented region in the target segmented region set, determine the relevant brightness indicators corresponding to each target segmented region can include the following sub-steps:
[0101] First sub-step, for each target segmented region in the target segmented region set, according to the Euclidean distance between the target segmented region and the target segmented region in the target segmented region set except the target segmented region, filter out the target segmented region satisfying the distance condition from the target segmented region set as adjacent segmented region, to obtain the adjacent segmented region set corresponding to the target segmented region.
[0102] Wherein, the distance condition is that the Euclidean distance between two target segmented regions is less than or equal to a pre-set distance threshold. The distance threshold can be the maximum Euclidean distance allowed when two target segmented regions are adjacent. For example, the distance threshold can be 0.01.
[0103] As shown in the following figure, the rectangle in the target segmented region set can represent the target segmented region. Figure 3 Figure 3 Figure 3 The six target segmentation regions are a first target segmentation region 301, a second target segmentation region 302, a third target segmentation region 303, a fourth target segmentation region 304, a fifth target segmentation region 305, and a sixth target segmentation region 306. The first target segmentation region 301 corresponds to a set of adjacent segmentation regions including the second target segmentation region 302, the third target segmentation region 303, and the fourth target segmentation region 304.
[0104] In a second sub-step, for each target segmentation region in the set of target segmentation regions, a mean value of the gray values of the pixels in the set of adjacent segmentation regions corresponding to the target segmentation region is determined as a corresponding adjacent gray mean value.
[0105] In a third sub-step, a mean value of the gray values of the pixels in each target segmentation region in the set of target segmentation regions is determined as a corresponding target gray mean value.
[0106] In a fourth sub-step, a corresponding relative brightness index of each target segmentation region in the set of target segmentation regions is determined based on the corresponding adjacent gray mean value and the corresponding target gray mean value.
[0107] For example, the formula for determining the relative brightness index of a target segmentation region can be:
[0108]
[0109] wherein L t is the relative brightness index of the tth target segmentation region in the set of target segmentation regions. t is the serial number of the target segmentation region in the set of target segmentation regions. h t is the target gray mean value of the tth target segmentation region in the set of target segmentation regions. H t is the adjacent gray mean value of the tth target segmentation region in the set of target segmentation regions. γ is a preset gray value greater than 0. γ is mainly used to prevent the denominator from being 0. For example, γ can be 0.05.
[0110] In actual situations, the relative brightness index of a target segmentation region can represent the relative brightness of the target segmentation region. The relative brightness index determined based on the target gray mean value and the adjacent gray mean value of the target segmentation region can represent the brightness of the target segmentation region relative to the adjacent segmentation regions. The brighter the target segmentation region relative to the adjacent segmentation regions, the less the target segmentation region needs to be enhanced, and thus the smaller the enhancement coefficient corresponding to the target segmentation region.
[0111] For example, determining the relevant brightness index corresponding to each target segmentation region according to the gray value corresponding to each pixel point in the target segmentation region in the target segmentation region set can include the following sub-steps:
[0112] In the first sub-step, the relative brightness index corresponding to each pixel point is determined according to the gray value corresponding to each pixel point in each target segmentation region and the gray value corresponding to each neighbor pixel point in the target neighborhood set in advance.
[0113] The target neighborhood can be a neighborhood set in advance. For example, the target neighborhood can be an eight-neighborhood. The neighbor pixel point can be a pixel point in the neighborhood.
[0114] For example, determining the relative brightness index corresponding to each pixel point according to the gray value corresponding to each pixel point in each target segmentation region and the gray value corresponding to each neighbor pixel point in the target neighborhood set in advance can include the following steps:
[0115] First, the average value of the gray value corresponding to the neighbor pixel point in the target neighborhood of the pixel point is determined as the neighborhood average value corresponding to the pixel point.
[0116] Next, the ratio of the gray value corresponding to the pixel point to the target neighborhood average value is determined as the relative brightness index corresponding to the pixel point.
[0117] The target neighborhood average value corresponding to the pixel point can be the sum of the neighborhood average value corresponding to the pixel point and the gray value set in advance greater than 0.
[0118] For example, the formula for determining the relative brightness index corresponding to the pixel point can be:
[0119]
[0120] Wherein, L t,a is the relative brightness index corresponding to the a-th pixel point in the t-th target segmentation region in the target segmentation region set. t is the serial number of the target segmentation region in the target segmentation region set. a is the serial number of the pixel point in the t-th target segmentation region in the target segmentation region set. h t,a is the gray value corresponding to the a-th pixel point in the t-th target segmentation region in the target segmentation region set. H t,a is the neighborhood average value corresponding to the a-th pixel point in the t-th target segmentation region in the target segmentation region set. γ1 is a gray value set in advance greater than 0. γ1 is mainly used to prevent the denominator from being 0. For example, γ1 can be 0.02.
[0121] In actual cases, the relative brightness index corresponding to a pixel point can represent the relative brightness of the pixel point. The relative brightness index determined by the gray value corresponding to the pixel point and the target neighborhood mean value can represent the brightness of the pixel point relative to the adjacent pixel point. The brighter the pixel point is relative to the adjacent pixel point, the less the gray value corresponding to the pixel point needs to be enhanced, and therefore, the smaller the enhancement coefficient corresponding to the pixel point is in the subsequent process. When the enhancement coefficients corresponding to all the pixel points in the target segmentation region are smaller, the enhancement coefficient corresponding to the target segmentation region is smaller in the subsequent process.
[0122] For example, when the target neighborhood is an eight-neighborhood, the relative brightness index corresponding to each pixel point in each target segmentation region can be determined according to the gray value corresponding to each pixel point and the gray value corresponding to each adjacent pixel point in the eight-neighborhood. The formula corresponding to the relative brightness index of the pixel point can be:
[0123]
[0124] wherein, L ij is the relative brightness index corresponding to the pixel point at the horizontal coordinate i and the vertical coordinate j. a kl is the gray value corresponding to the pixel point at the horizontal coordinate k and the vertical coordinate l.
[0125] In actual cases, the relative brightness index corresponding to a pixel point can represent the relative brightness of the pixel point. The relative brightness index determined by the gray value corresponding to the pixel point and the gray value corresponding to each adjacent pixel point in the eight-neighborhood can represent the brightness of the surrounding area where the pixel point is located. The brighter the surrounding area where the pixel point is located, the less the gray value corresponding to the pixel point needs to be enhanced, and therefore, the smaller the enhancement coefficient corresponding to the pixel point is in the subsequent process. When the enhancement coefficients corresponding to all the pixel points in the target segmentation region are smaller, the enhancement coefficient corresponding to the target segmentation region is smaller in the subsequent process.
[0126] In the second sub-step, the relative brightness index corresponding to each target segmentation region is determined according to the relative brightness index corresponding to each pixel point in each target segmentation region.
[0127] For example, the formula corresponding to the relative brightness index corresponding to the target segmentation region can be:
[0128]
[0129] wherein, L t is the relative brightness index corresponding to the tth target segmentation region in the target segmentation region set. t is the serial number of the target segmentation region in the target segmentation region set. a is the serial number of the pixel point in the tth target segmentation region in the target segmentation region set. A is the number of pixel points in the tth target segmentation region in the target segmentation region set. L t,ais a relative brightness index corresponding to an a-th pixel point in a t-th target segmentation region in the set of target segmentation regions.
[0130] In actual cases, when the relative brightness index corresponding to each pixel point in a target segmentation region is larger, the relevant brightness index corresponding to the target segmentation region is often larger, and the enhancement coefficient corresponding to the target segmentation region is often smaller.
[0131] In a second step, a pixel disorder degree corresponding to each pixel point in each target segmentation region is determined according to a gray value corresponding to the pixel point and gray values corresponding to each neighborhood pixel point in a reference neighborhood set in advance.
[0132] The reference neighborhood can be a neighborhood set set in advance. For example, the reference neighborhood can be an eight-neighborhood.
[0133] For example, a standard deviation of the gray value corresponding to the pixel point and the gray values corresponding to each neighborhood pixel point in the reference neighborhood corresponding to the pixel point can be determined as the pixel disorder degree corresponding to the pixel point.
[0134] For another example, when the reference neighborhood can be an eight-neighborhood, a formula for determining the pixel disorder degree corresponding to the pixel point can be:
[0135]
[0136] wherein, δ ij is a pixel disorder degree corresponding to a pixel point at a horizontal coordinate i and a vertical coordinate j. kl is a gray value corresponding to a pixel point at a horizontal coordinate k and a vertical coordinate l. is a mean value of gray values corresponding to pixel points in an eight-neighborhood of the pixel point at the horizontal coordinate i and the vertical coordinate j.
[0137] In actual cases, the larger the pixel disorder degree corresponding to the pixel point, the more chaotic the surroundings of the pixel point, the more the gray values in the surroundings of the pixel point can reflect the distinguishing features of the surroundings of the pixel point, and the less the gray value corresponding to the pixel point needs to be enhanced. Therefore, the enhancement coefficient corresponding to the pixel point in the future is often smaller.
[0138] In a third step, a disorder index corresponding to each target segmentation region is determined according to the pixel disorder degrees corresponding to each pixel point in the target segmentation region.
[0139] For example, a formula for determining the disorder index corresponding to the target segmentation region can be:
[0140]
[0141] wherein, δ tis the confusion index corresponding to the athpixel point in the tthtarget segmentation region in the target segmentation region set. t is the serial number of the target segmentation region in the target segmentation region set. a is the serial number of the pixel point in the tthtarget segmentation region in the target segmentation region set. A is the number of pixel points in the tthtarget segmentation region in the target segmentation region set. δ t,a is the pixel confusion degree corresponding to the athpixel point in the tthtarget segmentation region in the target segmentation region set.
[0142] In actual cases, when the pixel confusion degree corresponding to each pixel point in the target segmentation region is greater, the confusion index corresponding to the target segmentation region is often greater, and the enhancement coefficient corresponding to the target segmentation region is often smaller.
[0143] Fourthly, the edge of the target pipeline region is screened out from the target pipeline region image as a target pipeline edge.
[0144] For example, the edge of the target pipeline region screened out from the target pipeline region image can be the edge of the foreground segmented by Otsu thresholding method on the X-ray flaw detection image in step S1.
[0145] Fifthly, the pipeline distance index corresponding to each target segmentation region in the target segmentation region set is determined according to the target pipeline edge.
[0146] For example, the pipeline distance index corresponding to each target segmentation region in the target segmentation region set can be determined according to the target pipeline edge, which can include the following sub-steps:
[0147] Firstly, the Euclidean distance between each pixel point in the target segmentation region and the target pipeline edge is determined as the pixel pipeline distance corresponding to the pixel point.
[0148] Secondly, the mean value of the pixel pipeline distance corresponding to the pixel point in the target segmentation region is determined as the pipeline distance index corresponding to the target segmentation region.
[0149] For example, the formula for determining the pipeline distance index corresponding to the target segmentation region can be:
[0150]
[0151] wherein, d t is the pipeline distance index corresponding to the tthtarget segmentation region in the target segmentation region set. t is the serial number of the target segmentation region in the target segmentation region set. a is the serial number of the pixel point in the tthtarget segmentation region in the target segmentation region set. A is the number of pixel points in the tthtarget segmentation region in the target segmentation region set. d t,ais a pixel pipeline distance corresponding to an a-th pixel point in a t-th target segmentation region in the target segmentation region set.
[0152] In actual cases, when a pixel point in a target segmentation region is closer to a target pipeline edge, the pixel point in the target segmentation region is often less clear due to the influence of the target pipeline edge, the pipeline distance index corresponding to the target segmentation region is often smaller, and it is often indicated that the gray value corresponding to the pixel point in the target segmentation region needs to be enhanced, and therefore the enhancement coefficient corresponding to the target segmentation region is often larger. When a pixel point in a target segmentation region is farther away from a target pipeline edge, the pixel point in the target segmentation region is often closer to the middle of the pipeline, is often less affected by the target pipeline edge, the pixel point in the target segmentation region is often clearer, the pipeline distance index corresponding to the target segmentation region is often larger, and it is often indicated that the gray value corresponding to the pixel point in the target segmentation region does not need to be enhanced, and therefore the enhancement coefficient corresponding to the target segmentation region is often smaller. Secondly, if there is a crack defect in the target segmentation region and the target segmentation region is close to the target pipeline edge, the crack defect edge and the target pipeline edge can overlap, and the gray difference of the pixel points in the target segmentation region is often small, so a larger enhancement coefficient should be used when enhancing the target segmentation region to improve the contrast between the edge differences. Therefore, the enhancement coefficient corresponding to the target segmentation region close to the target pipeline edge is set to be larger, which can avoid the problem caused by the overlap of the crack defect edge and the target pipeline edge.
[0153] In step S5, for each target segmentation region in the target segmentation region set, the enhancement coefficient corresponding to the target segmentation region is determined according to the relevant brightness index, the confusion index and the pipeline distance index corresponding to the target segmentation region.
[0154] In some embodiments, for each target segmentation region in the target segmentation region set, the enhancement coefficient corresponding to the target segmentation region can be determined according to the relevant brightness index, the confusion index and the pipeline distance index corresponding to the target segmentation region.
[0155] As an example, the formula for determining the enhancement coefficient corresponding to the target segmentation region can be:
[0156]
[0157] wherein ε t is the enhancement coefficient corresponding to the t-th target segmentation region in the target segmentation region set. t is the serial number of the target segmentation region in the target segmentation region set. e is a natural constant. L t is the relevant brightness index corresponding to the t-th target segmentation region in the target segmentation region set. δ tis the confusion index corresponding to the t-th target segmentation region in the target segmentation region set.d t is the pipe distance index corresponding to the t-th target segmentation region in the target segmentation region set.
[0158] In actual cases, when the relevant brightness index, confusion index and pipe distance index corresponding to the target segmentation region are larger, it often means that the enhancement coefficient corresponding to the target segmentation region is often smaller. And normalization can facilitate subsequent processing.
[0159] Step S6, according to the enhancement coefficient corresponding to each target segmentation region in the target segmentation region set, enhancing each target segmentation region to generate a target enhanced image.
[0160] In some embodiments, the target enhanced image can be generated by enhancing each target segmentation region in the target segmentation region set according to the enhancement coefficient corresponding to each target segmentation region.
[0161] As an example, the present step can include the following steps:
[0162] First, according to the gray value corresponding to each pixel point in the target segmentation region, determine the enhanced gray value corresponding to each pixel point.
[0163] For example, the formula for determining the enhanced gray value corresponding to each pixel point can be:
[0164] f t,a =ε t ×h t,a
[0165] Where f t,a is the enhanced gray value corresponding to the a-th pixel point in the t-th target segmentation region in the target segmentation region set. t is the sequence number of the target segmentation region in the target segmentation region set. a is the sequence number of the pixel point in the t-th target segmentation region in the target segmentation region set. ε t is the enhancement coefficient corresponding to the t-th target segmentation region in the target segmentation region set. h t,a is the gray value corresponding to the a-th pixel point in the t-th target segmentation region in the target segmentation region set.
[0166] The product of the enhancement coefficient corresponding to the target segmentation region and the gray value corresponding to the pixel point in the target segmentation region is determined as the enhanced gray value corresponding to the pixel point in the target segmentation region, which can realize accurate enhancement of the pixel point in the target segmentation region.
[0167] Second, update the gray value corresponding to each pixel point in the target segmentation region set to the enhanced gray value corresponding to each pixel point to obtain a target enhanced image.
[0168] Optionally, first, the target enhanced image can be segmented by a threshold segmentation algorithm, the gray value corresponding to the pixel point with the gray value greater than the threshold in the target enhanced image can be updated to 1, the gray value corresponding to the pixel point with the gray value less than or equal to the threshold in the target enhanced image can be updated to 0, and a binary image is obtained. Then, the binary image can be analyzed for crack defects, and whether the target water supply pipeline has a crack defect can be determined. For example, some crack defects have a shape feature of being wide in the middle and narrow at both ends, and the features of the closed connected domain in the binary image can be analyzed to determine whether the target water supply pipeline has a crack defect.
[0169] Since the target enhanced image can clearly reflect the information of the target water supply pipeline, crack detection of the target water supply pipeline through the target enhanced image can improve the accuracy of crack detection of the target water supply pipeline.
[0170] The image enhancement method for detecting building water supply pipeline cracks of the present application realizes the enhancement of the X-ray flaw detection image by image data processing of the X-ray flaw detection image, solves the technical problem of low image enhancement effect, and improves the image enhancement effect. First, the X-ray flaw detection image of the target water supply pipeline to be detected for crack conditions is obtained, and the X-ray flaw detection image is threshold segmented to obtain a target pipeline region image. Since the building water supply pipeline is often installed inside the wall, the X-ray flaw detection image obtained by X-ray flaw detection often contains information of the target water supply pipeline, which can facilitate subsequent detection of the crack condition of the target water supply pipeline. Then, the target pipeline region image is adaptively and uniformly segmented according to the gray value corresponding to the pixel point in the target pipeline region image to obtain a segmentation region set. In actual conditions, the definition of each position of the target pipeline region image is often different, and the degree of enhancement is often different, so the target pipeline region image is adaptively and uniformly segmented to obtain a segmentation region set, which can facilitate subsequent analysis of each segmentation region in the segmentation region set and accurate image enhancement of each segmentation region. Then, the segmentation region set is subjected to Gaussian blur processing to obtain a target segmentation region set. In actual conditions, Gaussian blur processing of the segmentation region set can greatly remove noise in the segmentation region set and reduce the influence of noise on the segmentation region set. After that, each target segmentation region in the target segmentation region set is subjected to relevant brightness, confusion and pipeline distance feature analysis processing to obtain relevant brightness indicators, confusion indicators and pipeline distance indicators corresponding to the target segmentation region. Since the enhancement degree of the target segmentation region is often related to the relevant brightness, confusion degree and distance from the pipeline of the target segmentation region. Therefore, determining the relevant brightness indicators, confusion indicators and pipeline distance indicators corresponding to the target segmentation region can facilitate subsequent determination of the enhancement coefficient corresponding to the target segmentation region. Then, for each target segmentation region in the target segmentation region set, the enhancement coefficient corresponding to the target segmentation region is determined according to the relevant brightness indicators, confusion indicators and pipeline distance indicators corresponding to the target segmentation region. Comprehensive consideration of the relevant brightness indicators, confusion indicators and pipeline distance indicators corresponding to the target segmentation region can improve the accuracy of determination of the enhancement coefficient corresponding to the target segmentation region. Finally, each target segmentation region is enhanced according to the enhancement coefficient corresponding to each target segmentation region in the target segmentation region set to generate a target enhancement image.Therefore, the application realizes the enhancement of the X-ray flaw detection image by image data processing on the X-ray flaw detection image, compared with the existing histogram equalization algorithm, the target pipeline region image is adaptively and uniformly segmented, and the Gaussian blur processing is performed, the related brightness index, the confusion index and the pipeline distance index corresponding to the target segmentation region are comprehensively considered, the enhancement coefficient of the target segmentation region at different positions can be accurately determined, the adaptive detail enhancement of each target segmentation region can be realized, the detail loss is reduced, and therefore the image enhancement effect can be improved.
[0171] The above examples are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that the technical solutions recorded in the foregoing examples can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. An image enhancement method for detecting cracks in a building water supply pipe, characterized by, The method comprises the following steps: obtaining an X-ray flaw detection image of a target water supply pipeline; wherein the target water supply pipeline is a pipeline for water supply in a building to be detected for crack conditions; performing threshold segmentation on the X-ray flaw detection image to obtain a target pipeline region image; performing adaptive uniform segmentation on the target pipeline region image according to the gray value corresponding to a pixel point in the target pipeline region image to obtain a segmentation region set; performing Gaussian blur processing on the segmentation region set to obtain a target segmentation region set; performing relevant brightness, chaos and pipeline distance feature analysis processing on each target segmentation region in the target segmentation region set to obtain relevant brightness indicators, chaos indicators and pipeline distance indicators corresponding to the target segmentation region; for each target segmentation region in the target segmentation region set, determining an enhancement coefficient corresponding to the target segmentation region according to the relevant brightness indicators, chaos indicators and pipeline distance indicators corresponding to the target segmentation region; performing enhancement on each target segmentation region according to the enhancement coefficient corresponding to each target segmentation region in the target segmentation region set to generate a target enhancement image; the relevant brightness, chaos and pipeline distance feature analysis processing on each target segmentation region in the target segmentation region set to obtain relevant brightness indicators, chaos indicators and pipeline distance indicators corresponding to the target segmentation region comprises: determining relevant brightness indicators corresponding to each target segmentation region according to the gray value corresponding to each pixel point in the target segmentation region in the target segmentation region set; determining a pixel chaos degree corresponding to each pixel point in each target segmentation region according to the gray value corresponding to the pixel point and the standard deviation of the gray value corresponding to each neighborhood pixel point in a pre-set reference neighborhood; determining the mean value of the pixel chaos degrees corresponding to the pixel points in the target segmentation region as the chaos indicator corresponding to the target segmentation region; filtering out the edge of a target pipeline region from the target pipeline region image as a target pipeline edge; determining the Euclidean distance between each pixel point in the target segmentation region and the target pipeline edge as the pixel pipeline distance corresponding to the pixel point; determining the mean value of the pixel pipeline distances corresponding to the pixel points in the target segmentation region as the pipeline distance indicator corresponding to the target segmentation region.
2. The image enhancement method for detecting a crack in a building water supply pipe according to claim 1, wherein the adaptive uniform segmentation on the target pipeline region image according to the gray value corresponding to a pixel point in the target pipeline region image to obtain a segmentation region set comprises: equally dividing the target pipeline region image into a pre-set number of initial regions to obtain an initial region set; determining the discrete degree corresponding to each initial region in the initial region set according to the gray value corresponding to a pixel point in the initial region; when the discrete degree corresponding to an initial region is less than or equal to a pre-set discrete threshold, determining the initial region as a segmentation region; When the discrete degree corresponding to the initial region is greater than the discrete threshold, the initial region is equally divided into a preset number of sub-regions, the discrete degree corresponding to each sub-region is determined, when the discrete degree corresponding to the sub-region is less than or equal to the discrete threshold, the sub-region is determined as a segmentation region, when the discrete degree corresponding to the sub-region is greater than the discrete threshold, the sub-region is determined as an initial region, the step is repeated until the discrete degree corresponding to the initial region is less than or equal to the discrete threshold, and the initial region is determined as a segmentation region.
3. The image enhancement method for detecting a crack in a building water supply pipe according to claim 2, wherein The formula for determining the discrete degree corresponding to the initial region is: wherein μ n is the degree of dispersion of the nth initial region in the initial region set, N is the number of pixel points in the nth initial region in the initial region set, and n is the serial number of the initial region in the initial region set, is the gray value of the ith pixel point in the nth initial region in the initial region set, i is the serial number of the pixel point in the nth initial region in the initial region set, is the mean value of the gray values of the pixel points in the nth initial region in the initial region set.
4. The image enhancement method for detecting cracks in building water supply pipes according to any one of claims 1 to 3, characterized in that, The method further includes: For each target segmentation region in the target segmentation region set, target segmentation regions satisfying a distance condition are screened out from the target segmentation region set as adjacent segmentation regions, to obtain a set of adjacent segmentation regions corresponding to the target segmentation region, wherein the distance condition is that the Euclidean distance between two target segmentation regions is less than or equal to a preset distance threshold. For each target segmentation region in the target segmentation region set, the average of the gray values of the pixel points in the set of adjacent segmentation regions corresponding to the target segmentation region is determined as the adjacent gray average value corresponding to the target segmentation region. The average of the gray values of the pixel points in each target segmentation region in the target segmentation region set is determined as the target gray average value corresponding to the target segmentation region. The relative brightness index corresponding to each target segmentation region in the target segmentation region set is determined according to the adjacent gray average value and the target gray average value corresponding to the target segmentation region.
5. The image enhancement method for detecting cracks in building water supply pipes according to any one of claims 1 to 3, characterized in that, The method further includes: The relative brightness index corresponding to each target segmentation region in the target segmentation region set is determined according to the gray value of each pixel point in the target segmentation region and the gray value of each adjacent pixel point in a preset target neighborhood of the pixel point. The relative brightness index corresponding to each target segmentation region in the target segmentation region set is determined according to the gray value of each pixel point in the target segmentation region and the gray value of each adjacent pixel point in a preset target neighborhood of the pixel point.
6. The image enhancement method for detecting a crack in a building water supply pipe according to claim 5, wherein The method further includes: The average of the gray values of the adjacent pixel points in the target neighborhood corresponding to the pixel point is determined as the neighborhood average value corresponding to the pixel point. The ratio of the gray value of the pixel point to the target neighborhood average value is determined as the relative brightness index corresponding to the pixel point, wherein the target neighborhood average value corresponding to the pixel point is the sum of the neighborhood average value corresponding to the pixel point and a preset gray value greater than 0.
7. The image enhancement method for detecting a crack in a building water supply pipe according to claim 1, wherein The formula for determining the enhancement coefficient corresponding to the target segmentation region is: wherein ε t is an enhancement coefficient corresponding to the tth target segmentation region in the target segmentation region set, t is the serial number of the target segmentation region in the target segmentation region set, e is a natural constant, L t is a related brightness index corresponding to the tth target segmentation region in the target segmentation region set, δ t is a confusion index corresponding to the tth target segmentation region in the target segmentation region set, d t is a pipeline distance index corresponding to the tth target segmentation region in the target segmentation region set.
8. The image enhancement method for detecting a crack in a building water supply pipe according to claim 1, wherein The generating a target enhancement image by enhancing each target segmentation region according to the enhancement coefficient corresponding to the target segmentation region comprises: determining an enhanced gray value corresponding to each pixel point in the target segmentation region according to a gray value corresponding to each pixel point; a formula for determining the enhanced gray value corresponding to each pixel point is: f t,a = ε t × h t,a wherein f t,a is an enhanced gray value corresponding to the a-th pixel point in the t-th target segmentation region in the target segmentation region set, t is a serial number of the target segmentation region in the target segmentation region set, a is a serial number of the pixel point in the t-th target segmentation region in the target segmentation region set, ε t is an enhanced coefficient corresponding to the t-th target segmentation region in the target segmentation region set, h t,a is a gray value corresponding to the a-th pixel point in the t-th target segmentation region in the target segmentation region set; updating the gray value corresponding to each pixel point in the target segmentation region to the enhanced gray value corresponding to each pixel point to obtain the target enhancement image.
Citation Information
Patent Citations
Histogram-based iris image enhancement method and device, equipment and storage medium
CN108846319A
PCB production process online detection method based on edge detection
CN115272346A