A method, system, device and storage medium for detecting and identifying internal damage in duck egg breeding

By combining the grayscale threshold judgment and the main frequency ratio to obtain the error threshold, the problem of failure to judge duck egg fertilization in the prior art is solved, and the multi-faceted screening of duck eggs is achieved, and the hatching rate and recognition accuracy are improved.

CN119540563BActive Publication Date: 2025-05-16CHERRY VALLEY BREEDING TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411791012.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-05-16
Estimated Expiration
2044-12-06

AI Technical Summary

Technical Problem

In the prior art, only the freshness of duck eggs is judged, and no consideration is given to whether the duck eggs are fertilized, resulting in a low hatching rate of duck eggs.

Method used

By determining whether the duck egg is normal or damaged based on the grayscale threshold of the normal duck egg and the detection grayscale diagram, the smaller error threshold and larger error threshold are obtained based on the main frequency ratio, and the smaller error threshold are determined to determine whether the duck egg is infertilized.

Benefits of technology

The simultaneous screening of normal and damaged, fertilized and unfertilized duck eggs is achieved, and the hatching rate and recognition accuracy of duck eggs are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119540563B_ABST
    Figure CN119540563B_ABST
Patent Text Reader

Abstract

The invention discloses a method, system, device and storage medium for detecting and identifying internal damage in duck egg breeding, and relates to the technical field of internal detection of duck eggs, comprising the following steps: obtaining a perspective view of the duck egg to be detected during breeding, and marking it as a detection duck egg perspective view; judging whether the duck egg to be detected is a normal duck egg or a damaged duck egg based on a normal duck egg grayscale threshold and a detection grayscale image; obtaining a smaller error threshold and a larger error threshold based on a main number frequency ratio, and judging whether the detected duck egg is an unfertilized duck egg based on the detection main number proportion, the smaller error threshold and the larger error threshold; the invention is used to solve the problem of low hatching rate of duck eggs caused by only judging the freshness of duck eggs but not judging the fertilization of duck eggs in the existing technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of duck egg internal detection, and in particular to a method, system, equipment and storage medium for detecting and identifying internal damage in duck egg breeding. Background Art

[0002] When the demand for ducks is high, breeding based on duck eggs is needed. During the duck egg breeding process, humans are required to judge the quality of duck eggs through duck egg perspective images.

[0003] In the prior art, when inspecting duck eggs, a method combining duck egg perspective and image analysis is used to automatically and quickly identify infertile eggs and eggs with internal damage, thereby improving the hatching rate of duck eggs. For example, a patent application with publication number CN117007514A discloses a detection method, device and detection equipment for automatically identifying the inside of duck eggs. This solution only judges the freshness of duck eggs, but does not take into account the need to judge whether the duck eggs are fertilized during the duck egg breeding process, resulting in a low hatching rate of duck eggs. That is, the prior art only judges the freshness of duck eggs but does not judge whether the duck eggs are fertilized, resulting in the problem of low hatching rate of duck eggs. Summary of the invention

[0004] The present invention aims to solve one of the technical problems in the prior art to at least a certain extent, by judging whether the duck eggs to be tested are normal duck eggs or damaged duck eggs based on the normal duck egg grayscale threshold and the detection grayscale map; obtaining a smaller error threshold and a larger error threshold based on the main number frequency ratio, and judging whether the tested duck eggs are unfertilized duck eggs based on the detection main number proportion, the smaller error threshold and the larger error threshold, so as to solve the problem of low hatching rate of duck eggs caused by only judging the freshness of duck eggs but not judging the fertilization of duck eggs in the prior art.

[0005] To achieve the above objectives, in a first aspect, the present application provides a method for detecting and identifying internal damage in duck egg breeding, comprising the following steps:

[0006] Obtain a perspective view of the duck eggs to be tested during breeding, marked as a testing duck egg perspective view;

[0007] A detection grayscale image is obtained based on a detection duck egg perspective image and a grayscale method, a normal duck egg grayscale threshold is obtained based on a histogram threshold acquisition method, and based on the normal duck egg grayscale threshold and the detection grayscale image, it is determined whether the duck egg to be detected is a normal duck egg or a damaged duck egg, and the detection grayscale image of the normal duck egg is marked as a normal detection grayscale image;

[0008] Based on the normal detection grayscale image and the histogram threshold, the detection binary image is obtained. Based on the main number frequency ratio acquisition method, the detection main number proportion of the detection binary image is obtained. Based on the main number frequency ratio, the smaller error threshold and the larger error threshold are obtained. Based on the detection main number proportion, the smaller error threshold and the larger error threshold, it is judged whether the detected duck eggs are unfertilized duck eggs.

[0009] Furthermore, obtaining a detection grayscale image based on the detection of the duck egg perspective image and the binarization method includes the following sub-steps:

[0010] The RGB value of the pixel point of the duck egg perspective image is converted into a gray value using the grayscale method;

[0011] Grayscale methods include:

[0012] Get the R, G and B values ​​of each pixel in the RGB value of the detected duck egg perspective image;

[0013] Use the grayscale conversion formula to convert the RGB value into a grayscale value. The grayscale conversion formula is:

[0014] Dth=θ1*R+θ2*G+θ3*B; where Dth is the grayscale value of the pixel in the duck egg perspective image, and θ1, θ2 and θ3 are the R, G and B weights respectively.

[0015] Furthermore, obtaining the grayscale threshold based on the histogram threshold obtaining method includes the following sub-steps:

[0016] Obtaining a first number of historical perspective images of normal duck eggs and damaged duck eggs, marking the historical duck egg images, converting the historical duck egg images into historical grayscale images using a grayscale method, obtaining a distinguishing threshold for all historical grayscale images using a histogram threshold acquisition method, and marking the grayscale threshold for normal duck eggs;

[0017] The histogram threshold acquisition method includes:

