Mildew melon seed calibration method and system based on machine vision

By integrating multi-source images, image stain processing and deep learning networks through machine vision technology, combined with camera calibration, the problem of low efficiency and poor robustness in identifying moldy melon seeds in the existing technology has been solved, and high-accuracy identification of moldy melon seeds has been achieved. and calibration, improving the efficiency of the production line.

CN118691684AActive Publication Date: 2024-09-24HUNAN ZONGMING FOOD CO LTD

Patent Information

Application Number
CN202410835852.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-24
Estimated Expiration
2044-06-26

AI Technical Summary

Technical Problem

Existing technology cannot effectively identify and screen moldy melon seeds, especially in large-scale production lines. Moreover, due to the complex and diverse shapes, colors, and textures of moldy melon seeds, and non-uniform characteristics, the existing technology has poor robustness and cannot meet the requirements. Real-time requirements.

Method used

A machine vision-based calibration method for moldy melon seeds is adopted. The dual-camera acquisition of melon seed images is combined with image fusion, image preprocessing, and deep learning network to identify qualified melon seeds and eliminate them. Combined with camera calibration, the location of moldy melon seeds is determined and output in sequence.

Benefits of technology

It achieves high-accuracy identification and calibration of moldy melon seeds, improves the efficiency and accuracy of identification of moldy melon seeds, eases the work of diversified data collection, and improves the accuracy of camera parameters through self-calibration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691684A
    Figure CN118691684A
Patent Text Reader

Abstract

The invention discloses a mildewed melon seed calibration method and system based on machine vision, and the method comprises the steps: S1, collecting melon seed images through employing double cameras in a melon seed conveying process, and carrying out the fusion of the images; s2, removing stains of the melon seed image to obtain a complete image of each melon seed; s3, constructing a prototype network, carrying out pre-training, recognizing qualified melon seed images from the complete images of the melon seeds by adopting a pre-trained prototype network model, and removing the qualified melon seed images to obtain moldy melon seed images; s4, selecting a fused melon seed image frame as a reference line, and carrying out camera calibration to obtain camera parameters; and S5, determining the sorting sequence of the mildewed melon seeds, and calibrating the actual mildewed melon seeds. According to the invention, through image processing and deep learning methods, mildewed melon seeds are automatically identified; aiming at large intra-class difference between qualified melon seeds and mildewed melon seeds, a prototype network method is adopted to improve classification accuracy; the position data of the mildewed melon seeds are output in sequence, and the mildewed melon seed calibration efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of moldy melon seeds identification, and in particular to a moldy melon seeds calibration method and system based on machine vision. Background Art

[0002] Melon seeds can easily become oxidized and moldy due to improper storage. Moldy melon seeds have a poor taste, and eating such melon seeds is very harmful to your health. At present, the detection of moldy melon seeds is mainly done manually, which is inefficient and cannot be applied to large-scale melon seed production lines. At the same time, the shapes, colors, and textures of moldy melon seeds are complex and diverse, and the characteristics are not uniform, so they cannot be screened based on a single feature. The melon seed images obtained by the production line are unclear, incomplete, and contaminated. The existing moldy melon seed screening technology based on shape, color, and texture features has poor robustness and cannot meet the real-time requirements of the production process. Summary of the invention

[0003] In view of this, the present invention provides a method and system for calibrating moldy melon seeds based on machine vision, and the purpose is to provide a method and system for identifying moldy melon seeds based on machine vision and image processing, and obtain a complete melon seed image by fusing multi-source images and image stain processing. Since the features of qualified melon seeds images are relatively obvious, the appearance of moldy melon seeds is complex and the features are not uniform. Therefore, further, the pre-trained prototype network model is used to identify qualified melon seeds images from the complete melon seeds image and eliminate them, so as to obtain a moldy melon seeds recognition result with high accuracy. At the same time, the real position of the moldy melon seeds is obtained in combination with the camera calibration, and the moldy melon seeds position data is output in sequence on the basis of considering the picking order of the moldy melon seeds, so as to improve the calibration efficiency of the moldy melon seeds.

