Fresh corn ear head cutting method and device based on image recognition
1. A fresh corn ear head cutting method based on image recognition is characterized by comprising the following steps:
acquiring a tray and an image of fresh corn ears in the tray;
determining the direction of the big end and the small end of the fresh corn ear according to the image;
controlling the tray to rotate so that the big head and the small head of the fresh corn ears are positioned at a preset position;
and controlling a cutter to cut the head of the fresh corn ear.
2. The image recognition-based fresh-eating corn ear crop method according to claim 1, further comprising, before obtaining the tray and the image of the fresh-eating corn ear in the tray:
feeding fresh corn ears into a tray in a preset posture through a feeding mechanism provided with a limiting groove; the preset posture is as follows: the big end of the fresh corn ear is in front, or the small end of the fresh corn ear is in front.
3. The image recognition-based fresh corn ear cropping method according to claim 2, wherein if the head size of the fresh corn ear in the image is at the preset position, performing a cropping operation;
and if the head of the fresh corn ear is not at the preset position in the image, controlling the tray to rotate 180 degrees, and then performing head cutting operation.
4. The image recognition-based fresh corn ear crop method of claim 1, wherein determining the fresh corn ear head-size direction from the image comprises:
carrying out filtering and denoising pretreatment on the image;
obtaining a binary image of the head and the tail of the fresh-eating corn ear in the image by adopting segmentation operation based on an improved canny operator;
performing expansion and corrosion operations on the binary image to obtain pixel point information of the head part of the fresh corn ear;
comparing the pixel point information of the two ends of the big end and the small end of the fresh corn ear, if the number of the pixel points of the first end is more and the number of the pixel points of the second end is less, the first end is the big end of the fresh corn ear, and the second end is the small end of the fresh corn ear.
5. The image recognition-based fresh corn ear cropping method according to claim 4, further comprising, before acquiring the images of the tray and the fresh corn in the tray:
and controlling the tray to reach the cutter station.
6. The image recognition-based fresh corn ear topping method according to claim 5, further comprising, before controlling the cutter to perform the topping operation on the fresh corn ear:
acquiring images of the fresh corn ears and the cutter;
and judging whether the fresh corn ear is in place or not according to the distance between the small end of the fresh corn ear and the cutter.
7. The image recognition-based fresh corn ear cropping method according to claim 6, wherein the tray is controlled to rotate so that the fresh corn ear size head is located at a preset position, wherein the preset position determination condition further comprises:
when the distance between the edge of the fresh corn ear and the cutter is less than 5 pixels, judging that the fresh corn ear is in place;
and when the distance between the edge of the fresh corn ear and the cutter is more than 20 pixels, judging that the fresh corn ear is not in place, and controlling the tray to rotate until the distance between the edge of the fresh corn ear and the cutter is less than or equal to 5 pixels.
8. The utility model provides a fresh corn ear crop device based on image recognition which characterized in that includes:
the visual sensor is fixed above the conveying belt through a first support and used for acquiring a tray and an image of fresh corn ears in the tray;
the image processing module is electrically connected with the visual sensor and used for determining the direction of the big end and the small end of the fresh corn ear according to the image;
the single chip microcomputer is respectively and electrically connected with the vision sensor and the image processing module, and is used for controlling the tray to rotate so as to enable the big head and the small head of the fresh corn ears to be positioned at a preset position;
the belt pulley assembly comprises a large belt pulley and a small belt pulley; the central shaft of the large belt pulley is connected with the output shaft of the driving motor; the central shaft of the small belt pulley is fixedly connected with the central position of the back surface of the tray;
and the gear cutter is controlled by the single chip microcomputer and is used for cutting the head of the fresh corn ears.
9. The fresh corn ear head cutting device based on image recognition as claimed in claim 8, further comprising: the first photoelectric sensor and the visual sensor are arranged on the first support above the conveyor belt together, and the signal output end of the first photoelectric sensor is connected with the first signal input end of the single chip microcomputer; the single chip microcomputer receives signals sent by the first photoelectric sensor and controls the vision sensor to execute photographing actions.
10. The fresh corn ear head cutting device based on image recognition as claimed in claim 8, further comprising: the second photoelectric sensor is fixedly arranged between the small belt pulley and the large belt pulley through a second bracket; a light-reflecting coating is arranged on the surface of the small belt pulley with the axial symmetry; when the small belt pulley rotates by 180 degrees, the second photoelectric sensor triggers a signal through the reflective coating and sends the signal to the single chip microcomputer; and the singlechip controls the driving motor according to the signal to stop the driving motor.
Background
In recent years, with the improvement of living standard, fresh corn is more and more popular. Because the fresh corn has sweet taste and is particularly easy to grow insects, especially the head of the fresh corn is the most serious, the head cutting operation is required before the harvested fresh corn ears are processed.
The existing fresh corn after-harvest processing crop is mainly operated by manpower. The big end and the small end of the fresh corn ear are distinguished manually, then the head cutting operation is carried out by using the chopper, the manual operation has strong subjectivity and low efficiency, and therefore, the problem to be solved urgently is solved by how to realize the automatic turning and cutting of the fresh corn ear.
Disclosure of Invention
In view of this, the embodiment of the invention provides a fresh-eating corn ear head cutting method and device based on image recognition, so as to solve the problems of strong subjectivity and low efficiency of manual operation in the prior art that the size of a fresh-eating corn ear is manually distinguished and then a guillotine is used for head cutting operation.
The embodiment of the invention provides a fresh corn ear head cutting method based on image recognition, which comprises the following steps:
acquiring a tray and an image of fresh corn ears in the tray;
determining the direction of the big head and the small head of the fresh corn ear according to the image;
controlling the tray to rotate so that the big head and the small head of the fresh corn ear are positioned at a preset position;
and controlling the cutter to cut the head of the fresh corn ear.
Optionally, before acquiring the tray and the fresh corn ear image in the tray, further comprising:
feeding fresh corn ears into a tray in a preset posture through a feeding mechanism provided with a limiting groove; the preset posture is as follows: the big head of the fresh corn ear is in front, or the small head of the fresh corn ear is in front.
Optionally, if the head of the fresh corn ear is at a preset position in the image, performing head cutting operation;
if the head of the fresh corn ear is not at the preset position in the image, the tray is controlled to rotate 180 degrees, and then the head cutting operation is executed.
Optionally, determining the fresh corn ear size direction according to the image comprises:
carrying out filtering and noise reduction pretreatment on the image;
obtaining a binary image of the head and the tail of the fresh-eating corn ear in the image by adopting segmentation operation based on an improved canny operator;
performing expansion and corrosion operations on the binary image to obtain pixel point information of the head part of the fresh corn ear;
comparing the pixel point information of the two ends of the big end and the small end of the fresh corn ear, if the pixel points of the first end are more and the pixel points of the second end are less, the first end is the big end of the fresh corn ear, and the second end is the small end of the fresh corn ear.
Optionally, before acquiring the image of the tray and the fresh corn in the tray, the method further includes:
the tray is controlled to reach the cutter station.
Optionally, before controlling the cutter to perform a head cutting operation on the fresh corn ear, the method further includes:
acquiring images of fresh corn ears and a cutter;
and judging whether the fresh corn ear is in place or not according to the distance between the small end of the fresh corn ear and the cutter.
Optionally, the control tray is rotated to make the fresh corn ear reducer be located at a preset position, wherein the judgment condition of the preset position further comprises:
when the distance between the edge of the fresh corn ear and the cutter is less than 5 pixels, judging that the fresh corn ear is in place;
and when the distance between the edge of the fresh corn ear and the cutter is more than 20 pixels, judging that the fresh corn ear is not in place, and controlling the tray to rotate until the distance between the edge of the fresh corn ear and the cutter is less than or equal to 5 pixels.
The embodiment of the invention has the following beneficial effects:
the embodiment of the invention provides an image recognition-based fresh corn ear cropping method, which is characterized in that the big end and the small end of a fresh corn ear are recognized based on an image processing algorithm, the big end and the small end of the fresh corn ear are rotated to a target position through a rotatable turntable, and then the fresh corn ear cropping process is carried out, so that the problem of the existing artificial ear cropping mode of fresh corn is effectively solved, the labor intensity is reduced, the labor efficiency is improved, and the processing quality of the fresh corn is improved.
The embodiment of the invention also provides a fresh corn ear head cutting device based on image recognition, which comprises:
the visual sensor is fixed above the conveying belt through the first support and used for acquiring the tray and the fresh corn ear images in the tray;
the image processing module is electrically connected with the vision sensor and used for determining the direction of the big head and the small head of the fresh corn ear according to the image;
the single chip microcomputer is respectively and electrically connected with the vision sensor and the image processing module and is used for controlling the tray to rotate so as to enable the big head and the small head of the fresh corn ear to be positioned at a preset position;
the belt pulley assembly comprises a large belt pulley and a small belt pulley; the central shaft of the large belt pulley is connected with the output shaft of the driving motor; the central shaft of the small belt pulley is fixedly connected with the central position of the back of the tray;
and the gear cutter is controlled by the single chip microcomputer and is used for cutting the head of the fresh corn ears.
Optionally, the method further comprises: the first photoelectric sensor and the visual sensor are arranged on the first support above the conveyor belt together, and the signal output end of the first photoelectric sensor is connected with the first signal input end of the single chip microcomputer; the singlechip receives the signal that first photoelectric sensor sent, and control vision sensor carries out the action of shooing.
Optionally, the method further comprises: the second photoelectric sensor is fixedly arranged between the small belt pulley and the large belt pulley through a second bracket; a reflective coating is arranged on the surface of the small belt pulley with axial symmetry; when the small belt pulley rotates by 180 degrees, the second photoelectric sensor triggers a signal through the reflective coating and sends the signal to the single chip microcomputer; the singlechip controls the driving motor according to the signal to stop the driving motor.
The embodiment of the invention has the following beneficial effects:
the embodiment of the invention provides an image recognition-based fresh corn ear head cutting device, which is characterized in that the big end and the small end of a fresh corn ear are recognized based on an image processing algorithm, the big end and the small end of the fresh corn ear are rotated to a target position through a rotatable turntable, and then the fresh corn ear head cutting device enters a head cutting process, so that the problem that the existing artificial ear head cutting mode of fresh corn is mainly adopted is effectively solved, the labor intensity is reduced, the labor efficiency is improved, and the processing quality of the fresh corn is improved.
Drawings
The features and advantages of the present invention will be more clearly understood by reference to the accompanying drawings, which are illustrative and not to be construed as limiting the invention in any way, and in which:
FIG. 1 is a flow chart of a fresh corn ear crop method based on image recognition according to an embodiment of the present invention;
fig. 2 shows a circuit diagram of a fresh corn ear crop system based on image recognition in an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, 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 some, but not all, embodiments of the present invention. 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 embodiment of the invention provides a fresh corn ear head cutting method based on image recognition, which comprises the following steps of:
and step S10, acquiring the tray and the fresh corn ear image in the tray.
In this embodiment, the tray and the fresh corn ear image in the tray are acquired by an industrial camera. In a specific embodiment, after the tray reaches the ear crop station, the industrial camera is controlled to shoot the tray and the fresh corn ears.
And step S20, determining the head and end directions of the fresh corn ears according to the images.
In this embodiment, match the fresh corn ear in the image with the corn ear image in the database, after distinguishing the fresh corn ear size, judge the position of present fresh corn ear size relative to the cutter in the tray again.
And step S30, controlling the tray to rotate so that the big end and the small end of the fresh corn ear are positioned at a preset position.
In this embodiment, a standard position is preset in the system, and the tray is controlled to rotate until the fresh corn ears in the tray reach the preset standard position. In one embodiment, the predetermined position is the fresh corn ear crop in position.
And step S40, controlling the cutter to cut the head of the fresh corn ear.
In this embodiment, before the crop operation is carried out, fix eating corn ear with the new trend through fixing device, for example through annular rubber press wheel, push down through control rubber press wheel to fix eating corn ear with the new trend, control the cutter again and carry out the crop operation to eating corn ear with the new trend.
The embodiment of the invention provides an image recognition-based fresh corn ear cropping method, which is characterized in that the big end and the small end of a fresh corn ear are recognized based on an image processing algorithm, the big end and the small end of the fresh corn ear are rotated to a target position through a rotatable turntable, and then the fresh corn ear cropping process is carried out, so that the problem of the existing artificial ear cropping mode of fresh corn is effectively solved, the labor intensity is reduced, the labor efficiency is improved, and the processing quality of the fresh corn is improved.
As an optional implementation manner, step S10 further includes:
feeding fresh corn ears into a tray in a preset posture through a feeding mechanism provided with a limiting groove; the preset posture is as follows: the big head of the fresh corn ear is in front, or the small head of the fresh corn ear is in front.
In this embodiment, feed mechanism is including the conveyer belt that has the spacing groove, is empty tray under feed mechanism's the conveyer belt export, and the fresh food corn ear is after dropping into empty tray, and the conveyer belt of tray below passes the tray to next station. Through the feed mechanism who is provided with the spacing groove, can guarantee that the initial gesture of fresh corn ear only has two kinds of circumstances: the big head of the fresh corn ear is in front, or the small head of the fresh corn ear is in front.
As an optional implementation mode, if the head of the fresh corn ear is at a preset position in the image, performing head cutting operation;
if the head of the fresh corn ear is not at the preset position in the image, the tray is controlled to rotate 180 degrees, and then the head cutting operation is executed.
In this embodiment, since there are only two cases in the initial posture of the ear of fresh corn, the tray is only required to be controlled to rotate 180 degrees, and the head and the tail of the ear of fresh corn can be located at the preset position.
As an alternative embodiment, step S20 includes:
step S21, the image is subjected to filtering and denoising preprocessing.
In this embodiment, the fresh corn ear image to be processed is subjected to preprocessing such as filtering, so as to remove the possible pollution information such as noise in the photographing process and ensure the accuracy of the subsequent image processing result.
And step S22, obtaining a binary image of the head and the tail of the fresh-eating corn ear in the image by adopting segmentation operation based on an improved canny operator.
In the embodiment, an improved Canny operator is adopted to segment the image, and the interested target object in the image, namely the fresh-eating corn ear, is extracted through segmentation.
And step S23, performing expansion and corrosion operations on the binary image to obtain pixel point information of the head part of the fresh corn ear.
In this embodiment, a mathematical morphology method, i.e., Dilation and Erosion (Dilation and Erosion) operation, is used to eliminate noise in a binary image, segment individual image elements, connect adjacent elements in the image, find a significant maximum region or a significant minimum region in the image, and determine the gradient of the image. The erosion and swelling are for white parts (highlight parts) and not for black parts. Dilation is the dilation of a highlight in an image, "field expansion", the effect map having a larger highlight area than the original. The erosion is erosion of the highlight portion in the original image, "the field is eaten by silkworm", and the effect image has a smaller highlight area than the original image. Specifically, the dilation or erosion operation is the convolution of an image (or a portion of an image, we refer to as a) with a kernel (we refer to as B); erosion is the reverse operation to dilation and erosion is the local minimum. And obtaining the pixel point information of the head part of the fresh corn ear by expansion and corrosion.
Step S24, comparing the pixel point information of the big end and the small end of the fresh corn ear, if the pixel point of the first end is more and the pixel point of the second end is less, the first end is the big end of the fresh corn ear, and the second end is the small end of the fresh corn ear.
In this embodiment, since the morphological characteristics of the fresh-eating corn ear determine that the number of the pixels at the large head and the small head of the fresh-eating corn ear is different, after the information of the pixels at the large head and the small head of the fresh-eating corn ear is obtained, which end is the large head and which end is the small head can be determined by comparing the number of the pixels.
As an optional implementation manner, before step S10, the method further includes:
the tray is controlled to reach the cutter station.
In the embodiment, the tray rotating operation is carried out on the cutter station, so that the tray can be prevented from rotating again during the conveying of the conveyor belt, and the deviation caused by the rotation can be avoided.
As an optional implementation manner, before step S40, the method further includes:
acquiring images of fresh corn ears and a cutter;
and judging whether the fresh corn ear is in place or not according to the distance between the small end of the fresh corn ear and the cutter.
In the embodiment, the distance between the small end of the fresh corn ear, namely the part to be cut, and the cutter meets the subsequent head cutting operation requirement through the propelling mechanism. In a specific embodiment, the pushing mechanism is fixed above the conveying belt and can be installed through a lifting bracket, so that the pushing mechanism is adjusted to the height of the fresh corn ears after the tray is in place.
As an optional implementation manner, the tray is controlled to rotate, so that the head and the tail of the fresh corn ear are located at a preset position, wherein the judgment condition of the preset position further includes:
when the distance between the edge of the fresh corn ear and the cutter is less than 5 pixels, judging that the fresh corn ear is in place;
and when the distance between the edge of the fresh corn ear and the cutter is more than 20 pixels, judging that the fresh corn ear is not in place, and controlling the tray to rotate until the distance between the edge of the fresh corn ear and the cutter is less than or equal to 5 pixels.
If the distance between the edge of the fresh corn ear and the cutter is less than 5 pixels, the small end position of the fresh corn ear is considered to be closest to the gear cutter, and the fresh corn ear does not need to be subjected to rotary turning operation; if the distance between the two is more than 20 pixels and more than 20 pixels, the small end position of the fresh corn ear is far away from the gear cutter, and the fresh corn needs to be rotationally turned.
In this embodiment, to prevent the tray from rotating due to the surrounding environment, the fresh corn ear is positioned by the aforementioned method to ensure that the fresh corn ear is in place, and a crop operation may be performed.
The embodiment of the invention also provides an image recognition-based fresh corn ear head cutting device, which comprises a visual sensor, an image processing module, a single chip microcomputer, a belt pulley assembly and a gear cutter, wherein: the vision sensor is fixed above the conveyor belt through a first support and used for acquiring the tray and the fresh corn ear images in the tray; the image processing module is electrically connected with the vision sensor and is used for determining the head and end directions of the fresh corn ears according to the images; the single chip microcomputer is respectively and electrically connected with the vision sensor and the image processing module and is used for controlling the tray to rotate so as to enable the big head and the small head of the fresh corn ear to be positioned at a preset position; the belt pulley assembly comprises a large belt pulley and a small belt pulley; the central shaft of the large belt pulley is connected with the output shaft of the driving motor; the central shaft of the small belt pulley is fixedly connected with the central position of the back of the tray; the gear cutter is controlled by a single chip microcomputer and is used for cutting the head of the fresh corn ears.
In this embodiment, the fresh corn ear crop device based on image recognition adopts the aforementioned method based on image processing algorithm, recognizes the reducer of the fresh corn ear, makes the reducer of the fresh corn ear rotate to the target position through the rotatable turntable, then enters into the crop process, and the existing ear crop mode that takes the manual work as the main part of the fresh corn is effectively solved, so that the labor intensity is reduced, the labor efficiency is improved, and the fresh corn processing quality is improved.
As an optional implementation, further comprising: the first photoelectric sensor and the visual sensor are arranged on the first support above the conveyor belt together, and the signal output end of the first photoelectric sensor is connected with the first signal input end of the single chip microcomputer; the singlechip receives the signal that first photoelectric sensor sent, and control vision sensor carries out the action of shooing.
In this embodiment, as shown in fig. 2, the single chip microcomputer adopts a CY 2433 24533A chip, the first photosensor is connected to a P1_3 pin of the single chip microcomputer, and the visual sensor is connected to a P2_2 pin of the single chip microcomputer. And triggering a photographing signal through a photoelectric sensor. The singlechip controls the driving motor to operate through the control circuit.
As an optional implementation, further comprising: the second photoelectric sensor is fixedly arranged between the small belt pulley and the large belt pulley through a second bracket; a reflective coating is arranged on the surface of the small belt pulley with axial symmetry; when the small belt pulley rotates by 180 degrees, the second photoelectric sensor triggers a signal through the reflective coating and sends the signal to the single chip microcomputer; the singlechip controls the driving motor according to the signal to stop the driving motor.
In this embodiment, the second photoelectric sensor is connected to a pin P1_5 of the single chip microcomputer. The whole belt pulley that does not reflect light makes second photoelectric sensor trigger a signal when belt pulley every changes 180 degrees through set up the reflection of light coating on belt pulley surface, has reduced when rotatory each time, and the singlechip need calculate the calculation burden that the rotatory angle of belt pulley caused according to driving motor's rotational speed, time isoparametric.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD), a Solid State Drive (SSD), or the like; the storage medium may also comprise a combination of memories of the kind described above.
Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope defined by the appended claims.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:一种用于高频焊接机人手误触警示保护设备