Disclosure of Invention
Aiming at the defects existing in the prior art, the invention provides an intelligent bullet sorting system, which has the following specific technical scheme:
An intelligent bullet sorting system comprising:
A feed transport section including a conveyor belt, a tray, and a motion control system, in which different types of cartridges are placed in the tray, the motion of the conveyor belt being controlled by the motion control system;
The image acquisition part comprises a line scanning camera, a lens, a light source system, an image acquisition card and a rotary encoder, the tray is transmitted to the image acquisition part through a conveyor belt, and the image acquisition part acquires an original image of the tray filled with bullets;
the intelligent recognition detection part comprises a detection algorithm module, wherein the detection algorithm module is used for detecting all different types of bullets in the whole visual field range of the tray;
a communication part including a database for storing bullet types, position information, and detection results in real time and a communication module;
a control part for communicating the bullet model, the position information and the detection result to the control part through a communication module;
and the sorting execution part comprises a manipulator, the control part receives the detection result and makes corresponding instructions to the manipulator, and sorting of the bullets is realized by controlling the manipulator to grab bullets of different types to corresponding positions.
In a further development, the detection algorithm module comprises the following steps:
let the detected size be S, the diameter of the bullet be R, the distance from the top of the bullet to the line scanning camera be L, the focal length of the line scanning camera be f, the number of pixels be N, then
The running speed of the conveyor belt and the line frequency of the line scanning camera are matched according to a matching formula, wherein the matching formula is as follows:
L w is the length of the tray along the running direction of the conveyor belt, L h is the length of the tray perpendicular to the running direction of the conveyor belt, P w is the number of single-sided pixels of the line scanning camera, V is the running speed of the conveyor belt, t is the time required for the tray to enter the field of view of the line scanning camera and leave the field of view of the line scanning camera, R is the radius of the rotary encoder, B is the number of pulses which can be sent out by one circle of the rotary encoder, and lambda is the frequency doubling number which needs to be set by manual adjustment;
the algorithm in the detection algorithm module comprises the following steps:
firstly, placing an empty tray on a conveyor belt to run, and adjusting parameters of lambda to enable an image acquired by a line scanning camera to be a complete unstretched image;
Step two, respectively acquiring an Image1 of an empty tray and an Image2 of a tray with random bullets, and performing Image processing on the Image1 and the Image 2:
Firstly, performing spatial nonlinear filtering on an Image1 and an Image2, using a matrix A with a Rank m×Rankn size to slide through each pixel point of an acquired Image with a Rank p×Rankq from left to right from top to bottom, obtaining brightness values of all the pixel points, converting the brightness values into column vectors by calling a function fun1, generating a Rank m·Rankn -dimensional vector by the matrix A every time the pixel points pass through, generating Rank p·Rankq such vectors by the Image with a Rank p×Rankq size, further obtaining a Rank m·Rankn·Rankp·Rankq matrix, substituting each column of the matrix into the function fun2 to operate, generating a Rank p·Rankq -dimensional vector, and then re-reducing the Rank p·Rankq -dimensional vector into a Rank p×Rankq matrix by inverse operation of the function fun1 to complete operation;
Image enhancement is performed on Image Iamge and Image2,
I is the component value of the pixel of the original image, I * is the component value corresponding to the changed image, and n is the minimum gray value of the bullet;
an improved rapid self-adaptive image binarization method is introduced to carry out binarization processing on the image:
G (x, y) is the gray value of the current pixel point (x, y), S (x, y) is the sum of the gray values of all pixels at the upper left of the current pixel point (x, y), x represents the coordinate of the current pixel point in the x direction in the coordinate system, and y represents the coordinate of the current pixel point in the y direction in the coordinate system;
Traversing all pixels by S (x, y) =G (x, y) +S (x-1, y) +S (x, y-1) -S (x-1, y-1), calculating the average gray value of a rectangle by taking the pixels as the center, comparing with the current pixels, and further performing Image segmentation to obtain a segmented Image11 and an Image21;
Step three, carrying out contour extraction on the Image11 through Hough circle detection, extracting circular areas in which 6*8 bullets are placed on a tray, carrying out corrosion expansion operation on each circular area to obtain a detection area ROI i, taking the upper left corner of the tray as an origin position, wherein the positions of the circular areas are Cir i (x, y), i=1, 2, 48, i is an integer;
Fourthly, translational correction is carried out on the Image21 by taking Cir i (x, y) as a template, and then the Image in the detection area is obtained For imagesModel classification is carried out to obtainJ=1, 2, & gt.t, j is an integer, t is a category, and then the initial image of the j-category bullet is obtained by performing feature extraction operation
For a pair ofDecomposing to obtain each scale coefficientK=1, 2,3,4,5, pairThreshold processing is carried out according to the function F to obtain F (-), then all F (-) of the category are reconstructed and weighted and fused to obtain an initial image of j category bullets
Step five, after the initial images of the bullets of various types are collected, detecting and collecting the bullets on the new tray in real time, repeating the operations of the step two to the step four to obtain a current real-time image I current, and collecting the initial images of the bullets of class jThe data of each pixel point is subjected to a function with the current real-time image I current The method comprises the steps of obtaining expected information E j, judging the expected information E j according to the similarity, judging that the result P (j) is 1 and is represented as the existing model, directly returning coordinate information of the existing model, automatically creating a template of the new model and prompting a user;
col is the column of the image, row is the high of the image;
Gamma is a set similarity threshold set to 0.8.
In a further improvement, when the maximum diameter of the bullet to be detected is 20mm, R max is 20mm, the maximum accuracy S max required for detection is 0.03mm, the maximum pixel number N max = 666.7, the resolution of the line scan camera is at least 667×667, the minimum resolution of the line scan camera is 1334×1334, and the minimum resolution of the narrow side of the line scan camera is 8004.
The light source system comprises an open-pore backlight source positioned right above the tray, parallel line light sources which are axisymmetric and positioned at the left side and the right side above the tray, wherein the left side and the right side of the parallel line light sources are arranged in a correlation way, the included angles between the two parallel line light sources and the plane of the tray are 45 degrees, and the light source system is cooled in a stroboscopic and water-cooling dual mode.
Further improvement, the image acquisition card is used for image acquisition and transmission; the rotary encoder is used for providing acquisition signals for the line scanning camera.
The invention has the beneficial effects that:
1. The invention belongs to the application of machine vision in the field of military product detection, and realizes the online, rapid and accurate real-time detection and sorting of bullets by carrying out image acquisition, original image processing and feature extraction and discrimination on the bullets.
2. The system can automatically carry out template new construction on the newly detected bullet model, and carry out data statistics and analysis. In the algorithm, a large amount of operations are performed on the matrix, so that the algorithm is suitable for parallel acceleration operation, and the problem of real-time mass data can be solved.
3. The invention can replace manual work to recycle and sort the bullets, liberate manpower, improve efficiency and improve safety.
4. The intelligent type matching function is realized, bullet images of different types are collected, processed and stored, and then the bullet images of corresponding types can be automatically called without matching again.
5. The method has robustness, and can be used for completing the first installation and debugging for different transmission lines at different speeds without multiple debugging.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Example 1
As shown in fig. 1, the intelligent bullet sorting system includes:
And a feeding and conveying part including a conveyor belt, a tray, and a motion control system, wherein different types of bullets are placed in the tray, and the motion of the conveyor belt is controlled by the motion control system, and the feeding and conveying part can place the different types of bullets in the tray of 600 x 800mm shown in fig. 2, and convey the tray to the image acquisition part through the conveyor belt.
The image acquisition part comprises a line scanning camera, a lens, a light source system, an image acquisition card and a rotary encoder, the tray is transmitted to the image acquisition part through a conveyor belt, and the image acquisition part can acquire high-quality and high-contrast original images of the tray filled with bullets.
Because the tray size is 600 x 800mm, and there are the bullet of multiple model probably to have on the same tray, so select the line to sweep the camera and gather the image, this line sweep the camera and can avoid because the bullet highly inconsistent production that leads to the covering phenomenon in the image formation of image, and utilize it to gather the image of fixed line at every turn and splice realization to the collection of whole picture.
The image acquisition card is used for image acquisition and transmission, the data volume of the line scanning camera is too large, the common gigabit network cannot meet the real-time transmission requirement, and the data can be acquired and transmitted without loss through the image acquisition card.
The rotary encoder is used for providing acquisition signals for the line scanning camera. In the same period, the rotary encoder gives up how many pulses, and the line scan camera will acquire how many 8192 x1 images.
The light source system comprises an open-pore backlight source positioned right above the tray, parallel line light sources which are axially symmetrical and positioned at the left side and the right side above the tray, wherein the left side and the right side of the parallel line light sources are arranged in a correlation way, the included angles between the two parallel line light sources and the plane of the tray are 45 degrees, and the light source system is cooled in a stroboscopic and water-cooling dual mode.
Because the light source is angled to illuminate the surface of the tray, the light source emits parallel light, and the distance from the nearest side to the farthest side of the light source is different, so that the illumination intensity per unit area is uneven. The invention adopts the two parallel line light sources on the left and right to be arranged in opposite directions, and the illumination intensity of the middle area can be ensured to be consistent by adopting a specific angle.
The intelligent recognition detection part comprises a detection algorithm module, wherein the detection algorithm module is used for detecting all different types of bullets in the whole visual field range of the tray.
A communication part including a database for storing bullet types, position information, and detection results in real time and a communication module;
a control part for communicating the bullet model, the position information and the detection result to the control part through a communication module;
and the sorting execution part comprises a manipulator, the control part receives the detection result and makes corresponding instructions to the manipulator, and sorting of the bullets is realized by controlling the manipulator to grab bullets of different types to corresponding positions.
Example 2
The detection algorithm module comprises the following processes:
let the detected size be S, the diameter of the bullet be R, the distance from the top of the bullet to the line scanning camera be L, the focal length of the line scanning camera be f, the number of pixels be N, then If the maximum diameter of the bullet to be detected is 20mm, R max is 20mm, the required precision S max is 0.03mm, N max = 666.7, the resolution of the camera is at least 667 x 667 calculated according to the precision, in order to keep complete original information, more than 2 pixels are needed to be imaged, the minimum resolution of the camera is 1334 x 1334 calculated according to 2 pixels, and in view of the fact that the bullets arranged in a 6*8 mode are arranged, the minimum resolution of the narrow side of the camera is 8004, a Haikang 8k line scanning camera is selected, the resolution of which is 8192 x M (M is the number of spliced lines), and the requirement of the resolution of bullet detection can be met.
The accuracy of the detection result is determined by the quality of the image acquired by the camera to a great extent, the model size of the bullet is easy to judge as the acquired image contrast is higher, and the metal reflection phenomenon occurs on the surface of the bullet, so that the surface characteristics of the bullet are highlighted in order to realize large-area uniform lighting of the whole tray, a light source system as shown in fig. 3 is designed, an open pore backlight source is used for integrally improving illumination brightness, left and right opposite parallel line light sources are used for reducing reflection interference, and a stroboscopic and water cooling dual mode is adopted for reducing the temperature of the light source on site so as to ensure that the temperature of the light source on site is not too high.
Through field verification, the number of lines in practical application is 8192×11000, and a 600×800 tray can be completely collected. One image of the line scanning camera is 8192 x 1, and stitching 11000 images together is 8192 x 11000, namely the number of signals to be acquired.
The specific implementation steps of the algorithm are as follows:
Since the line scan camera needs to have relative motion with the object to present a complete image, and in order for the image not to be stretched or compressed, it is necessary that the speed and line frequency of the camera be matched. The running speed of the conveyor belt and the line frequency of the line scanning camera are matched according to a matching formula, wherein the matching formula is as follows:
L w is the length of the tray along the running direction of the conveyor belt, L h is the length of the tray perpendicular to the running direction of the conveyor belt, P w is the number of single-sided pixels of the line scanning camera, V is the running speed of the conveyor belt, t is the time required for the tray to enter the view of the line scanning camera and leave the view of the line scanning camera, R is the radius of the rotary encoder, B is the number of pulses which can be sent out by one circle of the rotary encoder, and lambda is the frequency doubling number which needs to be adjusted manually.
As shown in fig. 4, the algorithm in the detection algorithm module includes the following steps:
Step one, placing an empty tray on a conveyor belt to run, and adjusting parameters of lambda to enable an image acquired by a line scanning camera to be a complete unstretched image.
Step two, respectively acquiring an Image1 of an empty tray and an Image2 of a tray with random bullets, and performing Image processing on the Image1 and the Image 2:
firstly, performing spatial nonlinear filtering on an Image1 and an Image2, sliding each pixel point of an acquired Image with a size of Rank p×Rankq from top to bottom by using a matrix A with a size of Rank m×Rankn from left to right, obtaining brightness values of all the pixel points, converting the brightness values into column vectors by calling a function fun1, generating a Rank m·Rankn -dimensional vector by the matrix A every time the matrix A passes through one pixel point, generating Rank p·Rankq such vectors by the Image with the size of Rank p×Rankq, further obtaining a Rank m·Rankn·Rankp·Rankq matrix, substituting each column of the matrix into the function fun2, calculating to generate a Rank p·Rankq -dimensional vector, and then re-reducing the Rank p·Rankq -dimensional vector into a Rank p×Rankq matrix by inverse operation of the function fun1, thereby completing the operation. Wherein Rank m、Rankn is a row and a column of the matrix, respectively, and Rank p、Rankq is a row and a column of the matrix, respectively.
Since the gray dynamic range is narrow and the change is not obvious from the acquired bullet picture, and the bullet picture belongs to a low-contrast Image, the Image Iamge and the Image2 are subjected to Image enhancement:
i is the component value of the pixel of the original image, I * is the component value corresponding to the changed image, and n is the minimum gray value of the bullet;
an improved rapid self-adaptive image binarization method is introduced to carry out binarization processing on the image:
G (x, y) is the gray value of the current pixel point (x, y), S (x, y) is the sum of the gray values of all pixels at the upper left of the current pixel point (x, y), x represents the coordinate of the current pixel point in the x direction in the coordinate system, and y represents the coordinate of the current pixel point in the y direction in the coordinate system;
all pixels are traversed through S (x, y) =G (x, y) +S (x-1, y) +S (x, y-1) -S (x-1, y-1), then the average gray value of a rectangle is calculated by taking the pixels as the center, the average gray value is compared with the current pixels, and then Image segmentation is carried out, so that an Image11 and an Image21 after segmentation processing are obtained.
Step three, performing contour extraction on the Image11 through Hough circle detection, extracting circular areas in which 6*8 bullets are placed on the tray, performing corrosion expansion operation on each circular area to obtain a detection area ROI i, taking the upper left corner of the tray as an origin position, wherein the positions of the circular areas are Cir i (x, y), i=1, 2, 48 and i are integers.
Fourthly, translational correction is carried out on the Image21 by taking Cir i (x, y) as a template, and then the Image in the detection area is obtainedFor imagesModel classification is carried out to obtainJ=1, 2, & gt.t, j is an integer, t is a category, and then the initial image of the j-category bullet is obtained by performing feature extraction operation
For a pair ofDecomposing to obtain each scale coefficientK=1, 2,3,4,5, pairThreshold processing is carried out according to the function F to obtain F (-), then all F (-) of the category are reconstructed and weighted and fused to obtain an initial image of j category bullets
Step five, after the initial images of the bullets of various types are collected, detecting and collecting the bullets on the new tray in real time, repeating the operations of the step two to the step four to obtain a current real-time image I current, and collecting the initial images of the bullets of class jThe data of each pixel point is subjected to a function with the current real-time image I current The method comprises the steps of obtaining expected information E j, judging the expected information E j according to the similarity, judging that the result P (j) is 1 and is represented as the existing model, directly returning coordinate information of the existing model, automatically creating a template of the new model and prompting a user;
col is the column of the image, row is the high of the image;
Gamma is a set similarity threshold set to 0.8.
In the invention, the Image Iamge and the Image2 are subjected to Image enhancement by adopting a specific algorithm, because the acquired bullet Image has a narrow gray dynamic range and insignificant change, and belongs to a low-contrast Image, the gray value range of the bullet Image is expanded by setting the minimum gray value in the bullet Image as 0 and setting the part symmetrical to the minimum gray value 255 as 255, so that the gray contrast of the bullet Image can be improved, and the subsequent contour extraction is convenient.
Other image enhancement algorithms, such as:
1. image enhancement based on gamma transformation is low for image contrast and the image enhancement effect is obvious in the case of high overall brightness value (overexposure for camera).
2. The image enhancement based on the object Log transformation can expand the low gray value part of the image, display more details of the low gray value part, compress the high gray value part of the image, and reduce the details of the high gray value part, so that the aim of emphasizing the low gray value part of the image is fulfilled.
3. The gray level image of the original image is uniformly distributed in the whole gray level space from a gray level interval in a comparison set based on the image enhancement of histogram equalization, so that the nonlinear stretching of the image is realized, and the pixel values of the image are redistributed.
None of these can distinguish the grey scale of the bullet pictures significantly.
In the invention, the fourth and fifth steps can improve the bullet classifying effect. If in step four, the method of least square fitting the circle to the image ROI i * finds the largest circle, the existing model directly returns coordinate information, the new model automatically creates the template and prompts the user, then the method simply classifies the circles at the outermost periphery of the bullets, and there is a phenomenon that bullets with the same outer diameter and different inner diameters are classified into one category. The invention can accurately classify the bullets by extracting the characteristics in multiple dimensions through the present step four.
Gamma is set to a value that is measured over a large number of actual measurements and is continuously adjusted. If the gamma setting is too small, for example 0.5, it may lead to a partial bullet picture classification error, such as the fact that a-type bullets are classified into b-type bullets, and the occurrence probability of this situation is geometrically increased. If the gamma setting is too large, such as 0.9, a part of bullet pictures cannot find the built category, and a new category is automatically generated, so that the effect of actual accurate classification cannot be achieved.
In step four, pairDecomposing to obtain each scale coefficientK=1, 2,3,4,5, k maximum is 5, when k is too small, the extracted features are insufficient, such as k=3, only edge information can be extracted, when k is too large, calculation is exponentially increased, calculation time is too long, such as when k=7, detection time is 20 times of that when k=5, and detection performance is affected.
Fig. 5 is an original view of a bullet, and fig. 6 is a contour diagram of a bullet after being processed by a global threshold segmentation algorithm (a segmentation threshold is set according to a gray histogram of an image, then gray values of pixel points with gray values lower than the segmentation threshold in the image are set to 0, and the rest are set to 255). Fig. 7 is a contour map of a bullet after contour extraction by Canny algorithm (firstly, gaussian blur is performed to remove noise in an image, then gradient amplitude and direction of the image are calculated, and finally, edge contour is obtained by non-maximum suppression). Fig. 8 is a profile view of a process employing the algorithm of the present invention. As can be seen from FIGS. 5-8, conventional threshold segmentation cannot well filter out interference points in an image, conventional edge extraction can lose some profile information, and the method can remove the interference points in the image to the greatest extent possible on the basis of retaining the profile.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, and alternatives falling within the spirit and principles of the invention.