[0004] To achieve the above object, the present invention provides a method for calibrating moldy melon seeds based on machine vision, comprising the following steps:

[0005] S1: During the transmission of melon seeds, two cameras are used to collect melon seed images, and the melon seed images collected by the two cameras are fused to obtain a fused melon seed image;

[0006] S2: Preprocessing the fused melon seed image to remove stains in the image and obtain a preprocessed image; using two-dimensional constant false alarm detection on the preprocessed image and combining it with expansion processing to obtain a complete image of each melon seed;

[0007] S3: construct a prototype network and perform pre-training to obtain a pre-trained prototype network model; use the pre-trained prototype network model to identify qualified melon seeds images from the complete images of melon seeds and remove them to obtain moldy melon seeds images;

[0008] S4: Select the frame of the fused melon seed image obtained in step S1 as a reference line, perform camera calibration, and obtain camera parameters;

[0009] S5: Determine the picking order of the moldy melon seeds and calibrate the actual moldy melon seeds.

[0010] As a further improvement method of the present invention:

[0011] Optionally, the step S1 includes:

[0012] S101: Place two cameras on the front and side of the melon seed sorting channel, perform time calibration on the cameras, ensure that the cameras are started synchronously, and that the image acquisition intervals are consistent, and respectively acquire the front image Sxzm and the side image Sxcm of the melon seeds;

[0013] S102: Perform scale space transformation on images Sxzm and Sxcm respectively:

[0014] C zm =Sxzm*Xszm

[0015] C cm =Sxcm*Xscm

[0016] Among them, C zm Represents the information of the image Sxzm in the new scale space domain, C cm Represents the information of the image Sxcm in the new scale space domain, Xszm represents the scale coefficient of the image Sxzm, and Xscm represents the scale coefficient of the image Sxcm;

[0017] S103: Determine the region Ω where the image Sxzm is blocked in the new scale space domain, and calculate the gradient field Ru of the images Sxzm and Sxcm in the region Ω:

[0018] Ru=Rzm+Rcm

[0019] Among them, Rzm represents the gradient field of the image Sxzm in the region Ω, and Rcm represents the gradient field of the image Sxcm in the region Ω;

[0020] S104: Establish Poisson's equation, solve pixel values, and obtain the fused melon seed image:

[0021] Xs·x=Sd

[0022] Among them, Xs represents the coefficient matrix constructed according to , x represents the pixel value of the fused image to be solved, and Sd represents the divergence value of the gradient field Ru.

[0023] Optionally, in step S2, preprocessing the fused melon seed image to remove stains in the image includes:

[0024] S201: using a histogram equalization method on the fused melon seed image to adjust the image grayscale distribution and enhance the contrast of the fused melon seed image;

[0025] S202: Select any point Wd in the contaminated area of ​​the fused melon seed image, select a reference standard point Bd, and calculate the first-order derivative of the pixel at point Wd:

[0026] ▽I(Wd)=(I(Bd)-I(Wd)) / (Wd-Bd)

[0027] Where, ▽I(Wd) represents the first-order derivative of the pixel at point Wd, I(Bd) represents the pixel value of the reference point Bd, the reference point Bd is located in the neighborhood of Wd, I(Wd) represents the pixel value of point Wd, (Wd-Bd) represents the distance between point Wd and reference point Bd;

[0028] S203: Calculate the new pixel value of point Wd:

[0029]

[0030] Where I′(Wd) represents the new pixel value of point Wd, and ω(Wd,Bd) represents the weight function;

[0031] S204: Repeat steps S202 and S203 until all points in the polluted area are repaired to obtain a preprocessed image.

[0032] Optionally, in step S2, two-dimensional constant false alarm detection is used on the preprocessed image, and expansion processing is combined to obtain a complete image of each melon seed, including:

[0033] S211: Using two-dimensional constant false alarm detection on the preprocessed image to locate the target and find the target point Mb;

[0034] S212: Select the dilation reference image Pz and perform dilation processing on the target point Get a complete image of each melon seed.

[0035] Optionally, in step S3, constructing a prototype network and performing pre-training to obtain a pre-trained prototype network model includes:

[0036] S301: constructing a support set and a query set using a qualified melon seed image set and a moldy melon seed image set;

[0037] S302: using a ResNet network to extract feature information from each image in the support set, using an attention mechanism to enhance feature extraction of the feature information, and then using a prototype network to perform mean processing on the features to generate a prototype representation of qualified melon seeds and a prototype representation of moldy melon seeds;

[0038] S303: using a ResNet network to extract feature information from each image in the query set, using an attention mechanism to enhance feature extraction of the feature information, and then using a prototype network to perform mean processing on the features to obtain a prototype representation of the query set image;

[0039] S304: Calculate the Manhattan distance between the prototype representation of the query set image and the prototype representation of the qualified melon seeds and the prototype representation of the moldy melon seeds to determine the query set image;

[0040] S305: Repeat steps S302, S303 and S304 to perform training and obtain a pre-trained prototype network model.

[0041] Optionally, in step S3, a pre-trained prototype network model is used to identify qualified melon seed images from the complete melon seed images and remove them to obtain moldy melon seed images, including:

[0042] S311: construct a test data set using the complete image of melon seeds, and use the pre-trained prototype network model to identify the test data set to obtain qualified melon seed images;

[0043] S312: Eliminate qualified melon seeds images from the complete melon seeds images to obtain moldy melon seeds images.

[0044] Optionally, step S4 includes:

[0045] S401: Select the frame of the fused melon seed image obtained in step S1 as a reference line, and determine the corresponding relationship between the reference line and the camera frame:

[0046] Sfd·Sbk=Snc·Sfx·Ck

[0047] Among them, Sfd represents the scaling factor of each point on the camera frame, Sbk represents the coordinates of each point on the camera frame, Snc represents the camera parameter matrix to be solved, Sfx represents the rotation matrix, and Ck represents the coordinates of each point on the reference line;

[0048] S402: Use quadratic surfaces to establish the Kruppa equation and fine-tune the camera parameter matrix Snc through self-calibration;

[0049] S403: The elements in the matrix Snc are the camera parameters.

[0050] Optionally, in step S5, determining the order of picking moldy melon seeds includes:

[0051] S501: marking the moldy melon seeds in the fused melon seeds image according to the moldy melon seeds image;

[0052] S502: In the fused melon seed image in which the moldy melon seeds are marked, demarcate each row of moldy melon seeds:

[0053] Mx1-Mx2≤Hj

[0054] Among them, Mx1, Mx2 represent the horizontal coordinates of two moldy melon seeds, and Hj represents the row spacing;

[0055] In the fused image, delineate the moldy melon seeds in each column:

[0056] My1-My2≤Lj

[0057] Among them, My1, My2 represent the vertical coordinates of two moldy melon seeds, and Lj represents the column spacing;

[0058] S503: Starting from the first row and the first column, the moldy melon seeds are numbered in sequence to determine the order in which the moldy melon seeds are picked.

[0059] Optionally, in step S5, the actual moldy melon seeds are calibrated including:

[0060] S511: Determine the position of the moldy melon seeds in the camera coordinate system:

[0061] Sxw·Snc=Txw

[0062] Among them, Sxw represents the position of the moldy melon seeds in the camera coordinate system, Snc represents the fine-tuned camera parameter matrix, and Txw represents the position of the moldy melon seeds in the fused melon seed image;

[0063] Determine the position of the moldy melon seeds in the geodetic coordinate system:

[0064] Sxw=Xz·Sjw+Py

[0065] Among them, Xz represents the rotation relationship matrix between the camera coordinate system and the earth coordinate system, Sjw represents the position of the moldy melon seeds in the earth coordinate system, and Py represents the translation relationship matrix between the camera coordinate system and the earth coordinate system;

[0066] S512: Outputting the actual location information of the moldy melon seeds in sequence according to the order in which the moldy melon seeds are picked.