[0018] Divide the grayscale value of 0-255 into s intervals evenly, marked as grayscale range intervals;

[0019] Count the frequency of the grayscale values ​​in each grayscale range respectively, and mark it as grayscale range frequency;

[0020] Draw a histogram with grayscale value as X-axis and grayscale range frequency as Y-axis, marked as grayscale range histogram;

[0021] Add up all gray range frequencies to get the total frequency, marked as O;

[0022] Intervals with a gray - scale range frequency less than O / s are marked as regions with a smaller frequency, and intervals other than those with a smaller frequency are marked as regions with a larger frequency. Determine whether there are regions with a larger frequency on both sides of the region with a smaller frequency. If so, mark this region with a smaller frequency as the threshold region;

[0023] Set the mid - point value of the abscissa of the threshold region as the discrimination threshold.

[0024] Furthermore, based on the gray - scale threshold of normal duck eggs and the detected gray - scale image, determining whether the duck egg to be detected is a normal duck egg or a damaged duck egg includes the following sub - steps:

[0025] Mark the gray - scale value of each pixel point in the detected gray - scale image as the detected gray - scale value;

[0026] Obtain the total number of detected gray - scale values, marked as Jzs;

[0027] Obtain the number of detected gray - scale values less than the gray - scale threshold of normal duck eggs, marked as Jzc;

[0028] Calculate the detection ratio as: JZ = Jzc / Jzs; where JZ is the detection ratio;

[0029] Obtain the perspective view of damaged duck eggs in the first - quantity history, marked as the historical damaged - duck - egg image. Use the gray - scale conversion method to obtain the gray - scale values of pixel points in the historical damaged - duck - egg image, marked as historical gray - scale values;

[0030] Obtain the total number of historical gray - scale values of a historical damaged - duck - egg image, marked as Jls;

[0031] Obtain the number of historical gray - scale values less than the gray - scale threshold of normal duck eggs, marked as Jlc;

[0032] Calculate the historical ratio as: JL = Jlc / Jls; where JL is the historical ratio;

[0033] Obtain the historical ratio of each historical damaged - duck - egg image, and obtain the minimum value of the historical ratio, marked as JLm;

[0034] Judge whether JZ < JLm is satisfied. If it is satisfied, the duck egg to be detected is a normal duck egg; if not, the duck egg to be detected is a damaged duck egg.

[0035] Furthermore, based on the normal detected gray - scale image and the histogram threshold, obtain the detected binary image. Based on the method for obtaining the main - number frequency ratio, obtaining the proportion of the detected main number in the detected binary image includes the following sub - steps:

[0036] Use the histogram - threshold - obtaining method to obtain the discrimination threshold for the normal detected gray - scale image, marked as the binary - threshold. Set the gray - scale values of pixel points greater than or equal to the binary - threshold to 255, and set the gray - scale values of pixel points less than the binary - threshold to 0;

[0037] The pixels with a grayscale value of 0 are set as embryo pixels, and the pixels with a grayscale value of 255 are set as background pixels;

[0038] The main number frequency ratio acquisition method is used to obtain the ratio of the main number frequency of the detection binary image, which is marked as the detection main number ratio;

[0039] Method for obtaining the main frequency ratio:

[0040] Establish a first plane rectangular coordinate system, and put the duck egg binary image into the first plane rectangular coordinate system;

[0041] Get two pixels adjacent to the corner point of the pixel, mark them as corner adjacent pixels, get the coordinates of the center points of the two corner adjacent pixels, mark them as (x1, y1) and (x2, y2) respectively;

[0042] The distance between the center coordinates of two adjacent corner pixels is calculated as: ; Where Dj is the distance between the center coordinates of two adjacent corner pixels;

[0043] Obtain the coordinates of the center point of all embryonic pixels, use the coordinates of the center point of the embryonic pixels as the coordinates of the corresponding embryonic pixels, and mark the coordinates of the embryonic pixels as embryonic coordinate points;

[0044] Obtain an embryo coordinate point and mark it as a detection coordinate point; mark the remaining embryo coordinate points as remaining coordinate points;

[0045] The detected coordinate points are marked as (a, b) and the remaining coordinate points are marked as (c i , d i );

[0046] The distance between the detected coordinate point and all remaining coordinate points is calculated as: ; where Dp i To detect the distance between the coordinate point and all remaining coordinate points;

[0047] Statistics Dp i ≤The number of Dj, marked as the adjacent number;

[0048] Get the number of adjacent pixels of all embryos;

[0049] Count the frequency of each adjacent number and mark it as adjacent frequency;

[0050] Obtain the adjacent frequencies of the first proportion from large to small, and mark them as larger frequencies;

[0051] Mark the adjacent numbers corresponding to the larger frequency as the main numbers;

[0052] Find the larger frequency sum, marked as N1;

[0053] Mark the larger frequency as N j ;

[0054] Find the ratio of the frequency of each main number: NZ j =N j / N1;NZ j is the ratio of the main number frequencies.

[0055] Furthermore, obtaining a smaller error threshold and a larger error threshold based on the main number frequency ratio includes the following sub-steps:

[0056] A second number of unfertilized duck eggs are obtained, which are marked as historical unfertilized duck eggs, and a historical unfertilized binary graph is obtained by using a binarization method and a histogram threshold;

[0057] The frequency ratio of each main number in each historical unfertilized binary image was obtained using the main number frequency ratio acquisition method, and marked as the historical fertilized main number ratio;

[0058] Calculate the mean of each historical unfertilized population, marked as Mw j ;

[0059] Get the smaller error threshold: Ms j -v, get the maximum error threshold: Ms j +v; where v is the range proportionality constant.

[0060] Further, judging whether the detected duck eggs are unfertilized duck eggs based on the main number ratio, the smaller error threshold and the larger error threshold includes the following sub-steps:

[0061] Mark the main number of detections as Mjc j ;

