A method for rapid identification and counting of an egg flow line

By using machine vision technology, Gaussian filtering and morphological processing, combined with template matching and coordinate axis definition, high precision and real-time performance of egg counting were achieved, solving the problems of low counting accuracy and slow speed in existing technologies and improving work efficiency.

CN116863463BActive Publication Date: 2026-03-03QINGDAO UNIV OF SCI & TECH
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-31
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing egg counting methods are not very accurate and are slow, especially when large quantities are arranged in a disordered manner.

Method used

Using machine vision technology, through Gaussian filtering, morphological processing and template matching, combined with coordinate axis definition and distance judgment, high-precision tracking and counting of eggs can be achieved.

Benefits of technology

It improved the accuracy and real-time performance of egg counting, increased work efficiency, and saved operating costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116863463B_ABST
    Figure CN116863463B_ABST
Patent Text Reader

Abstract

The application provides a kind of egg pipeline fast identification counting method, comprising: using a circular egg template to identify the eggs on the pipeline;When the egg appears, track the egg;A kind of horizontal line determination method realizes the counting of the eggs on the pipeline;The accuracy of the egg counting method reaches 99.99%, which can quickly and real-time count a large number of eggs, and has a significant improvement in detection accuracy and speed compared with traditional counting methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of machine vision technology, specifically relating to a method for counting eggs on an assembly line. Background Technology

[0002] With the development of egg-laying hen farming in my country, the scale and mechanization are increasing, and productivity is constantly rising. Traditional methods can no longer meet the information processing needs of large and medium-sized egg-laying hen farms. For daily egg production statistics, manual counting is not only costly and slow, but also inaccurate. The traditional method of weighing eggs involves first weighing the total weight of many eggs and then dividing it by the average weight of a single egg to obtain an approximate number. This method is merely an estimate and lacks accuracy. Existing sensor-based egg counting devices rely on auxiliary devices to feed eggs into a conveyor chain that only allows for the orderly transport of eggs. This requires counting each egg individually, which is slow and inefficient, especially for large batches of randomly arranged eggs. The multiple steps from queuing to counting significantly impact work efficiency. Summary of the Invention

[0003] To address the problems of low accuracy and slow speed in existing egg counting methods, this invention proposes a high-precision, real-time egg counting method, the technical solution of which is as follows:

[0004] A rapid identification and counting method for eggs on an assembly line includes the following steps:

[0005] A camera is fixed at a suitable position above the production line to film the moving eggs.

[0006] Gaussian filtering is applied to the images of eggs on the production line captured by the camera to reduce the influence of complex backgrounds; the RGB image is converted to an HSV image; an HSV threshold is set to binarize the image, with the foreground represented by white and the background by black; the distance between each non-zero pixel in the image and its nearest zero pixel is calculated, and the non-zero pixels that are farther away from the zero pixel are brighter, thus the center of the egg is the brightest, and the brightest point is taken as the center of the egg.

[0007] Define a 3x3 rectangular structuring element as the structuring element for the morphological denoising algorithm. This structuring element serves as the basis for subsequent morphological operations. The morphological opening operation is applied, which first performs morphological erosion and then morphological dilation. The purpose of the opening operation is to remove noise from the image to improve the accuracy of background subtraction. At thin points, closely spaced eggs are separated, and the boundaries of the eggs are smoothed without significantly changing their area.

[0008] Detect all egg outlines and construct a complete hierarchical structure; store all outline points.

[0009] Based on the shape characteristics of an egg, a circular egg template is generated as a reference for identification, so as to achieve the goal of efficiently and accurately identifying eggs.

[0010] The processed egg image is matched with the circular egg template using the normalized coefficient matching method; if the match is successful, the egg outline is marked with an elliptical border and the egg is located using the center point.

[0011] Using the top-left corner of the image captured by the camera as the origin, define the coordinate axes as the horizontal X-axis and the vertical Y-axis, with the X-axis to the right and the Y-axis downward as positive directions; define a specific horizontal line along the X-axis, with the Y-axis coordinate of this horizontal line being y. mid .

[0012] Record the coordinates of the egg in each frame. The coordinates of the center of an egg in the current frame are (x, y), and the coordinates of the center of the egg in the previous frame are (x0, y0).