[0067] The present invention also provides a machine vision-based moldy melon seed calibration system, comprising:

[0068] Image fusion module: collect melon seed images, perform image scale transformation and image fusion on them, and establish an image fusion quality evaluation system;

[0069] Image preprocessing module: enhances the contrast of the fused image, repairs the contaminated area, and performs two-dimensional constant false alarm detection to obtain a complete image of the melon seeds;

[0070] Image recognition module: construct an image set, perform feature extraction and prototype network pre-training, identify qualified melon seed images, and remove moldy melon seed images;

[0071] Camera calibration module: select reference lines, perform camera calibration, and obtain camera parameters;

[0072] Moldy melon seeds calibration module: determine the picking order of moldy melon seeds and calibrate the moldy melon seeds.

[0073] Beneficial Effects

[0074] The present invention obtains high-accuracy moldy melon seed recognition results by fusing multi-source images, image stain processing, and a two-stage deep learning network. At the same time, the accurate real position of the moldy melon seeds is obtained by combining camera calibration, and the moldy melon seed position data is output in sequence based on the order of picking the moldy melon seeds, thereby improving the efficiency of moldy melon seed calibration.

[0075] The method of the present invention fuses and removes stains from the melon seed images of two cameras, ensuring that the images are clear and unobstructed; through a deep learning network, qualified melon seeds with relatively consistent features are identified, and moldy melon seeds are obtained by elimination, thereby improving the recognition accuracy of moldy melon seeds. The work of collecting data on a variety of moldy melon seed images is reduced. After the method of the present invention performs a scale transformation on the image, the Poisson equation is used to solve the pixel value of the fused image, effectively retaining the gradient information of the source image and realizing seamless fusion of the new image.

[0076] The present invention uses two-dimensional constant false alarm detection combined with expansion processing to obtain a complete image of melon seeds for further recognition by the subsequent network; the deep learning network is strengthened to extract effective features of melon seeds through the attention mechanism, and the prototype network is trained to improve recognition performance. The present invention uses a self-calibration method to fine-tune the camera parameter matrix, which is conducive to improving the accuracy of the camera parameter matrix; and the spatial sorting of the moldy melon seed numbers is conducive to determining the optimal melon seed picking order. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] Figure 1 The present invention is a flowchart of a method for calibrating moldy melon seeds based on machine vision according to an embodiment of the present invention.

[0078] Figure 2 Schematic diagram of output result after processing in step S3 of an embodiment of the present invention.

[0079] Figure 3 FIG. 4 is another schematic diagram of an output result after processing in step S3 according to an embodiment of the present invention. DETAILED DESCRIPTION

[0080] The present invention is further described below in conjunction with the accompanying drawings, but the present invention is not limited in any way. Any changes or substitutions made based on the teachings of the present invention belong to the protection scope of the present invention.

[0081] Embodiment 1:

[0082] A method for calibrating moldy melon seeds based on machine vision, such as Figure 1 As shown, the following steps are included:

[0083] S1: During the transmission of melon seeds, two cameras are used to collect melon seed images, and the melon seed images collected by the two cameras are fused to obtain a fused melon seed image;

[0084] S101: Place two cameras on the front and side of the melon seed sorting channel, perform time calibration on the cameras, ensure that the cameras are started synchronously, and that the image acquisition intervals are consistent, and respectively acquire the front image Sxzm and the side image Sxcm of the melon seeds;

[0085] S102: Perform scale space transformation on images Sxzm and Sxcm respectively:

[0086] C zm =Sxzm*Xszm

[0087] C cm =Sxcm*Xscm

[0088] Among them, C zm Represents the information of the image Sxzm in the new scale space domain, C cm Represents the information of the image Sxcm in the new scale space domain, Xszm represents the scale coefficient of the image Sxzm, and Xscm represents the scale coefficient of the image Sxcm;

[0089] S103: Determine the region Ω where the image Sxzm is blocked in the new scale space domain, and calculate the gradient field Ru of the images Sxzm and Sxcm in the region Ω:

[0090] Ru=Rzm+Rcm

[0091] Among them, Rzm represents the gradient field of the image Sxzm in the region Ω, and Rcm represents the gradient field of the image Sxcm in the region Ω;

[0092] S104: Establish Poisson's equation, solve pixel values, and obtain the fused melon seed image:

[0093] Xs·x=Sd

[0094] Among them, Xs represents the coefficient matrix constructed according to , x represents the pixel value of the fused image to be solved, and Sd represents the divergence value of the gradient field Ru.

[0095] S2: Preprocessing the fused melon seed image to remove stains in the image and obtain a preprocessed image; using two-dimensional constant false alarm detection on the preprocessed image and combining it with expansion processing to obtain a complete image of each melon seed;

[0096] S201: using a histogram equalization method on the fused melon seed image to adjust the image grayscale distribution and enhance the contrast of the fused melon seed image;

[0097] S202: Select any point Wd in the contaminated area of ​​the fused melon seed image, select a reference standard point Bd, and calculate the first-order derivative of the pixel at point Wd:

[0098] ▽I(Wd)=(I(Bd)-I(Wd)) / (Wd-Bd)

[0099] Where, ▽I(Wd) represents the first-order derivative of the pixel at point Wd, I(Bd) represents the pixel value of the reference point Bd, the reference point Bd is located in the neighborhood of Wd, I(Wd) represents the pixel value of point Wd, (Wd-Bd) represents the distance between point Wd and reference point Bd;

[0100] S203: Calculate the new pixel value of point Wd:

[0101]

[0102] Where I′(Wd) represents the new pixel value of point Wd, and ω(Wd,Bd) represents the weight function;

[0103] S204: Repeat steps S202 and S203 until all points in the polluted area are repaired to obtain a preprocessed image.

[0104] S205: Using two-dimensional constant false alarm detection on the pre-processed image to locate the target and find the target point Mb;

[0105] S206: Select the dilation reference image Pz and perform dilation processing on the target point Get a complete image of each melon seed.

[0106] S3: Construct a prototype network and perform pre-training to obtain a pre-trained prototype network model; use the pre-trained prototype network model to identify qualified melon seed images from the complete images of melon seeds and remove them, see Figure 2-3 , get the moldy melon seeds image;

[0107] S301: manually sorting actual melon seeds in advance to determine qualified melon seeds and moldy melon seeds, and taking photos of the two types of melon seeds respectively to obtain a qualified melon seed image set and a moldy melon seed image set;

[0108] S302: constructing a support set and a query set using the qualified melon seed image set and the moldy melon seed image set;

[0109] S303: using a ResNet network to extract feature information from each image in the support set, using an attention mechanism to enhance feature extraction of the feature information, and then using a prototype network to perform mean processing on the features to generate a prototype representation of qualified melon seeds and a prototype representation of moldy melon seeds;

[0110] S304: using a ResNet network to extract feature information from each image in the query set, using an attention mechanism to enhance feature extraction of the feature information, and then using a prototype network to perform mean processing on the features to obtain a prototype representation of the query set image;

[0111] S305: Calculate the Manhattan distance between the prototype representation of the query set image and the prototype representation of the qualified melon seeds and the prototype representation of the moldy melon seeds to realize the judgment of the query set image;

[0112] S306: Repeat steps S303, S304 and S305 to perform training and obtain a pre-trained prototype network model;

[0113] S307: normalizing the size and orientation of the complete image of the melon seeds obtained in step S206 to construct a test data set;

[0114] S308: using a pre-trained prototype network model to identify a test data set to obtain a qualified melon seed image;

[0115] S309: Eliminate the qualified melon seeds image from the complete melon seeds image obtained in step S206 to obtain the moldy melon seeds image.

[0116] S4: Select the frame of the fused melon seed image obtained in step S1 as a reference line, perform camera calibration, and obtain camera parameters;

[0117] S401: Select the frame of the fused melon seed image obtained in step S1 as a reference line, and determine the corresponding relationship between the reference line and the camera frame:

[0118] Sfd·Sbk=Snc·Sfx·Ck

