CN117237396B - Rail bolt rust area segmentation method based on image characteristics - Google Patents
Rail bolt rust area segmentation method based on image characteristics Download PDFInfo
- Publication number
- CN117237396B CN117237396B CN202311523044.8A CN202311523044A CN117237396B CN 117237396 B CN117237396 B CN 117237396B CN 202311523044 A CN202311523044 A CN 202311523044A CN 117237396 B CN117237396 B CN 117237396B
- Authority
- CN
- China
- Prior art keywords
- region
- threshold
- area
- steel rail
- gray
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 230000011218 segmentation Effects 0.000 title claims abstract description 112
- 238000000034 method Methods 0.000 title claims abstract description 86
- JEIPFZHSYJVQDO-UHFFFAOYSA-N iron(III) oxide Inorganic materials O=[Fe]O[Fe]=O JEIPFZHSYJVQDO-UHFFFAOYSA-N 0.000 title claims abstract description 26
- 229910000831 Steel Inorganic materials 0.000 claims abstract description 112
- 239000010959 steel Substances 0.000 claims abstract description 112
- 230000003044 adaptive effect Effects 0.000 claims description 9
- 230000000903 blocking effect Effects 0.000 claims description 4
- 230000010354 integration Effects 0.000 claims description 4
- 230000000052 comparative effect Effects 0.000 claims description 3
- 238000010606 normalization Methods 0.000 claims description 3
- 238000005260 corrosion Methods 0.000 description 4
- 230000007797 corrosion Effects 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000002902 bimodal effect Effects 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Image Analysis (AREA)
Abstract
The invention relates to the technical field of image processing, in particular to a method for dividing a rust area of a steel rail bolt based on image characteristics, which comprises the following steps: collecting gray level images of steel rail bolts; obtaining a reference area according to the gray level image of the steel rail bolt; obtaining high gray pixel points and low gray pixel points according to the reference area; obtaining the segmentation necessity according to the high gray pixel points and the low gray pixel points; obtaining a core threshold region and a traditional comparison reference region according to the segmentation necessity; obtaining coincidence degree according to the core threshold value region and the traditional comparison reference region; obtaining an initial segmentation threshold according to the coincidence degree; obtaining a segmentation threshold according to the initial segmentation threshold; obtaining a final self-adaptive threshold according to the segmentation threshold; and obtaining a rust area for the gray level image of the steel rail bolt according to the final self-adaptive threshold value. The method ensures that the acquired rusted area is more complete, and improves the precision of dividing the rusted area.
Description
Technical Field
The invention relates to the technical field of image processing, in particular to a method for dividing a rust area of a steel rail bolt based on image characteristics.
Background
The railway rails are usually fixedly connected by bolts, and the surfaces of the steel rail bolts are rusted due to the fact that the rails are exposed outdoors all the time, so that in order to treat the rusting, potential safety hazards are reduced, and the rusting areas in the images of the steel rail bolts are required to be divided. The traditional method utilizes the self-adaptive threshold segmentation algorithm to segment the rusted area of the steel rail bolt image, but the gray scale difference in part of the area is larger because the corroded degree in the rusted area is not uniformly distributed, the gray scale difference in part of the area is smaller, the segmented rusted area is incomplete, and part of the rusted area is lost.
Disclosure of Invention
The invention provides a method for dividing a rust area of a steel rail bolt based on image characteristics, which aims to solve the existing problems: the corrosion degree inside the corrosion area is not uniformly distributed, so that the gray scale difference in part of the area is larger, and the gray scale difference in part of the area is smaller, so that the corrosion area segmented by the self-adaptive threshold segmentation algorithm is incomplete, and part of the corrosion area is lost.
The method for dividing the rust area of the steel rail bolt based on the image characteristics adopts the following technical scheme:
the method comprises the following steps:
collecting steel rail bolt gray images of a plurality of steel rail bolts;
image blocking is carried out on the gray level image of the steel rail bolt to obtain a plurality of reference areas; gray scale division is carried out on gray scale values of pixel points in the reference areas to obtain a plurality of high gray scale pixel points and a plurality of low gray scale pixel points in each reference area; obtaining the segmentation necessity of each reference area according to the quantity difference between the high gray pixel points and the low gray pixel points in the reference area;
performing region division on the reference region according to the segmentation necessity to obtain a plurality of core threshold regions and a plurality of traditional comparison reference regions of each core threshold region; obtaining the coincidence degree of each core threshold region and each corresponding traditional comparison reference region according to the gray level difference between the core threshold region and the traditional comparison reference region; obtaining an initial segmentation threshold value of each core threshold value region and each traditional comparison reference region according to the coincidence degree and the number of pixel points of the coincidence part between the core threshold value region and the traditional comparison reference region; average integration is carried out on all initial segmentation threshold values to obtain a segmentation threshold value of each core threshold value region;
weighting and integrating all the segmentation thresholds to obtain a final self-adaptive threshold of each steel rail bolt gray level image; and dividing the gray level image of the steel rail bolt according to the final self-adaptive threshold value to obtain a plurality of rust areas.
Preferably, the method for obtaining a plurality of reference areas by performing image blocking on the gray level image of the steel rail bolt comprises the following specific steps:
presetting a block size T1 and a step length U, wherein the step length U is smaller than the block size T1, and for any pixel point in any steel rail bolt gray scale image, marking a block with the block size T1 as an initial area of the pixel point by taking the pixel point as a block center, and acquiring the initial areas of all the pixel points;
the method comprises the steps of marking an initial area of a pixel point on a first row in a steel rail bolt gray scale image as a first reference area, marking an initial area of a pixel point on a fourth row in the steel rail bolt gray scale image as a second reference area, and marking an initial area of a pixel point on a seventh row in the steel rail bolt gray scale image as a third reference area; and so on until the initial areas of the pixel points on all columns of the first row in the gray level image of the steel rail bolt are traversed; starting traversing the initial areas of all the pixel points on the fourth row in the steel rail bolt gray level image by taking the step length as U, and starting the sequence of the reference areas on the fourth row from the next sequence number of the last reference area on the first row until the initial areas of all the pixel points on the fourth row in the steel rail bolt gray level image are traversed; and the same is repeated until the initial areas of the pixel points on all columns of the last row in the steel rail bolt gray level image are traversed, so that a plurality of reference areas of the steel rail bolt gray level image are obtained.
Preferably, the gray scale dividing of the gray scale value of the pixel point in the reference area is performed to obtain a plurality of high gray scale pixel points and a plurality of low gray scale pixel points in each reference area, which comprises the following specific steps:
for any one reference area, the average value of the gray values of all the pixel points in the reference area is marked as an area gray average value, the pixel points with the gray values larger than the area gray average value in the reference area are marked as high gray pixel points, and the pixel points with the gray values smaller than or equal to the area gray average value in the reference area are marked as low gray pixel points.
Preferably, the obtaining the segmentation necessity of each reference area according to the number difference between the high gray pixel point and the low gray pixel point in the reference area includes the following specific methods:
in the method, in the process of the invention,representing the initial segmentation necessity of any one reference region; />Representing the variance of gray values of all pixel points in the reference area; />Representing the number of all high gray pixel points in the reference area; />Representing the number of all low gray pixel points in the reference area; />Representing preset super parameters; />Representing the number of all pixel points in the reference area; />Indicating the%>The number of all pixels in the eight neighborhoods of the pixels; />Indicating the%>Gray values of the individual pixels; />Indicating the%>Eighth +.>Gray values of the individual pixels; />The representation takes absolute value;
acquiring the initial segmentation necessity of all the reference areas, carrying out linear normalization on all the initial segmentation necessity, and marking each normalized initial segmentation necessity as segmentation necessity.
Preferably, the method for performing region division on the reference region according to the segmentation necessity to obtain a plurality of core threshold regions and a plurality of traditional comparison reference regions of each core threshold region includes the following specific steps:
presetting a segmentation necessity threshold T2, marking a reference area with segmentation necessity larger than T2 as a traditional threshold area, and marking a reference area with segmentation necessity smaller than or equal to T2 as a threshold area to be determined;
for any one threshold area to be determined, marking a reference area with a coincident part with the threshold area to be determined as a comparison reference area of the threshold area to be determined;
if the traditional threshold value area exists in all the comparison reference areas of the threshold value area to be determined, the threshold value area to be determined is marked as a core threshold value area, and the traditional threshold value area is marked as a traditional comparison reference area of the core threshold value area.
Preferably, the obtaining the coincidence degree of each core threshold region and each corresponding traditional contrast reference region according to the gray scale difference between the core threshold region and the traditional contrast reference region includes the following specific methods:
for any one traditional comparison reference area of any one core threshold area, acquiring an oxford threshold value of the traditional comparison reference area by using an oxford method, and marking the average value of gray values of all pixel points in the core threshold area as an area gray average value;
in the method, in the process of the invention,representing the coincidence degree of the core threshold region and the traditional comparison reference region; />A region gray average value representing a core threshold region; />Representing the average value of gray values of all pixel points in the superposition part of the core threshold value area and the traditional contrast reference area; />Representing preset super parameters; />An oxford threshold representing a conventional comparative reference region; />The representation takes absolute value.
Preferably, the method for obtaining the initial segmentation threshold value of each core threshold value region and each corresponding traditional comparison reference region according to the coincidence degree and the number of pixel points of the coincidence part between the core threshold value region and the traditional comparison reference region comprises the following specific steps:
in the method, in the process of the invention,an initial segmentation threshold representing any one of the core threshold regions and any one of the conventional comparison reference regions of the core threshold region; />Representing the number of all pixel points in the core threshold region; />Representing the number of all pixel points in the superposition part of the core threshold value region and the traditional contrast reference region; />Representing preset super parameters; />Representing the coincidence degree of the core threshold region and the traditional comparison reference region; />Representing the average value of gray values of all pixel points in the superposition part of the core threshold value area and the traditional contrast reference area; />The representation takes absolute value.
Preferably, the average integration of all the initial segmentation thresholds obtains the segmentation threshold of each core threshold region, including the following specific methods:
and (3) for any core threshold region, rounding and rounding the average value of the initial segmentation threshold values of the core threshold region and all traditional comparison reference regions of the core threshold region, and recording the rounded result as the segmentation threshold value of the core threshold region.
Preferably, the step of weighting and integrating all the segmentation thresholds to obtain a final self-adaptive threshold value of each steel rail bolt gray level image comprises the following specific steps:
for any steel rail bolt gray level image, acquiring an oxford threshold value of each traditional threshold value region in the steel rail bolt gray level image by using an oxford method, and marking the oxford threshold value as a segmentation threshold value of each traditional threshold value region; marking each core threshold region and each traditional threshold region in the gray level image of the steel rail bolt as a threshold reference region;
in the method, in the process of the invention,representing a final adaptive threshold of the rail bolt gray scale image; />Representing the number of all threshold reference areas in the gray level image of the steel rail bolt; />The +.o. in the gray scale image of the steel rail bolt>Segmentation threshold of the individual threshold reference regions;the +.o. in the gray scale image of the steel rail bolt>The necessity of segmentation of the individual threshold reference regions; />The +.o. in the gray scale image of the steel rail bolt>The necessity of segmentation of the individual threshold reference regions; />Representing an upward rounding.
Preferably, the method for dividing the gray level image of the steel rail bolt according to the final adaptive threshold value to obtain a plurality of rust areas comprises the following specific steps:
and for any steel rail bolt gray level image, taking the final self-adaptive threshold value of the steel rail bolt gray level image as the self-adaptive threshold value, carrying out self-adaptive segmentation on the steel rail bolt gray level image according to the self-adaptive threshold value to obtain a plurality of segmentation areas, and marking the segmentation areas as rust areas.
The technical scheme of the invention has the beneficial effects that: dividing a gray level image of a steel rail bolt to obtain a reference area, obtaining the division necessity of the reference area, obtaining the coincidence degree according to the division necessity, obtaining the division threshold value of a core threshold value area according to the coincidence degree, obtaining a final self-adaptive threshold value according to the division threshold value, and obtaining a plurality of rust areas according to the self-adaptive threshold value; the segmentation necessity of the invention reflects the degree of the reference area to be segmented, and the coincidence degree reflects the possibility that the core threshold area belongs to the rust area; the method ensures that the acquired rusted area is more complete, and improves the precision of dividing the rusted area.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of steps of a method for segmenting rusted areas of steel rail bolts based on image features.
Detailed Description
In order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following detailed description is given below of the specific implementation, structure, characteristics and effects of the method for dividing the rusted region of the steel rail bolt based on the image characteristics according to the invention by combining the attached drawings and the preferred embodiment. In the following description, different "one embodiment" or "another embodiment" means that the embodiments are not necessarily the same. Furthermore, the particular features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
The specific scheme of the method for dividing the rusted region of the steel rail bolt based on the image features is specifically described below with reference to the accompanying drawings.
Referring to fig. 1, a flowchart of a method for dividing a rusted region of a rail bolt based on image features according to an embodiment of the invention is shown, the method comprises the following steps:
step S001: and acquiring steel rail bolt gray level images of a plurality of steel rail bolts.
It should be noted that, in the conventional method, the rust area is segmented by using the adaptive threshold segmentation algorithm on the steel rail bolt image, but the gray level difference in part of the area is larger due to uneven distribution of the corroded degree in the rust area, and the gray level difference in part of the area is smaller, so that the segmented rust area is incomplete, and part of the rust area is lost. For this reason, this embodiment proposes a method for dividing a rust area of a rail bolt based on image features.
Specifically, in order to implement the method for dividing the rusted region of the steel rail bolt based on the image features, which is provided in the embodiment, firstly, gray images of the steel rail bolt need to be collected, and the specific process is as follows: and shooting a plurality of steel rail bolt images by using an industrial camera, and carrying out gray-scale treatment on each steel rail bolt image to obtain a plurality of steel rail bolt gray-scale images. The graying process is a known technique, and the description of this embodiment is omitted.
So far, the gray level images of the steel rail bolts of the plurality of steel rail bolts are obtained through the method.
Step S002: image blocking is carried out on the gray level image of the steel rail bolt to obtain a plurality of reference areas; gray scale division is carried out on gray scale values of pixel points in the reference areas to obtain a plurality of high gray scale pixel points and a plurality of low gray scale pixel points in each reference area; the segmentation necessity of each reference area is obtained according to the number difference between the high gray pixel points and the low gray pixel points in the reference area.
In the gray level image of the steel rail bolt, in order to effectively divide the rusted area, the edge parts of the rusted area and the normal area are mainly required to be distinguished, certain gray level differences exist around pixel points of the edge parts, the gray level distribution in a window containing the edge parts is in a bimodal characteristic, and gray level fluctuation is larger; therefore, in order to effectively divide the rusted area, the present embodiment analyzes the distribution difference of gray values in each of the blocks by dividing the gray image of the rail bolt to determine the blocks including the edge portion, thereby determining the division necessity of each block to be divided for the subsequent analysis processing.
Specifically, a block size T1 is preset, where t1=7 in this embodiment7, the embodiment is not limited to the specific example, wherein T1 may be determined according to the specific implementation; taking any pixel point in a gray level image of any steel rail bolt as an example, marking a block with the pixel point as a block center and the block size of T1 as an initial area of the pixel point, and acquiring initial areas of all the pixel points. The initial area of the pixel points on the first row and the first column in the steel rail bolt gray scale image is marked as a first reference area, the initial area of the pixel points on the fourth row and the fourth column in the steel rail bolt gray scale image is marked as a second reference area, and the steel rail bolt gray scale is markedThe initial area of the pixel points on the seventh column of the first row in the image is recorded as a third reference area; and so on until the initial areas of the pixel points on all columns of the first row in the gray level image of the steel rail bolt are traversed; starting traversing the initial areas of the pixel points on all columns of the fourth row in the steel rail bolt gray level image with the step length of 3, and starting the sequence of the reference areas on the fourth row from the next sequence number of the last reference area on the first row until the initial areas of the pixel points on all columns of the fourth row in the steel rail bolt gray level image are traversed; starting traversing the initial areas of pixel points on all columns of a seventh row in the gray scale image of the steel rail bolt with the step length of 3, wherein the sequence of the reference areas on the seventh row is started from the next sequence number of the last reference area on the fourth row; and the same is repeated until the initial areas of the pixel points on all columns of the last row in the gray level image of the steel rail bolt are traversed, and a plurality of reference areas of the gray level image of the steel rail bolt are obtained. Each steel rail bolt gray level image comprises a plurality of reference areas, and a certain overlapping part exists between adjacent reference areas. In addition, it should be noted that, in the process of obtaining the initial area of the pixel, if the number of pixels actually existing around the pixel does not meet the preset T1, the initial area of the pixel is obtained based on the number of pixels actually existing around the pixel.
Further, taking any reference area in the gray level image of the steel rail bolt as an example, marking the average value of gray level values of all pixel points in the reference area as an area gray level average value, marking the pixel points with gray level values larger than the area gray level average value in the reference area as high gray level pixel points, and marking the pixel points with gray level values smaller than or equal to the area gray level average value in the reference area as low gray level pixel points; and obtaining the initial segmentation necessity of the reference area according to all the high gray pixel points and all the low gray pixel points in the reference area. The method for calculating the initial segmentation necessity of the reference region comprises the following steps:
in the method, in the process of the invention,indicating the necessity of an initial segmentation of the reference region; />Representing the variance of gray values of all pixel points in the reference area; />Representing the number of all high gray pixel points in the reference area; />Representing the number of all low gray pixel points in the reference area; />Representing a preset hyper-parameter, preset +.>For preventing denominator from being 0; />Representing the number of all pixel points in the reference area; />Indicating the +.>The number of all pixels in the eight neighborhoods of the pixels; />Indicating the +.>Gray values of the individual pixels; />Indicating the +.>Eighth +.>Gray values of the individual pixels; />The representation takes absolute value. The greater the initial segmentation necessity of the reference region, the more obvious the gray scale difference between pixel points in the reference region, the more likely the reference region contains a rusted region and a normal region, reflecting that the reference region needs to be segmented. Acquiring the initial segmentation necessity of all the reference areas, carrying out linear normalization on all the initial segmentation necessity, and marking each normalized initial segmentation necessity as segmentation necessity.
So far, the necessity of division of all the reference areas is obtained by the above method.
Step S003: performing region division on the reference region according to the segmentation necessity to obtain a plurality of core threshold regions and a plurality of traditional comparison reference regions of each core threshold region; obtaining the coincidence degree of each core threshold region and each corresponding traditional comparison reference region according to the gray level difference between the core threshold region and the traditional comparison reference region; obtaining an initial segmentation threshold value of each core threshold value region and each traditional comparison reference region according to the coincidence degree and the number of pixel points of the coincidence part between the core threshold value region and the traditional comparison reference region; and (5) integrating all initial segmentation threshold values averagely to obtain the segmentation threshold value of each core threshold value region.
In the gray scale image of the steel rail bolt, for any area with rust, the same rust area can irregularly extend outwards, so that the same rust area extends to different degrees in all directions, the dividing threshold values of the rust areas of different surrounding areas are affected to different degrees, and adjacent areas can be mutually affected; for a region with strong segmentation necessity, the gray level difference in the region is obvious, and a proper threshold value can be determined by a traditional Ojin method; for the region with weak segmentation necessity, the gray level difference in the region is fuzzy, if the threshold value is directly determined by the traditional Ojin method, the accuracy of the corresponding threshold value is reduced, therefore, the segmentation threshold value of the region with weak segmentation necessity is determined by the same overlapped part of the regions, the accuracy of the segmentation threshold value of the region with weak segmentation necessity is improved, and the analysis processing of the adaptive threshold value of the gray level image of the subsequent steel rail bolt is facilitated.
Specifically, a segmentation necessity threshold T2 is preset, where the present embodiment is described by taking t2=0.6 as an example, and the present embodiment is not specifically limited, where T2 may be determined according to the specific implementation situation; marking a reference area with segmentation necessity larger than T2 as a traditional threshold area, acquiring the oxford threshold values of all the traditional threshold areas by using a oxford method, and marking the oxford threshold value of each traditional threshold area as a segmentation threshold value of each traditional threshold area; the reference region whose division necessity is less than or equal to T2 is noted as a threshold region to be determined. Taking any one threshold area to be determined as an example, and recording a reference area with a superposition part with the threshold area to be determined as a comparison reference area of the threshold area to be determined; if the conventional threshold regions exist in all the comparison reference regions of the threshold region to be determined, the threshold region to be determined is marked as a core threshold region, and the conventional threshold regions are marked as conventional comparison reference regions of the core threshold region. Wherein each threshold region corresponds to a plurality of conventional contrast reference regions; the process of obtaining the oxford threshold is a well-known content of the oxford method, and this embodiment will not be described in detail.
Further, taking any one conventional comparison reference area of any one core threshold area as an example, the coincidence degree of the core threshold area and the conventional comparison reference area is obtained according to the coincidence part of the core threshold area and the conventional comparison reference area. The method for calculating the coincidence degree of the core threshold region and the traditional comparison reference region comprises the following steps:
in the method, in the process of the invention,representing the coincidence degree of the core threshold region and the traditional comparison reference region; />A region gray scale average value representing the core threshold region; />Representing the average value of gray values of all pixel points in the superposition part of the core threshold value area and the traditional contrast reference area; />Representing a preset hyper-parameter, preset +.>For preventing denominator from being 0; />An oxford threshold representing the conventional comparative reference region; />The representation takes absolute value. The smaller the coincidence degree of the core threshold region and the traditional comparison reference region, the more likely the core threshold region belongs to the rust region.
Further, an initial segmentation threshold of the core threshold region and the conventional comparison reference region is obtained according to the coincidence degree of the core threshold region and the conventional comparison reference region. The method for calculating the initial segmentation threshold value of the core threshold value region and the traditional comparison reference region comprises the following steps:
in the method, in the process of the invention,an initial segmentation threshold representing the core threshold region and the legacy contrast reference region; />Representing the number of all pixel points within the core threshold region; />Representing the number of all pixel points in the overlapping part of the core threshold region and the traditional contrast reference region; />Representing a preset hyper-parameter, preset +.>For preventing->Is 0; />Representing the coincidence degree of the core threshold region and the traditional comparison reference region; />Representing the average value of gray values of all pixel points in the superposition part of the core threshold value area and the traditional contrast reference area; />The representation takes absolute value. Wherein if the initial segmentation threshold of the core threshold region and the conventional comparison reference region is larger, the segmentation threshold effect of the coincidence part of the core threshold region and the conventional comparison reference region on the core threshold region is larger. And obtaining initial segmentation thresholds of the core threshold region and all traditional comparison reference regions of the core threshold region, and marking a result of rounding and rounding the average value of the initial segmentation thresholds of the core threshold region and all traditional comparison reference regions of the core threshold region as a segmentation threshold of the core threshold region. Acquiring all coresSegmentation threshold of threshold region.
So far, the segmentation threshold values of all the core threshold value areas are obtained through the method.
Step S004: weighting and integrating all the segmentation thresholds to obtain a final self-adaptive threshold of each steel rail bolt gray level image; and dividing the gray level image of the steel rail bolt according to the final self-adaptive threshold value to obtain a plurality of rust areas.
Specifically, each core threshold region and each traditional threshold region in the steel rail bolt gray image are marked as threshold reference regions, and the final self-adaptive threshold of the steel rail bolt gray image is obtained according to the segmentation threshold values of all threshold reference regions in the steel rail bolt gray image and the corresponding segmentation necessity. The method for calculating the final self-adaptive threshold value of the steel rail bolt gray level image comprises the following steps:
in the method, in the process of the invention,representing a final adaptive threshold value of the rail bolt gray scale image; />Representing the number of all threshold reference areas in the gray level image of the steel rail bolt; />Representing the +.o in the gray scale image of the rail bolt>Segmentation threshold of the individual threshold reference regions; />Representing the +.o in the gray scale image of the rail bolt>The necessity of segmentation of the individual threshold reference regions; />Representing the +.o in the gray scale image of the rail bolt>The necessity of segmentation of the individual threshold reference regions; />Representing an upward rounding. And if the final self-adaptive threshold value of the gray level image of the steel rail bolt is larger, the gray level value of the rusted area in the gray level image of the steel rail bolt is larger as a whole.
Further, the final self-adaptive threshold value of the steel rail bolt gray level image is used as a self-adaptive threshold value, the steel rail bolt gray level image is subjected to Ojin threshold value segmentation according to the self-adaptive threshold value to obtain a plurality of segmentation areas, and the segmentation areas are marked as rust areas. The process of segmentation according to the adaptive threshold is a well-known content of the adaptive threshold segmentation algorithm, and this embodiment is not described in detail; the present embodiment is described taking an oxford threshold segmentation algorithm as an example among the adaptive threshold segmentation algorithms. The divided regions are regions where the rail bolts are corroded.
This embodiment is completed.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the invention, but any modifications, equivalent substitutions, improvements, etc. within the principles of the present invention should be included in the scope of the present invention.
Claims (7)
1. The method for dividing the rusted region of the steel rail bolt based on the image characteristics is characterized by comprising the following steps of:
collecting steel rail bolt gray images of a plurality of steel rail bolts;
image blocking is carried out on the gray level image of the steel rail bolt to obtain a plurality of reference areas; gray scale division is carried out on gray scale values of pixel points in the reference areas to obtain a plurality of high gray scale pixel points and a plurality of low gray scale pixel points in each reference area; obtaining the segmentation necessity of each reference area according to the quantity difference between the high gray pixel points and the low gray pixel points in the reference area;
performing region division on the reference region according to the segmentation necessity to obtain a plurality of core threshold regions and a plurality of traditional comparison reference regions of each core threshold region; obtaining the coincidence degree of each core threshold region and each corresponding traditional comparison reference region according to the gray level difference between the core threshold region and the traditional comparison reference region; obtaining an initial segmentation threshold value of each core threshold value region and each traditional comparison reference region according to the coincidence degree and the number of pixel points of the coincidence part between the core threshold value region and the traditional comparison reference region; average integration is carried out on all initial segmentation threshold values to obtain a segmentation threshold value of each core threshold value region;
weighting and integrating all the segmentation thresholds to obtain a final self-adaptive threshold of each steel rail bolt gray level image; dividing the gray level image of the steel rail bolt according to the final self-adaptive threshold value to obtain a plurality of rust areas;
the method comprises the following steps of carrying out region division on a reference region according to the segmentation necessity to obtain a plurality of core threshold regions and a plurality of traditional comparison reference regions of each core threshold region, wherein the specific method comprises the following steps:
presetting a segmentation necessity threshold T2, marking a reference area with segmentation necessity larger than T2 as a traditional threshold area, and marking a reference area with segmentation necessity smaller than or equal to T2 as a threshold area to be determined;
for any one threshold area to be determined, marking a reference area with a coincident part with the threshold area to be determined as a comparison reference area of the threshold area to be determined;
if the traditional threshold value areas exist in all the comparison reference areas of the threshold value areas to be determined, marking the threshold value areas to be determined as core threshold value areas, and marking the traditional threshold value areas as traditional comparison reference areas of the core threshold value areas;
the method for obtaining the coincidence degree of each core threshold region and each corresponding traditional comparison reference region according to the gray level difference between the core threshold region and the traditional comparison reference region comprises the following specific steps:
for any one traditional comparison reference area of any one core threshold area, acquiring an oxford threshold value of the traditional comparison reference area by using an oxford method, and marking the average value of gray values of all pixel points in the core threshold area as an area gray average value;
in the method, in the process of the invention,representing the coincidence degree of the core threshold region and the traditional comparison reference region; />A region gray average value representing a core threshold region; />Representing the average value of gray values of all pixel points in the superposition part of the core threshold value area and the traditional contrast reference area; />Representing preset super parameters; />An oxford threshold representing a conventional comparative reference region; />The representation takes absolute value;
the method for obtaining the final self-adaptive threshold value of each steel rail bolt gray level image by weighting and integrating all the segmentation threshold values comprises the following specific steps:
for any steel rail bolt gray level image, acquiring an oxford threshold value of each traditional threshold value region in the steel rail bolt gray level image by using an oxford method, and marking the oxford threshold value as a segmentation threshold value of each traditional threshold value region; marking each core threshold region and each traditional threshold region in the gray level image of the steel rail bolt as a threshold reference region;
in the method, in the process of the invention,representing a final adaptive threshold of the rail bolt gray scale image; />Representing the number of all threshold reference areas in the gray level image of the steel rail bolt; />The +.o. in the gray scale image of the steel rail bolt>Segmentation threshold of the individual threshold reference regions; />The +.o. in the gray scale image of the steel rail bolt>The necessity of segmentation of the individual threshold reference regions; />The +.o. in the gray scale image of the steel rail bolt>The necessity of segmentation of the individual threshold reference regions; />Representing an upward rounding.
2. The method for dividing the rusted region of the steel rail bolt based on the image features of claim 1, which is characterized in that the image of the gray level image of the steel rail bolt is divided into a plurality of reference regions, and comprises the following specific steps:
presetting a block size T1 and a step length U, wherein the step length U is smaller than the block size T1, and for any pixel point in any steel rail bolt gray scale image, marking a block with the block size T1 as an initial area of the pixel point by taking the pixel point as a block center, and acquiring the initial areas of all the pixel points;
the method comprises the steps of marking an initial area of a pixel point on a first row in a steel rail bolt gray scale image as a first reference area, marking an initial area of a pixel point on a fourth row in the steel rail bolt gray scale image as a second reference area, and marking an initial area of a pixel point on a seventh row in the steel rail bolt gray scale image as a third reference area; and so on until the initial areas of the pixel points on all columns of the first row in the gray level image of the steel rail bolt are traversed; starting traversing the initial areas of the pixel points on all columns of the fourth row in the steel rail bolt gray level image by taking the step length as U, and starting the sequence of the reference areas on the fourth row from the next sequence number of the last reference area on the first row until the initial areas of the pixel points on all columns of the fourth row in the steel rail bolt gray level image are traversed; and the same is repeated until the initial areas of the pixel points on all columns of the last row in the steel rail bolt gray level image are traversed, so that a plurality of reference areas of the steel rail bolt gray level image are obtained.
3. The method for dividing the rusted region of the steel rail bolt based on the image characteristics according to claim 1, wherein the gray scale dividing of the gray scale values of the pixel points in the reference region is performed to obtain a plurality of high gray scale pixel points and a plurality of low gray scale pixel points in each reference region, and the specific method comprises the following steps:
for any one reference area, the average value of the gray values of all the pixel points in the reference area is marked as an area gray average value, the pixel points with the gray values larger than the area gray average value in the reference area are marked as high gray pixel points, and the pixel points with the gray values smaller than or equal to the area gray average value in the reference area are marked as low gray pixel points.
4. The method for dividing the rusted region of the steel rail bolt based on the image characteristics according to claim 1, wherein the dividing necessity of each reference region is obtained according to the number difference between the high gray pixel point and the low gray pixel point in the reference region, comprises the following specific steps:
in the method, in the process of the invention,representing the initial segmentation necessity of any one reference region; />Representing the variance of gray values of all pixel points in the reference area; />Representing the number of all high gray pixel points in the reference area; />Representing the number of all low gray pixel points in the reference area; />Representing preset super parameters; />Representing the number of all pixel points in the reference area; />Indicating the%>Individual pixel pointsThe number of all pixels in the eight neighborhood; />Indicating the%>Gray values of the individual pixels; />Indicating the%>Eighth +.>Gray values of the individual pixels; />The representation takes absolute value;
acquiring the initial segmentation necessity of all the reference areas, carrying out linear normalization on all the initial segmentation necessity, and marking each normalized initial segmentation necessity as segmentation necessity.
5. The method for dividing the rusted region of the steel rail bolt based on the image characteristics according to the coincidence degree and the pixel point number of the coincidence part between the core threshold region and the traditional comparison reference region, which is characterized in that the method for obtaining the initial dividing threshold value of each core threshold region and each corresponding traditional comparison reference region comprises the following specific steps:
in the method, in the process of the invention,representing any one core threshold region and coreAn initial segmentation threshold for any one of the conventional contrast reference regions of the heart threshold region; />Representing the number of all pixel points in the core threshold region; />Representing the number of all pixel points in the superposition part of the core threshold value region and the traditional contrast reference region; />Representing preset super parameters; />Representing the coincidence degree of the core threshold region and the traditional comparison reference region; />Representing the average value of gray values of all pixel points in the superposition part of the core threshold value area and the traditional contrast reference area; />The representation takes absolute value.
6. The method for dividing the rusted region of the steel rail bolt based on the image characteristics according to claim 1, wherein the method for average integration of all initial dividing thresholds to obtain the dividing threshold of each core threshold region comprises the following specific steps:
and (3) for any core threshold region, rounding and rounding the average value of the initial segmentation threshold values of the core threshold region and all traditional comparison reference regions of the core threshold region, and recording the rounded result as the segmentation threshold value of the core threshold region.
7. The method for dividing the rusted region of the steel rail bolt based on the image characteristics according to claim 1, wherein the method for dividing the gray level image of the steel rail bolt according to the final self-adaptive threshold value to obtain a plurality of rusted regions comprises the following specific steps:
and for any steel rail bolt gray level image, taking the final self-adaptive threshold value of the steel rail bolt gray level image as the self-adaptive threshold value, carrying out self-adaptive threshold value segmentation on the steel rail bolt gray level image according to the self-adaptive threshold value to obtain a plurality of segmentation areas, and marking the segmentation areas as rust areas.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311523044.8A CN117237396B (en) | 2023-11-16 | 2023-11-16 | Rail bolt rust area segmentation method based on image characteristics |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311523044.8A CN117237396B (en) | 2023-11-16 | 2023-11-16 | Rail bolt rust area segmentation method based on image characteristics |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117237396A CN117237396A (en) | 2023-12-15 |
CN117237396B true CN117237396B (en) | 2024-02-06 |
Family
ID=89095266
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311523044.8A Active CN117237396B (en) | 2023-11-16 | 2023-11-16 | Rail bolt rust area segmentation method based on image characteristics |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117237396B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117437247B (en) * | 2023-12-18 | 2024-03-05 | 津泰(天津)医疗器械有限公司 | Lesion region extraction and segmentation method based on natural cavity image |
CN117541605B (en) * | 2024-01-09 | 2024-03-29 | 山东华中重钢有限公司 | Rapid segmentation method for rusted image area of steel structure |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102222346A (en) * | 2011-05-23 | 2011-10-19 | 北京云加速信息技术有限公司 | Vehicle detecting and tracking method |
CN102637257A (en) * | 2012-03-22 | 2012-08-15 | 北京尚易德科技有限公司 | Video-based detection and recognition system and method of vehicles |
CN110334750A (en) * | 2019-06-21 | 2019-10-15 | 西安工程大学 | Iron tower of power transmission line bolt corrosion degree image classification recognition methods |
CN115294159A (en) * | 2022-09-30 | 2022-11-04 | 南通市博洋铸造有限公司 | Method for dividing corroded area of metal fastener |
CN115311292A (en) * | 2022-10-12 | 2022-11-08 | 南通创铭伊诺机械有限公司 | Strip steel surface defect detection method and system based on image processing |
CN115578389A (en) * | 2022-12-08 | 2023-01-06 | 青岛澳芯瑞能半导体科技有限公司 | Defect detection method of groove MOS device |
CN115578476A (en) * | 2022-11-21 | 2023-01-06 | 山东省标筑建筑规划设计有限公司 | Efficient storage method for urban and rural planning data |
WO2023134792A2 (en) * | 2022-12-15 | 2023-07-20 | 苏州迈创信息技术有限公司 | Led lamp wick defect detection method |
-
2023
- 2023-11-16 CN CN202311523044.8A patent/CN117237396B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102222346A (en) * | 2011-05-23 | 2011-10-19 | 北京云加速信息技术有限公司 | Vehicle detecting and tracking method |
CN102637257A (en) * | 2012-03-22 | 2012-08-15 | 北京尚易德科技有限公司 | Video-based detection and recognition system and method of vehicles |
CN110334750A (en) * | 2019-06-21 | 2019-10-15 | 西安工程大学 | Iron tower of power transmission line bolt corrosion degree image classification recognition methods |
CN115294159A (en) * | 2022-09-30 | 2022-11-04 | 南通市博洋铸造有限公司 | Method for dividing corroded area of metal fastener |
CN115311292A (en) * | 2022-10-12 | 2022-11-08 | 南通创铭伊诺机械有限公司 | Strip steel surface defect detection method and system based on image processing |
CN115578476A (en) * | 2022-11-21 | 2023-01-06 | 山东省标筑建筑规划设计有限公司 | Efficient storage method for urban and rural planning data |
CN115578389A (en) * | 2022-12-08 | 2023-01-06 | 青岛澳芯瑞能半导体科技有限公司 | Defect detection method of groove MOS device |
WO2023134792A2 (en) * | 2022-12-15 | 2023-07-20 | 苏州迈创信息技术有限公司 | Led lamp wick defect detection method |
Non-Patent Citations (2)
Title |
---|
Manual and Automatic Image Analysis Segmentation Methods for Blood Flow Studies in Microchannels;Violeta Carvalho et al.;《micromachines》;第1-20页 * |
基于机器视觉的开发板表面缺陷检测技术研究;任韶杰;《中国优秀硕士学位论文全文数据库 信息科技辑 》;I138-444 * |
Also Published As
Publication number | Publication date |
---|---|
CN117237396A (en) | 2023-12-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN117237396B (en) | Rail bolt rust area segmentation method based on image characteristics | |
CN116310360B (en) | Reactor surface defect detection method | |
CN115330783A (en) | Steel wire rope defect detection method | |
CN117078671B (en) | Thyroid ultrasonic image intelligent analysis system | |
CN115858832B (en) | Method and system for storing production data of steel strand | |
CN111507206B (en) | Finger vein identification method based on multi-scale local feature fusion | |
CN115512231B (en) | Remote sensing interpretation method suitable for homeland space ecological restoration | |
CN101499164B (en) | Image interpolation reconstruction method based on single low-resolution image | |
CN116152505B (en) | Bone target identification and segmentation method based on X-ray data | |
CN116385472B (en) | Hardware stamping part deburring effect evaluation method | |
CN110163123B (en) | Fingerprint finger vein fusion identification method based on single near-infrared finger image | |
CN115984148B (en) | Denoising enhancement method for high-throughput gene sequencing data | |
CN115311375B (en) | Compression storage and transmission method and system for data of check fabric | |
CN115115641B (en) | Pupil image segmentation method | |
CN111369623A (en) | Lung CT image identification method based on deep learning 3D target detection | |
CN117893527B (en) | New energy storage box surface defect detection method | |
CN116843692B (en) | Regenerated active carbon state detection method based on artificial intelligence | |
CN110335322B (en) | Road recognition method and road recognition device based on image | |
CN117274820B (en) | Map data acquisition method and system for mapping geographic information | |
CN117314940B (en) | Laser cutting part contour rapid segmentation method based on artificial intelligence | |
CN117291843B (en) | Efficient management method for image database | |
CN117392155A (en) | High-throughput gene sequencing data processing method based on image processing | |
CN116777845B (en) | Building site safety risk intelligent assessment method and system based on artificial intelligence | |
CN116402816B (en) | Physical examination CT image data management method and system | |
CN110288540B (en) | Carbon fiber wire X-ray image online imaging standardization method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |