Disclosure of Invention
In order to solve the technical problems, the invention aims to provide an automatic extraction method of gasoline engine spray wall-collision parameters based on image processing, which adopts the following technical scheme:
acquiring a spray image of a gasoline direct injection injector, and extracting an initial spray area in the spray image by utilizing an Otsu threshold segmentation method;
acquiring edge information corresponding to the initial spraying area through a canny operator, wherein the edge information is non-closed edge information;
acquiring a plurality of breaking point pairs corresponding to the edge information, wherein the edge information is lost between each breaking point pair, randomly selecting one breaking point from any breaking point pair as a growing point, and acquiring the lost edge information between the breaking point pairs based on the next growing point obtained by growing the growing point;
acquiring a plurality of connecting point pairs corresponding to the edge information, wherein a plurality of pieces of edge information exist between each connecting point pair, randomly selecting one connecting point from any one connecting point pair as a seed point, growing the seed point in an area surrounded by two pieces of edge information on the outermost side between the connecting point pairs, and acquiring a plurality of pieces of edge information to be selected between the connecting point pairs;
recording edge information and edge information to be selected between each connecting point pair as edge information to be detected, acquiring a first characteristic region and a second characteristic region corresponding to the edge information to be detected, calculating a judgment index corresponding to each piece of edge information to be detected between each connecting point pair based on an average gray value corresponding to the first characteristic region and the second characteristic region and a gray value of each pixel point on the edge information to be detected, and recording the edge information to be detected corresponding to the maximum judgment index as termination edge information between each connecting point pair;
obtaining final edge information corresponding to the initial spraying area based on the termination edge information and the obtained missing edge information between each breaking point pair; and acquiring a spraying area based on the final edge information, and extracting spraying wall collision parameters according to the spraying area.
Preferably, the method for acquiring missing edge information between the pairs of fracture points includes: sequentially selecting a plurality of pixel points on edge information where the growth points are located by taking the growth points as starting points, calculating an included angle between a connecting line of any two adjacent pixel points and a horizontal line, and calculating a difference value of two adjacent included angles to obtain a difference characteristic value, wherein the difference characteristic value is the difference characteristic value of common pixel points corresponding to the two adjacent included angles; then obtaining a plurality of non-edge information pixel points on the vertical line of the non-edge information pixel points adjacent to the growing point, marking the non-edge information pixel points as first pixel points, calculating the optimal value corresponding to each first pixel point according to the included angle between the connecting line of each first pixel point and the growth point and the horizontal line and the difference characteristic value, taking the first pixel point corresponding to the maximum optimal value as the next growth point, and the next growing point is classified into the edge information, the next growing point at the moment is the first next growing point, then the first next growing point is taken as a growing point to continue growing to obtain a second next growing point, by analogy, until the obtained mth next growth point stops growing on the vertical line where the non-edge information pixel point adjacent to the other fracture point in the fracture point pair is located, the obtained next growth points form missing edge information between the fracture point pairs; wherein m is greater than or equal to 1.
Preferably, the preferred values are:
wherein the content of the first and second substances,
a preferred value corresponding to the qth first pixel point,
the 1 st pixel point is selected on the edge information of the growing point by taking the growing point as a starting point,
the 2 nd pixel point is selected on the edge information of the growing point by taking the growing point as a starting point,
the ith pixel point is selected on the edge information of the growing point by taking the growing point as a starting point,
is composed of
With the q-th first imageThe included angle between the connecting line of the element points and the horizontal line,
is composed of
And
the angle between the line of (a) and the horizontal line,
is the q-th first pixel and
the euclidean distance between them,
is composed of
Corresponding difference characteristic values; n is the total number of pixel points sequentially selected on the edge information where the growing points are located by taking the growing points as starting points;
is an exponential function with e as the base,
as a function of the absolute value;
as a function of the maximum.
Preferably, the method for acquiring a plurality of pairs of connection points corresponding to the edge information includes:
carrying out corner point detection on the edge information to obtain a plurality of corner points corresponding to the edge information; and randomly selecting one corner point, acquiring edge information between the corner point and the rest of other corner points by a chain code method, and marking the corner point and one of the rest of other corner points as a connecting point pair when a plurality of pieces of edge information exist between the corner point and the one of the rest of other corner points.
Preferably, the method for acquiring the first and second feature regions corresponding to the edge information to be detected includes: recording a region with the left side width of a pixel point of the edge information to be detected as a first characteristic region, and recording a region with the right side width of a pixel point of the edge information to be detected as a second characteristic region, wherein a is more than or equal to 1.
Preferably, the determination index is:
wherein the content of the first and second substances,
in order to determine the index,
is the average gray-scale value corresponding to the first characteristic region,
is the average gray value corresponding to the second characteristic region,
the gray value of the jth pixel point on the edge information to be detected,
the gray value of the j +1 th pixel point on the edge information to be detected is obtained; n is the total number of pixel points on the edge information to be detected,
e is a natural constant as a function of the maximum.
Preferably, the spray impingement parameters include spray cone angle, spray penetration distance, spray radius, and spray height.
The invention also provides an automatic extraction system of the gasoline engine spray wall-hitting parameter based on image processing, which comprises a processor and a memory, wherein the processor executes a program of the automatic extraction method of the gasoline engine spray wall-hitting parameter based on image processing stored in the memory.
The embodiment of the invention at least has the following beneficial effects:
according to the invention, the missing edge information between the breaking point pairs corresponding to the growing points is obtained through the next growing points obtained by growing the growing points, so that the missing edge information formed by each next growing point can better accord with the edge characteristics of the edge information, and the obtained missing edge information is more real; recording edge information between each connecting point pair and edge information to be selected as edge information to be detected between each connecting point pair, calculating a judgment index according to an average gray value of a first characteristic region and a second characteristic region corresponding to the edge information to be detected and a gray value of each pixel point on the edge information to be detected, and obtaining termination edge information between each connecting point pair according to the judgment index; the termination edge information obtained by judging the index is more accurate edge information between the corresponding connecting point pairs; obtaining final edge information according to the missing edge information and the terminating edge information between the obtained breaking point pairs, so that the obtained final edge information has no breaking condition and can completely obtain the boundary of the spraying area; the method can accurately acquire the spraying area, and further accurately extract the spraying wall collision parameters.
Detailed Description
To further explain the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description of the proposed solution, its specific implementation, structure, features and effects will be made with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" refers to not necessarily the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
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 purpose of the invention is: acquiring missing edge information between breaking point pairs corresponding to the growing points through the next growing point obtained by growing the growing points, and then acquiring terminating edge information between each connecting point pair through judging indexes; obtaining accurate final edge information corresponding to the initial spraying area according to the termination edge information and the obtained missing edge information between each breaking point pair; and acquiring a spraying area based on the final edge information, and further accurately extracting spraying wall collision parameters.
Referring to fig. 1, a flowchart illustrating steps of a gasoline engine spray wall collision parameter automatic extraction method based on image processing according to an embodiment of the present invention is shown, where the method includes the following steps:
step 1, obtaining a spray image of a gasoline direct injection engine fuel injector, and extracting an initial spray area in the spray image by using an Otsu threshold segmentation method.
Specifically, a high-speed camera is used for obtaining a spray image of the gasoline direct injection engine injector, the spray image is stored in the high-speed camera as an unsigned gray scale digital image of 8-bit bytes as shown in fig. 2, in the digital image, the brightness of each pixel is represented by a numerical value between 0 and 255, 0 represents black, 255 represents white, and other numerical values represent gray scales of the pixel.
And then extracting an initial spraying area in the spraying image by using an Otsu threshold segmentation method, namely, taking the initial spraying area as a foreground and other areas as backgrounds, and segmenting the initial spraying area by using the Otsu threshold segmentation method. The Otsu threshold segmentation method is a well-known technique and is not described in detail.
Step 2, obtaining edge information corresponding to the initial spraying area through a canny operator, wherein the edge information is non-closed edge information; the method comprises the steps of obtaining a plurality of breaking point pairs corresponding to edge information, wherein the edge information is lost between each breaking point pair, randomly selecting one breaking point from any breaking point pair as a growing point, and obtaining the lost edge information between the breaking point pairs based on the next growing point obtained by growing the growing point.
The edge information corresponding to the initial spraying area is obtained through the canny operator, and the characteristics of the canny operator show that the canny operator has poor noise immunity and is sensitive to noise, so that the small noise can cause large deviation of the image boundary, and the local noise is enhanced while the boundary is detected, therefore, when the edge information of the image is detected by using the canny operator, the broken edge information or the noise edge information is easy to detect. The edge information corresponding to the initial spray region is not accurate, that is, there may be broken edge information (edge information missing) and noise edge information in the edge information corresponding to the initial spray region. In order to accurately acquire the edge information corresponding to the initial spray region, the missing edge information needs to be acquired.
Because the edge information is non-closed edge information, firstly, a plurality of breaking point pairs corresponding to the edge information are obtained, specifically, each end point corresponding to the edge information is obtained, and when the edge information is lacked between two adjacent end points, the two adjacent end points are one breaking point pair; for example, when the endpoints corresponding to the obtained edge information are endpoint 1, endpoint 2, endpoint 3, and endpoint 4 in sequence; if edge information exists between the end point 1 and the end point 2, edge information exists between the end point 3 and the end point 4, and edge information does not exist between the end point 2 and the end point 3, marking the end point 2 and the end point 3 as a fracture point pair; endpoint 2 is one of the pair of break points, and endpoint 3 is the other of the pair of break points; since there should be edge information between endpoint 2 and endpoint 3, but the canny operator does not detect edge information between endpoint 2 and endpoint 3, endpoint 2 and endpoint 3 are a pair of breakpoint points.
And then randomly selecting one breaking point from any breaking point pair as a growing point, and obtaining the missing edge information between the breaking point pairs based on the next growing point obtained by growing the growing point.
The method for acquiring the missing edge information between the fracture point pairs comprises the following steps:
sequentially selecting a plurality of pixel points on edge information where the growth points are located by taking the growth points as starting points, calculating an included angle between a connecting line of any two adjacent pixel points and a horizontal line, and calculating a difference value of two adjacent included angles to obtain a difference characteristic value, wherein the difference characteristic value is the difference characteristic value of common pixel points corresponding to the two adjacent included angles; then, a plurality of non-edge information pixel points are obtained on a vertical line where the non-edge information pixel points adjacent to the growing point are located, and are marked as first pixel points; in the embodiment, 3 non-edge information pixel points, namely 3 first pixel points, are obtained, and in the actual operation process, an implementer can adjust the non-edge information pixel points according to the actual situation; and then, taking the first next growing point as a growing point to continuously grow to obtain a second next growing point, and so on until the obtained mth next growing point is on the vertical line of the non-edge information pixel point adjacent to the other breaking point in the breaking point pair, stopping growing, and obtaining each next growing point to form missing edge information between the breaking point pair.
The preferred values are:
wherein the content of the first and second substances,
for a preferred value corresponding to the qth first pixel point,
the 1 st pixel point is selected on the edge information of the growing point by taking the growing point as a starting point,
the 2 nd pixel point is selected on the edge information of the growing point by taking the growing point as a starting point,
the ith pixel point is selected on the edge information of the growing point by taking the growing point as a starting point,
is composed of
The angle between the connecting line of the qth first pixel point and the horizontal line,
is composed of
And
the angle between the connecting line of (a) and the horizontal line,
is the q thA first pixel and
the euclidean distance between them,
is composed of
Corresponding difference characteristic values; n is the total number of pixel points sequentially selected on the edge information where the growing points are located by taking the growing points as starting points; an implementer obtains the total number of sequentially selected pixel points according to actual conditions, when the trend of the edge information of the growing point is relatively smooth, fewer pixel points can be sequentially selected, and when the trend of the edge information of the growing point is not smooth, more pixel points can be correspondingly and sequentially selected;
is an exponential function with the base e as the base,
as a function of the absolute value;
as a function of the maximum.
The calculation of the above-mentioned european distance and included angle is well known technology and is not specifically described.
The preferred value representation is obtained according to the qth first pixel point
Actual difference eigenvalue of
The greater the similarity degree is, the greater the possibility that the qth first pixel point is the next growth point is, and the greater the preferred value is;
the representation is obtained according to the qth first pixel point
The actual value of the difference characteristic of (c),
characterization of
The difference characteristic value is calculated according to a plurality of sequentially selected pixel points, the trend of the edge information where the growth point is located is obtained, and the trend behind the edge information where the growth point is located is predicted to obtain the predicted difference characteristic value
The predicted difference characteristic value is calculated by considering the distance between each pixel point selected in sequence and the q-th first pixel point, and the closer the distance is, the larger the weight of the difference characteristic value corresponding to the pixel point is, so that the difference characteristic value can be more accurately obtained
The predicted difference feature value of (1).
It should be noted that the difference characteristic value of the growth point is predicted by the difference characteristic value calculated by the sequentially selected plurality of pixel points, so as to obtain the difference characteristic value of the growth point, and further obtain each first pixel point as the preferred value of the missing edge information; when calculating the optimal value, not only the angle change trend of the edge information, namely the difference characteristic value, but also the influence of the distance on the prediction difference characteristic value is considered; the obtained prediction difference characteristic value is more accurate; meanwhile, when the predicted difference characteristic value corresponding to the first next growth point is calculated, the number of the corresponding sequentially selected pixel points is one more than that of the sequentially selected pixel points corresponding to the calculated breaking point as the growth point, namely, the obtained first next growth point is added, when the predicted difference characteristic value corresponding to the second next growth point is calculated, the obtained first next growth point and the second next growth point are added, and the like. The prediction result of the first prediction is added into the second prediction, the prediction results of the first prediction and the second prediction are added into the third prediction, and the like; the missing edge information formed by each next growing point can be more consistent with the edge characteristics of the edge information, and the obtained missing edge information is more real.
And 3, acquiring a plurality of connecting point pairs corresponding to the edge information, wherein a plurality of pieces of edge information exist between each connecting point pair, randomly selecting one connecting point from any one connecting point pair as a seed point, growing the seed point in an area surrounded by two pieces of edge information on the outermost side between the connecting point pairs, and acquiring a plurality of pieces of edge information to be selected between the connecting point pairs.
Firstly, a plurality of connecting point pairs corresponding to the edge information are obtained, and the method for obtaining the plurality of connecting point pairs specifically comprises the following steps:
carrying out corner detection on the edge information by using a Harris corner detection algorithm to obtain a plurality of corners corresponding to the edge information; and randomly selecting one corner point, acquiring edge information between the corner point and the rest of other corner points by a chain code method, and marking the corner point and one of the rest of other corner points as a connecting point pair when a plurality of pieces of edge information exist between the corner point and the one of the rest of other corner points. The implementer may also select another corner detection algorithm to obtain a plurality of corners corresponding to the edge information, and both the Harris corner detection algorithm and the chain code method are known technologies and are not further described.
For example, a schematic diagram of each corner point corresponding to the edge information is shown in fig. 3, and then the corner point d and the corner point e are a connecting point pair; i.e. corner d is one of the pair of connection points and corner e is the other of the pair of connection points.
Then randomly selecting one connection point from any one connection point pair as a seed point, and growing the seed point in an area surrounded by two pieces of edge information on the outermost side between the connection point pairs to obtain a plurality of pieces of edge information to be selected between the connection point pairs; for example, an angular point d is used as a seed point, an angular point e is used as an end point, the seed point grows in a region Q surrounded by two pieces of edge information on the outermost side between the connection point pairs, the growth directions are 0 °, 45 ° and-45 ° of the seed point, when the difference value between the gray value of the pixel point in the growth direction and the gray value of the seed point is smaller than a difference threshold, the seed point grows once, the pixel point in the corresponding growth direction is used as the seed point to continue to grow until the difference value between the gray value of the pixel point in the growth direction and the gray value of the seed point is greater than the difference threshold or the end point (angular point e) is reached, the growth is stopped, and the edge information to be selected at the moment is obtained, but because of excessive interference factors in the growth process, there may be a plurality of the obtained edge information to be selected at the moment. The values of the difference threshold values corresponding to different spray images are different, and the difference threshold values are set by an implementer according to specific conditions.
It should be noted that, the existence of multiple pieces of edge information between one connecting point pair is caused by the inaccuracy of the canny operator in the detection; since the canny operator detects a plurality of pieces of edge information between a connection point pair, it is considered that there is necessarily one piece of accurate edge information between the connection point pair, and therefore, one connection point is randomly selected from any one connection point pair as a seed point, the edge information to be selected between the corresponding connection point pair is obtained through the growth of the seed point, and then an accurate piece of edge information is selected from the edge information to be selected and the edge information between the two connection point pairs.
And 4, recording edge information and to-be-selected edge information between each connecting point pair as to-be-detected edge information, acquiring a first characteristic region and a second characteristic region corresponding to the to-be-detected edge information, calculating a judgment index corresponding to each piece of to-be-detected edge information between each connecting point pair based on an average gray value corresponding to the first characteristic region and the second characteristic region and a gray value of each pixel point on the to-be-detected edge information, and recording the to-be-detected edge information corresponding to the maximum judgment index as termination edge information between each connecting point pair.
The method for acquiring the first and second characteristic regions corresponding to the edge information to be detected comprises the following steps: and recording the region with the width of a pixel points on the left side of the edge information to be detected as a first characteristic region, and recording the region with the width of a pixel points on the right side of the edge information to be detected as a second characteristic region, wherein a is more than or equal to 1. In this embodiment, a =2, the implementer can select the value of a according to the specific situation.
Specifically, the determination index is:
wherein the content of the first and second substances,
in order to determine the index,
is the average gray value corresponding to the first characteristic region,
is the average gray value corresponding to the second characteristic region,
the gray value of the jth pixel point on the edge information to be detected,
the gray value of the j +1 th pixel point on the edge information to be detected is obtained; n is the total number of pixel points on the edge information to be detected,
e is a natural constant as a function of the maximum.
The judgment index represents the probability that the edge information to be detected is the termination edge information, the higher the probability is, the more likely the corresponding edge information to be detected is the termination edge information,
representing the difference degree between every two adjacent pixel points on the edge information to be detected, wherein the larger the difference degree is, the smaller the similarity degree between every two adjacent pixel points on the edge information to be detected is, namely the more disordered the gray scale distribution of the pixel points on the edge information to be detected is, the more unlikely the edge information to be detected is to be the termination edge information,
and representing the difference between the first characteristic region and the second characteristic region corresponding to the edge information to be detected, wherein the larger the difference is, the better the segmentation effect of the edge information to be detected is represented, and the higher the possibility that the edge information to be detected is termination edge information is. As can be seen from the above-described analysis,
and the judgment index are in a negative correlation relationship, but not in a linear relationship,
and the judgment indexes are in positive correlation but not linear, so that a calculation formula of the judgment indexes is obtained by using a mathematical modeling method, and the relationship between each factor and the judgment indexes is met.
It should be noted that, as can be seen from the description in step 3, there is an accurate edge information between each pair of connected points, and the terminating edge information is the accurate edge information between the corresponding pair of connected points.
Step 5, obtaining final edge information corresponding to the initial spraying area based on the termination edge information and the obtained missing edge information between each breaking point pair; and acquiring a spraying area based on the final edge information, and extracting spraying wall collision parameters according to the spraying area.
The final edge information comprises edge information obtained by using a canny operator, termination edge information and the obtained missing edge information between each breaking point pair; and finally, the edge information completes accurate acquisition of the boundary of the spraying area, and then the spraying area is accurately acquired according to the final edge information, so that the spraying wall collision parameters can be accurately extracted from the spraying area.
The final edge information comprises edge information obtained by using a canny operator, wherein the edge information comprises the following edge information: only one piece of edge information exists between two corner points, such as edge information between corner point a and corner point b, edge information between corner point c and corner point d, and edge information between corner point e and corner point a in fig. 3.
Spray impingement parameters include spray cone angle, spray penetration distance, spray radius, and spray height. Wherein the spray cone angle is the included angle between the tangent lines at two sides of the spray from the position of the nozzle to the spray penetration distance of 1/2; the spray penetration distance is the distance from the nozzle position to the farthest end of the spray development before hitting the wall, and the vertical distance from the nozzle position to the wall surface after hitting the wall; the spray radius is the distance of spreading of the jet along the wall surface after the spray hits the wall; the spraying height is the spraying entrainment height which is vertical to the wall surface and is outward along the wall surface direction after the free spraying hits the wall surface;
it should be noted that extracting the spray wall collision parameter according to the spray area is a known technique and will not be described in detail.
The invention also provides a gasoline engine spray wall-hitting parameter automatic extraction system based on image processing, which comprises a processor and a memory, wherein the processor executes a program of the gasoline engine spray wall-hitting parameter automatic extraction method based on image processing stored in the memory.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; the modifications or substitutions do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present application, and are included in the protection scope of the present application.