[0013] Assuming the size ratio of the egg captured by the camera to the egg in the template is k, and the detection frame rate is f; considering the potential jitter along the X-axis when the egg moves, and taking the number of pixels along the major axis of the egg as n, and the distance from the camera to the production line as l, the distance the egg moves per frame along the X-axis is:

[0014] s0=n 2 / l

[0015] If the conveyor belt moves at a speed of v, then the distance the egg travels per frame along the Y-axis is:

[0016] s1=kv / f

[0017] If |x-x0|≤s0 and y-y0≤s1, it is determined that the coordinates of these two frames locate the same egg, that is, the egg is tracked.

[0018] For a particular egg being tracked, when y0≤y mid And y > y mid The egg is determined to pass through a specific horizontal line along the X-axis and is included in the total count.

[0019] This invention utilizes machine vision technology to count eggs. It tracks and records the quantity by continuously calculating changes in the coordinates of the eggs, and runs the program on an embedded platform. This method offers high accuracy and real-time performance in recording egg counts, improving factory efficiency and reducing operating costs. Attached Figure Description

[0020] Figure 1 This is a basic flowchart of the present invention;

[0021] Figure 2 This is a schematic diagram of the coordinate axes;

[0022] Figure 3 A diagram illustrating the counting of eggs;

[0023] Figure 4 This is a flowchart of the counting process of the present invention;

[0024] Figure 5 For real-time detection of the image; Detailed Implementation

[0025] The purpose of this invention is to provide an egg counting method with high detection accuracy and strong real-time performance. The technical solution is as follows:

[0026] A rapid identification and counting method for eggs on an assembly line, the basic flowchart of which is as follows: Figure 1 As shown, it includes:

[0027] Choose a suitable position above the production line and fix a camera to film the moving eggs;

[0028] Considering the cluttered background of the production line, Gaussian filtering is used to remove noise from each frame of the video. Before color segmentation, the RGB image is converted to an HSV image, as the HSV color space better reflects the color information in the image. By setting an HSV threshold, pixels of a specific color can be selected based on the range of hue, saturation, and brightness. The foreground is represented by white, and the background by black. The binary image is converted to a grayscale image, and the distance between each non-zero pixel and its nearest zero pixel is calculated. The farther a non-zero pixel is from the zero pixel, the brighter it is, and the larger its grayscale value. Thus, the center of the egg is the brightest part, and this brightest point is taken as the center of the egg.

[0029] Define a 3x3 rectangular structuring element as the structuring element for the morphological denoising algorithm. This structuring element serves as the basis for subsequent morphological operations. The morphological opening operation is then applied, which begins with a morphological erosion operation, as shown in the following formula:

[0030]

[0031] In the formula, A is the image to be eroded, B is a 3*3 rectangular structuring element, Z is the pixel position that meets the condition, (B) Z It is the structuring element that is translated from B to position Z. Moving structure B, if the intersection of structure B and image A completely falls within the region of image A, then that position is retained. All points satisfying this condition constitute the result of structure A being eroded by structure B.

[0032] Then, a morphological dilation operation is performed, as shown in the following formula:

[0033]

[0034] In the formula, B^ is the reflection of the structuring element B; the structure B is convolved on the image A. If there is an overlapping area between the structure B and the image A during the process of moving the structure B, the position is recorded. The set of all positions where the moved structure B intersects with the image A is the dilation result of the image A under the action of the structure B.

[0035] The opening operation removes noise from an image to improve the accuracy of background subtraction. It separates closely spaced eggs at fine points, smoothing the boundaries of the eggs without significantly changing their area.

[0036] Detect all egg outlines and construct a complete hierarchical structure; store all outline points;

[0037] Based on the shape characteristics of an egg, a circular egg template is generated as a reference for identification, so as to achieve the goal of efficiently and accurately identifying eggs;

[0038] The processed egg image is matched with a circular egg template using a normalized coefficient matching method. This method can be used to find the region in the image that is most similar to the template in order to locate the egg. If the match is successful, the egg outline is marked with an elliptical border and the egg is located using the center point.

[0039] Using the top left corner of the image captured by the camera as the origin, define the coordinate axes as the horizontal X-axis and the vertical Y-axis, with the X-axis to the right and the Y-axis downwards as positive directions, such as... Figure 2 As shown; define a specific horizontal line in the X-axis direction, and the Y-axis coordinate of this horizontal line is y. mid ;