[0062] Determine whether each (Ms j -v) <Mjc j <(Ms j +v), if it is satisfied, the duck egg to be tested is an unfertilized duck egg.

[0063] In a second aspect, the present application provides a duck egg breeding internal damage detection and identification system, including: a detection image acquisition module, a duck egg quality judgment module, and a duck egg fertilization judgment module;

[0064] The detection image acquisition module is used to obtain a perspective view of the duck eggs to be detected during breeding, which is marked as a detection duck egg perspective view;

[0065] The module for judging the quality of duck eggs is used to obtain a detection grayscale image based on a detection duck egg perspective image and a grayscale method, obtain a normal duck egg grayscale threshold based on a histogram threshold acquisition method, judge whether the duck egg to be detected is a normal duck egg or a damaged duck egg based on the normal duck egg grayscale threshold and the detection grayscale image, and mark the detection grayscale image of the normal duck egg as a normal detection grayscale image;

[0066] The module for determining the fertilization of duck eggs is used to obtain a detection binary image based on a normal detection grayscale image and a histogram threshold, obtain the main number of detection proportions of the detection binary image based on a main number frequency ratio acquisition method, obtain a smaller error threshold and a larger error threshold based on the main number frequency ratio, and determine whether the detected duck eggs are unfertilized duck eggs based on the main number of detection proportions, the smaller error threshold and the larger error threshold.

[0067] In a third aspect, the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the above method are performed.

[0068] In a fourth aspect, the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the above method are performed.

[0069] Beneficial effects of the present invention: The present invention determines whether the duck egg to be detected is a normal duck egg or a damaged duck egg based on the grayscale threshold of a normal duck egg and the detection grayscale map; obtains a smaller error threshold and a larger error threshold based on the frequency ratio of the main number, and determines whether the detected duck egg is an unfertilized duck egg based on the proportion of the main number of detections, the smaller error threshold and the larger error threshold. The advantage of the present invention is that normal duck eggs and damaged duck eggs are first distinguished, and unfertilized duck eggs are then distinguished from normal duck eggs. The damaged duck eggs and unfertilized duck eggs can be screened and removed at the same time, thereby improving the hatching rate of duck eggs.

[0070] The present invention uses a main number frequency ratio acquisition method, and its advantage is that there are blood threads radiating from the embryonic outline of a fertilized duck egg, and the diverging blood threads make the embryonic pixel points more adjacent to the background pixel points; while there are no blood threads radiating from the embryonic outline of an unfertilized duck egg, and in comparison, the embryonic pixel points are less adjacent to the background pixel points, so fertilized duck eggs and unfertilized duck eggs can be distinguished, thereby improving the accuracy of identifying unfertilized duck eggs. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] Figure 1 is a flow chart of the steps of the method of the present invention;

[0072] Figure 2 is a schematic diagram of a grayscale range histogram of the present invention;

[0073] Figure 3A schematic diagram of obtaining the adjacent number of the present invention;

[0074] Figure 4 It is a functional block diagram of the system of the present invention. DETAILED DESCRIPTION

[0075] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0076] Example 1, please refer to Figure 1 As shown, in the first aspect, the present application provides a duck egg breeding internal damage detection and identification system, including: a detection image acquisition module, a duck egg quality judgment module and a duck egg fertilization judgment module; the detection image acquisition module is used to obtain a perspective view of the duck egg to be detected during breeding, marked as a detection duck egg perspective view.

[0077] The module for judging the quality of duck eggs is used to obtain a detection grayscale image based on the detection duck egg perspective image and the grayscale method, obtain a normal duck egg grayscale threshold based on the histogram threshold acquisition method, judge whether the duck egg to be detected is a normal duck egg or a damaged duck egg based on the normal duck egg grayscale threshold and the detection grayscale image, and mark the detection grayscale image of the normal duck egg as a normal detection grayscale image;

[0078] The module for judging the quality of duck eggs is configured with a grayscale strategy, which includes: using a grayscale method to convert the RGB values ​​of the pixels of the duck egg perspective image into grayscale values;

[0079] The grayscale method includes: obtaining R, G and B values ​​in the RGB value of each pixel point of the detected duck egg perspective image;

[0080] The RGB value is converted into a grayscale value using the grayscale conversion formula: Dth=θ1*R+θ2*G+θ3*B; where Dth is the grayscale value of the pixel in the duck egg perspective image, θ1, θ2 and θ3 are the R, G and B weights respectively; where θ1, θ2 and θ3 are set based on the different sensitivities of the human eye to color, such as θ1=0.299, θ2=0.587, θ3=0.114, and 0.299+0.587+0.114=1 is satisfied at the same time.

[0081] The module for judging whether duck eggs are good or bad is configured with a strategy for obtaining a distinguishing threshold value, which includes: obtaining a first number of historical perspective images of normal duck eggs and damaged duck eggs, marking the historical duck egg images, converting the historical duck egg images into historical grayscale images using a grayscale method, obtaining a distinguishing threshold value for all historical grayscale images using a histogram threshold acquisition method, and marking the grayscale threshold value for normal duck eggs;

[0082] The principle is: normal duck eggs are yellow or orange when light is transmitted, while damaged duck eggs are usually gray and black when light is transmitted. Therefore, the gray value distribution of normal duck eggs and damaged duck eggs after conversion is different. Therefore, the histogram threshold acquisition method can be used to find the gray threshold between normal duck eggs and damaged duck eggs.

[0083] The histogram threshold acquisition method includes: dividing the grayscale value of 0-255 into s intervals on average, marking them as grayscale range intervals; s is set to ensure that the optimal frequency area with a small frequency appears, and if the optimal frequency area with a small frequency does not appear, s is appropriately increased;

[0084] Count the frequency of the grayscale values ​​in each grayscale range respectively, and mark it as grayscale range frequency;

[0085] Draw a histogram with grayscale value as X-axis and grayscale range frequency as Y-axis, marked as grayscale range histogram;