[0119] Among them, Sfd represents the scaling factor of each point on the camera frame, Sbk represents the coordinates of each point on the camera frame, Snc represents the camera parameter matrix to be solved, Sfx represents the rotation matrix, and Ck represents the coordinates of each point on the reference line;

[0120] S402: Use quadratic surfaces to establish the Kruppa equation and fine-tune the camera parameter matrix Snc through self-calibration;

[0121] S403: The elements in the matrix Snc are the camera parameters.

[0122] S5: Determine the picking order of the moldy melon seeds and calibrate the actual moldy melon seeds.

[0123] S501: marking the moldy melon seeds in the fused melon seeds image according to the moldy melon seeds image;

[0124] S502: In the fused melon seed image in which the moldy melon seeds are marked, demarcate each row of moldy melon seeds:

[0125] Mx1-Mx2≤Hj

[0126] Among them, Mx1, Mx2 represent the horizontal coordinates of two moldy melon seeds, and Hj represents the row spacing;

[0127] In the fused image, delineate the moldy melon seeds in each column:

[0128] My1-My2≤Lj

[0129] Among them, My1, My2 represent the vertical coordinates of two moldy melon seeds, and Lj represents the column spacing;

[0130] S503: Starting from the first row and the first column, the moldy melon seeds are numbered in sequence to determine the order in which the moldy melon seeds are picked.

[0131] S504: Determine the position of the moldy melon seeds in the camera coordinate system:

[0132] Sxw·Snc=Txw

[0133] Among them, Sxw represents the position of the moldy melon seeds in the camera coordinate system, Snc represents the fine-tuned camera parameter matrix, and Txw represents the position of the moldy melon seeds in the fused melon seed image;

[0134] Determine the position of the moldy melon seeds in the geodetic coordinate system:

[0135] Sxw=Xz·Sjw+Py

[0136] Among them, Xz represents the rotation relationship matrix between the camera coordinate system and the earth coordinate system, Sjw represents the position of the moldy melon seeds in the earth coordinate system, and Py represents the translation relationship matrix between the camera coordinate system and the earth coordinate system;

[0137] S505: Outputting the actual location information of the moldy melon seeds in sequence according to the order in which the moldy melon seeds are picked.

[0138] Embodiment 2:

[0139] A method and system for calibrating moldy melon seeds based on machine vision, including the following five modules:

[0140] Image fusion module: collect melon seed images, perform image scale transformation and image fusion on them, and establish an image fusion quality evaluation system;

[0141] Image preprocessing module: enhances the contrast of the fused image, repairs the contaminated area, and performs two-dimensional constant false alarm detection to obtain a complete image of the melon seeds;

[0142] Image recognition module: construct an image set, perform feature extraction and prototype network pre-training, identify qualified melon seed images, and remove moldy melon seed images;

[0143] Camera calibration module: select reference lines, perform camera calibration, and obtain camera parameters;

[0144] Moldy melon seeds calibration module: determine the picking order of moldy melon seeds and calibrate the moldy melon seeds.

[0145] It should be noted that the serial numbers of the above-mentioned embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.

[0146] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0147] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for calibrating moldy melon seeds based on machine vision. It is characterized in that The following steps are involved: S1: During the transmission of melon seeds, two cameras are used to collect melon seed images, and the melon seed images collected by the two cameras are fused to obtain a fused melon seed image; S2: preprocessing the fused melon seed image to remove stains in the image and obtain a preprocessed image; The pre-processed image is subjected to two-dimensional constant false alarm detection and combined with dilation processing to obtain a complete image of each melon seed; S3: construct a prototype network and perform pre-training to obtain a pre-trained prototype network model; use the pre-trained prototype network model to identify qualified melon seeds images from the complete images of melon seeds and remove them to obtain moldy melon seeds images; S4: Select the frame of the fused melon seed image obtained in step S1 as a reference line, perform camera calibration, and obtain camera parameters; S5: Determine the picking order of the moldy melon seeds and calibrate the actual moldy melon seeds.