[0040] Record the coordinates of the egg in each frame. The coordinates of the center of an egg in the current frame are (x, y), and the coordinates of the center of the egg in the previous frame are (x0, y0).

[0041] Assuming the size ratio of the egg captured by the camera to the egg in the template is k, and the detection frame rate is f; considering the potential jitter along the X-axis when the egg moves, and taking the number of pixels along the major axis of the egg as n, and the distance from the camera to the production line as l, the distance the egg moves per frame along the X-axis is:

[0042] s0=n 2 / l

[0043] If the conveyor belt moves at a speed of v, then the distance the egg travels per frame along the Y-axis is:

[0044] s1=kv / f

[0045] If |x-x0|≤s0 and y-y0≤s1, it is determined that the coordinates of these two frames locate the same egg, that is, the egg is tracked.

[0046] For a particular egg being tracked, when y0≤y mid And y > y mid Position changes such as Figure 3 As shown, the egg is determined to have passed through a specific horizontal line along the X-axis and is included in the total count. The counting process is as follows: Figure 4 As shown;

[0047] The real-time detection screen and the total number of eggs will be displayed, such as Figure 5 As shown.

[0048] In summary, the method described in this invention is for identifying and counting eggs on an assembly line. As can be seen from the final results, the proposed rapid egg counting method for an assembly line is of great significance for improving the working efficiency of egg-laying chicken farms.

[0049] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above content to create equivalent embodiments for application in other fields. However, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the technical solution of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A rapid identification and counting method for eggs on an assembly line, characterized in that, include: S1. A circular egg template is used to identify eggs of different shapes and randomly arranged on the production line; S2. An accurate and fast counting method was designed, the specific steps of which are as follows: A camera is used to photograph moving eggs from a fixed position on the production line; the top left corner of the image captured by the camera is defined as the origin, and the horizontal direction is defined as... Axis, vertical direction is The coordinate axes of the axis, with Axis to the right and The downward axis is the positive direction; define a specific The horizontal line along the axis, this horizontal line Axis coordinates are ; Record the coordinates of the egg in each frame. The coordinates of the center of an egg in the current frame are ( ). , The coordinates of the center of the egg in the previous frame were ( ). , ); Assume the size ratio between the egg captured by the camera and the egg in the template is . The detection frame rate is Regarding methods for tracking eggs, it is important to consider the potential for eggs to move during operation. The jitter occurring along the axial direction is represented by the number of pixels along the major axis of the egg. Distance from camera to assembly line Then the egg along The distance moved per frame in the axial direction is: The conveyor belt moves at a speed of Then the egg along The distance moved per frame in the axial direction is: when and The coordinates of these two frames indicate that the same egg is located, meaning that the egg has been tracked. For a particular egg being tracked, when and The egg was determined to have undergone specific treatment. The horizontal line along the axis is included in the total.

2. The rapid counting method for eggs on an assembly line according to claim 1, characterized in that, S1 uses a circular egg template to identify eggs of different shapes and randomly arranged on the production line. The specific steps are as follows: Gaussian filtering is applied to the images of eggs on the production line captured by the camera to reduce the influence of complex backgrounds; the RGB image is converted to an HSV image; an HSV threshold is set to binarize the image, with the foreground represented by white and the background by black; the distance between each non-zero pixel in the image and its nearest zero pixel is calculated, and the non-zero pixels that are farther away from the zero pixel are brighter, thus the center of the egg is the brightest, and the brightest point is taken as the center of the egg; Define a A rectangular structuring element of a certain size is used as the structuring element of the morphological noise reduction algorithm. This structuring element is used as the basis for subsequent morphological operations. The morphological opening operation is used. The opening operation first performs a morphological erosion operation and then a morphological dilation operation. The purpose of the opening operation is to remove noise in the image to improve the accuracy of background subtraction. At the thin points, eggs that are close to each other are separated, and the boundaries of the eggs are smoothed without significantly changing their area. Detect all egg outlines and construct a complete hierarchical structure; store all outline points; Based on the shape characteristics of an egg, a circular egg template is generated as a reference for identification, so as to achieve the goal of efficiently and accurately identifying eggs; The processed egg image is matched with the circular egg template using the normalized coefficient matching method; if the match is successful, the egg outline is marked with an elliptical border and the egg is located using the center point.

Citation Information

Patent Citations

  • Method and system for monitoring egg laying performance of laying hen zone of cage-rearing laying hens

    CN111134047A