[0086] Add up all gray range frequencies to get the total frequency, marked as O;

[0087] The intervals with grayscale range frequency less than O / s are marked as the areas with smaller frequency, and the intervals other than the areas with smaller frequency are marked as the areas with larger frequency. It is determined whether there are areas with larger frequency on both sides of the areas with smaller frequency. If so, the areas with smaller frequency are marked as the threshold areas. This method can distinguish two parts with too large a difference in grayscale values.

[0088] The midpoint value of the abscissa of the threshold area is set as the discrimination threshold.

[0089] The module for judging the quality of duck eggs is configured with strategies for judging the quality of duck eggs. The strategies for judging the quality of duck eggs include:

[0090] Mark the grayscale value of each pixel in the detection grayscale image as the detection grayscale value;

[0091] Get the total number of detected gray values, marked as Jzs;

[0092] Get the number of detected gray values ​​less than the normal duck egg gray threshold, marked as Jzc;

[0093] The detection ratio is calculated as: JZ = Jzc / Jzs;

[0094] Obtain a perspective view of the damaged duck eggs in the first quantity history, marked as the historical damaged duck egg diagram, and use the grayscale method to obtain the grayscale values of the pixel points in the historical damaged duck egg diagram, marked as the historical grayscale values;

[0095] Obtain the total quantity of the historical grayscale values of a historical damaged duck egg diagram, marked as Jls;

[0096] Obtain the quantity of historical grayscale values less than the normal duck egg grayscale threshold, marked as Jlc;

[0097] Calculate the historical ratio as: JL = Jlc / Jls; where JL is the historical ratio;

[0098] Obtain the historical ratio of each historical damaged duck egg diagram, and obtain the minimum value of the historical ratio, marked as JLm;

[0099] Judge whether JZ < JLm is satisfied. If it is satisfied, the duck egg to be detected is a normal duck egg; if not, the duck egg to be detected is a damaged duck egg;

[0100] The principle is that the grayscale values of the part less than the normal duck egg grayscale threshold are close to the grayscale value range of the damaged duck eggs. Therefore, the larger the ratio, the greater the degree of damage of the duck eggs. Therefore, the minimum value of the historical ratio is set as the threshold ratio, and less than the threshold ratio is a normal duck egg;

[0101] In practical applications, the total quantity of the detected grayscale values obtained is Jzs = 2 million, the quantity of the detected grayscale values less than the normal duck egg grayscale threshold obtained is Jzc = 120,000, and the detected ratio is calculated as: JZ = Jzc / Jzs = 0.06. The total quantity of the historical grayscale values of a historical damaged duck egg diagram obtained is Jls = 2 million; the quantities of the historical grayscale values less than the normal duck egg grayscale threshold of each historical damaged duck egg diagram are 1 million, 1.6 million, 210,000, and 130,000 respectively; the historical ratios are calculated as: 0.5, 0.8, 0.105, and 0.065 respectively; where the historical ratio is reserved to three decimal places, and JL is the historical ratio; the minimum value of the historical ratio obtained is JLm = 0.065, and JZ = 0.06 < JLm = 0.065 is satisfied, that is, the duck egg to be detected is a normal duck egg.

[0102] The duck egg fertilization judgment module is used to obtain a detection binary image based on the normal detection grayscale image and the histogram threshold, obtain the detection main number ratio of the detection binary image based on the main number frequency ratio acquisition method, obtain the smaller error threshold and the larger error threshold based on the main number frequency ratio, and judge whether the detected duck egg is an unfertilized duck egg based on the detection main number ratio, the smaller error threshold, and the larger error threshold;

[0103] The duck egg fertilization judgment module is configured with a ratio strategy for obtaining the main number frequency, and the ratio strategy for obtaining the main number frequency includes:

[0104] The normal detection grayscale image is obtained by using the histogram threshold acquisition method to obtain the distinction threshold, which is marked as the binarization threshold. The grayscale values ​​of pixels greater than or equal to the binarization threshold are set to 255, and the grayscale values ​​of pixels less than the binarization threshold are set to 0. Because the embryo part is dark yellow or orange-red, and the rest of the part is bright yellow, the distribution of the converted grayscale values ​​is different, so the binarization threshold can be used to distinguish the embryo part from the rest of the part.

[0105] The pixels with a grayscale value of 0 are set as embryo pixels, and the pixels with a grayscale value of 255 are set as background pixels;

[0106] The main number frequency ratio acquisition method is used to obtain the ratio of the main number frequency of the detection binary image, which is marked as the detection main number ratio; the principle is that the embryo contour of the fertilized duck egg has blood threads that diverge around it, and the divergent blood threads make the embryo pixel points more adjacent to the background pixel points; while the embryo contour of the unfertilized duck egg does not have blood threads that diverge around it, and in comparison, the embryo pixel points are less adjacent to the background pixel points, so the fertilized duck eggs and the unfertilized duck eggs can be distinguished;

[0107] Method for obtaining the frequency ratio of main numbers: establish the first plane rectangular coordinate system, and put the duck egg binary graph into the first plane rectangular coordinate system;

[0108] Get two pixels adjacent to the corner point of the pixel, mark them as corner adjacent pixels, get the coordinates of the center points of the two corner adjacent pixels, mark them as (x1, y1) and (x2, y2) respectively;

[0109] The distance between the center coordinates of two adjacent corner pixels is calculated as: ; Where Dj is the distance between the center coordinates of two adjacent corner pixels; the distance between adjacent corner pixels is the longest distance between a pixel and its surrounding eight pixels;

[0110] Obtain the coordinates of the center point of all embryonic pixels, use the coordinates of the center point of the embryonic pixels as the coordinates of the corresponding embryonic pixels, and mark the coordinates of the embryonic pixels as embryonic coordinate points;

[0111] Obtain an embryo coordinate point and mark it as a detection coordinate point; mark the remaining embryo coordinate points as remaining coordinate points;

