CN117237350A - Real-time detection method for quality of steel castings - Google Patents

Real-time detection method for quality of steel castings Download PDF

Info

Publication number
CN117237350A
CN117237350A CN202311509082.8A CN202311509082A CN117237350A CN 117237350 A CN117237350 A CN 117237350A CN 202311509082 A CN202311509082 A CN 202311509082A CN 117237350 A CN117237350 A CN 117237350A
Authority
CN
China
Prior art keywords
gray level
analysis
gray
image
subinterval
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.)
Granted
Application number
CN202311509082.8A
Other languages
Chinese (zh)
Other versions
CN117237350B (en
Inventor
李明波
李春林
穆建平
于涛
韩强
卢清涛
穆伟华
穆文东
穆宝成
郝建坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Sanheshan Casting Group Co ltd
Original Assignee
Qingdao Sanheshan Casting Group Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Qingdao Sanheshan Casting Group Co ltd filed Critical Qingdao Sanheshan Casting Group Co ltd
Priority to CN202311509082.8A priority Critical patent/CN117237350B/en
Publication of CN117237350A publication Critical patent/CN117237350A/en
Application granted granted Critical
Publication of CN117237350B publication Critical patent/CN117237350B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Continuous Casting (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to the technical field of image region segmentation, in particular to a real-time detection method for the quality of steel castings. According to the method, analysis gray level is screened out for the first time from gray levels of gray level images of the surface of the steel casting, the analysis gray level of the gray level images of the surface of the steel casting is screened more carefully to obtain target gray level, a final segmentation threshold value for segmenting the gray level images of the surface of the steel casting is obtained according to pixel points corresponding to the target gray level of the gray level images of the surface of the steel casting, and the quality of the steel casting is detected based on the final segmentation threshold value. According to the invention, the gray level of the gray level image on the surface of the steel casting is screened twice, the final image segmentation threshold value is obtained based on the pixel points corresponding to the screened gray level, and the quality detection efficiency of the steel casting is improved.

Description

Real-time detection method for quality of steel castings
Technical Field
The invention relates to the technical field of image region segmentation, in particular to a real-time detection method for the quality of steel castings.
Background
The steel casting is a common mechanical part and is widely applied to various mechanical equipment. The quality of the steel castings is detected in real time, unqualified steel castings are identified, defective steel castings are prevented from participating in the processing of subsequent mechanical equipment, and the possibility of abnormality of the mechanical equipment is reduced. Therefore, the real-time detection of the quality of the steel castings is of great significance.
In the prior art, a threshold value is generally obtained directly on a steel casting surface image by using a maximum inter-class method, and a defect area and a normal surface area in the steel casting surface image are segmented based on the threshold value. In the process of utilizing the maximum inter-class variance method, traversal search is needed for all gray levels of the steel casting surface image, so that the algorithm efficiency is low, and the steel casting quality detection efficiency is low.
Disclosure of Invention
In order to solve the technical problem that the efficiency of steel casting quality detection is low because all gray levels of an image need to be searched for a segmentation threshold value, the invention aims to provide a steel casting quality real-time detection method, and the adopted technical scheme is as follows:
the invention provides a real-time detection method for the quality of a steel casting, which comprises the following steps:
acquiring a gray image of the surface of the steel casting;
screening out analysis gray levels from the gray levels of the gray level image of the surface of the steel casting according to the gray values of the pixels corresponding to each gray level of the gray level image of the surface of the steel casting and the number of pixels corresponding to the gray level adjacent to each gray level;
screening out target gray level from an analysis interval of the gray level image on the surface of the steel casting, wherein an initial interval of the analysis interval is an initial gray level interval constructed based on the analysis gray level; dividing an analysis interval into a preset number of analysis subintervals, screening out one analysis subinterval by using the threshold presence degree of the analysis subinterval, and updating the analysis interval; when the analysis interval does not meet the condition to be selected, updating the analysis interval until the updated analysis interval meets the condition to be selected; when the condition to be selected is met, taking the updated analysis gray level in the analysis interval as a target gray level;
the threshold presence degree obtaining method comprises the following steps: combining the gray difference between the pixel point corresponding to each gray level in the analysis subinterval and the pixel point in the preset neighborhood of the pixel point and the discrete degree of the number of the pixel points corresponding to the gray level in the analysis subinterval to obtain the threshold value existence degree of the analysis subinterval;
acquiring a final image segmentation threshold value for segmenting the gray level image of the surface of the steel casting according to the pixel points corresponding to the target gray level in the gray level image of the surface of the steel casting;
and detecting the quality of the steel castings based on the final image segmentation threshold.
Further, the method for screening out the analysis gray level from the gray level of the gray level image of the surface of the steel casting comprises the following steps:
based on the gray value of the pixel point corresponding to the gray level, sequentially arranging the gray levels of the gray images on the surface of the steel casting to obtain a gray level sequence; taking other gray levels except the gray level in a preset first window of each gray level in the gray level sequence as adjacent gray levels of each gray level;
acquiring a screening coefficient of each gray level of the gray level image of the surface of the steel casting according to the gray value of the pixel corresponding to each gray level of the gray level image of the surface of the steel casting and the number of pixels corresponding to the adjacent gray level of each gray level;
an image gray level interval formed by the minimum gray level and the maximum gray level of the gray level image on the surface of the steel casting is divided into two image subintervals; screening the gray level with the largest screening coefficient in each image subinterval as the target gray level of each image subinterval;
and taking the gray level which is larger than the corresponding target gray level in the first image subinterval and the gray level which is smaller than the corresponding target gray level in the second image subinterval as the analysis gray level of the gray level image of the surface of the steel casting.
Further, the calculation formula of the screening coefficient of each gray level of the gray level image of the surface of the steel casting is as follows:
the method comprises the steps of carrying out a first treatment on the surface of the Wherein C is a screening coefficient of each gray level of the gray level image on the surface of the steel casting; h is the gray value of the pixel point corresponding to each gray level of the gray level image on the surface of the steel casting; num1 is the number of pixel points corresponding to each gray level of the gray level image on the surface of the steel casting; />The number of pixel points corresponding to the ith adjacent gray level of each gray level of the gray level image of the surface of the steel casting; i is the number of adjacent gray levels for each gray level of the gray level image of the surface of the steel casting; />Is a preset value; />As a function of absolute value; exp is an exponential function based on a natural constant e.
Further, the method for acquiring the initial gray level interval comprises the following steps:
the minimum analysis gray level and the maximum analysis gray level of the gray level image of the surface of the steel casting form an initial gray level interval.
Further, the condition to be selected is that the number of gray levels in the updated analysis interval is smaller than a preset number threshold.
Further, the method for obtaining the threshold presence degree of the analysis subinterval by combining the gray level difference between the pixel point corresponding to each gray level in the analysis subinterval and the pixel point in the preset neighborhood of the pixel point and the discrete degree of the number of the pixel points corresponding to the gray level in the analysis subinterval comprises the following steps:
selecting any pixel point corresponding to each gray level in each analysis subinterval as an analysis pixel point, and taking the average value of gray values of the pixel points except the analysis pixel point in a preset second window of the analysis pixel point as a neighborhood gray value of the analysis pixel point;
and obtaining the threshold value existence degree of each analysis subinterval according to the difference between the gray value of the pixel point corresponding to each gray level in each analysis subinterval and the neighborhood gray value and the discrete degree of the number of the pixel points corresponding to the gray level in each analysis subinterval.
Further, the calculation formula of the threshold presence degree is as follows:
the method comprises the steps of carrying out a first treatment on the surface of the Wherein P is the threshold presence of each analysis subinterval; />Standard deviation of the number of pixel points corresponding to all gray levels in each analysis subinterval; k is the number of gray levels in each analysis subinterval; />The number of pixels corresponding to the kth gray level in each analysis subinterval; />The gray value of the pixel point corresponding to the kth gray level in each analysis subinterval is obtained; />The neighborhood gray level of the mth pixel point corresponding to the kth gray level in each analysis subinterval is obtained; />As a function of absolute value.
Further, the method for acquiring the final image segmentation threshold value comprises the following steps:
and taking a threshold value obtained by using a maximum inter-class variance method for the gray value of the pixel point corresponding to the target gray level of the gray image on the surface of the steel casting as a final image segmentation threshold value.
Further, the method for detecting the quality of the steel casting based on the final image segmentation threshold comprises the following steps:
taking a pixel point with the gray value smaller than a final image segmentation threshold value in the gray image of the surface of the steel casting as a defect pixel point; taking the ratio of the number of defective pixel points in the gray level image of the surface of the steel casting to the number of all pixel points as a defect judgment value;
when the defect judgment value is larger than a preset defect threshold value, the quality of the steel casting is unqualified; and when the defect judging value is smaller than or equal to the preset defect threshold value, the steel casting quality is qualified.
Further, the method for dividing the image gray level interval into two image subintervals comprises the following steps:
taking the endpoint value at the left side of the image gray level interval as the endpoint value at the left side of the first image subinterval, and taking the preset value as the endpoint value at the right side of the first image subinterval; taking the sum of the preset value and the constant 1 as the endpoint value of the left side of the second image subinterval and taking the endpoint value of the right side of the image gray level interval as the endpoint value of the right side of the second image subinterval.
The invention has the following beneficial effects:
in the embodiment of the invention, the segmentation threshold is usually positioned in the middle of the gray level histogram of the image, and the number of pixels corresponding to the gray level adjacent to the gray level corresponding to the segmentation threshold is more, so that more information is conveniently provided for the determination of the threshold, and the analysis gray level is initially screened out from the gray level of the gray level image returned from the surface of the steel casting by combining the two factors; dividing an analysis interval which is updated each time into a plurality of analysis subintervals by taking an initial gray level interval formed by the analysis gray levels as an initial interval of the analysis interval, wherein the gray level difference degree around pixels corresponding to the segmentation threshold value and the balance degree of the number of pixels corresponding to each gray level in the analysis subinterval influence the possibility that the segmentation threshold value exists in the analysis subinterval, and acquiring the threshold value existence degree of the analysis subinterval; further screening out analysis subintervals based on the threshold presence degree, updating the analysis intervals until the updated analysis intervals meet the condition to be selected, and taking the gray level in the updated analysis intervals as a target gray level; acquiring a final image segmentation threshold value based on the pixel points corresponding to the screened target gray level, and further detecting the quality of the steel casting; and gray level of gray level images on the surface of the steel casting is screened twice, so that redundant searching is avoided, and the quality detection efficiency of the steel casting is improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions and advantages of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a method for real-time detecting quality of steel castings according to an embodiment of the present invention.
Detailed Description
An embodiment of a method for detecting the quality of a steel casting in real time comprises the following steps:
in order to further describe the technical means and effects adopted by the invention to achieve the preset aim, the following is a real-time detection method for the quality of the steel castings according to the invention, which is provided by combining the accompanying drawings and the preferred embodiment, and the specific implementation, structure, characteristics and effects thereof are described in detail below. 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 invention provides a concrete scheme of a real-time steel casting quality detection method, which is specifically described below with reference to the accompanying drawings.
Referring to fig. 1, a method flowchart of a method for detecting quality of a steel casting in real time according to an embodiment of the invention is shown, where the method includes:
step S1: and acquiring a gray level image of the surface of the steel casting.
Specifically, an industrial camera is used for shooting an image of the surface of the steel casting, and because the image is possibly affected by noise in the image acquisition process, the acquired image needs to be denoised, and then gray-scale processing is carried out to obtain a gray-scale image of the surface of the steel casting.
In the embodiment of the present invention, a non-local mean denoising algorithm is selected for denoising, and a weighted averaging algorithm is used for graying, and the specific method is not described herein, and is a technical means well known to those skilled in the art.
Step S2: and screening out the analysis gray level from the gray level of the gray level image of the surface of the steel casting according to the gray value of the pixel point corresponding to each gray level of the gray level image of the surface of the steel casting and the number of the pixel points corresponding to the gray level adjacent to each gray level.
And acquiring a gray level histogram of the gray level image of the surface of the steel casting, and acquiring the gray level of the gray level image of the surface of the steel casting according to the gray level histogram. In the gray level histogram of the image, the part of gray levels at two sides of the edge of the histogram usually does not contain main information of foreground and background in the gray level image of the surface of the steel casting, and in order to reduce the calculation amount, the part of gray levels needs to be removed.
The defects on the surface of the steel casting are cracks and oxide layers, and both defects can cause brightness change of the surface of the steel casting, so that the number of pixels corresponding to gray levels adjacent to gray levels in an image is changed, and the analysis gray levels of the gray level image on the surface of the steel casting are obtained based on the factors.
Preferably, the specific acquisition method for analyzing the gray level is as follows: based on the gray value of the pixel point corresponding to the gray level, sequentially arranging the gray levels of the gray images on the surface of the steel casting to obtain a gray level sequence; taking other gray levels except the gray level in a preset first window of each gray level in the gray level sequence as adjacent gray levels of each gray level; acquiring a screening coefficient of each gray level of the gray level image of the surface of the steel casting according to the gray value of the pixel corresponding to each gray level of the gray level image of the surface of the steel casting and the number of pixels corresponding to the adjacent gray level of each gray level; an image gray level interval formed by the minimum gray level and the maximum gray level of the gray level image on the surface of the steel casting is divided into two image subintervals; screening the gray level with the largest screening coefficient in each image subinterval as the target gray level of each image subinterval; and taking the gray level which is larger than the corresponding target gray level in the first image subinterval and the gray level which is smaller than the corresponding target gray level in the second image subinterval as the analysis gray level of the gray level image of the surface of the steel casting.
It should be noted that, the preset first window is a one-dimensional window, that is, the width of the preset first window is 1, and the width thereof needs to satisfyA is a positive integer. In the embodiment of the invention, the size of the preset first window takes an empirical value +.>And each gray level in the gray level sequence is positioned at the center of the preset first window.
And combining the gray value of the pixel corresponding to each gray level of the gray image of the surface of the steel casting and the number of the pixel corresponding to the adjacent gray level of each gray level to obtain a screening coefficient of each gray level of the gray image of the surface of the steel casting, wherein the calculation formula of the screening coefficient is as follows:
wherein C is each gray of gray scale image of the surface of the steel castingA screening coefficient of the degree level; h is the gray value of the pixel point corresponding to each gray level of the gray level image on the surface of the steel casting; num1 is the number of pixel points corresponding to each gray level of the gray level image on the surface of the steel casting;the number of pixel points corresponding to the ith adjacent gray level of each gray level of the gray level image of the surface of the steel casting; i is the number of adjacent gray levels for each gray level of the gray level image of the surface of the steel casting; YH is a preset value, and takes an experience value 128; />As a function of absolute value; exp is an exponential function based on a natural constant e.
Since the segmentation threshold obtained by using the maximum inter-class variance method for the image is usually located at the trough position in the middle of the double peaks in the gray level histogram of the image, that is, the segmentation threshold is more intensively distributed in the middle of the gray level range, the preset value YH in the embodiment of the invention takes the checked value 128, and an implementer can set the threshold according to specific situations. When (when)When the gray level is larger, the gray level is closer to the two sides of the gray histogram, and the gray value of the pixel point corresponding to the gray level is a segmentation threshold value; the lower the likelihood, the greater the likelihood of being culled, the greater the screening coefficient C for the gray level.
The area of the defect area in the gray level image of the surface of the steel casting is smaller, and when the number of pixel points corresponding to each gray level is equalThe smaller the gray level, the greater the gray level probability of the pixel point whose gray level is the defective position, the greater the gray level screening coefficient C. The number of pixels corresponding to the adjacent gray level of each gray level>The smaller the pixel point corresponding to the gray level is, the less information is provided for determining the segmentation threshold value, the lower the accuracy of the segmentation threshold value evaluation is, and the possibility of being eliminated is indicatedThe larger the property, the larger the screening coefficient C of the gray level.
An image gray level section composed of the minimum gray level and the maximum gray level of the gray level image of the surface of the steel casting is divided into two image subsections based on the preset value YH.
The method for acquiring the image subinterval comprises the following steps: taking the endpoint value at the left side of the image gray level interval as the endpoint value at the left side of the first image subinterval, and taking the preset value as the endpoint value at the right side of the first image subinterval; taking the sum of the preset value and the constant 1 as the endpoint value of the left side of the second image subinterval and taking the endpoint value of the right side of the image gray level interval as the endpoint value of the right side of the second image subinterval.
As one example: if the image gray level interval isThe first image subinterval is +.>The first image subinterval is +.>. Assuming that 50 is the gray level with the largest screening coefficient in the first image subinterval and 200 is the gray level with the largest screening coefficient in the second image subinterval, the gray level between the gray level 50 and the gray level 200 is used as the analysis gray level of the gray image of the surface of the steel casting. It should be noted that the gray level is a positive integer.
Step S3: screening out target gray level from an analysis interval of the gray level image on the surface of the steel casting, wherein an initial interval of the analysis interval is an initial gray level interval constructed based on the analysis gray level; dividing an analysis interval into a preset number of analysis subintervals, screening out one analysis subinterval by using the threshold presence degree of the analysis subinterval, and updating the analysis interval; when the analysis interval does not meet the condition to be selected, updating the analysis interval until the updated analysis interval meets the condition to be selected; and when the condition to be selected is met, taking the updated analysis gray level in the analysis interval as the target gray level.
And S3, carrying out preliminary rough screening on the gray level of the gray level image on the surface of the steel casting, wherein the screened analysis gray level number is relatively large, and more careful screening is needed, namely screening the target gray level from the analysis gray level of the gray level image on the surface of the steel casting.
The minimum analysis gray level and the maximum analysis gray level of the gray level image of the surface of the steel casting form an initial gray level interval, and the initial gray level interval is assumed to be. Screening out target gray level from analysis interval of gray level image of steel casting surface, wherein initial interval of analysis interval is initial gray level interval, and analyzing interval +.>Dividing into a preset number of analysis subintervals.
The specific method for dividing the analysis interval into a preset number B of analysis subintervals comprises the following steps: the left endpoint value and the right endpoint value of the analysis interval are sequentially as followsAnd->A value obtained by rounding the ratio of the difference between the two end values of the analysis interval and the preset number is used as a subinterval length value +.>,/>Rounding up the symbol; analysis interval is based on subinterval length value L>Sequentially dividing into a preset number of analysis subintervals, wherein the analysis subintervals are sequentially as follows,/>,/>And so on,the method comprises the steps of carrying out a first treatment on the surface of the Since the gray level is an integer, the analysis subinterval corresponds to +.>,/>And so on,
in the embodiment of the invention, the preset number is measured to have an empirical value of 2, and the analysis interval is analyzedDivided into two analysis subintervals, subinterval length value +.>The two analysis subintervals are in turn: />,/>The method comprises the steps of carrying out a first treatment on the surface of the Acquisition ofThreshold presence of->,/>Threshold presence of->The method comprises the steps of carrying out a first treatment on the surface of the The greater the threshold presence degree P, the greater the likelihood of a segmentation threshold being present within the analysis subinterval; by->And->Updating the analysis section by the analysis subsection with the largest threshold presence degree, if +.>The updated analysis interval is +.>
Updated analysis intervalThe number of the inner gray level is 75, and the updated analysis interval is judgedWhether the number of the inner gray levels is smaller than a preset number threshold value or not, if not, acquiring a subinterval length valueThe updated analysis interval +.>Divided into +.>And->Two analysis subintervals. Acquisition->Threshold presence of->,/>Threshold presence of->The method comprises the steps of carrying out a first treatment on the surface of the If->The updated analysis interval is +.>
Updated analysis intervalThe number of inner gray levels is 38, judging +.>Whether the number of the inner gray levels is smaller than a preset number threshold, if not, obtaining a subinterval length value +.>The updated analysis interval +.>Divided into->And->Two analysis subintervals. Acquisition->Threshold degree of presence of (2),/>Threshold presence of->The method comprises the steps of carrying out a first treatment on the surface of the If->The updated analysis interval is +.>
And the like, taking the updated gray level in the analysis interval as the target gray level until the number of the gray levels in the updated analysis interval is smaller than a preset number threshold value.
In the embodiment of the invention, the preset number of threshold values take the experience value of 10, and an implementer can set the threshold values according to specific situations.
The gray level in the analysis section is the analysis gray level of the gray image of the surface of the steel casting.
Step S4: the method for acquiring the threshold presence degree comprises the following steps: and combining the gray level difference between the pixel point corresponding to each gray level in the analysis subinterval and the pixel point in the preset neighborhood of the pixel point and the discrete degree of the number of the pixel points corresponding to the gray level in the analysis subinterval to obtain the threshold value existence degree of the analysis subinterval.
The brightness of the surface of the steel casting is changed due to the defect of the surface, gray level contrast can occur in the image, and the threshold value existence degree of the analysis subinterval is obtained by combining the gray level difference between the pixel point corresponding to each gray level in the analysis subinterval and the pixel point in the preset neighborhood of the analysis subinterval and the discrete degree of the number of the pixel points corresponding to the gray level in the analysis subinterval.
Selecting any pixel point corresponding to each gray level in each analysis subinterval as an analysis pixel point, and taking the average value of gray values of the pixel points except the analysis pixel point in a preset second window of the analysis pixel point as a neighborhood gray value of the analysis pixel point; and obtaining the threshold value existence degree of each analysis subinterval according to the difference between the gray value of the pixel point corresponding to each gray level in each analysis subinterval and the neighborhood gray value and the discrete degree of the number of the pixel points corresponding to the gray level in each analysis subinterval.
In the embodiment of the invention, the size of the preset second window of the analysis pixel point takes an empirical valueThe implementer can set up by himself according to the specific circumstances.
The calculation formula of the threshold presence degree of each analysis subinterval is as follows:
wherein P is the threshold presence of each analysis subinterval;standard deviation of the number of pixel points corresponding to all gray levels in each analysis subinterval; k is the number of gray levels in each analysis subinterval; />The number of pixels corresponding to the kth gray level in each analysis subinterval; />The gray value of the pixel point corresponding to the kth gray level in each analysis subinterval is obtained; />A neighborhood gray value of an mth pixel point corresponding to a kth gray level in each analysis subinterval; />As a function of absolute value.
When (when)When the gray scale difference between the pixel point corresponding to the kth gray scale in the analysis subinterval and the surrounding pixel points is larger, the gray scale fluctuation around the pixel points is obvious; and->The larger the number of pixels, the larger the number of pixels around the pixel corresponding to the kth gray level in the analysis subinterval, the more the gray level fluctuation around the pixel corresponding to the kth gray level in the analysis subinterval is, and the more the gray level of the pixel corresponding to the kth gray level in the analysis subinterval is likely to be the segmentation threshold valueBig (I)>The larger the threshold presence degree P is, the larger it is. />For the possible analysis of the presence of a segmentation threshold in the analysis sub-interval based on a single gray level of the analysis sub-interval, for the overall trend of the analysis sub-interval, all gray levels in the analysis sub-interval are analyzed identically, i.e. & lt/EN & gt>
The distribution threshold of the image is usually located at the trough position of the bimodal position in the gray level histogram, and the surrounding fluctuation of the position is obvious. When analyzing standard deviation of pixel numbers corresponding to all gray scales in the subintervalThe smaller the distribution of the number of the pixels corresponding to the gray level in the analysis subinterval is, the less obvious the fluctuation of the analysis subinterval at the position corresponding to the gray level histogram is, and the smaller the possibility that the segmentation threshold is positioned in the analysis subinterval is, the smaller the threshold existence degree P is.
Step S5: and acquiring a final image segmentation threshold value for segmenting the gray level image of the surface of the steel casting according to the pixel points corresponding to the target gray level in the gray level image of the surface of the steel casting.
And taking a threshold value obtained by using a maximum inter-class variance method for the gray value of the pixel point corresponding to the target gray level of the gray image on the surface of the steel casting as a final image segmentation threshold value. The maximum inter-class variance method is a well-known technique for those skilled in the art, and is not described herein.
Step S6: and detecting the quality of the steel castings based on the final image segmentation threshold.
The cast steel is a high-strength, wear-resistant and corrosion-resistant metal material, the color of the cast steel is usually gray or black, and when defects such as cracks or oxide layers on the surface of the cast steel are illuminated, the gray value of the defect position in the gray image on the surface of the cast steel is larger due to reflection of light.
Therefore, taking the pixel point with the gray value smaller than the final image segmentation threshold value in the gray image of the surface of the steel casting as a defect pixel point; and taking the ratio of the number of defective pixel points in the gray level image of the surface of the steel casting to the number of all pixel points as a defect judgment value. When the defect judgment value is larger than a preset defect threshold value, the quality of the steel casting is unqualified; and when the defect judging value is smaller than or equal to the preset defect threshold value, the steel casting quality is qualified.
In the embodiment of the invention, the preset defect threshold value takes an empirical value of 0.1, and an implementer can set the preset defect threshold value according to specific conditions.
The present invention has been completed.
In summary, in the embodiment of the present invention, the analysis gray level is first selected from the gray levels of the gray level image of the surface of the steel casting, the analysis gray level of the gray level image of the surface of the steel casting is more carefully selected to obtain the target gray level, the final segmentation threshold value for segmenting the gray level image of the surface of the steel casting is obtained according to the pixel point corresponding to the target gray level of the gray level image of the surface of the steel casting, and the quality of the steel casting is detected based on the final segmentation threshold value. According to the invention, the gray level of the gray level image on the surface of the steel casting is screened twice, the final image segmentation threshold value is obtained based on the pixel points corresponding to the screened gray level, and the quality detection efficiency of the steel casting is improved.
An embodiment of a steel casting image segmentation method comprises the following steps:
the steel casting is a common mechanical part and is widely applied to various mechanical equipment. When the surface of the steel casting has defects such as cracks and oxide layers, the image of the surface of the steel casting has obvious gray scale difference, and the image can be divided into a defect area and a normal area. In the prior art, a threshold value is generally obtained by directly utilizing a maximum inter-class method on a steel casting surface image, a defect area and a normal area in the steel casting surface image are segmented based on the threshold value, and all gray levels of the steel casting surface image need to be subjected to traversal search in the process of utilizing the maximum inter-class variance method, so that the algorithm efficiency is low.
In order to solve the technical problem that the image segmentation efficiency of a steel casting is low due to the fact that all gray levels of an image need to be traversed when an image segmentation threshold value is acquired, the invention aims to provide a steel casting image segmentation method, and the adopted technical scheme is as follows:
step S1: acquiring a gray image of the surface of the steel casting;
step S2: screening out analysis gray levels from the gray levels of the gray level image of the surface of the steel casting according to the gray values of the pixels corresponding to each gray level of the gray level image of the surface of the steel casting and the number of pixels corresponding to the gray level adjacent to each gray level;
step S3: screening out target gray level from an analysis interval of the gray level image on the surface of the steel casting, wherein an initial interval of the analysis interval is an initial gray level interval constructed based on the analysis gray level; dividing an analysis interval into a preset number of analysis subintervals, screening out one analysis subinterval by using the threshold presence degree of the analysis subinterval, and updating the analysis interval; when the analysis interval does not meet the condition to be selected, updating the analysis interval until the updated analysis interval meets the condition to be selected; when the condition to be selected is met, taking the updated analysis gray level in the analysis interval as a target gray level;
step S4: the threshold presence degree obtaining method comprises the following steps: combining the gray difference between the pixel point corresponding to each gray level in the analysis subinterval and the pixel point in the preset neighborhood of the pixel point and the discrete degree of the number of the pixel points corresponding to the gray level in the analysis subinterval to obtain the threshold value existence degree of the analysis subinterval;
step S5: and acquiring a final image segmentation threshold value for segmenting the gray level image of the surface of the steel casting according to the pixel points corresponding to the target gray level in the gray level image of the surface of the steel casting.
The embodiment of the invention provides a steel casting image segmentation method, which has the following technical effects:
in the embodiment of the invention, the segmentation threshold is usually positioned in the middle of the gray level histogram of the image, and the number of pixels corresponding to the gray level adjacent to the gray level corresponding to the segmentation threshold is more, so that more information is conveniently provided for the determination of the threshold, and the analysis gray level is initially screened out from the gray level of the gray level image returned from the surface of the steel casting by combining the two factors; dividing an analysis interval which is updated each time into a plurality of analysis subintervals by taking an initial gray level interval formed by the analysis gray levels as an initial interval of the analysis interval, wherein the gray level difference degree around pixels corresponding to the segmentation threshold value and the balance degree of the number of pixels corresponding to each gray level in the analysis subinterval influence the possibility that the segmentation threshold value exists in the analysis subinterval, and acquiring the threshold value existence degree of the analysis subinterval; further screening out analysis subintervals based on the threshold presence degree, updating the analysis intervals until the updated analysis intervals meet the condition to be selected, and taking the gray level in the updated analysis intervals as a target gray level; and acquiring a final image segmentation threshold value based on the pixel points corresponding to the screened target gray level, and screening the gray level of the gray level image on the surface of the steel casting twice, so that redundant searching is avoided, and the acquisition efficiency of the final image segmentation threshold value is improved.
The steps S1 to S5 are already described in detail in the foregoing embodiment of the method for detecting the quality of a steel casting in real time, and will not be described in detail.
It should be noted that: the sequence of the embodiments of the present invention is only for description, and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.

Claims (10)

1. A method for detecting the quality of a steel casting in real time is characterized by comprising the following steps:
acquiring a gray image of the surface of the steel casting;
screening out analysis gray levels from the gray levels of the gray level image of the surface of the steel casting according to the gray values of the pixels corresponding to each gray level of the gray level image of the surface of the steel casting and the number of pixels corresponding to the gray level adjacent to each gray level;
screening out target gray level from an analysis interval of the gray level image on the surface of the steel casting, wherein an initial interval of the analysis interval is an initial gray level interval constructed based on the analysis gray level; dividing an analysis interval into a preset number of analysis subintervals, screening out one analysis subinterval by using the threshold presence degree of the analysis subinterval, and updating the analysis interval; when the analysis interval does not meet the condition to be selected, updating the analysis interval until the updated analysis interval meets the condition to be selected; when the condition to be selected is met, taking the updated analysis gray level in the analysis interval as a target gray level;
the threshold presence degree obtaining method comprises the following steps: combining the gray difference between the pixel point corresponding to each gray level in the analysis subinterval and the pixel point in the preset neighborhood of the pixel point and the discrete degree of the number of the pixel points corresponding to the gray level in the analysis subinterval to obtain the threshold value existence degree of the analysis subinterval;
acquiring a final image segmentation threshold value for segmenting the gray level image of the surface of the steel casting according to the pixel points corresponding to the target gray level in the gray level image of the surface of the steel casting;
and detecting the quality of the steel castings based on the final image segmentation threshold.
2. The method for detecting the quality of the steel castings in real time according to claim 1, wherein the method for screening out the analysis gray level from the gray level of the gray image of the surface of the steel castings comprises the following steps:
based on the gray value of the pixel point corresponding to the gray level, sequentially arranging the gray levels of the gray images on the surface of the steel casting to obtain a gray level sequence; taking other gray levels except the gray level in a preset first window of each gray level in the gray level sequence as adjacent gray levels of each gray level;
acquiring a screening coefficient of each gray level of the gray level image of the surface of the steel casting according to the gray value of the pixel corresponding to each gray level of the gray level image of the surface of the steel casting and the number of pixels corresponding to the adjacent gray level of each gray level;
an image gray level interval formed by the minimum gray level and the maximum gray level of the gray level image on the surface of the steel casting is divided into two image subintervals; screening the gray level with the largest screening coefficient in each image subinterval as the target gray level of each image subinterval;
and taking the gray level which is larger than the corresponding target gray level in the first image subinterval and the gray level which is smaller than the corresponding target gray level in the second image subinterval as the analysis gray level of the gray level image of the surface of the steel casting.
3. The method for detecting the quality of the steel castings in real time according to claim 2, wherein a calculation formula of a screening coefficient of each gray level of the gray level image of the surface of the steel castings is as follows:
the method comprises the steps of carrying out a first treatment on the surface of the Wherein C is a screening coefficient of each gray level of the gray level image on the surface of the steel casting; h is the gray value of the pixel point corresponding to each gray level of the gray level image on the surface of the steel casting; num1 is the number of pixel points corresponding to each gray level of the gray level image on the surface of the steel casting; />The number of pixel points corresponding to the ith adjacent gray level of each gray level of the gray level image of the surface of the steel casting; i is the number of adjacent gray levels for each gray level of the gray level image of the surface of the steel casting; />Is a preset value; />As a function of absolute value; exp is an exponential function based on a natural constant e.
4. The method for detecting the quality of a steel casting in real time according to claim 1, wherein the method for acquiring the initial gray level interval comprises the following steps:
the minimum analysis gray level and the maximum analysis gray level of the gray level image of the surface of the steel casting form an initial gray level interval.
5. The method for detecting the quality of the steel castings in real time according to claim 1, wherein the condition to be selected is that the number of gray levels in the updated analysis interval is smaller than a preset number threshold.
6. The method for detecting the quality of a steel casting in real time according to claim 1, wherein the method for acquiring the threshold presence degree of the analysis subinterval by combining the gray scale difference between the pixel point corresponding to each gray scale in the analysis subinterval and the pixel point in the preset neighborhood thereof and the discrete degree of the number of the pixel points corresponding to the gray scale in the analysis subinterval comprises the following steps:
selecting any pixel point corresponding to each gray level in each analysis subinterval as an analysis pixel point, and taking the average value of gray values of the pixel points except the analysis pixel point in a preset second window of the analysis pixel point as a neighborhood gray value of the analysis pixel point;
and obtaining the threshold value existence degree of each analysis subinterval according to the difference between the gray value of the pixel point corresponding to each gray level in each analysis subinterval and the neighborhood gray value and the discrete degree of the number of the pixel points corresponding to the gray level in each analysis subinterval.
7. The method for detecting the quality of the steel castings in real time according to claim 6, wherein the calculation formula of the threshold presence is as follows:
the method comprises the steps of carrying out a first treatment on the surface of the Wherein P is the threshold presence of each analysis subinterval;for all within each analysis subintervalStandard deviation of the number of pixels corresponding to gray level; k is the number of gray levels in each analysis subinterval; />The number of pixels corresponding to the kth gray level in each analysis subinterval; />The gray value of the pixel point corresponding to the kth gray level in each analysis subinterval is obtained; />The neighborhood gray level of the mth pixel point corresponding to the kth gray level in each analysis subinterval is obtained; />As a function of absolute value.
8. The method for detecting the quality of the steel castings in real time according to claim 1, wherein the method for acquiring the final image segmentation threshold value comprises the following steps:
and taking a threshold value obtained by using a maximum inter-class variance method for the gray value of the pixel point corresponding to the target gray level of the gray image on the surface of the steel casting as a final image segmentation threshold value.
9. The method for detecting the quality of the steel castings in real time according to claim 1, wherein the method for detecting the quality of the steel castings based on the final image segmentation threshold comprises the following steps:
taking a pixel point with the gray value smaller than a final image segmentation threshold value in the gray image of the surface of the steel casting as a defect pixel point; taking the ratio of the number of defective pixel points in the gray level image of the surface of the steel casting to the number of all pixel points as a defect judgment value;
when the defect judgment value is larger than a preset defect threshold value, the quality of the steel casting is unqualified; and when the defect judging value is smaller than or equal to the preset defect threshold value, the steel casting quality is qualified.
10. The method for real-time detection of steel casting quality according to claim 2, wherein the method for dividing the image gray level interval into two image subintervals comprises the steps of:
taking the endpoint value at the left side of the image gray level interval as the endpoint value at the left side of the first image subinterval, and taking the preset value as the endpoint value at the right side of the first image subinterval; taking the sum of the preset value and the constant 1 as the endpoint value of the left side of the second image subinterval and taking the endpoint value of the right side of the image gray level interval as the endpoint value of the right side of the second image subinterval.
CN202311509082.8A 2023-11-14 2023-11-14 Real-time detection method for quality of steel castings Active CN117237350B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311509082.8A CN117237350B (en) 2023-11-14 2023-11-14 Real-time detection method for quality of steel castings

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311509082.8A CN117237350B (en) 2023-11-14 2023-11-14 Real-time detection method for quality of steel castings

Publications (2)

Publication Number Publication Date
CN117237350A true CN117237350A (en) 2023-12-15
CN117237350B CN117237350B (en) 2024-01-26

Family

ID=89098766

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311509082.8A Active CN117237350B (en) 2023-11-14 2023-11-14 Real-time detection method for quality of steel castings

Country Status (1)

Country Link
CN (1) CN117237350B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117764981A (en) * 2024-01-11 2024-03-26 东莞市中钢模具有限公司 Injection mold quality on-line measuring system based on machine vision

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103578095A (en) * 2012-07-24 2014-02-12 南京理工大学 Multi-threshold-value segmentation method based on gray level histogram
CN104537673A (en) * 2015-01-09 2015-04-22 西安电子科技大学 Infrared image segmentation method based on multiple threshold values and self-adaptation fuzzy clustering
CN107248159A (en) * 2017-08-04 2017-10-13 河海大学常州校区 A kind of metal works defect inspection method based on binocular vision
CN109115785A (en) * 2018-08-08 2019-01-01 长沙理工大学 A kind of casting grinding quality determining method, device and its application method
CN114937055A (en) * 2022-03-31 2022-08-23 江苏益捷思信息科技有限公司 Image self-adaptive segmentation method and system based on artificial intelligence
CN114943848A (en) * 2022-07-25 2022-08-26 南通德晋昌光电科技有限公司 Crack identification method in nickel screen laser cladding process
CN115272321A (en) * 2022-09-28 2022-11-01 山东军冠纺织有限公司 Textile defect detection method based on machine vision
US20230023963A1 (en) * 2021-07-14 2023-01-26 Wenzhou University Multi-threshold segmentation method for medical images based on improved salp swarm algorithm

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103578095A (en) * 2012-07-24 2014-02-12 南京理工大学 Multi-threshold-value segmentation method based on gray level histogram
CN104537673A (en) * 2015-01-09 2015-04-22 西安电子科技大学 Infrared image segmentation method based on multiple threshold values and self-adaptation fuzzy clustering
CN107248159A (en) * 2017-08-04 2017-10-13 河海大学常州校区 A kind of metal works defect inspection method based on binocular vision
CN109115785A (en) * 2018-08-08 2019-01-01 长沙理工大学 A kind of casting grinding quality determining method, device and its application method
US20230023963A1 (en) * 2021-07-14 2023-01-26 Wenzhou University Multi-threshold segmentation method for medical images based on improved salp swarm algorithm
CN114937055A (en) * 2022-03-31 2022-08-23 江苏益捷思信息科技有限公司 Image self-adaptive segmentation method and system based on artificial intelligence
CN114943848A (en) * 2022-07-25 2022-08-26 南通德晋昌光电科技有限公司 Crack identification method in nickel screen laser cladding process
CN115272321A (en) * 2022-09-28 2022-11-01 山东军冠纺织有限公司 Textile defect detection method based on machine vision

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
DONGHENG XIE, ET AL: "A fast threshold segmentation method for forth image base on the pixel distribution characteristic", 《PLOS ONE》 *
周秀东: "脑出血CT图像分割与三维重建方法研究", 《中国优秀硕士学位论文全文数据库 医药卫生科技辑》, vol. 2022, no. 03, pages 070 - 286 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117764981A (en) * 2024-01-11 2024-03-26 东莞市中钢模具有限公司 Injection mold quality on-line measuring system based on machine vision
CN117764981B (en) * 2024-01-11 2024-05-10 东莞市中钢模具有限公司 Injection mold quality on-line measuring system based on machine vision

Also Published As

Publication number Publication date
CN117237350B (en) 2024-01-26

Similar Documents

Publication Publication Date Title
CN114529549B (en) Cloth defect labeling method and system based on machine vision
CN115311292B (en) Strip steel surface defect detection method and system based on image processing
CN116758061B (en) Casting surface defect detection method based on computer vision
CN115082418B (en) Precise identification method for automobile parts
CN116758083B (en) Quick detection method for metal wash basin defects based on computer vision
CN117237350B (en) Real-time detection method for quality of steel castings
CN115829883A (en) Surface image denoising method for dissimilar metal structural member
CN117351019B (en) Welding defect detection method
CN115131354B (en) Laboratory plastic film defect detection method based on optical means
CN115294120A (en) Valve surface quality detection method based on image recognition
CN116777916B (en) Defect detection method based on metal shell of pump machine
CN116823822B (en) Ship sheet metal part welding defect detection method based on visual characteristics
CN115689948B (en) Image enhancement method for detecting cracks of building water supply pipeline
CN116883408B (en) Integrating instrument shell defect detection method based on artificial intelligence
CN115294159B (en) Method for dividing corroded area of metal fastener
CN114782329A (en) Bearing defect damage degree evaluation method and system based on image processing
CN116152242B (en) Visual detection system of natural leather defect for basketball
CN117291919B (en) Visual detection method for lubricating grease on surface of steel rail bolt
CN115311289A (en) Method for detecting oil stain defects of plain-color cloth
CN117808796B (en) Gear surface damage detection method based on computer vision
CN114998333A (en) Computer vision detection method and system for light source characteristics
CN117252874B (en) Visual detection method for production quality of plastic mold
CN116664584B (en) Intelligent feedback regulating system for production of thin-wall zinc alloy die casting die
CN114998346B (en) Waterproof cloth quality data processing and identifying method
CN117474910B (en) Visual detection method for motor quality

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