CN110853097A - Biscuit identification and positioning method applied to biscuit surface pattern printing equipment - Google Patents
Biscuit identification and positioning method applied to biscuit surface pattern printing equipment Download PDFInfo
- Publication number
- CN110853097A CN110853097A CN201911086429.6A CN201911086429A CN110853097A CN 110853097 A CN110853097 A CN 110853097A CN 201911086429 A CN201911086429 A CN 201911086429A CN 110853097 A CN110853097 A CN 110853097A
- Authority
- CN
- China
- Prior art keywords
- biscuit
- image
- edge
- rotation angle
- identification
- 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.)
- Pending
Links
- 235000015895 biscuits Nutrition 0.000 title claims abstract description 209
- 238000000034 method Methods 0.000 title claims abstract description 33
- 238000007639 printing Methods 0.000 title claims abstract description 23
- 238000001914 filtration Methods 0.000 claims abstract description 32
- 230000009466 transformation Effects 0.000 claims abstract description 8
- 238000010586 diagram Methods 0.000 claims description 13
- 238000007781 pre-processing Methods 0.000 claims description 12
- 238000004364 calculation method Methods 0.000 claims description 7
- 235000014510 cooky Nutrition 0.000 description 17
- 230000000694 effects Effects 0.000 description 11
- 238000005286 illumination Methods 0.000 description 9
- 230000011218 segmentation Effects 0.000 description 8
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 6
- 238000000605 extraction Methods 0.000 description 5
- 238000004519 manufacturing process Methods 0.000 description 5
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000005520 cutting process Methods 0.000 description 2
- 235000013305 food Nutrition 0.000 description 2
- 230000002401 inhibitory effect Effects 0.000 description 2
- 230000001629 suppression Effects 0.000 description 2
- 238000010146 3D printing Methods 0.000 description 1
- 230000010339 dilation Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 238000000265 homogenisation Methods 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000010422 painting Methods 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000007115 recruitment Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/70—Determining position or orientation of objects or cameras
- G06T7/73—Determining position or orientation of objects or cameras using feature-based methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/10—Image enhancement or restoration using non-spatial domain filtering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration using local operators
- G06T5/30—Erosion or dilatation, e.g. thinning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/187—Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
- G06T2207/10008—Still image; Photographic image from scanner, fax or copier
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20024—Filtering details
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20048—Transform domain processing
- G06T2207/20056—Discrete and fast Fourier transform, [DFT, FFT]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20112—Image segmentation details
- G06T2207/20152—Watershed segmentation
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a biscuit identification and positioning method applied to biscuit surface pattern printing equipment. The method comprises the following steps: acquiring an image to be identified and carrying out homomorphic filtering processing and binarization processing on the image; performing distance transformation on the preprocessed image, and extracting a biscuit skeleton in the preprocessed image; performing expansion operation on the preprocessed image to obtain an external expansion image; subtracting the biscuit skeleton image and the external expansion image, and negating pixels of an image obtained after subtraction to obtain a mask image; carrying out connected domain marking on the mask graph; performing AND operation on the mask image and the connected domain mark image to obtain a watershed seed image; extracting the edge of the biscuit image in the watershed seed image by using a watershed algorithm to obtain a first biscuit edge image; performing subtraction on the preprocessed image and the first biscuit edge image to obtain a second biscuit edge image; and determining the central point and the rotation angle predicted value of the biscuit in the second biscuit edge map. The invention can accurately identify and position the biscuit.
Description
Technical Field
The invention relates to the technical field of biscuit pattern printing, in particular to a biscuit identification and positioning method applied to biscuit surface pattern printing equipment.
Background
Decorative biscuits such as frosted biscuits have great demand in the festival gift market and the children food market. At present, the production process of the decorative biscuit mainly depends on manual work to realize the drawing of the surface decorative patterns. The method has the problems of poor guarantee of pattern drawing quality and drawing consistency, and poor recruitment and training of personnel in the aspect of personnel. In order to solve the problems, food equipment manufacturers are also beginning to introduce technologies such as 3D printing and the like into the production process of the decorative biscuits, so as to realize the automation of drawing the patterns on the surfaces of the decorative biscuits.
During the production process, baked biscuits are placed on the tray disorderly. Therefore, to realize the automation of drawing the biscuit surface patterns, the identification and positioning of the biscuits on the tray must be realized, namely the coordinates and the rotation angle of the center point of each biscuit are extracted. And then the information is transmitted to the printing equipment, so that the printing equipment is guided to finish the automatic drawing of the biscuit surface pattern. Thus, accurate identification and location of cookies has become an urgent problem to be solved.
Disclosure of Invention
The invention aims to provide a biscuit identification and positioning method applied to biscuit surface pattern printing equipment, which can accurately identify and position biscuits.
In order to achieve the purpose, the invention provides the following scheme:
a biscuit identification and positioning method applied to a biscuit surface pattern printing device comprises the following steps:
acquiring an image to be identified containing a biscuit image;
preprocessing the image to be identified, wherein the preprocessing comprises homomorphic filtering processing and binarization processing to obtain a preprocessed image;
performing distance transformation on the preprocessed image, and extracting a biscuit skeleton in the preprocessed image to obtain a biscuit skeleton diagram;
performing expansion operation on the preprocessed image to obtain an external expansion image;
subtracting the biscuit skeleton image and the external expansion image, and negating pixels of an image obtained after subtraction to obtain a mask image;
carrying out connected domain marking on the mask map to obtain a connected domain marked map;
performing AND operation on the mask map and the connected domain mark map to obtain a watershed seed map;
extracting the edge of the biscuit image in the watershed seed image by using a watershed algorithm to obtain a first biscuit edge image;
performing subtraction on the preprocessed image and the first biscuit margin image to obtain a second biscuit margin image;
and determining the central point and the rotation angle predicted value of the biscuit in the second biscuit edge map.
Optionally, the determining the predicted values of the center point and the rotation angle of the biscuit in the second biscuit margin map specifically includes:
extracting biscuit edges in the second biscuit edge image to obtain an edge point set of the biscuit image;
and determining the predicted values of the center point and the rotation angle of the biscuit according to the edge point set.
Optionally, the determining the center point of the biscuit according to the edge point set specifically includes:
calculating a first moment of the biscuit image according to the edge point set of the biscuit image;
and calculating the central point of the biscuit image according to the first moment of the biscuit image.
Optionally, the determining the rotation angle prediction value of the biscuit according to the edge point set specifically includes:
determining a minimum bounding rectangle of the set of edge points;
and determining the rotation angle of the minimum circumscribed rectangle, wherein the rotation angle of the minimum circumscribed rectangle is the rotation angle predicted value of the biscuit, and the predicted values are multiple.
Optionally, after determining the rotation angle prediction value of the biscuit in the second biscuit margin map, the method further includes:
and calculating the distance between the biscuit template graph and the biscuit image in the second biscuit edge graph, and taking the rotation angle predicted value corresponding to the biscuit image when the distance is minimum as the rotation angle of the biscuit.
Optionally, the distance calculation is a euclidean distance calculation.
Optionally, extracting cookie edges in the second cookie edge map using Canny.
Optionally, performing homomorphic filtering processing on the biscuit image specifically includes:
after Fourier transform is carried out on the image to be recognized, logarithm is taken to obtain a frequency domain graph of the image to be recognized;
carrying out high-pass Butterworth filtering processing on the frequency domain graph to obtain a Butterworth filtering mask graph;
and solving a Hadamard product of the frequency domain graph and the Butterworth filtering mask graph, and performing exponential on Hadamard product data and inverse Fourier transform.
Optionally, the preprocessing further includes:
and performing closed operation and open operation on the image subjected to homomorphic filtering processing and binarization processing.
Optionally, the distance transform is a Euclidean distance-based distance transform.
According to the specific embodiment provided by the invention, the invention discloses the following technical effects: according to the biscuit identification and positioning method applied to the biscuit surface pattern printing equipment, firstly, homomorphic filtering is adopted to preprocess the image containing the biscuit, which is acquired by the camera, so that the influence of illumination on an identification result is reduced. Secondly, in order to solve the problem of difficult segmentation caused by adhesion and close fitting of biscuits, the method comprises the steps of respectively obtaining a skeleton graph and an external expansion graph of an image to be identified, obtaining a mask graph through subtraction of the skeleton graph and the external expansion graph, marking a connected domain of the mask graph, carrying out and operation on the obtained connected domain mark graph and the mask graph to obtain a watershed seed graph, extracting biscuit image edges in the watershed seed graph by adopting a watershed algorithm to obtain a first biscuit edge graph, and subtracting the preprocessed image from the first biscuit edge graph to obtain a second biscuit edge graph. Finally, the center point and the rotation angle of the biscuit are determined according to the biscuit edges in the second biscuit edge map. Therefore, on one hand, the interference of illumination on the image to be recognized is eliminated through homomorphic filtering processing; on the other hand, by processing a plurality of columns of the image to be recognized and extracting the biscuit edges in the image to be recognized by adopting a watershed algorithm, the problem of difficult segmentation caused by adhesion and close fitting of biscuits is solved, the condition of inaccurate positioning caused by the problem is further avoided, and accurate positioning of the biscuits is realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic flow chart illustrating a cookie identification and positioning method applied to a cookie surface pattern printing apparatus according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a cookie identification and positioning method applied to a cookie surface pattern printing device in an example of the present invention;
FIG. 3 is a diagram of an original image acquired by an industrial camera in an embodiment of the invention;
FIG. 4 is a diagram of an image after homomorphic filtering used in an embodiment of the present invention;
FIG. 5 is a diagram illustrating an effect of binarized original image according to an embodiment of the present invention;
FIG. 6 is a skeleton diagram obtained after applying distance transformation in an embodiment of the present invention;
FIG. 7 is a diagram illustrating the effect of applying a watershed algorithm in an embodiment of the present invention;
FIG. 8 is a diagram illustrating a pair of the original binarized image and the watershed image according to the embodiment of the present invention;
FIG. 9 is a diagram illustrating the effect of extracting cookie boundary using connected component in the embodiment of the present invention;
FIG. 10 is a drawing of a cookie cutter in an embodiment of the present invention;
FIG. 11 is an effect diagram of the final extraction of the center and rotation angle of the biscuit in the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention aims to provide a biscuit identification and positioning method applied to biscuit surface pattern printing equipment, which can accurately identify and position biscuits.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
The biscuit identification and positioning method applied to the biscuit surface pattern printing equipment provided by the invention realizes an automatic core function for the biscuit surface pattern printing equipment. The method can send the real coordinates and the rotation angle of each biscuit on the tray to the printing equipment so as to realize the automatic operation of the printing equipment, such as painting patterns on the surface of the frosted biscuits.
As shown in FIG. 1, the biscuit identification and positioning method applied to the biscuit surface pattern printing equipment provided by the invention comprises the following steps:
step 101: acquiring an image to be identified containing a biscuit image; the image may be an image of a biscuit on a biscuit tray taken by an industrial camera.
Step 102: preprocessing the image to be identified, wherein the preprocessing comprises homomorphic filtering processing and binarization processing to obtain a preprocessed image;
step 103: performing distance transformation on the preprocessed image, and extracting a biscuit skeleton in the preprocessed image to obtain a biscuit skeleton diagram; the distance transform may be a euclidean distance transform;
step 104: performing expansion operation on the preprocessed image to obtain an external expansion image;
step 105: subtracting the biscuit skeleton image and the external expansion image, and negating pixels of an image obtained after subtraction to obtain a mask image;
step 106: carrying out connected domain marking on the mask map to obtain a connected domain marked map;
step 107: performing AND operation on the mask map and the connected domain mark map to obtain a watershed seed map;
step 108: extracting the edge of the biscuit image in the watershed seed image by using a watershed algorithm to obtain a first biscuit edge image;
step 109: performing subtraction on the preprocessed image and the first biscuit margin image to obtain a second biscuit margin image;
step 110: and determining the central point and the rotation angle predicted value of the biscuit in the second biscuit edge map.
In the foregoing embodiment, step 110 may specifically be:
extracting biscuit edges in the second biscuit edge image to obtain an edge point set of the biscuit image; the extraction method can adopt a Canny algorithm;
and determining the predicted values of the center point and the rotation angle of the biscuit according to the edge point set.
Wherein determining the center point of the biscuit according to the edge point set may include:
calculating a first moment of the biscuit image according to the edge point set of the biscuit image;
and calculating the central point of the biscuit image according to the first moment of the biscuit image.
Wherein, determining the rotation angle of the biscuit according to the edge point set may include:
determining a minimum bounding rectangle of the set of edge points;
and determining the rotation angle of the minimum circumscribed rectangle, wherein the rotation angle of the minimum circumscribed rectangle is the rotation angle predicted value of the biscuit, and the rotation angle predicted value has four angles of α, α +90 degrees, α +180 degrees and α +270 degrees.
On the basis of the above embodiment, since there are a plurality of predicted values of the cookie rotation angle, after step 110, the method may further include: and calculating the distance between the biscuit template graph and the biscuit image in the second biscuit edge graph, and taking the rotation angle predicted value corresponding to the biscuit image when the distance is minimum as the rotation angle of the biscuit. The distance calculation here may be a euclidean distance calculation. The application of the biscuit template map can determine the main direction of the biscuit and determine a correct rotation angle from a plurality of predicted rotation angles, and can compare the calculated minimum distance with a set threshold value, if the minimum distance is smaller than the set threshold value, the edge point set is the biscuit, otherwise, the edge point set is not the point set of the biscuit, and therefore misidentification items of the biscuit can be further eliminated.
In the above embodiment, the homomorphic filtering processing on the cookie image in step 102 may specifically include the following steps:
after Fourier transform is carried out on the image to be recognized, logarithm is taken to obtain a frequency domain graph of the image to be recognized;
carrying out high-pass Butterworth filtering processing on the frequency domain graph to obtain a Butterworth filtering mask graph;
and solving a Hadamard product of the frequency domain graph and the Butterworth filtering mask graph, and performing exponential on Hadamard product data and inverse Fourier transform.
In the above embodiment, the preprocessing may further include:
and performing closed operation and open operation on the image subjected to homomorphic filtering processing and binarization processing. The closed operation can remove holes in the biscuits generated by binarization and eliminate algorithm interference; and the opening operation can remove isolated points outside the biscuit and inhibit image noise.
The method provided by the present invention is explained below by way of a specific example, as shown in fig. 2:
step 1: images are acquired from an industrial camera that captures images on a cookie tray carrying a plurality of cookies. As shown in fig. 3.
Step 2: and (3) image preprocessing is performed by adopting homomorphic filtering, so that the homogenization of image illumination is realized. As shown in fig. 4.
2.1, converting the picture from a spatial domain to a frequency domain through discrete Fourier transform, and then taking an absolute value of a logarithm suppression image;
on the basis of 2.2> frequency domain conversion, high-pass Butterworth filtering is further applied to filter out a part of low-frequency components to obtain a mask, so that the effects of inhibiting illumination and realizing illumination balance are achieved;
2.3> Butterworth filtering mask and the frequency domain graph obtained in the step 2.1 obtain a Hadamard product, then taking index reduction data, and carrying out Fourier inversion transformation to convert the frequency domain graph into a space domain to obtain a homomorphic filtered image;
and 2.4, on the basis of the picture obtained in the step 2.3, carrying out binarization by adopting OSTU to obtain a binarization picture. As shown in fig. 5.
And step 3: and calculating the skeleton of the image through the Euclidean distance. On the basis, seeds of watershed are arranged.
3.1, on the basis of the picture obtained in the step 2.4, firstly performing closed operation to remove holes in the biscuit generated by binarization and eliminate algorithm interference; and then, carrying out opening operation to remove isolated points outside the biscuit and inhibit image noise.
3.2, on the basis of the picture obtained in the step 3.1, extracting a biscuit skeleton graph in the image by using distance transformation; as shown in fig. 6;
3.3> based on the picture obtained in step 3.1, performing a dilation operation to obtain an expanded picture.
And 3.4, performing subtraction on the pictures obtained in the steps 3.3 and 3.2, namely subtracting the pixel values of the picture obtained in the step 3.3 from the pixel values of the picture obtained in the step 3.2, and then inverting all the pixels to obtain a mask picture.
3.5> the picture obtained in the step 3.2 is marked with connected component, and the pixels in each independent connected component are set as independent digital labels. Then, the pixel values of all pixels in the picture are added with 1, so that the purpose of setting the background as a connected domain is achieved. This step results in a connected domain signature.
3.6, carrying out AND operation on the images obtained in the steps 3.4 and 3.5 to achieve the purpose of cutting the connected domain and the background to obtain the watershed seed image.
And 4, step 4: and (3) extracting the biscuit image edge by using the watershed seeds in the step 3 and applying a watershed algorithm to obtain an image with the biscuit edge reserved, as shown in fig. 7.
And 5: and (4) carrying out subtraction on the result graph obtained in the step (2) and the result graph obtained by applying the watershed algorithm in the step (4), so as to achieve the effect of cutting the connected biscuits, as shown in fig. 8.
Step 6: edge extraction was performed using Canny to obtain a set of edge points for each cookie, as shown in figure 9.
And 7: and 6, on the basis of the biscuit edge point set obtained in the step 6, obtaining a centroid point of the image by calculating the first moment of the image.
Formula for calculating zero order moment:
M00=∑∑V(i,j)
calculation formula of first moment:
M10=∑∑i*V(i,j)
M01=∑∑j*V(i,j)
x and Y coordinates of the centroid point:
x=M10/M00;
y=M01/M00;
where M00 is the sum of non-0 pixels in the image;
m10 is the accumulated value of x coordinate values of a non-0 pixel region on the image;
m01 is the accumulated value of the y coordinate values of the non-0 pixel region on the image;
(x, y) is the center of gravity of the image.
And 8, on the basis of the edge point set obtained in the step 6, solving a minimum circumscribed rectangle for the edge point set to obtain a rotation angle of the minimum circumscribed rectangle, wherein the predicted values of the rotation angles are α, α +90 degrees, α +180 degrees and α +270 degrees.
And step 9: and determining a final rotation angle through a biscuit template image, and rejecting misrecognized items, wherein the biscuit template is shown in FIG. 10.
9.1> calculating Euclidean distance from the biscuit template image and each identified biscuit image:
when the distance is the minimum value, the corresponding rotation angle is the actual biscuit angle; v. of0Is a pixel of the template, v1Is the pixel of the cookie image, row is the number of rows of the image, and col is the number of columns of the image.
9.2, comparing the Euclidean distance obtained in the step 9.1 with a set threshold, if the Euclidean distance is smaller than the threshold, indicating that the edge point set is a biscuit, otherwise, not indicating that the edge point set is a point set of the biscuit, and further excluding the misrecognized item; the final effect is shown in fig. 11.
Step 10: and transmitting the obtained center coordinates and rotation angles of each biscuit to printing equipment through a TCP/IP protocol, thereby achieving the purpose of guiding printing and automatic printing.
The homomorphic filtering preprocessing employed by the present invention is explained below:
the homomorphic filtering preprocessing in the invention is realized by discrete Fourier transformAnd (4) after the picture is converted from the space domain to the frequency domain, taking the absolute numerical value of the logarithm suppression image. Therefore, the effect of compressing the information scale under the condition of not changing the correlation of the information is achieved.
On the basis of realizing frequency domain conversion of the image, high-pass Butterworth filtering is further applied to filter out a part of low-frequency components, so that the effects of inhibiting illumination and realizing illumination balance are achieved.
The high-pass butterworth high-pass filtering formula is:
γHIs a high frequency weight, gammaLObtaining mask for low frequency weight by Butterworth filtering, obtaining Hadamard product with frequency domain diagram, taking index to restore data, and performing inverse Fourier transformAnd converting the frequency domain image into a space domain to obtain a homomorphic filtered image.
The following explains the edge extraction of the biscuit of the invention:
during the production process, the biscuits are placed on the tray densely, so that the biscuits in the image shot by the camera are connected together and cannot be positioned. Therefore, the algorithm uses a watershed algorithm to extract the edges of the biscuits and divides the densely arranged biscuits to distinguish the biscuits.
Watershed is an image region segmentation algorithm, and the pixels of a picture are [0,255 ]. Therefore, the watershed algorithm considers the image as terrain, the pixel as elevation, the place with large pixel value as mountain, the place with small pixel value as valley, and the pixel in each block area has a local minimum value, i.e. the valley bottom. The watershed is to take the pixel as water and pour the pixel into the image. Water is gathered at a local minimum value at the beginning to generate a plurality of water poises, when the water falls down more, the water level, namely the pixel value, rises slowly, the terrain with smaller pixels, namely the terrain with low altitude, is submerged until the water poises of different areas are converged at last, and the formed boundary is the watershed, so that the image is subjected to area segmentation by the boundary.
The use of watershed is premised on the fact that local minima are needed to distinguish regions, and the pixels of the biscuit are uniformly distributed, and the inside of the biscuit cannot become valleys. This situation results in the watershed algorithm recognizing the cookies stuck together as a whole mountain, and failing to cut both cookies. There is a need for improvements to watershed algorithms. According to the algorithm, firstly, binaryzation operation is carried out on an original image, then, a skeleton of the biscuit is extracted through distance transformation, and finally, the skeleton image is used as a mask to be subtracted from the original image, so that the biscuit is internally provided with a local minimum value. By the method, the valley bottoms of the watershed are artificially generated and marked as the final segmentation area, and the segmentation of the biscuit area can be completed. And carrying out subtraction on the binary image of the original image and the image obtained by applying the watershed algorithm, thereby achieving the effect of blackening the edge position in the original image. And finally, extracting the edges of the biscuits by adopting the connected domain to obtain an edge point set of each biscuit.
The following explains the acquisition of the center point and the rotation angle of the biscuit in the present invention:
the rotation angle of the minimum circumscribed rectangle can be obtained by solving the minimum circumscribed rectangle of the edge point set of the image, because the direction of the biscuit is unknown, the actual angle cannot be determined, and four angle candidates exist, namely α, α +90 degrees, α +180 degrees and α +270 degreesAnd when the distance is the minimum value, the corresponding rotating angle is the actual biscuit angle. And meanwhile, judging whether the obtained edge point set is a biscuit or not through the Euclidean distance so as to further eliminate the misrecognized item.
The invention firstly adopts homomorphic filtering to compensate the illumination of the image, reduces the influence of the illumination on the extraction algorithm of the biscuit image edge and reduces the requirement on the consistency of the reflected light on the biscuit surface. And then, a watershed algorithm of a traditional region segmentation algorithm is improved, so that the problem that region segmentation cannot be carried out under the condition that biscuits are tightly attached in the production process is solved. And finally, confirming the main direction of the biscuits by adopting a template matching algorithm, and filtering out the inconsistent target biscuits. The process can improve the accuracy of extracting the biscuit outline and realize the quick acquisition of the accurate angle of the biscuit. Through the optimization processing, the algorithm can eliminate the error identification caused by external interference, stably and accurately identify the center coordinates and the rotation angle of the biscuits, has better robustness, and can meet the actual requirements of biscuit surface pattern printing equipment.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In view of the above, the present disclosure should not be construed as limiting the invention.
Claims (10)
1. A biscuit identification and positioning method applied to biscuit surface pattern printing equipment is characterized by comprising the following steps:
acquiring an image to be identified containing a biscuit image;
preprocessing the image to be identified, wherein the preprocessing comprises homomorphic filtering processing and binarization processing to obtain a preprocessed image;
performing distance transformation on the preprocessed image, and extracting a biscuit skeleton in the preprocessed image to obtain a biscuit skeleton diagram;
performing expansion operation on the preprocessed image to obtain an external expansion image;
subtracting the biscuit skeleton image and the external expansion image, and negating pixels of an image obtained after subtraction to obtain a mask image;
carrying out connected domain marking on the mask map to obtain a connected domain marked map;
performing AND operation on the mask map and the connected domain mark map to obtain a watershed seed map;
extracting the edge of the biscuit image in the watershed seed image by using a watershed algorithm to obtain a first biscuit edge image;
performing subtraction on the preprocessed image and the first biscuit margin image to obtain a second biscuit margin image;
and determining the central point and the rotation angle predicted value of the biscuit in the second biscuit edge map.
2. The biscuit identification and positioning method according to claim 1, wherein the determining of the central point and the rotation angle prediction value of the biscuit in the second biscuit margin map specifically comprises:
extracting biscuit edges in the second biscuit edge image to obtain an edge point set of the biscuit image;
and determining the predicted values of the center point and the rotation angle of the biscuit according to the edge point set.
3. The biscuit identification and positioning method according to claim 2, wherein the determining the center point of the biscuit according to the edge point set specifically comprises:
calculating a first moment of the biscuit image according to the edge point set of the biscuit image;
and calculating the central point of the biscuit image according to the first moment of the biscuit image.
4. The biscuit identification and positioning method according to claim 2, wherein the determining of the biscuit rotation angle prediction value according to the edge point set specifically comprises:
determining a minimum bounding rectangle of the set of edge points;
and determining the rotation angle of the minimum circumscribed rectangle, wherein the rotation angle of the minimum circumscribed rectangle is the rotation angle predicted value of the biscuit, and the predicted values are multiple.
5. The biscuit identification and positioning method according to claim 4, wherein after determining the rotation angle prediction value of the biscuit in the second biscuit margin map, the method further comprises:
and calculating the distance between the biscuit template graph and the biscuit image in the second biscuit edge graph, and taking the rotation angle predicted value corresponding to the biscuit image when the distance is minimum as the rotation angle of the biscuit.
6. The biscuit identification and positioning method of claim 5, wherein the distance calculation is a Euclidean distance calculation.
7. The biscuit identification and location method of claim 2, wherein the biscuit edges in the second biscuit edge map are extracted by Canny.
8. The biscuit identification and positioning method according to claim 1, wherein homomorphic filtering processing is performed on the biscuit image, specifically comprising:
after Fourier transform is carried out on the image to be recognized, logarithm is taken to obtain a frequency domain graph of the image to be recognized;
carrying out high-pass Butterworth filtering processing on the frequency domain graph to obtain a Butterworth filtering mask graph;
and solving a Hadamard product of the frequency domain graph and the Butterworth filtering mask graph, and performing exponential on Hadamard product data and inverse Fourier transform.
9. The biscuit identification and location method of claim 1, wherein the preprocessing further comprises:
and performing closed operation and open operation on the image subjected to homomorphic filtering processing and binarization processing.
10. The biscuit identification and positioning method of claim 1, wherein the distance transform is a Euclidean distance-based distance transform.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911086429.6A CN110853097A (en) | 2019-11-08 | 2019-11-08 | Biscuit identification and positioning method applied to biscuit surface pattern printing equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911086429.6A CN110853097A (en) | 2019-11-08 | 2019-11-08 | Biscuit identification and positioning method applied to biscuit surface pattern printing equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110853097A true CN110853097A (en) | 2020-02-28 |
Family
ID=69599894
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911086429.6A Pending CN110853097A (en) | 2019-11-08 | 2019-11-08 | Biscuit identification and positioning method applied to biscuit surface pattern printing equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110853097A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112907613A (en) * | 2020-12-21 | 2021-06-04 | 中国农业大学 | Platform for positioning densely arranged goods and center positioning method thereof |
CN115496794A (en) * | 2022-09-26 | 2022-12-20 | 广东省公路建设有限公司湾区特大桥养护技术中心 | Concrete crack width calculation method and system, computer device and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103914843A (en) * | 2014-04-04 | 2014-07-09 | 上海交通大学 | Image segmentation method based on watershed algorithm and morphological marker |
US20150078648A1 (en) * | 2013-09-13 | 2015-03-19 | National Cheng Kung University | Cell image segmentation method and a nuclear-to-cytoplasmic ratio evaluation method using the same |
CN105865329A (en) * | 2016-03-31 | 2016-08-17 | 河北科技大学 | Vision-based acquisition system for end surface center coordinates of bundles of round steel and acquisition method thereof |
CN108319973A (en) * | 2018-01-18 | 2018-07-24 | 仲恺农业工程学院 | Detection method for citrus fruits on tree |
-
2019
- 2019-11-08 CN CN201911086429.6A patent/CN110853097A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150078648A1 (en) * | 2013-09-13 | 2015-03-19 | National Cheng Kung University | Cell image segmentation method and a nuclear-to-cytoplasmic ratio evaluation method using the same |
CN103914843A (en) * | 2014-04-04 | 2014-07-09 | 上海交通大学 | Image segmentation method based on watershed algorithm and morphological marker |
CN105865329A (en) * | 2016-03-31 | 2016-08-17 | 河北科技大学 | Vision-based acquisition system for end surface center coordinates of bundles of round steel and acquisition method thereof |
CN108319973A (en) * | 2018-01-18 | 2018-07-24 | 仲恺农业工程学院 | Detection method for citrus fruits on tree |
Non-Patent Citations (4)
Title |
---|
山上有风景: "OpenCV---分水岭算法", 《HTTPS://WWW.CNBLOGS.COM/SSYFJ/P/9278815.HTML》 * |
王亮: "基于数字图像处理技术的泥沙颗粒分析", 《中国优秀硕士学位论文全文数据库(电子期刊)》 * |
贾永红等: "《数字图像处理技巧》", 31 January 2017 * |
邓继忠等: "《数字图像处理技术》", 30 September 2005 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112907613A (en) * | 2020-12-21 | 2021-06-04 | 中国农业大学 | Platform for positioning densely arranged goods and center positioning method thereof |
CN112907613B (en) * | 2020-12-21 | 2024-04-30 | 中国农业大学 | Platform for positioning densely-arranged goods and center positioning method thereof |
CN115496794A (en) * | 2022-09-26 | 2022-12-20 | 广东省公路建设有限公司湾区特大桥养护技术中心 | Concrete crack width calculation method and system, computer device and storage medium |
CN115496794B (en) * | 2022-09-26 | 2024-02-02 | 广东省公路建设有限公司湾区特大桥养护技术中心 | Concrete crack width calculation method, system, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109377485B (en) | Machine vision detection method for instant noodle packaging defects | |
CN110286124B (en) | Machine vision-based refractory brick measuring system | |
CN105608671B (en) | A kind of image split-joint method based on SURF algorithm | |
CN104408460B (en) | A kind of lane detection and tracking detection method | |
CN112712512A (en) | Hot-rolled strip steel scab defect detection method and system based on artificial intelligence | |
CN107392929B (en) | Intelligent target detection and size measurement method based on human eye vision model | |
CN108615239B (en) | Tongue image segmentation method based on threshold technology and gray level projection | |
CN103080979B (en) | From the system and method for photo synthesis portrait sketch | |
CN107292869B (en) | Image speckle detection method based on anisotropic Gaussian kernel and gradient search | |
WO2021109697A1 (en) | Character segmentation method and apparatus, and computer-readable storage medium | |
WO2023070593A1 (en) | Line width measurement method and apparatus, computing processing device, computer program, and computer readable medium | |
CN111354047B (en) | Computer vision-based camera module positioning method and system | |
CN115661187B (en) | Image enhancement method for analysis of traditional Chinese medicine preparation | |
CN111161295A (en) | Background stripping method for dish image | |
CN111444773B (en) | Image-based multi-target segmentation identification method and system | |
CN110853097A (en) | Biscuit identification and positioning method applied to biscuit surface pattern printing equipment | |
CN112884746A (en) | Character defect intelligent detection algorithm based on edge shape matching | |
CN111476804A (en) | Method, device and equipment for efficiently segmenting carrier roller image and storage medium | |
CN114332079A (en) | Plastic lunch box crack detection method, device and medium based on image processing | |
CN110458019B (en) | Water surface target detection method for eliminating reflection interference under scarce cognitive sample condition | |
CN117372432A (en) | Electronic cigarette surface defect detection method and system based on image segmentation | |
CN109635679B (en) | Real-time target paper positioning and loop line identification method | |
CN104200460B (en) | Method for registering images based on characteristics of image and mutual information | |
CN110349129B (en) | Appearance defect detection method for high-density flexible IC substrate | |
CN108985294B (en) | Method, device and equipment for positioning tire mold picture and storage medium |
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 | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20211124 Address after: 361026 floor 20, Block E, Xiamen center, No. 567, Haicang Avenue, Haicang District, Xiamen City, Fujian Province Applicant after: Panrou (Xiamen) industrial intelligence Co.,Ltd. Address before: 361102 Room 202, No. 5002, Xiang'an South Road, Xiang'an District, Xiamen City, Fujian Province Applicant before: Pan Rou (Xiamen) Technology Co.,Ltd. |
|
TA01 | Transfer of patent application right | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200228 |
|
RJ01 | Rejection of invention patent application after publication |