[0112] The detected coordinate points are marked as (a, b) and the remaining coordinate points are marked as (c i , d i );

[0113] The distance between the detected coordinate point and all remaining coordinate points is calculated as: ; where Dp i To detect the distance between the coordinate point and all remaining coordinate points;

[0114] See also Figure 3 As shown, the statistical Dp i ≤Dj, marked as the number of adjacent points; the number of adjacent points is the number of calculated detection coordinate points and the number of adjacent points to the remaining coordinate points, that is, between 0 and 8;

[0115] Get the number of adjacent pixels of all embryos;

[0116] Count the frequency of each adjacent number and mark it as adjacent frequency;

[0117] Obtain the adjacent frequencies of the first ratio from large to small, and mark them as larger frequencies; for example, the embryonic pixel points in the middle of the embryo are generally 8, the embryonic pixel points at the edge are generally 5, and the embryonic pixel points of the bloodshot are generally 2 or 5. Since the adjacent frequencies are mainly 2, 5 and 8, the first ratio is generally set to 3 / 8;

[0118] Mark the adjacent numbers corresponding to the larger frequency as the main numbers;

[0119] Find the larger frequency sum, marked as N1;

[0120] Mark the larger frequency as N j ;

[0121] Find the ratio of the frequency of each main number: NZ j =N j / N1;NZ j is the ratio of the main number frequencies;

[0122] In practical applications, the coordinates of the center points of two adjacent corner pixels are obtained as (0, 0) and (1, 1), that is, Dj is ; Get Dp i ≤ The main numbers are 8, 5 and 2, and the corresponding larger frequencies are 1.2 million, 400,000 and 200,000. The total larger frequency is N1=1.8 million. The frequency ratio of each main number is 0.667, 0.222 and 0.111, and the frequency ratio of each main number is rounded to three decimal places.

[0123] The module for judging the fertilization of duck eggs is configured with an acquisition error threshold strategy, which includes:

[0124] A second number of unfertilized duck eggs are obtained, which are marked as historical unfertilized duck eggs, and a historical unfertilized binary graph is obtained by using a binarization method and a histogram threshold;

[0125] The frequency ratio of each main number in each historical unfertilized binary image was obtained using the main number frequency ratio acquisition method, and marked as the historical fertilized main number ratio;

[0126] Calculate the mean of each historical unfertilized population, marked as Mw j ;

[0127] Get the smaller error threshold: Ms j -v, get the maximum error threshold: Ms j +v; where v is the range proportional constant; because the morphology of unfertilized duck egg embryos does not change and they are all spherical, and the proportion of the main number of historical fertilizations is roughly the same, v is the range proportional constant and can be set relatively small, so v can be set to: 0.05;

[0128] In actual applications, the mean proportions of the main number of historical unfertilized individuals corresponding to each of the main number of historical unfertilized individuals, 8, 5, and 2, are 0.897, 0.132, and 0.051; the larger error threshold of the main number of historical unfertilized individuals, 8, is 0.947, and the smaller error threshold is 0.857; the larger error threshold of the main number of historical unfertilized individuals, 5, is 0.182, and the smaller error threshold is 0.082; the larger error threshold of the main number of historical unfertilized individuals, 2, is 0.101, and the smaller error threshold is 0.001.

[0129] The module for judging the fertilization of duck eggs is configured with a strategy for judging the fertilization of duck eggs. The strategy for judging the fertilization of duck eggs includes: marking the proportion of the main number of detections as Mjc j ;

[0130] Determine whether each (Ms j -v) <Mjc j <(Ms j +v), if it is satisfied, the duck egg to be tested is an unfertilized duck egg; if it is not satisfied, it is initially set as a fertilized duck egg. Because the fertilized duck egg is constantly incubating, it will change, and it is necessary to further determine the fertilized duck egg.

[0131] In practical applications, the main number of 8 does not satisfy 0.857<0.667<0.947, the main number of 5 does not satisfy 0.082<0.222<0.182, and the main number of 2 does not satisfy 0.001<0.111<0.101. Therefore, the duck eggs to be tested are preliminarily screened as fertilized duck eggs.

[0132] Example 2, please refer to Figure 4 As shown, in a second aspect, the present application provides a method for detecting and identifying internal damage in duck egg breeding, comprising the following steps:

[0133] Step S1, obtaining a perspective view of the duck eggs to be tested during breeding, marked as a tested duck egg perspective view.

[0134] Step S2, based on the detection egg perspective image and the grayscale method, a detection grayscale image is obtained, based on the histogram threshold acquisition method, a normal duck egg grayscale threshold is obtained, based on the normal duck egg grayscale threshold and the detection grayscale image, it is determined whether the duck egg to be detected is a normal duck egg or a damaged duck egg, and the detection grayscale image of the normal duck egg is marked as a normal detection grayscale image; Step S2 includes the following sub-steps:

[0135] Step S201, converting the RGB values ​​of the pixels of the duck egg perspective image into gray values ​​using a grayscale method; Step S201 includes the following sub-steps:

[0136] Step S20101, the grayscale method includes: obtaining R, G and B values ​​in the RGB value of each pixel point of the detected duck egg perspective image;

[0137] Step S20102, converting the RGB value into a grayscale value using a grayscale conversion formula, the grayscale conversion formula is:

[0138] Step S20103, Dth=θ1*R+θ2*G+θ3*B; wherein Dth is the gray value of the pixel in the duck egg perspective image, and θ1, θ2 and θ3 are the R, G and B weights respectively;

[0139] Step S202, obtaining perspective images of a first number of normal duck eggs and damaged duck eggs in history, marking the historical duck egg images, converting the historical duck egg images into historical grayscale images using a grayscale method, obtaining a distinguishing threshold for all historical grayscale images using a histogram threshold acquisition method, and marking the grayscale threshold for normal duck eggs; Step S202 includes the following sub-steps:

