Full-automatic crab grading system based on image recognition
Technical Field
The invention relates to the technical field, in particular to a full-automatic crab grading system based on image recognition.
Background
The existing grading equipment mostly uses the weight of crabs as a grading index, and mainly has the principles of a moving conveying disc type, a fixed weighing body, a moving weighing body type and the like, and the grading precision is not high mainly due to various factors such as dynamic weighing errors, unstable stress and the like, so that the existing grading equipment is difficult to adapt to various operating environments. At present, in the aspect of quality detection and classification, classification parameters are mainly obtained in an electronic weighing mode, so that detection and classification are carried out. The weight of the fish is researched and designed according to the body dimension characteristic parameters and the weight relation of different fishes
And (4) a dynamic grading device. The traditional manual sorting mode is changed, the conical row classifying rollers with the same direction are obliquely arranged on the classifying plane, the body thickness value corresponding to fish with any body weight is calculated through a regression equation to serve as the basis for adjusting the interval between the classifying rollers on the classifying plane, and the interval between the adjacent classifying rollers on the classifying plane is gradually increased, so that the classifying equipment is low in precision and low in efficiency and is not easy to sort in large scale.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention provides a system for automatically sorting crabs, which takes the weight and male and female characteristics of the crabs as sorting bases. The system establishes a research scheme for realizing automatic sorting of the crabs based on technical bases such as visual identification, PLC control and virtual instruments, and aims to solve key technical problems of quick identification of male and female characteristics of the crabs, accurate extraction of weight characteristics, quick realization of multi-stage sorting and the like. The system can be applied to crab breeding bases, improves the classification efficiency and classification precision of crabs, completely liberates labor force, and brings great economic and social benefits.
The technical scheme adopted by the invention is as follows: the full-automatic crab grading system based on image recognition comprises a PLC control device, a sorting device, an electronic belt scale and a grading sorting device, wherein the sorting device, the electronic belt scale and the grading sorting device are connected to the PLC control device and are sequentially connected; wherein:
the sorting device is used for transporting and sorting crabs, acquiring male and female image characteristic information of the abdomen of the crabs through the image acquisition camera, and transmitting the male and female image characteristic information to the PLC control device;
the electronic belt scale acquires the weight information of the crabs through a weighing sensor arranged on the electronic belt scale and transmits the weight information to the PLC control device, and meanwhile, the running speed of an electronic belt acquired through a speed sensor is transmitted to the PLC control device;
the PLC control device is also connected with a counter and a timer and is used for controlling the time length of a single crab in an image acquisition area of the image acquisition camera device and counting the crabs classified on the classification sorting device;
the PLC control device controls the classification and the classification speed of the crabs according to the acquired weight information of the crabs on the electronic belt weigher, the running speed of the electronic belt and the male and female image characteristic information of the abdomen of the crabs of the classification and sorting device.
Further, the PLC control device comprises an upper computer and a lower computer, wherein: in the specific implementation process, an industrial personal computer is used as an upper monitor, and LabVIEW virtual instrument software is installed for realizing the acquisition and processing of images;
the upper computer is connected with the image acquisition camera and is in communication connection with the lower computer, and is used for detecting the male and female image characteristic information of the crab abdomen in real time and transmitting the detected male and female image characteristic information of the crab abdomen to the lower computer;
and the lower computer controls the sorting work of the grading sorting device according to the received male and female image characteristic information of the crab abdomen, the collected weight information of the crab and the running speed of the electronic belt.
Further, after the image acquisition camera acquires the characteristic information of the male and female images of the crab abdomen, the PLC control device processes the acquired original image to obtain the image information for matching, and the processing steps of obtaining the image information for matching sequentially comprise:
s11, converting the collected original image into a gray image, completing the conversion of the image by using a Colorpaneextraction color plane extraction function, and selecting the image extracted through a green plane as the converted gray image;
s12, selecting a Lookup Table function to process the contrast and brightness of the gray image, changing the gray values of the pixels so that the pixels are more uniformly distributed in a designated gray range, combining an equal number of pixels in each gray interval by an algorithm, and fully utilizing the gray change of the pixels. The equalized image reveals the details of the regions with intensity, while other regions will be cleared;
s13, the image is de-duplicated using the filter function.
Further, the Matching image information processed by the PLC control device is matched with the male crab Pattern model and the female crab Pattern model stored in the PLC control device by using a Pattern Matching function or a Geometric Matching function.
Furthermore, the electronic belt scale is a multi-roller scale, at least three groups of weighing sensors are arranged in the electronic belt scale to weigh the electronic belt scale, and in order to improve the measuring precision of the weight of the crabs, the method for measuring the weight of the crabs by the PLC control device comprises the following steps:
s41, the PLC control device obtains the weight of the crabs measured by each weighing sensor and calculates the average value of the weights of a plurality of crabs;
s42, the PLC control device judges whether the electronic belt scale enters an idle-load mode; if so, performing S43, if not, performing S44;
s43, measuring the belt weight of the electronic belt scale;
s44, judging whether to enter the calibration mode, if so, carrying out S45, and if not, executing S46;
s45, calibrating the belt scale;
and S46, measuring the weight of the crabs.
Further, the control flow of the sorting speed of the PLC control device sorting device comprises the following steps:
s21, the PLC control device judges whether a loading time is set, if yes, the PLC control device executes S22, and if not, the PLC control device executes S23;
s22, setting the feeding time of single crabs;
s23, reading a belt speed encoder value of the electronic belt scale by the PLC control device;
s24, calculating the belt running speed of the electronic belt scale by the PLC control device;
and S25, the PLC calculates the time for the crabs to reach the corresponding grading mechanisms according to the belt running speed of the electronic belt scale calculated in the S24, so that the grading mechanisms corresponding to the grading sorting device are controlled to be opened, and the grading of the crabs is completed.
Further, the PLC control device 1 controls the grading and sorting device according to the weight information of the crabs, and the specific control comprises the following steps:
s31, setting the weight grading parameter index D of male crabs and female crabs0,D1,D2…DnAs the basis for grading male crabs and female crabs;
s32, judging whether the crab is a male crab or a female crab, setting the measured weight of the crab as m, and executing S33 if the crab is the male crab; if the crab is the female crab, executing S34;
s33, when m is more than or equal to D0Judging the crabs as first-class male crabs and sorting the crabs; when D is present0≤m≤D1Judging the crabs as second-level male crabs, and sorting; the classification is carried out in a circulating way;
s34, when m is more than or equal to D2Judging the crabs as primary female crabs and sorting; when D is present2≤m≤D3Judging the crabs to be secondary female crabs, and sorting; and (4) performing cyclic classification in such a way.
Compared with the prior art, the invention has the beneficial effects that: the invention discloses a full-automatic crab grading system based on image recognition, which is designed by taking the weight and male and female characteristics of crabs as sorting bases against the blank of automatic crab grading products in the existing market.
The system can be applied to crab breeding bases, greatly improves the classification efficiency and classification precision of crabs, completely liberates labor force, and brings great economic and social benefits.
Drawings
FIG. 1 is a block diagram of one embodiment of a fully automated crab grading system based on image recognition;
FIG. 2 is a block diagram of another embodiment of a fully automated crab grading system based on image recognition;
fig. 3 is a converted sampling example image of an original image acquired by the image acquisition camera device, namely step S11, where a is the original image, b is the red plane extraction image, c is the green plane extraction image, and b is the blue plane extraction image;
fig. 4 is an image obtained by selecting the Lookup Table function to perform contrast and brightness processing on a grayscale image in the matching image information processing step S12, and a is an image before equalization and b is an image after equalization;
fig. 5 is an embodiment of a crab image after the processing step S13 of the image information for matching uses a filter function to perform denoising processing on the image;
FIG. 6 is a flowchart of a process of grading crab control;
wherein: 1-a PLC control device, 11-an upper computer, 12-a lower computer and 13-an OPC communication cable; 2-sorting device, 3-image acquisition camera, 4-electronic belt scale, 41-weighing sensor and 42-speed sensor; 5-grading sorting device, 6-counter and 7-timer.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
As shown in fig. 1, the fully automatic crab grading system based on image recognition is characterized in that: the automatic sorting machine comprises a PLC (programmable logic controller) control device 1, a sorting device 2, an electronic belt scale 4 and a grading sorting device 5 which are connected with the PLC control device in sequence; wherein:
the sorting device 2 is used for transporting and sorting crabs, acquiring male and female image characteristic information of the abdomen of the crabs through the image acquisition camera 3, and transmitting the male and female image characteristic information to the PLC control device 1; the image Acquisition camera 3 uses a USB industrial camera, and after a Vision Acquisition Software and Vision Development Module Software package is installed on an upper computer, the head portrait Acquisition and processing process based on the USB camera can be realized in LabVIEW Software; the method is economical and convenient to operate, and can meet the precision and technical requirements of the system.
The electronic belt scale 4 acquires the weight information of the crabs through a weighing sensor 41 arranged on the electronic belt scale and transmits the weight information to the PLC control device 1, and meanwhile, the running speed of an electronic belt acquired through a speed sensor 42 is transmitted to the PLC control device 1; the weighing sensor is an important component in the system, plays a key role in measuring the precision and stability of the system, and is related to the precision and reliability of online dynamic weighing of crabs. A single point 651C type load cell may be used. The speed sensor of the belt scale is used for measuring the speed of a belt in operation, the sorting speed is determined according to the numerical values of the weighing sensor and the speed sensor, an ohm dragon E6C2-C series incremental rotary encoder with high resolution can be adopted, the model is E6C2-CWZ1X, the outer diameter is 50mm, the resolution is 1000p/r, and the requirement for the accuracy of the on-line dynamic weighing and metering system of the reclaimer can be met.
The PLC control device 1 is also connected with a counter 6 and a timer 7 and is used for controlling the time length of a single crab in an image acquisition area of the image acquisition camera device and counting the classified crabs;
the PLC control device 1 controls the classification and the classification speed of the crabs according to the acquired weight information of the crabs on the electronic belt scale 4, the running speed of the electronic belt and the male and female image characteristic information of the abdomen of the crabs of the classification and sorting device 5. In the specific implementation process, the full-automatic crab grading system firstly enables the crabs to be sorted to be primarily sorted and transported into an image recognition area of an image acquisition camera by using a sorting device, a PLC (programmable logic controller) acquires male and female special image characteristic information of the abdomen of the crabs by using the image acquisition camera, then the crabs with the extracted male and female special image characteristic information of the abdomen of the crabs enter an electronic belt scale, the weight information of the crabs is acquired by using a weighing sensor, and according to the weight information and the male and female special image characteristic information of the abdomen of the crabs, the PLC controls a sorting grading mechanism to operate according to the belt operation speed acquired by using a speed sensor, so that the grading speed of the crabs can be set by the system, and the grading efficiency is improved.
As shown in fig. 2, the PLC control device 1 includes an upper computer 11 and a lower computer 12, wherein: in the specific implementation process, an industrial personal computer is used as an upper monitor, and LabVIEW virtual instrument software is installed for realizing the acquisition and processing of images;
the upper computer 11 is connected with the image acquisition camera 3 and the lower computer 12 in a communication way, is used for detecting the male and female image characteristic information of the crab abdomen in real time and transmitting the detected male and female image characteristic information of the crab abdomen to the lower computer 12;
and the lower computer 12 is connected with the upper computer through an OPC communication cable 13 and controls the sorting work of the grading sorting device according to the received male and female image characteristic information of the crab abdomen, the collected weight information of the crab and the running speed of the electronic belt. In the implementation process, an industrial personal computer can be used as an upper computer for monitoring, and LabVIEW virtual instrument software is installed on the upper computer and used for achieving image acquisition and processing. And STEP7 MicroWIN software is installed on the lower computer and used for realizing programming and debugging of the PLC of the lower computer.
In the above embodiment, after the image acquisition camera 3 of the full-automatic crab grading system acquires the male and female image feature information of the crab abdomen, the PLC control device 1 processes the acquired original image to obtain the image information for matching, and the processing steps of obtaining the image information for matching sequentially include:
s11, converting the collected original image into a gray image, completing the conversion of the image by using a Colorpaneextraction color plane extraction function, and selecting the image extracted through a green plane as the converted gray image; the three planes are respectively subjected to image extraction on the original image shot by the image acquisition camera, and the obtained result is shown in fig. 3. It can be seen from the figure that the extracted single plane grayscale images have less obvious difference because the proportion of the red, green and blue color channels in the original color image of the crab is close. The main basis for distinguishing male crabs from female crabs is that the ventral surfaces of female crabs gradually become round (umbilicus), and male crabs are in long and narrow triangles (umbilicus). In the gray level image extracted by the green plane, the gray level characteristics and the surrounding gray levels of the long and narrow triangle (umbilicus) of the male crab are clearer, so the program selects the image extracted by the green plane as the converted gray level image.
S12, selecting a Lookup Table function to process the contrast and brightness of the gray image, changing the gray values of the pixels so that the pixels are more uniformly distributed in a designated gray range, combining an equal number of pixels in each gray interval by an algorithm, and fully utilizing the gray change of the pixels. As can be seen in fig. 4, the equalized image reveals the details of the regions of intensity, while other regions will be cleared;
s13, denoising the image by using the filter function, as can be seen from FIG. 5, for the image with more high-frequency noise, the algorithm can effectively filter the high-frequency noise to obtain a more ideal image.
In the above embodiment, the image information for Matching processed by the PLC control device 1 of the full-automatic crab grading system is matched with the male crab Pattern model and the female crab Pattern model stored in the PLC control device by using a Pattern Matching function or a Geometric Matching function; the geometric matching algorithm uses geometric information of the template image as a main feature for matching, the geometric feature can be from a low-level feature such as an edge or a curve to a high-level feature such as a geometric shape obtained by a curve of the image, so the geometric matching algorithm includes both edge-based geometric matching and feature-based geometric matching, but whichever is selected, the image is required to have sharp edge characteristics, and the curve or feature information in the image can be accurately extracted. When a template is created, selecting a narrow and long triangular umbilicus region of a male crab as a feature extraction region; pattern matching allows for fast localization of a grayscale image region that matches a known reference template. When pattern matching is used, a template is first created that represents the object to be searched. Because the pattern matching is operated based on the image pixel value, compared with the geometric matching, the pattern matching has wider application range and higher operation speed than the geometric matching.
In the above embodiment, the electronic belt weigher of the fully automatic crab grading system is a multi-roller weigher, which reduces the measurement error and improves the grading precision of crabs, and at least three groups of weighing sensors are preferably arranged in the multi-roller weigher for weighing the crabs, and in order to improve the measurement precision of the crab weight, the PLC control device controls the crab weight measuring method to include:
s41, the PLC control device obtains the weight of the crabs measured by each weighing sensor and calculates the average value of the weights of a plurality of crabs;
s42, the PLC control device judges whether the electronic belt scale enters an idle-load mode; if so, performing S43, if not, performing S44;
s43, measuring the belt weight of the electronic belt scale;
s44, judging whether to enter the calibration mode, if so, carrying out S45, and if not, executing S46;
s45, calibrating the belt scale;
and S46, measuring the weight of the crabs, namely, accurately measuring the mass of the crabs.
Further, the control flow of the sorting speed of the PLC control device sorting device comprises the following steps:
s21, the PLC control device judges whether a loading time is set, if yes, the PLC control device executes S22, and if not, the PLC control device executes S23;
s22, setting the feeding time of single crabs;
s23, after the setting is finished, the PLC control device reads the belt speed encoder value of the electronic belt scale;
s24, calculating the belt running speed of the electronic belt scale by the PLC control device;
and S25, the PLC control device calculates the time for the crabs to reach the corresponding grading mechanisms according to the belt running speed of the electronic belt scale calculated in the S24, so that the grading mechanisms corresponding to the grading sorting device are controlled to be opened, and accurate grading of the crabs is completed.
In the above embodiment, the PLC control device 1 of the full-automatic crab classification system controls the classification and sorting device based on the weight information of crabs, and the specific control includes:
s31, setting the weight grading parameter index D of male crabs and female crabs0,D1,D2…DnAs the basis for grading male crabs and female crabs;
s32, judging whether the crab is a male crab or a female crab, setting the measured weight of the crab as m, and executing S33 if the crab is the male crab; if the crab is the female crab, executing S34;
s33, when m is more than or equal to D0Judging the crabs as first-class male crabs and sorting the crabs; when D is present0≤m≤D1Judging the crabs as second-level male crabs, and sorting; the classification is carried out in a circulating way;
s34, when m is more than or equal to D2Judging the crabs as primary female crabs and sorting; when D is present2≤m≤D3Judging the crabs to be secondary female crabs, and sorting; and (4) performing cyclic classification in such a way. In one embodiment of the crab grading control routine flowchart shown in fig. 6, the PLC receives weight parameter settings from the touch screen, respectively public, and private,
Setting weight sorting indexes for the female crabs. Wherein when the crab is male, the weight m is more than or equal to D0Judging the crab to be a first-class male crab, performing first-class sorting, and when D is0≤m≤D1Judging the crabs as second-level male crabs, and performing second-level sorting; the rest is defined as three stages. When the crab is female, and the weight m is more than or equal to D2Is divided into four stagesWhen D is selected3≤m≤D2Carrying out five-stage sorting; and the rest is six-level, six-level sorting is carried out, and the flow is ended after sorting introduction.
Grading tests were performed on 100 male crabs and 100 female crabs using the fully automatic crab grading system of the above embodiment, and the test results are shown in table 1-1. As can be seen from the table, the system has the advantages that the identification accuracy of male and female characteristics of the crabs is close to 100%, the average error of measurement of the weight characteristics of the crabs is about 2.3%, and the grading precision of the crabs is very high. The average time of the system for sorting single crabs is 0.82-0.85 second, the sorting efficiency is 70-73 crabs per minute, and the grading efficiency is far higher than that of manual sorting.
TABLE 1-1 results of experimental analyses
The embodiments of the present invention are disclosed as the preferred embodiments, but not limited thereto, and those skilled in the art can easily understand the spirit of the present invention and make various extensions and changes without departing from the spirit of the present invention.