2. The method for calibrating moldy melon seeds based on machine vision according to claim 1, It is characterized in that The step S1 comprises: S101: two cameras are placed on the front and side of the melon seed sorting channel to collect the front image Sxzm and side image Sxcm of the melon seeds respectively; S102: Perform scale space transformation on images Sxzm and Sxcm respectively: C zm =Sxzm*Xszm C cm =Sxcm*Xscm Among them, C zm Represents the information of the image Sxzm in the new scale space domain, C cm Represents the information of the image Sxcm in the new scale space domain, Xszm represents the scale coefficient of the image Sxzm, and Xscm represents the scale coefficient of the image Sxcm; S103: Determine the region Ω where the image Sxzm is blocked in the new scale space domain, and calculate the gradient field Ru of the images Sxzm and Sxcm in the region Ω: Ru=Rzm+Rcm Among them, Rzm represents the gradient field of the image Sxzm in the region Ω, and Rcm represents the gradient field of the image Sxcm in the region Ω; S104: Establish Poisson's equation, solve pixel values, and obtain the fused melon seed image: Xs·x=Sd Among them, Xs represents the coefficient matrix constructed according to , x represents the pixel value of the fused image to be solved, and Sd represents the divergence value of the gradient field Ru.

3. The method for calibrating moldy melon seeds based on machine vision according to claim 1, It is characterized in that In step S2, the fused melon seed image is preprocessed to remove stains in the image, including: S201: using a histogram equalization method on the fused melon seed image to adjust the image grayscale distribution and enhance the contrast of the fused melon seed image; S202: Select any point Wd in the contaminated area of ​​the fused melon seed image, select a reference standard point Bd, and calculate the first-order derivative of the pixel at point Wd: ▽I(Wd)=(I(Bd)-I(Wd)) / (Wd-Bd) Where, ▽I(Wd) represents the first-order derivative of the pixel at point Wd, I(Bd) represents the pixel value of the reference point Bd, the reference point Bd is located in the neighborhood of Wd, I(Wd) represents the pixel value of point Wd, (Wd-Bd) represents the distance between point Wd and reference point Bd; S203: Calculate the new pixel value of point Wd: Where I′(Wd) represents the new pixel value of point Wd, and ω(Wd,Bd) represents the weight function; S204: Repeat steps S202 and S203 until all points in the polluted area are repaired to obtain a preprocessed image.

4. The method for calibrating moldy melon seeds based on machine vision according to claim 1, It is characterized in that In step S2, two-dimensional constant false alarm detection is used on the pre-processed image, and expansion processing is combined to obtain a complete image of each melon seed, including: S211: Using two-dimensional constant false alarm detection on the preprocessed image to locate the target and find the target point Mb; S212: Select the dilation reference image Pz and perform dilation processing on the target point Get a complete image of each melon seed.

5. The method for calibrating moldy melon seeds based on machine vision according to claim 1, It is characterized in that In step S3, a prototype network is constructed and pre-trained to obtain a pre-trained prototype network model, including: S301: constructing a support set and a query set using a qualified melon seed image set and a moldy melon seed image set; S302: using a ResNet network to extract feature information from each image in the support set, using an attention mechanism to enhance feature extraction of the feature information, and then using a prototype network to perform mean processing on the features to generate a prototype representation of qualified melon seeds and a prototype representation of moldy melon seeds; S303: using a ResNet network to extract feature information from each image in the query set, using an attention mechanism to enhance feature extraction of the feature information, and then using a prototype network to perform mean processing on the features to obtain a prototype representation of the query set image; S304: Calculate the Manhattan distance between the prototype representation of the query set image and the prototype representation of the qualified melon seeds and the prototype representation of the moldy melon seeds to determine the query set image; S305: Repeat steps S302, S303 and S304 to perform training and obtain a pre-trained prototype network model.