[0140] Step S20201, the histogram threshold acquisition method includes: dividing the grayscale value of 0-255 into s intervals on average, marked as grayscale range intervals;

[0141] Step S20202, respectively counting the frequency of the grayscale values ​​in each grayscale range interval, and marking it as grayscale range frequency;

[0142] Step S20203, draw a histogram with the gray value as the X-axis and the gray range frequency as the Y-axis, marked as gray range histogram;

[0143] Step S20204, add up all gray range frequencies to obtain a total frequency, marked as 0;

[0144] Step S20205: Mark the intervals with a gray - scale range frequency less than O / s as regions with a smaller frequency, and mark the intervals other than the regions with a smaller frequency as regions with a larger frequency. Determine whether there are regions with a larger frequency on both sides of the region with a smaller frequency. If so, mark the region with a smaller frequency as the threshold region.

[0145] Step S20205: Set the mid - point value of the abscissa of the threshold region as the discrimination threshold.

[0146] Step S203: Mark the gray - scale value of each pixel in the detected gray - scale image as the detected gray - scale value.

[0147] Step S204: Obtain the total number of detected gray - scale values, marked as Jzs; obtain the number of detected gray - scale values less than the normal duck - egg gray - scale threshold, marked as Jzc.

[0148] Step S205: Calculate the detection ratio as: JZ = Jzc / Jzs; where JZ is the detection ratio.

[0149] Step S206: Obtain the perspective view of damaged duck - eggs in the first - quantity history, marked as the historical damaged - duck - egg image. Use the grayscale method to obtain the gray - scale values of the pixels in the historical damaged - duck - egg image, marked as historical gray - scale values.

[0150] Step S207: Obtain the total number of historical gray - scale values of a historical damaged - duck - egg image, marked as Jls; obtain the number of historical gray - scale values less than the normal duck - egg gray - scale threshold, marked as Jlc.

[0151] Step S208: Calculate the historical ratio as: JL = Jlc / Jls; where JL is the historical ratio. Obtain the historical ratio of each historical damaged - duck - egg image, and obtain the minimum value of the historical ratio, marked as JLm.

[0152] Step S209: Determine whether JZ < JLm is satisfied. If it is satisfied, the duck - egg to be detected is a normal duck - egg; if not, the duck - egg to be detected is a damaged duck - egg.

[0153] Step S3: Obtain the detected binary image based on the normal detected gray - scale image and the histogram threshold, obtain the proportion of the detected main number in the detected binary image based on the main - number frequency - ratio acquisition method, obtain the smaller error threshold and the larger error threshold based on the main - number frequency - ratio, and determine whether the detected duck - egg is an unfertilized duck - egg based on the detected main - number proportion, the smaller error threshold, and the larger error threshold. Step S3 includes the following sub - steps:

[0154] Step S301: Use the histogram - threshold acquisition method to obtain the discrimination threshold for the normal detected gray - scale image, marked as the binary - threshold. Set the gray - scale values of the pixels greater than or equal to the binary - threshold to 255, and set the gray - scale values of the pixels less than the binary - threshold to 0.

[0155] Step S302, setting the pixel with a gray value of 0 as the embryo pixel, and setting the pixel with a gray value of 255 as the background pixel;

[0156] Step S303, using a main number frequency ratio acquisition method to acquire the main number frequency ratio of the detection binary image, marked as the detection main number ratio; step S303 includes the following sub-steps:

[0157] Step S30301, method for obtaining the main number frequency ratio: establish a first plane rectangular coordinate system, and put the duck egg binary image into the first plane rectangular coordinate system;

[0158] Step S30302, obtain two pixel points adjacent to the corner point of the pixel point, mark them as corner adjacent pixel points, obtain the coordinates of the center points of the two corner adjacent pixel points, mark them as (x1, y1) and (x2, y2) respectively; calculate the distance between the center coordinates of the two corner adjacent pixel points: ; Where Dj is the distance between the center coordinates of two adjacent corner pixels;

[0159] Step S30303, obtaining the coordinates of the center point of all embryonic pixels, taking the coordinates of the center point of the embryonic pixels as the coordinates of the corresponding embryonic pixels, and marking the coordinates of the embryonic pixels as embryonic coordinate points;

[0160] Step S30304, obtain an embryo coordinate point and mark it as a detection coordinate point; mark the remaining embryo coordinate points as remaining coordinate points; mark the detection coordinate point as (a, b), and mark the remaining coordinate points as (c i , d i );

[0161] Step S30305, calculate the distance between the detected coordinate point and all remaining coordinate points: ; where Dp i To detect the distance between the coordinate point and all remaining coordinate points; statistics Dp i ≤The number of Dj, marked as the adjacent number;

[0162] Step S30306, obtaining the number of adjacent pixels of all embryos; counting the frequency of each adjacent number and marking it as the adjacent frequency;

[0163] Step S30307, ​​obtain the adjacent frequencies of the first proportion from large to small, and mark them as larger frequencies; mark the adjacent numbers corresponding to the larger frequencies as the main numbers; and obtain the sum of the larger frequencies, and mark it as N1;

[0164] Step S30308: mark the larger frequency as N j ;

[0165] Step S30309, find the ratio of the frequency of each main number: NZ j =N j / N1;NZ j is the ratio of the main number frequencies.

[0166] Step S304, obtaining a second number of unfertilized duck eggs, marking them as historical unfertilized duck eggs, and obtaining a historical unfertilized binary map using a binarization method and a histogram threshold;

[0167] Step S305, using a method for obtaining the frequency ratio of main numbers, respectively obtain the ratio of the frequency of each main number in each historical unfertilized binary image, and mark it as the ratio of the main number of historical fertilization;

[0168] Step S306, calculate the mean of each historical unfertilized main number ratio, marked as Mw j ;

