CN118097676B - Downhole tool tag monitoring system based on image processing - Google Patents
Downhole tool tag monitoring system based on image processing Download PDFInfo
- Publication number
- CN118097676B CN118097676B CN202410496920.0A CN202410496920A CN118097676B CN 118097676 B CN118097676 B CN 118097676B CN 202410496920 A CN202410496920 A CN 202410496920A CN 118097676 B CN118097676 B CN 118097676B
- Authority
- CN
- China
- Prior art keywords
- determined
- text region
- pixel point
- text
- pixel
- 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
- 238000012545 processing Methods 0.000 title claims abstract description 19
- 238000012544 monitoring process Methods 0.000 title claims abstract description 11
- 229910000831 Steel Inorganic materials 0.000 claims abstract description 102
- 239000010959 steel Substances 0.000 claims abstract description 102
- 238000000034 method Methods 0.000 claims abstract description 28
- 230000002708 enhancing effect Effects 0.000 claims abstract description 5
- 238000004458 analytical method Methods 0.000 claims description 24
- 238000009826 distribution Methods 0.000 claims description 17
- 238000012937 correction Methods 0.000 claims description 14
- 229910001315 Tool steel Inorganic materials 0.000 abstract description 4
- 238000012015 optical character recognition Methods 0.000 description 5
- 238000005299 abrasion Methods 0.000 description 4
- 238000005452 bending Methods 0.000 description 4
- 238000013528 artificial neural network Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000007726 management method Methods 0.000 description 2
- 239000003208 petroleum Substances 0.000 description 2
- 230000011218 segmentation Effects 0.000 description 2
- 238000003860 storage Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000003111 delayed effect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000004519 manufacturing process 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
Landscapes
- Character Input (AREA)
- Image Analysis (AREA)
Abstract
The invention belongs to the technical field of image processing, and particularly relates to an underground tool tag monitoring system based on image processing, which comprises the following components: the device comprises an image acquisition module, an image processing module, a region dividing module, a fuzzy pixel point acquisition module and a label identification module. Obtaining a determined text region and a text region to be determined according to character recognition results of all text regions in the steel code image, obtaining probability that each pixel point in the text region to be determined belongs to a fuzzy pixel point, further obtaining the fuzzy pixel point in the text region to be determined, enhancing the fuzzy pixel point in the text region to be determined, obtaining an enhanced text region to be determined, and determining a label corresponding to the steel code image according to the enhanced character recognition results of the text region to be determined and the character recognition results of the text region to be determined. The method improves the accuracy of label identification of the underground tool steel code.
Description
Technical Field
The invention relates to the technical field of image processing. More particularly, the present invention relates to a downhole tool tag monitoring system based on image processing.
Background
The underground tools are various, and the traditional paper mode is registered and then recorded into the system, so that once the recording is delayed due to other works, the machine account is unclear, the tool state cannot be acquired in real time, and the normal production operation of the business department is influenced.
The steel code of the downhole tool is scanned and confirmed through the hand-held machine, the downhole tool is put in storage, the account of the system is automatically updated, and scanning is needed when the downhole tool goes out of the warehouse and returns to monitor the service condition of the downhole tool, so that the digital management of the downhole tool is realized.
In the using process of the downhole tool, the steel code is worn, so that part of characters of the collected steel code surface image are blurred, and as the downhole tool is of a tubular structure, the steel code is required to be completely attached to the surface of the downhole tool when assembled on the downhole tool, the steel code is bent, so that the steel code surface is affected by light, and the part of characters of the collected steel code surface image are blurred; the characters are fuzzy due to abrasion and light influence, and when the downhole tool steel codes are identified through the hand-held machine, part of the characters cannot be accurately identified.
Disclosure of Invention
In order to solve the technical problem that when the underground tool steel code is identified through the hand-held machine, the characters are fuzzy due to abrasion and light influence, and further partial characters cannot be accurately identified, the invention provides the following aspects.
A downhole tool tag monitoring system based on image processing, the system comprising the following modules:
The image acquisition module is used for acquiring the steel surface images;
The image processing module is used for determining the representative gray value of the mimeograph area according to the distribution condition of the neighborhood gray mean value of all pixel points in the steel surface image; determining the probability that each pixel belongs to the mimeograph region according to the difference between the neighborhood gray average value of each pixel and the representative gray value of the mimeograph region and the gradient amplitude value of each pixel; according to the gray distribution of all pixel points, determining a representative gray value H of a background area; setting the gray value of the pixel point with the probability of belonging to the mimeograph area larger than a preset first threshold value as H, and obtaining a steel code image;
The region dividing module is used for dividing the steel code image to obtain a plurality of text regions in the steel code image; dividing all the text areas into a determined text area and a text area to be determined according to the probability that each text area belongs to each character;
the fuzzy pixel point acquisition module is used for acquiring fuzzy pixel points in the determined text region according to the gradient amplitude values of the pixel points in the determined text region; according to the gradient amplitude and gradient direction of the pixel points in the pixel point neighborhood, acquiring the theoretical gradient direction of each pixel point in the text region to be determined and determining the theoretical gradient direction of each fuzzy pixel point in the text region; obtaining the probability that each pixel point in the text region to be determined belongs to a fuzzy pixel point according to the gradient amplitude difference, the gray value difference and the theoretical gradient direction difference of each pixel point in the text region to be determined and all fuzzy pixel points belonging to the determined text region in the analysis region; acquiring fuzzy pixel points in a text region to be determined according to the probability of the fuzzy pixel points;
The tag identification module is used for enhancing the fuzzy pixel points in the text region to be determined to obtain an enhanced text region to be determined; and determining the label corresponding to the steel code image according to the enhanced character recognition result of the text region to be determined and the character recognition result of the text region.
In one embodiment, the probability that each pixel belongs to the mimeograph area satisfies the expression:
;
In the method, in the process of the invention, Representing the probability that the ith pixel point belongs to the mimeograph area, i represents the serial number of the pixel point, i takes all integers in the range of pass [1, L ], L represents the number of all the pixel points in the steel surface image,Representing the neighborhood gray scale average of the ith pixel point,Representing the representative gray value of the mimeograph area,Representing the gradient magnitude of the i-th pixel,An exponential function based on a natural constant is represented.
In one embodiment, the theoretical gradient direction of the pixel satisfies the expression:
;
wherein F represents the theoretical gradient direction of the pixel points, M represents the number of reference pixel points of the pixel points, Representing the gradient amplitude of the mth reference pixel point of the pixel point, m represents the serial number of the reference pixel point, m takes all integers in the range of [1, M ], T represents the sum of the gradient amplitudes of all the reference pixel points of the pixel point,Representing the gradient direction of the mth reference pixel point of the pixel point;
The reference pixel point of the pixel point refers to a pixel point in which all gradient amplitude values are not smaller than a preset gradient amplitude threshold value in the neighborhood of the pixel point.
In one embodiment, the probability that each pixel point in the text region to be determined belongs to a blurred pixel point satisfies the expression:
;
In the method, in the process of the invention, Representing the probability that the j-th pixel point in the text area to be determined belongs to the fuzzy pixel point, j represents the serial number of the pixel point, j takes all integers in the range of [1, A ], A represents the number of all the pixel points in the text area to be determined,Representing the number of blurred pixels belonging to the determined text region in the analysis region of the j-th pixel in the text region to be determined,Represents the gray value of the j-th pixel point in the text region to be determined,Representing the gradient magnitude of the j-th pixel in the text region to be determined,Represents the theoretical gradient direction of the j-th pixel point in the text region to be determined,Representing the gray value of the nth fuzzy pixel belonging to the determined text region in the analysis region of the jth pixel in the text region to be determined,Representing the gradient amplitude of the nth blurred pixel point belonging to the determined text region in the analysis region of the jth pixel point in the text region to be determined,The theoretical gradient direction of the nth fuzzy pixel point belonging to the determined text area in the analysis area of the jth pixel point in the text area to be determined is represented, n represents the serial number of the fuzzy pixel point belonging to the determined text area in the analysis area, n is taken over 1,All integers in the range, Z1 represents a first parameter, Z2 represents a second parameter,An exponential function that is based on a natural constant;
the analysis area refers to an area formed by a column in which the pixel point is located and two adjacent columns of the column in which the pixel point is located.
In one embodiment, the enhancing the blurred pixel points in the text region to be determined to obtain the enhanced text region to be determined includes:
Taking pixel points with gradient amplitude values larger than a preset gradient amplitude value in a text region to be determined as clear pixel points in the text region to be determined, and marking the gray value average value of all the clear pixel points as G;
And setting the gray value of the fuzzy pixel point in the text region to be determined as G to obtain the enhanced text region to be determined.
In one embodiment, the dividing all text areas into the determined text area and the text area to be determined according to the probability that each text area belongs to each character includes:
For any text region, if the maximum value of the probability that the text region belongs to each character is larger than a preset second threshold value, taking the text region as a determined text region, and taking the character corresponding to the maximum value of the probability as a character recognition result of the determined text region; and if the maximum value of the probability that the text region belongs to each character is not greater than a preset second threshold value, taking the text region as the text region to be determined.
In one embodiment, the determining the label corresponding to the steel code image includes:
Matching with all downhole tool labels stored in a database according to character recognition results of all the determined text areas to obtain matching results; deleting all character recognition results of the determined text region from the characters contained in each matching result, and taking the rest characters in all the matching results as possible characters;
Determining the correction probability of the enhanced text region to be determined belonging to each character according to the probability of the enhanced text region to be determined belonging to each character and the occurrence times of each character in all possible characters;
if the maximum value of the correction probability of the enhanced text region to be determined belonging to each character is not greater than a preset second threshold value, manually identifying the text region to be determined to obtain a character identification result of the enhanced text region to be determined; if the maximum value of the correction probability of the enhanced text region to be determined belonging to each character is larger than a preset second threshold value, the character corresponding to the maximum value of the correction probability of the enhanced text region to be determined belonging to each character is used as a character recognition result of the enhanced text region to be determined;
And taking the character recognition results of all the determined text areas and the character recognition results of all the enhanced text areas to be determined as labels corresponding to the steel surface images.
In one embodiment, the enhanced correction probability of the text region to be determined belonging to each character satisfies the expression:
;
In the method, in the process of the invention, Representing the modified probability that the enhanced text region to be determined belongs to the d-th character,Representing the probability that the enhanced text region to be determined belongs to the d-th character,Representing the number of occurrences of the D-th character in all possible characters, Q representing the number of all possible characters, D representing the sequence number of the character, D taking an integer in the range of [1, D ], and D representing the number of all characters.
In one embodiment, the determining the representative gray value of the mimeograph area according to the distribution of the neighborhood gray mean values of all the pixel points in the steel surface image includes:
for each pixel point, taking the average value of gray values of each pixel point and all pixel points in 8 neighborhoods of each pixel point as the neighborhood gray average value of each pixel point; constructing a neighborhood gray average histogram of the steel code surface image according to the neighborhood gray average of all the pixel points;
and taking the neighborhood gray average value corresponding to the peak value with the smallest abscissa among all peak values of the neighborhood gray average value histogram of the steel surface image as the representative gray value of the mimeograph area.
In one embodiment, the determining the representative gray value H of the background area according to the gray distribution of all the pixel points includes:
According to the gray values of all the pixel points, constructing a gray histogram of the steel surface image; and taking a gray value corresponding to the peak with the largest frequency among all peaks of the gray histogram of the steel surface image as a representative gray value H of the background area.
The invention has the beneficial effects that:
According to the method, all text areas in a steel code image are divided into a determined text area and a text area to be determined according to the probability that each text area belongs to each character, based on the characteristic that the same bending degree of each column in the steel code image leads to the same light influence degree in each column and the characteristic that the pixels with the same gradient direction are subjected to the same light influence degree, according to the gradient amplitude difference, the gray value difference and the theoretical gradient direction difference of each pixel in the text area to be determined and all fuzzy pixels belonging to the determined text area in the analysis area, the probability that each pixel in the text area to be determined belongs to the fuzzy pixels is obtained, the fuzzy pixels in the text area to be determined are obtained according to the probability that the fuzzy pixels belong to the fuzzy pixels, the pixels representing important character characteristics are enhanced, the labels corresponding to the steel code image are determined according to the character recognition result of the enhanced text area to be determined, the label corresponding to the steel code image is eliminated, and the label corresponding to the steel code is improved when the steel code is recognized by a downhole tool.
According to the distribution condition of the neighborhood gray average value of all the pixel points in the steel code surface image, the representative gray value of the mimeograph area is determined, the probability that each pixel point belongs to the mimeograph area is determined according to the difference between the neighborhood gray average value of each pixel point and the representative gray value of the mimeograph area and the gradient amplitude of each pixel point, the representative gray value H of the background area is determined according to the distribution condition of the gray of all the pixel points, the gray value of the pixel point with the probability of the mimeograph area being larger than the preset first threshold value is set as H, the steel code image is obtained, the pixel points belonging to the mimeograph area are processed, the steel code image excluding the mimeograph interference is obtained, and the accuracy of the subsequent label identification is improved.
Drawings
The above, as well as additional purposes, features, and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description when read in conjunction with the accompanying drawings. In the drawings, embodiments of the invention are illustrated by way of example and not by way of limitation, and like reference numerals refer to similar or corresponding parts and in which:
FIG. 1 schematically illustrates a system block diagram of a downhole tool tag monitoring system based on image processing in accordance with the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
The invention provides a downhole tool tag monitoring system based on image processing. As shown in fig. 1, the following is a specific description.
The image acquisition module 101 is used for acquiring the steel surface image.
Specifically, the steel code of the downhole tool needs to be scanned and identified through the hand-held machine during the delivery and return of the downhole tool, the downhole tool is delivered or put in storage, and the account of the system is automatically updated so as to monitor the service condition of the downhole tool and realize the digital management of the downhole tool.
Firstly, acquiring a surface image of a steel code on a downhole tool through a camera of a handheld machine to serve as a steel code surface image, wherein the steel code surface image is a gray image; during acquisition, the distance between the camera of the handheld machine and the steel code is adjusted, so that the acquired steel code surface image only contains the steel code part, and interference of irrelevant background areas is eliminated.
And the image processing module 102 is used for processing the steel code surface image and determining the steel code image.
It should be noted that, because the downhole tool contacts with petroleum during the use process, the residual mimeograph on the steel surface can affect the subsequent recognition of characters, so the invention needs to recognize the pixels belonging to the mimeograph area in the steel surface image, and process the pixels belonging to the mimeograph area to obtain the steel code image excluding the mimeograph interference.
It should be further noted that, the color of the petroleum is black, so that the gray value of the pixel points belonging to the mimeograph area in the steel surface image is smaller, and the gray value of the pixel points belonging to the character area in the steel surface image is also smaller, and only the pixel points belonging to the mimeograph area are identified by the gray value, which can cause the pixel points belonging to the character area to be incorrectly identified as the pixel points belonging to the mimeograph area; in order to avoid that the pixel points belonging to the character area are wrongly identified as the pixel points belonging to the mimeograph area, the pixel points belonging to the mimeograph area are considered to be connected into one piece, no obvious gradient change exists, and the pixel points belonging to the character area have gradient change, so that the invention combines the gray value and the gradient amplitude to identify the pixel points belonging to the mimeograph area.
Specifically, determining a representative gray value of a mimeograph region according to the distribution condition of the neighborhood gray average values of all pixel points in the steel surface image; determining the probability that each pixel belongs to the mimeograph region according to the difference between the neighborhood gray average value of each pixel and the representative gray value of the mimeograph region and the gradient amplitude value of each pixel; according to the gray distribution of all pixel points, determining a representative gray value H of a background area; and setting the gray value of the pixel points belonging to the mimeograph area in the steel code surface image as H, and obtaining the processed steel code surface image as a steel code image.
The specific value of the preset first threshold value can be set according to the actual application scene and the requirement, the range of the specific value of the preset first threshold value is [0.65,1], and the first threshold value is set to be 0.7.
The determining the representative gray value of the mimeograph area according to the distribution condition of the neighborhood gray average value of all pixel points in the steel code surface image comprises the following steps: for each pixel point, taking the average value of gray values of each pixel point and all pixel points in 8 neighborhoods of each pixel point as the neighborhood gray average value of each pixel point; constructing a neighborhood gray average value histogram of the steel surface image according to the neighborhood gray average values of all the pixel points, wherein the horizontal axis of the neighborhood gray average value histogram is the neighborhood gray average value, the vertical axis is the frequency of each neighborhood gray average value, and the frequency of each neighborhood gray average value represents the ratio of the number of the pixel points corresponding to each neighborhood gray average value to the number of all the pixel points; and taking the neighborhood gray average value corresponding to the peak value with the smallest abscissa among all peak values of the neighborhood gray average value histogram of the steel surface image as the representative gray value of the mimeograph area.
Further, the probability that each pixel belongs to the mimeograph region satisfies the expression:
In the method, in the process of the invention, Representing the probability that the ith pixel point belongs to the mimeograph area, i represents the serial number of the pixel point, i takes all integers in the range of pass [1, L ], L represents the number of all the pixel points in the steel surface image,Representing the neighborhood gray scale average of the ith pixel point,Representing the representative gray value of the mimeograph area,Representing the gradient magnitude of the i-th pixel,An exponential function based on a natural constant is represented.
It should be noted that, for the ith pixel, the smaller the difference between the neighborhood gray average value of the ith pixel and the representative gray value of the mimeograph area, the more likely the ith pixel is the pixel of the mimeograph area, i.e. the probability that the ith pixel belongs to the mimeograph areaThe larger; meanwhile, the smaller the gradient amplitude of the ith pixel point is, the more likely the ith pixel point is the pixel point of the mimeograph area, namely the probability that the ith pixel point belongs to the mimeograph areaThe larger the pixel is, the less likely it is to be the pixel of the character area, thereby avoiding erroneous recognition of the pixel belonging to the character area as the pixel belonging to the mimeograph area.
Since most of the pixels in the steel surface image belong to the background area, the gray level histogram of the steel surface image can determine the representative gray level of the background area, and the gray level of the pixels belonging to the mimeograph area is set as the representative gray level of the background area, so that the mimeograph interference is eliminated.
The determining the representative gray value H of the background area according to the gray distribution of all the pixel points includes: according to the gray values of all the pixel points, a gray level histogram of the steel surface image is constructed, wherein the horizontal axis of the gray level histogram is the gray level value, the vertical axis is the frequency of each gray level value, and the frequency of each gray level value represents the ratio of the number of the pixel points corresponding to each gray level value to the number of all the pixel points; and taking a gray value corresponding to the peak with the largest frequency among all peaks of the gray histogram of the steel surface image as a representative gray value H of the background area.
According to the distribution condition of the neighborhood gray average value of all the pixel points in the steel code surface image, the representative gray value of the mimeograph area is determined, the probability that each pixel point belongs to the mimeograph area is determined according to the difference between the neighborhood gray average value of each pixel point and the representative gray value of the mimeograph area and the gradient amplitude of each pixel point, the representative gray value H of the background area is determined according to the distribution condition of the gray of all the pixel points, the gray value of the pixel point with the probability of the mimeograph area being larger than the preset first threshold value is set as H, the steel code image is obtained, the pixel points belonging to the mimeograph area are processed, the steel code image excluding the mimeograph interference is obtained, and the accuracy of the subsequent label identification is improved.
The region dividing module 103 is configured to divide the steel code image to obtain a plurality of text regions in the steel code image; and dividing all the text areas into a determined text area and a text area to be determined according to the probability that each text area belongs to each character.
When the underground tool steel code is identified through the hand-held machine, the underground tool can cause abrasion of the steel code in the use process, so that part of characters of the collected steel code surface image are blurred, and as the underground tool is of a tubular structure, the steel code is required to be completely attached to the surface of the underground tool when assembled on the underground tool, the steel code is bent, so that the steel code surface is affected by light, and the part of characters of the collected steel code surface image are blurred; the character blurring caused by abrasion and light influence can lead to the fact that partial characters cannot be accurately recognized when character recognition is carried out on the steel surface image through OCR technology; therefore, the invention needs to determine the character which can be accurately identified in the steel surface image, and then carry out enhancement processing on the pixel point corresponding to the character which cannot be accurately identified in the steel surface image according to the gray scale characteristic and the position adjustment of the pixel point corresponding to the character which can be accurately identified in the steel surface image, so that the character is clear and can be accurately identified.
Specifically, segmenting a steel code image by an OCR (Optical Character Recognition ) character segmentation technology to obtain a plurality of text areas in the steel code image; performing character recognition on each text region through a BP (Back Propagation) neural network algorithm, and determining the probability that each text region belongs to each character, wherein the characters comprise all numbers between 0 and 9, all capital English letters and all lowercase English letters, D=62 characters in total, the serial numbers are integers in the range of [1, D ], and D represents the number of all the characters; for any one text region, the sum of probabilities that the text region belongs to each of the 62 characters is 1.
It should be noted that, the OCR character segmentation technique and the BP neural network algorithm are known techniques, and will not be described here.
Further, for any text region, if the maximum value of the probability that the text region belongs to each character is larger than a preset second threshold value, the text region is used as a determined text region, and the character corresponding to the maximum value of the probability is used as a character recognition result of the determined text region; and if the maximum value of the probability that the text region belongs to each character is not greater than a preset second threshold value, taking the text region as the text region to be determined.
The specific value of the preset second threshold value can be set according to the actual application scene and the requirement, the specific value of the preset second threshold value is required to be in the range of [0.5,1], and the second threshold value is set to be 0.75.
The blurred pixel point obtaining module 104 is configured to obtain blurred pixels in the text region to be determined.
It should be noted that, when character recognition is performed on the steel surface image by OCR technology, part of characters cannot be accurately recognized, that is, because fuzzy pixels exist in the text region to be determined, character recognition results of the text region to be determined cannot be obtained, and only those pixels in the text region to be determined are obtained as fuzzy pixels, the fuzzy pixels can be enhanced, so that pixels belonging to character features in the text region to be determined are enhanced, further, character recognition results of the text region to be determined are obtained, and because gray values of the fuzzy pixels of the text region to be determined are close to the representative gray values of the background region, the fuzzy pixels of the text region to be determined cannot be obtained only by the gray values.
It should be further noted that, in the steel code image, since the degree of bending of each column is the same, the degree of influence of the steel code bending on the light of the steel code surface is the same in each column of the steel code image; meanwhile, the distribution directions of the pixel points in the neighborhood of the position of the pixel point are different, and the light influence degrees of the position of the pixel point are also different, namely, the light influence degrees of the pixel points with different gradient directions are different; therefore, in each column, fuzzy pixel points exist in more than the text region to be determined, and fuzzy pixel points also exist in the text region to be determined; for the blurred pixel points existing in the determined text area, the blurred pixel points can be determined according to the clear pixel points in the determined text area, because the character recognition result of the determined text area can be accurately obtained, the pixel points in the determined text area comprise most important characteristics in characters corresponding to the determined text area, the character recognition result of the text area to be determined cannot be accurately obtained, the pixel points in the determined text area comprise less important characteristics in the characters corresponding to the determined text area, and therefore the blurred pixel points in the text area to be determined are not accurately obtained according to the clear pixel points in the text area to be determined. The method comprises the steps of determining the gradient amplitude of each pixel point in a text region according to the gradient amplitude of the pixel point in the text region, obtaining the clear pixel point in the text region according to the clear pixel point, obtaining the fuzzy pixel point in the text region according to the clear pixel point, and obtaining the probability that each pixel point in the text region belongs to the fuzzy pixel point according to the gradient amplitude difference, the gray value difference and the theoretical gradient direction difference of each pixel point in the text region to be determined and all fuzzy pixel points in the adjacent columns of the pixel point; and obtaining the fuzzy pixel points in the text region to be determined according to the probability of the fuzzy pixel points.
Specifically, obtaining the fuzzy pixel point in the text region according to the gradient amplitude of the pixel point includes: and determining the pixel points with gradient amplitude larger than a preset gradient amplitude threshold in the text region as clear pixel points in the determined text region, determining a clear pixel point C closest to the clear pixel point B along the vertical direction of the gradient direction of the clear pixel point B for any clear pixel point B, and taking the pixel points between the clear pixel point B and the clear pixel point C as fuzzy pixel points in the determined text region if the distance between the clear pixel point B and the clear pixel point C is smaller than the preset distance threshold.
The specific values of the preset gradient amplitude value and the preset distance threshold value can be set according to actual application scenes and requirements, the specific value range of the specific value requiring the preset gradient amplitude value is [0,25], the specific value range of the specific value requiring the preset distance threshold value is [3,7], the preset gradient amplitude value is set to 15, and the preset distance threshold value is set to 5.
Further, a theoretical gradient direction of each pixel point in the text region to be determined and a theoretical gradient direction of each fuzzy pixel point in the text region are obtained.
The obtaining the theoretical gradient direction of the pixel point comprises the following steps: taking a rectangular area which takes the pixel point as a center and has the size of K multiplied by K as a neighborhood of the pixel point, wherein K represents a preset number; in the neighborhood of the pixel point, all the pixel points with gradient amplitude values not smaller than a preset gradient amplitude threshold value are used as reference pixel points of the pixel point, the theoretical gradient direction of the pixel point is determined according to the gradient amplitude values and the gradient directions of all the reference pixel points, and the theoretical gradient direction of the pixel point meets the expression:
;
wherein F represents the theoretical gradient direction of the pixel points, M represents the number of reference pixel points of the pixel points, Representing the gradient amplitude of the mth reference pixel point of the pixel point, m represents the serial number of the reference pixel point, m takes all integers in the range of [1, M ], T represents the sum of the gradient amplitudes of all the reference pixel points of the pixel point,And representing the gradient direction of the mth reference pixel point of the pixel point.
The specific numerical value of the preset number can be set according to the actual application scene and the requirement, the range of the specific numerical value of the preset number is [3,10], and the preset number is set to be 7.
It should be noted that, the larger the gradient amplitude, the more likely it is that the reference pixel belongs to the pixel corresponding to the character, so the more the gradient amplitude has reference to the theoretical gradient direction of the pixel, and therefore, the more the gradient amplitude will beAnd weighting the gradient direction of the mth reference pixel point of the pixel point as the weight of the mth reference pixel point of the pixel point, and determining the theoretical gradient direction of the pixel point.
Further, for any one pixel point in the text region to be determined, taking a region formed by the column in which the pixel point is located and two adjacent columns of the column in which the pixel point is located as an analysis region of the pixel point; obtaining the probability that the pixel belongs to the fuzzy pixel according to the gradient amplitude difference, the gray value difference and the theoretical gradient direction difference of the pixel and all the fuzzy pixels belonging to the determined text region in the analysis region, wherein the probability that the pixel belongs to the fuzzy pixel in the text region to be determined meets the expression:
;
In the method, in the process of the invention, Representing the probability that the j-th pixel point in the text area to be determined belongs to the fuzzy pixel point, j represents the serial number of the pixel point, j takes all integers in the range of [1, A ], A represents the number of all the pixel points in the text area to be determined,Representing the number of blurred pixels belonging to the determined text region in the analysis region of the j-th pixel in the text region to be determined,Represents the gray value of the j-th pixel point in the text region to be determined,Representing the gradient magnitude of the j-th pixel in the text region to be determined,Represents the theoretical gradient direction of the j-th pixel point in the text region to be determined,Representing the gray value of the nth fuzzy pixel belonging to the determined text region in the analysis region of the jth pixel in the text region to be determined,Representing the gradient amplitude of the nth blurred pixel point belonging to the determined text region in the analysis region of the jth pixel point in the text region to be determined,The theoretical gradient direction of the nth fuzzy pixel point belonging to the determined text area in the analysis area of the jth pixel point in the text area to be determined is represented, n represents the serial number of the fuzzy pixel point belonging to the determined text area in the analysis area, n is taken over 1,All integers in the range, Z1 represents a first parameter, Z2 represents a second parameter, z1=30, z2=360,An exponential function based on a natural constant is represented.
It should be noted that, the smaller the gradient amplitude difference and the gray value difference between a pixel point in the text region to be determined and all the fuzzy pixel points belonging to the determined text region in the analysis region are, the more similar the characteristics of the pixel point are to those of the fuzzy pixel point, the more likely the pixel point is a fuzzy pixel point, and the greater the probability that the pixel point belongs to the fuzzy pixel point is; the more similar the features of two similar points of the theoretical gradient direction difference should be, therefore, the less the theoretical gradient direction difference with the pixel is, the more the features have reference meaning to the pixel, the more the features of the blurred pixel are, the more the blurred pixel has the reference meaning to the pixel, the more the blurred pixel isTo implement the logic described above,Within the range of [0,1], thusThe smaller theThe larger the pixel is, the more likely the pixel is a blurred pixel, and the greater the probability that the pixel belongs to the blurred pixel.
Further, the pixel points, which belong to the fuzzy pixel points in the text area to be determined and have the probability larger than a preset third threshold value, are used as the fuzzy pixel points in the text area to be determined.
The specific value of the preset third threshold value can be set according to the actual application scene and the requirement, the range of the specific value of the preset third threshold value is [0.5,1], and the invention sets the third threshold value to 0.8.
The tag identification module 105 is configured to enhance the blurred pixel points in the text region to be determined, and obtain an enhanced text region to be determined; and determining the label corresponding to the steel code image according to the enhanced character recognition result of the text region to be determined and the character recognition result of the text region.
Specifically, pixel points with gradient amplitude larger than a preset gradient amplitude threshold value in the text region to be determined are used as clear pixel points in the text region to be determined, the gray value average value of all the clear pixel points is recorded as G, the gray value of the fuzzy pixel points in the text region to be determined is set as G, so that the fuzzy pixel points in the text region to be determined are enhanced, and the enhanced text region to be determined is obtained.
Further, character recognition is carried out on the enhanced text region to be determined through a BP neural network algorithm, and the probability that the enhanced text region to be determined belongs to each character is determined.
Further, according to the character recognition results of all the determined text areas, matching with all the downhole tool labels stored in the database to obtain matching results; and deleting all character recognition results of the determined text region from the characters contained in each matching result, and taking the rest characters in all the matching results as possible characters.
According to the probability that the enhanced text region to be determined belongs to each character and the occurrence times of each character in all possible characters, determining the correction probability that the enhanced text region to be determined belongs to each character, wherein the correction probability that the enhanced text region to be determined belongs to each character satisfies the expression:
;
In the method, in the process of the invention, Representing the modified probability that the enhanced text region to be determined belongs to the d-th character,Representing the probability that the enhanced text region to be determined belongs to the d-th character,Representing the number of occurrences of the D-th character in all possible characters, Q representing the number of all possible characters, D representing the sequence number of the character, D taking an integer in the range of [1, D ], and D representing the number of all characters.
If the maximum value of the correction probability of the enhanced text region to be determined belonging to each character is not greater than a preset second threshold value, manually identifying the text region to be determined to obtain a character identification result of the enhanced text region to be determined; if the maximum value of the correction probability of the enhanced text region to be determined belonging to each character is larger than a preset second threshold value, the character corresponding to the maximum value of the correction probability of the enhanced text region to be determined belonging to each character is used as the character recognition result of the enhanced text region to be determined.
And taking the character recognition results of all the determined text areas and the character recognition results of all the enhanced text areas to be determined as labels corresponding to the steel surface images, so as to obtain the label recognition results of the downhole tool, warehousing the downhole tool according to the label recognition results of the downhole tool, and automatically updating the ledger of the system.
According to the method, all text areas in a steel code image are divided into a determined text area and a text area to be determined according to the probability that each text area belongs to each character, based on the characteristic that the same bending degree of each column in the steel code image leads to the same light influence degree in each column and the characteristic that the pixels with the same gradient direction are subjected to the same light influence degree, according to the gradient amplitude difference, the gray value difference and the theoretical gradient direction difference of each pixel in the text area to be determined and all fuzzy pixels belonging to the determined text area in the analysis area, the probability that each pixel in the text area to be determined belongs to the fuzzy pixels is obtained, the fuzzy pixels in the text area to be determined are obtained according to the probability that the fuzzy pixels belong to the fuzzy pixels, the pixels representing important character characteristics are enhanced, the labels corresponding to the steel code image are determined according to the character recognition result of the enhanced text area to be determined, the label corresponding to the steel code image is eliminated, and the label corresponding to the steel code is improved when the steel code is recognized by a downhole tool.
In the description of the present specification, the meaning of "a plurality", "a number" or "a plurality" is at least two, for example, two, three or more, etc., unless explicitly defined otherwise.
While various embodiments of the present invention have been shown and described herein, it will be obvious to those skilled in the art that such embodiments are provided by way of example only. Many modifications, changes, and substitutions will now occur to those skilled in the art without departing from the spirit and scope of the invention. It should be understood that various alternatives to the embodiments of the invention described herein may be employed in practicing the invention.
Claims (6)
1. A downhole tool tag monitoring system based on image processing, comprising:
The image acquisition module is used for acquiring the steel surface images;
The image processing module is used for determining the representative gray value of the mimeograph area according to the distribution condition of the neighborhood gray mean value of all pixel points in the steel surface image; according to the difference between the neighborhood gray average value of each pixel point and the representative gray value of the mimeograph area and the gradient amplitude value of each pixel point, determining the probability that each pixel point belongs to the mimeograph area, and satisfying the expression:
;
In the method, in the process of the invention, Representing the probability that the ith pixel point belongs to the mimeograph area, i represents the serial number of the pixel point, i takes all integers in the range of pass [1, L ], L represents the number of all the pixel points in the steel surface image,Representing the neighborhood gray scale average of the ith pixel point,Representing the representative gray value of the mimeograph area,Representing the gradient magnitude of the i-th pixel,An exponential function that is based on a natural constant; according to the gray distribution of all pixel points, determining a representative gray value H of a background area; setting the gray value of the pixel point with the probability of belonging to the mimeograph area larger than a preset first threshold value as H, and obtaining a steel code image;
The region dividing module is used for dividing the steel code image to obtain a plurality of text regions in the steel code image; dividing all the text areas into a determined text area and a text area to be determined according to the probability that each text area belongs to each character;
The fuzzy pixel point acquisition module is used for acquiring fuzzy pixel points in the determined text region according to the gradient amplitude values of the pixel points in the determined text region; according to the gradient amplitude and gradient direction of the pixel points in the pixel point neighborhood, acquiring the theoretical gradient direction of each pixel point in the text region to be determined and determining the theoretical gradient direction of each fuzzy pixel point in the text region, wherein the theoretical gradient direction of the pixel points meets the expression:
;
wherein F represents the theoretical gradient direction of the pixel points, M represents the number of reference pixel points of the pixel points, Representing the gradient amplitude of the mth reference pixel point of the pixel point, m represents the serial number of the reference pixel point, m takes all integers in the range of [1, M ], T represents the sum of the gradient amplitudes of all the reference pixel points of the pixel point,Representing the gradient direction of the mth reference pixel point of the pixel point;
The reference pixel point of the pixel point refers to a pixel point in which all gradient amplitude values are not smaller than a preset gradient amplitude value threshold value in the neighborhood of the pixel point; according to the gradient amplitude difference, the gray value difference and the theoretical gradient direction difference of each pixel point in the text region to be determined and all the fuzzy pixel points belonging to the text region in the analysis region, the probability that each pixel point in the text region to be determined belongs to the fuzzy pixel points is obtained, and the expression is satisfied:
;
In the method, in the process of the invention, Representing the probability that the j-th pixel point in the text area to be determined belongs to the fuzzy pixel point, j represents the serial number of the pixel point, j takes all integers in the range of [1, A ], A represents the number of all the pixel points in the text area to be determined,Representing the number of blurred pixels belonging to the determined text region in the analysis region of the j-th pixel in the text region to be determined,Represents the gray value of the j-th pixel point in the text region to be determined,Representing the gradient magnitude of the j-th pixel in the text region to be determined,Represents the theoretical gradient direction of the j-th pixel point in the text region to be determined,Representing the gray value of the nth fuzzy pixel belonging to the determined text region in the analysis region of the jth pixel in the text region to be determined,Representing the gradient amplitude of the nth blurred pixel point belonging to the determined text region in the analysis region of the jth pixel point in the text region to be determined,The theoretical gradient direction of the nth fuzzy pixel point belonging to the determined text area in the analysis area of the jth pixel point in the text area to be determined is represented, n represents the serial number of the fuzzy pixel point belonging to the determined text area in the analysis area, n is taken over 1,All integers in the range, Z1 represents a first parameter, Z2 represents a second parameter,An exponential function that is based on a natural constant;
The analysis area is an area formed by a column in which the pixel point is positioned and two adjacent columns of the column in which the pixel point is positioned; acquiring fuzzy pixel points in a text region to be determined according to the probability of the fuzzy pixel points;
the tag identification module is used for enhancing the fuzzy pixel points in the text region to be determined to obtain an enhanced text region to be determined; according to the enhanced character recognition result of the text region to be determined and the character recognition result of the text region to be determined, determining the label corresponding to the steel code image comprises the following steps:
Matching with all downhole tool labels stored in a database according to character recognition results of all the determined text areas to obtain matching results; deleting all character recognition results of the determined text region from the characters contained in each matching result, and taking the rest characters in all the matching results as possible characters;
Determining the correction probability of the enhanced text region to be determined belonging to each character according to the probability of the enhanced text region to be determined belonging to each character and the occurrence times of each character in all possible characters;
if the maximum value of the correction probability of the enhanced text region to be determined belonging to each character is not greater than a preset second threshold value, manually identifying the text region to be determined to obtain a character identification result of the enhanced text region to be determined; if the maximum value of the correction probability of the enhanced text region to be determined belonging to each character is larger than a preset second threshold value, the character corresponding to the maximum value of the correction probability of the enhanced text region to be determined belonging to each character is used as a character recognition result of the enhanced text region to be determined;
And taking the character recognition results of all the determined text areas and the character recognition results of all the enhanced text areas to be determined as labels corresponding to the steel surface images.
2. The image processing-based downhole tool tag monitoring system of claim 1, wherein the enhancing the blurred pixels in the text area to be determined to obtain the enhanced text area to be determined comprises:
Taking pixel points with gradient amplitude values larger than a preset gradient amplitude value in a text region to be determined as clear pixel points in the text region to be determined, and marking the gray value average value of all the clear pixel points as G;
And setting the gray value of the fuzzy pixel point in the text region to be determined as G to obtain the enhanced text region to be determined.
3. The image processing-based downhole tool tag monitoring system of claim 1, wherein the dividing all text regions into a determined text region and a text region to be determined according to probabilities that each text region belongs to each character comprises:
For any text region, if the maximum value of the probability that the text region belongs to each character is larger than a preset second threshold value, taking the text region as a determined text region, and taking the character corresponding to the maximum value of the probability as a character recognition result of the determined text region; and if the maximum value of the probability that the text region belongs to each character is not greater than a preset second threshold value, taking the text region as the text region to be determined.
4. The image processing-based downhole tool tag monitoring system of claim 1, wherein the modified probabilities that the enhanced text region to be determined belongs to each character satisfy the expression:
;
In the method, in the process of the invention, Representing the modified probability that the enhanced text region to be determined belongs to the d-th character,Representing the probability that the enhanced text region to be determined belongs to the d-th character,Representing the number of occurrences of the D-th character in all possible characters, Q representing the number of all possible characters, D representing the sequence number of the character, D taking an integer in the range of [1, D ], and D representing the number of all characters.
5. The system of claim 1, wherein determining the representative gray value of the mimeograph area based on a distribution of a neighborhood gray mean value of all pixels in the steel surface image comprises:
for each pixel point, taking the average value of gray values of each pixel point and all pixel points in 8 neighborhoods of each pixel point as the neighborhood gray average value of each pixel point; constructing a neighborhood gray average histogram of the steel code surface image according to the neighborhood gray average of all the pixel points;
and taking the neighborhood gray average value corresponding to the peak value with the smallest abscissa among all peak values of the neighborhood gray average value histogram of the steel surface image as the representative gray value of the mimeograph area.
6. The system of claim 1, wherein determining the representative gray value H of the background area according to the gray distribution of all pixels comprises:
According to the gray values of all the pixel points, constructing a gray histogram of the steel surface image; and taking a gray value corresponding to the peak with the largest frequency among all peaks of the gray histogram of the steel surface image as a representative gray value H of the background area.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410496920.0A CN118097676B (en) | 2024-04-24 | 2024-04-24 | Downhole tool tag monitoring system based on image processing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410496920.0A CN118097676B (en) | 2024-04-24 | 2024-04-24 | Downhole tool tag monitoring system based on image processing |
Publications (2)
Publication Number | Publication Date |
---|---|
CN118097676A CN118097676A (en) | 2024-05-28 |
CN118097676B true CN118097676B (en) | 2024-07-09 |
Family
ID=91144337
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410496920.0A Active CN118097676B (en) | 2024-04-24 | 2024-04-24 | Downhole tool tag monitoring system based on image processing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118097676B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116934748A (en) * | 2023-09-15 | 2023-10-24 | 山东重交路桥工程有限公司 | Pavement crack detection system based on emulsified high-viscosity asphalt |
CN117542003A (en) * | 2024-01-08 | 2024-02-09 | 大连天成电子有限公司 | Freight train model judging method based on image feature analysis |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105894459A (en) * | 2015-12-10 | 2016-08-24 | 乐视云计算有限公司 | Gradient value and direction based image sharpening method and device |
CN115578732B (en) * | 2022-11-21 | 2023-03-28 | 山东爱福地生物股份有限公司 | Label identification method for fertilizer production line |
CN117876367B (en) * | 2024-03-11 | 2024-06-07 | 惠州威尔高电子有限公司 | Exposure optimization method for circuit board printing |
-
2024
- 2024-04-24 CN CN202410496920.0A patent/CN118097676B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116934748A (en) * | 2023-09-15 | 2023-10-24 | 山东重交路桥工程有限公司 | Pavement crack detection system based on emulsified high-viscosity asphalt |
CN117542003A (en) * | 2024-01-08 | 2024-02-09 | 大连天成电子有限公司 | Freight train model judging method based on image feature analysis |
Also Published As
Publication number | Publication date |
---|---|
CN118097676A (en) | 2024-05-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5787194A (en) | System and method for image processing using segmentation of images and classification and merging of image segments using a cost function | |
US6151423A (en) | Character recognition with document orientation determination | |
EP0622750A2 (en) | Pattern recognition | |
US4516262A (en) | Character data processing apparatus | |
US20070253040A1 (en) | Color scanning to enhance bitonal image | |
CN114332650B (en) | Remote sensing image road identification method and system | |
CN116071763A (en) | Teaching book intelligent correction system based on character recognition | |
CN115497109B (en) | Character and image preprocessing method based on intelligent translation | |
JP2903923B2 (en) | Car number recognition device | |
US8200016B2 (en) | Method and apparatus for character string recognition | |
CN108427954B (en) | Label information acquisition and recognition system | |
CN112836541B (en) | Automatic acquisition and identification method and device for 32-bit bar code of cigarette | |
CN110210467A (en) | A kind of formula localization method, image processing apparatus, the storage medium of text image | |
Herwanto et al. | Zoning feature extraction for handwritten Javanese character recognition | |
CN113221696A (en) | Image recognition method, system, equipment and storage medium | |
CN118097676B (en) | Downhole tool tag monitoring system based on image processing | |
US6694059B1 (en) | Robustness enhancement and evaluation of image information extraction | |
CN115731550A (en) | Deep learning-based automatic drug specification identification method and system and storage medium | |
CN113537216B (en) | Dot matrix font text line inclination correction method and device | |
EP0684576A2 (en) | Improvements in image processing | |
JPH0256688A (en) | Character segmenting device | |
CN1641681A (en) | Method for rapid inputting character information for mobile terminal with pickup device | |
CN112766082A (en) | Chinese text handwriting identification method and device based on macro-micro characteristics and storage medium | |
Waladi et al. | Automatic Counting Based On Scanned Election Form Using Feature Match and Convolutional Neural Network | |
CN118193652B (en) | Asset type identification method for asset recovery management |
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 |