6. The method for calibrating moldy melon seeds based on machine vision according to claim 1, It is characterized in that In step S3, a pre-trained prototype network model is used to identify qualified melon seed images from the complete melon seed images and remove them to obtain moldy melon seed images, including: S311: construct a test data set using the complete image of melon seeds, and use the pre-trained prototype network model to identify the test data set to obtain qualified melon seed images; S312: Eliminate qualified melon seeds images from the complete melon seeds images to obtain moldy melon seeds images.

7. The method for calibrating moldy melon seeds based on machine vision according to claim 1, It is characterized in that The step S4 comprises: S401: Select the frame of the fused melon seed image obtained in step S1 as a reference line, and determine the corresponding relationship between the reference line and the camera frame: Sfd·Sbk=Snc·Sfx·Ck Among them, Sfd represents the scaling factor of each point on the camera frame, Sbk represents the coordinates of each point on the camera frame, Snc represents the camera parameter matrix to be solved, Sfx represents the rotation matrix, and Ck represents the coordinates of each point on the reference line; S402: Use quadratic surfaces to establish the Kruppa equation and fine-tune the camera parameter matrix Snc through self-calibration; S403: The elements in the matrix Snc are the camera parameters.

8. The method for calibrating moldy melon seeds based on machine vision according to claim 1, It is characterized in that In step S5, determining the order of picking moldy melon seeds includes: S501: marking the moldy melon seeds in the fused melon seeds image according to the moldy melon seeds image; S502: In the fused melon seed image in which the moldy melon seeds are marked, demarcate each row of moldy melon seeds: Mx1-Mx2≤Hj Among them, Mx1, Mx2 represent the horizontal coordinates of two moldy melon seeds, and Hj represents the row spacing; In the fused image, delineate the moldy melon seeds in each column: My1-My2≤Lj Among them, My1, My2 represent the vertical coordinates of two moldy melon seeds, and Lj represents the column spacing; S503: Starting from the first row and the first column, the moldy melon seeds are numbered in sequence to determine the order in which the moldy melon seeds are picked.

9. The method for calibrating moldy melon seeds based on machine vision according to claim 1, It is characterized in that In step S5, the actual moldy melon seeds are calibrated including: S511: Determine the position of the moldy melon seeds in the camera coordinate system: Sxw·Snc=Txw Among them, Sxw represents the position of the moldy melon seeds in the camera coordinate system, Snc represents the fine-tuned camera parameter matrix, and Txw represents the position of the moldy melon seeds in the fused melon seed image; Determine the position of the moldy melon seeds in the geodetic coordinate system: Sxw=Xz·Sjw+Py Among them, Xz represents the rotation relationship matrix between the camera coordinate system and the earth coordinate system, Sjw represents the position of the moldy melon seeds in the earth coordinate system, and Py represents the translation relationship matrix between the camera coordinate system and the earth coordinate system; S512: Outputting the actual location information of the moldy melon seeds in sequence according to the order in which the moldy melon seeds are picked.

10. A moldy melon seed calibration system based on machine vision, It is characterized in that include: Image fusion module: collect melon seed images, perform image scale transformation and image fusion on them, and establish an image fusion quality evaluation system; Image preprocessing module: enhances the contrast of the fused image, repairs the contaminated area, and performs two-dimensional constant false alarm detection to obtain a complete image of the melon seeds; Image recognition module: construct an image set, perform feature extraction and prototype network pre-training, identify qualified melon seed images, and remove moldy melon seed images; Camera calibration module: select reference lines, perform camera calibration, and obtain camera parameters; Moldy melon seeds calibration module: determine the picking order of moldy melon seeds and calibrate the moldy melon seeds; to implement a moldy melon seeds calibration method based on machine vision as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Data enhancement method for improving identification accuracy of external damage target of power transmission line

    CN110378862A

  • Small sample classification algorithm based on multi-scale attention feature fusion

    CN114863174A

  • Rock core image fusion method for optimizing Poisson fusion

    CN115249255A

  • Method and equipment for positioning object based on three points and two lines

    CN116755104A

  • Online quality detection system and method for hollow sunshade product based on target detection

    CN117635603A

Cited By

  • Grain mildew degree image intelligent grading method and system

    CN121767983A