[0169] Step S307, obtaining the minimum error threshold: Ms j -v, the maximum error threshold is: Msj+v; where v is the range proportional constant;

[0170] Step S308: Mark the main number ratio of the detection as Mjc j ;

[0171] Step S309, determine whether each (Ms j -v) <Mjc j <(Ms j +v), if it is satisfied, the duck egg to be tested is an unfertilized duck egg.

[0172] Embodiment 3, a schematic diagram of the structure of an electronic device, the electronic device may include: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, the steps in a method for detecting and identifying internal damage in duck egg breeding are executed to achieve the following functions: judging whether the duck egg to be detected is a normal duck egg or a damaged duck egg based on the grayscale threshold of normal duck eggs and the detection grayscale map; obtaining a smaller error threshold and a larger error threshold based on the frequency ratio of the main number, and judging whether the detected duck egg is an unfertilized duck egg based on the proportion of the main number of detections, the smaller error threshold and the larger error threshold.

[0173] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0174] Example 4. The present application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute a method for detecting and identifying internal damage in duck egg breeding provided by the above methods, the method including: judging whether the duck egg to be tested is a normal duck egg or a damaged duck egg based on the normal duck egg grayscale threshold and the detection grayscale map; obtaining a smaller error threshold and a larger error threshold based on the main number frequency ratio, and judging whether the tested duck egg is an unfertilized duck egg based on the detection main number proportion, the smaller error threshold and the larger error threshold.

[0175] Example 5. The present application also provides a computer-readable storage medium. The present application provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method for detecting and identifying internal damage in duck egg breeding are executed to achieve the following functions: judging whether the duck egg to be tested is a normal duck egg or a damaged duck egg based on the normal duck egg grayscale threshold and the detection grayscale image; obtaining a smaller error threshold and a larger error threshold based on the main number frequency ratio, and judging whether the tested duck egg is an unfertilized duck egg based on the detection main number proportion, the smaller error threshold and the larger error threshold.

[0176] Through the description of the above implementation methods, the embodiments of the present invention can be provided as methods, systems or computer program products. Based on such an understanding, the above technical solutions can be essentially or partly contributed to the prior art in the form of software products, which can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and include several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0177] In the embodiments provided in the present application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of systems, modules and units can be electrical, mechanical or other forms.

[0178] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for detecting and identifying internal damage in duck egg breeding, characterized in that: The steps include: Obtain a perspective view of the duck eggs to be tested during breeding, marked as a testing duck egg perspective view; A detection grayscale image is obtained based on a detection duck egg perspective image and a grayscale method, a normal duck egg grayscale threshold is obtained based on a histogram threshold acquisition method, and based on the normal duck egg grayscale threshold and the detection grayscale image, it is determined whether the duck egg to be detected is a normal duck egg or a damaged duck egg, and the detection grayscale image of the normal duck egg is marked as a normal detection grayscale image; A detection binary image is obtained based on a normal detection grayscale image and a histogram threshold, a detection main number ratio of the detection binary image is obtained based on a main number frequency ratio acquisition method, a smaller error threshold and a larger error threshold are obtained based on the main number frequency ratio, and whether the detected duck egg is an unfertilized duck egg is determined based on the detection main number ratio, the smaller error threshold and the larger error threshold; Method for obtaining the main frequency ratio: Establish a first plane rectangular coordinate system, and put the duck egg binary image into the first plane rectangular coordinate system; Get two pixels adjacent to the corner point of the pixel, mark them as corner adjacent pixels, get the coordinates of the center points of the two corner adjacent pixels, mark them as (x1, y1) and (x2, y2) respectively; The distance between the center coordinates of two adjacent corner pixels is calculated as: ; Where Dj is the distance between the center coordinates of two adjacent corner pixels; Obtain the coordinates of the center point of all embryonic pixels, use the coordinates of the center point of the embryonic pixels as the coordinates of the corresponding embryonic pixels, and mark the coordinates of the embryonic pixels as embryonic coordinate points; Obtain an embryo coordinate point and mark it as a detection coordinate point; mark the remaining embryo coordinate points as remaining coordinate points; The detected coordinate points are marked as (a, b) and the remaining coordinate points are marked as (c i , d i ); The distance between the detected coordinate point and all remaining coordinate points is calculated as: ; where Dp i To detect the distance between the coordinate point and all remaining coordinate points; Statistics Dp i ≤The number of Dj, marked as the adjacent number; Get the number of adjacent pixels of all embryos; Count the frequency of each adjacent number and mark it as adjacent frequency; Obtain the adjacent frequencies of the first proportion from large to small, and mark them as larger frequencies; Mark the adjacent numbers corresponding to the larger frequency as the main numbers; Find the larger frequency sum, marked as N1; Mark the larger frequency as N j ; Find the ratio of the frequency of each main number: NZ j =N j / N1;NZ j is the ratio of the main number frequencies.

2. A method for detecting and identifying internal damage in duck egg breeding according to claim 1, characterized in that: The following sub-steps are included in obtaining the detection grayscale image based on the detection of duck egg perspective image and binarization method: The RGB value of the pixel point of the duck egg perspective image is converted into a gray value using the grayscale method; Grayscale methods include: Get the R, G and B values ​​of each pixel in the RGB value of the detected duck egg perspective image; Use the grayscale conversion formula to convert the RGB value into a grayscale value. The grayscale conversion formula is: Dth=θ1*R+θ2*G+θ3*B; where Dth is the grayscale value of the pixel in the duck egg perspective image, and θ1, θ2 and θ3 are the R, G and B weights respectively.

3. A method for detecting and identifying internal damage in duck egg breeding according to claim 2, characterized in that: The grayscale threshold is obtained based on the histogram threshold acquisition method, which includes the following sub-steps: Obtaining a first number of historical perspective images of normal duck eggs and damaged duck eggs, marking the historical duck egg images, converting the historical duck egg images into historical grayscale images using a grayscale method, obtaining a distinguishing threshold for all historical grayscale images using a histogram threshold acquisition method, and marking the grayscale threshold for normal duck eggs; The histogram threshold acquisition method includes: Divide the grayscale value of 0-255 into s intervals evenly, marked as grayscale range intervals; Count the frequency of the grayscale values ​​in each grayscale range respectively, and mark it as grayscale range frequency; Draw a histogram with grayscale value as X-axis and grayscale range frequency as Y-axis, marked as grayscale range histogram; Add up all gray range frequencies to get the total frequency, marked as O; Intervals with a gray-scale range frequency less than O / s are marked as regions with a smaller frequency, and intervals other than those with a smaller frequency are marked as regions with a larger frequency. Determine whether there are regions with a larger frequency on both sides of the region with a smaller frequency. If so, mark the region with a smaller frequency as the threshold region; Set the midpoint value of the abscissa of the threshold region as the discrimination threshold.

4. A method for detecting and identifying internal damage in duck egg breeding according to claim 3, characterized in that: Judging whether the duck egg to be detected is a normal duck egg or a damaged duck egg based on the normal duck egg gray-scale threshold and the detected gray-scale image includes the following sub-steps: Mark the gray-scale value of each pixel point in the detected gray-scale image as the detected gray-scale value; Obtain the total number of detected gray-scale values, marked as Jzs; Obtain the number of detected gray-scale values less than the normal duck egg gray-scale threshold, marked as Jzc; Calculate the detection ratio as: JZ = Jzc / Jzs; where JZ is the detection ratio; Obtain the perspective view of the damaged duck eggs in the first quantity history, marked as the historical damaged duck egg image, and use the gray-scale method to obtain the gray-scale values of the pixel points in the historical damaged duck egg image, marked as the historical gray-scale values; Obtain the total number of historical gray-scale values of a historical damaged duck egg image, marked as Jls; Obtain the number of historical gray-scale values less than the normal duck egg gray-scale threshold, marked as Jlc; Calculate the historical ratio as: JL = Jlc / Jls; where JL is the historical ratio; Obtain the historical ratio of each historical damaged duck egg image, and obtain the minimum value of the historical ratio, marked as JLm; Judge whether JZ < JLm is satisfied. If it is satisfied, the duck egg to be detected is a normal duck egg; if not, the duck egg to be detected is a damaged duck egg.

5. The method for detecting and identifying internal damage in duck egg breeding according to claim 4, characterized in that: Obtaining the detected binary image based on the normal detected gray-scale image and the histogram threshold, and obtaining the proportion of the detected main number in the detected binary image based on the main number frequency ratio obtaining method includes the following sub-steps: Use the histogram threshold obtaining method to obtain the discrimination threshold for the normal detected gray-scale image, marked as the binary threshold. Set the gray-scale values of pixel points greater than or equal to the binary threshold to 255, and set the gray-scale values of pixel points less than the binary threshold to 0; Set the pixel points with a gray-scale value of 0 as embryo pixel points, and set the pixel points with a gray-scale value of 255 as background pixel points; Use the main number frequency ratio obtaining method to obtain the proportion of the main number frequency in the detected binary image, marked as the detected main number proportion.

6. A method for detecting and identifying internal damage in duck egg breeding according to claim 5, characterized in that: Obtaining the smaller error threshold and the larger error threshold based on the main number frequency ratio includes the following sub-steps: Obtain the second quantity of unfertilized duck eggs, marked as historical unfertilized duck eggs, and use the binary method and the histogram threshold to obtain the historical unfertilized binary image in turn; Use the main number frequency ratio obtaining method to obtain the proportion of each main number frequency in each historical unfertilized binary image, marked as the historical fertilized main number proportion; Calculate the mean of each historical unfertilized population, marked as Mw j ; Get the minimum error threshold: Ms j -v, get the maximum error threshold: Ms j +v; where v is the range proportionality constant.

7. A method for detecting and identifying internal damage in duck egg breeding according to claim 6, characterized in that: Judging whether the detected duck egg is an unfertilized duck egg based on the detected main number proportion, the smaller error threshold, and the larger error threshold includes the following sub-steps: Mark the main number of detections as Mjc j ; Determine whether each (Ms j -v) <Mjc j <(Ms j +v), if it is satisfied, the duck egg to be tested is an unfertilized duck egg.

8. A duck egg breeding internal damage detection and identification system, applicable to a duck egg breeding internal damage detection and identification method according to any one of claims 1 to 7, characterized in that: including: A detected image acquisition module, a duck egg quality judgment module, and a duck egg fertilization judgment module; The detected image acquisition module is used to obtain the perspective view of the duck egg to be detected during breeding, marked as the detected duck egg perspective view; The module for judging the quality of duck eggs is used to obtain a detection grayscale image based on a detection duck egg perspective image and a grayscale method, obtain a normal duck egg grayscale threshold based on a histogram threshold acquisition method, judge whether the duck egg to be detected is a normal duck egg or a damaged duck egg based on the normal duck egg grayscale threshold and the detection grayscale image, and mark the detection grayscale image of the normal duck egg as a normal detection grayscale image; The module for determining the fertilization of duck eggs is used to obtain a detection binary image based on a normal detection grayscale image and a histogram threshold, obtain the main number of detection proportions of the detection binary image based on a main number frequency ratio acquisition method, obtain a smaller error threshold and a larger error threshold based on the main number frequency ratio, and determine whether the detected duck eggs are unfertilized duck eggs based on the main number of detection proportions, the smaller error threshold and the larger error threshold.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 7 are executed.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 7 are executed.

Citation Information

Patent Citations

  • Detection method, device and equipment for automatically identifying interior of duck egg

    CN117007514A

  • Anomaly detection method and system for finger vein equipment

    CN110866503A

  • Method and system for quickly detecting brittled fish meat based on computer image

    CN113466232A