Automatic fruit surface defect detection method based on image recognition

Through laser projection and image analysis technology, the problems of low manual detection efficiency and impact of light changes are solved, and fast and accurate fruit surface defect detection is achieved to meet the needs of industrial production.

CN119006366APending Publication Date: 2024-11-22SHANDONG AGRICULTURAL UNIVERSITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410943211.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

The existing fruit surface defect detection methods rely on artificial visual inspection, are inefficient and susceptible to changes in light, and cannot meet the needs of industrial production.

Method used

The laser projector is used to project linearly on the fruit surface, and the laser lines are recorded using the camera. The laser lines are analyzed through image acquisition, denoising, enhancement, histogram equalization and edge detection algorithms to determine whether there are uneven defects on the fruit surface. And mark the defective parts on the image.

Benefits of technology

It realizes fast, accurate, automated and visualized fruit surface defect detection, improves detection efficiency and accuracy, ensures product quality, and adapts to different production environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119006366A_ABST
    Figure CN119006366A_ABST
Patent Text Reader

Abstract

The invention provides an automatic fruit surface defect detection method based on image recognition, which comprises the following steps: performing linear light projection on the surface of a target fruit by using a laser projector, and recording laser lines passing through the surface of the fruit at a preset angle by using a camera to obtain initial image data; transmitting the initial image data to a computer through an image acquisition card; denoising the initial image data to obtain a denoised image; performing image enhancement processing on the de-noised image to obtain an enhanced image; performing histogram equalization on the enhanced image to obtain a to-be-analyzed image; and analyzing the laser line form in the to-be-analyzed image, judging whether the surface of the fruit has an uneven defect or not, marking a defect part on the image, and recording a specific condition. The method has the advantages of rapidness, accuracy, automation, visualization, flexibility and the like, the defect detection efficiency and precision in the agricultural fruit production process can be effectively improved, the product quality is guaranteed, and the production 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 smart agriculture, and in particular to an automated fruit surface defect detection method based on image recognition. Background Art

[0002] With the rapid development of modern agriculture and food industry, fruit quality inspection and grading have become important links to ensure product quality and enhance market competitiveness. Traditional methods of fruit surface defect detection mainly rely on manual visual inspection. Although this method can be detected through experience and intuition, it is inefficient and easily affected by human fatigue and subjective factors, resulting in unstable detection results. In addition, with the expansion of production scale and the improvement of automation level, manual inspection can no longer meet the needs of industrial production. Therefore, automated fruit surface defect detection technology based on image recognition came into being.

[0003] Existing image processing technologies include filtering, enhancement, segmentation, and feature extraction. In the detection of fruit surface defects, the acquired image must first be preprocessed, such as denoising, contrast enhancement, etc., to improve the image quality. Then, the fruit is separated from the background through image segmentation technology, and useful information on the fruit surface is extracted. Finally, the features in the image are extracted and analyzed to distinguish between normal areas and defective areas.

[0004] The prior art discloses a method and system for detecting fruit surface defects based on brightness correction and color classification, the method comprising: extracting an R component image from an RGB image of a fruit to be detected, performing brightness correction on the R component image to make the brightness of the R component image uniform; performing HSI transformation on the RGB image, obtaining an H value in the HSI transformation corresponding to each pixel in the RGB image, and comparing the H value with the H value of a preset color to determine the color of each pixel; determining the color of each pixel according to the preset threshold value corresponding to the color, obtaining a defective area to be confirmed in the R component image after brightness correction, and setting the grayscale value of the pixel points other than the defective area to be confirmed in the R component image to zero, and further determining to set the grayscale value of the fruit stalk / calyx area identified in the defective area to be confirmed to zero, and finally obtaining the defective area on the fruit surface, thereby improving the accuracy of detecting fruit defects. However, although brightness correction can partially alleviate the problem of uneven illumination, in practical applications, changes in illumination may still have a significant impact on the image processing results. For example, shadows and strong light reflections may cause brightness correction to fail in some cases, thereby affecting the final detection results. Summary of the invention

[0005] In order to overcome the deficiencies of the prior art, the object of the present invention is to provide an automated fruit surface defect detection method based on image recognition.

[0006] To achieve the above object, the present invention provides the following solutions:

[0007] An automatic fruit surface defect detection method based on image recognition, comprising:

[0008] A laser projector is used to project line light onto the surface of the target fruit, and a camera is used to record the laser line passing through the surface of the fruit at a preset angle to obtain initial image data;

[0009] Transmitting the initial image data to a computer via an image acquisition card;

[0010] In a computer, denoising the initial image data to obtain a denoised image;

[0011] Performing image enhancement processing on the denoised image to obtain an enhanced image;

[0012] Performing histogram equalization on the enhanced image to obtain an image to be analyzed;

[0013] Analyze the laser line morphology in the image to be analyzed to determine whether there are uneven defects on the fruit surface, mark the defective parts on the image and record the specific situation.

[0014] Preferably, the specific conditions include the size and shape of the defect.

[0015] Preferably, denoising the initial image data to obtain a denoised image comprises:

[0016] Performing wavelet decomposition on the initial image data at multiple scales to obtain corresponding wavelet coefficients;

[0017] Constructing a filtering threshold according to the size and decomposition scale of the initial image data;

[0018] constructing an image filtering model using the filtering threshold;

[0019] The initial image data is filtered using the image filtering model to obtain the denoised image.

[0020] Preferably, the calculation formula of the filtering threshold is: Among them, λ j represents the filtering threshold at the jth decomposition scale, σ j represents the standard deviation of the noise at the jth decomposition scale, N j represents the signal length at the jth decomposition scale, and j represents the decomposition scale.

[0021] Preferably, the calculation formula of the image filtering model is: Wherein, sign is the sign function, a is the first preset coefficient, b is the second preset coefficient, ω j,k represents the kth wavelet coefficient at the jth decomposition scale, Represents the wavelet coefficients after filtering.

[0022] Preferably, performing image enhancement processing on the denoised image to obtain an enhanced image includes:

[0023] Detecting the denoised image using an image recognition model to obtain a proportion value under each image enhancement window;

[0024] When the proportion value in the image enhancement window is greater than a preset threshold, median denoising is performed on the image in the corresponding image enhancement window to obtain an enhanced image;

[0025] The image enhancement window is slid until the entire denoised image is traversed to obtain the enhanced image.

[0026] Preferably, the denoised image is detected by an image recognition model to obtain a proportion value under each image enhancement window, including:

[0027] Using Formula F ij =|x ij -y ij |Get the pixel difference of each pixel under each image enhancement window; where F ij represents the pixel difference of the denoised image at position (i, j), x ij Represents the pixel value of the initial image data at position (i, j), y ij Represents the pixel value of the denoised image at position (i, j);

[0028] Pixels whose pixel difference is greater than the feature threshold are taken as feature points and the number is recorded;

[0029] The ratio of the feature points to all the pixels in the image enhancement window is taken as the ratio value.

[0030] Preferably, when the proportion value in the image enhancement window is greater than a preset threshold, median denoising is performed on the image in the corresponding image enhancement window to obtain an enhanced image, including:

[0031] Using formula The image in the corresponding image enhancement window is subjected to median denoising to obtain the enhanced image; wherein f(a, b) represents the pixel value of the pixel point (a, b) after median denoising, D is an adjustable parameter, x(a, b) represents the pixel value of the pixel point (a, b) in the image enhancement window, mean(a, b) represents the pixel median of the image enhancement window, σ x (a, b) represents the variance of pixel values ​​within the image enhancement window.

[0032] Preferably, analyzing the laser line morphology in the image to be analyzed, determining whether there are uneven defects on the fruit surface, marking the defective parts on the image and recording the specific conditions, including:

[0033] Extracting the contour of the laser line in the image to be analyzed using an edge detection algorithm;

[0034] Use line tracking algorithm to obtain the specific direction and position of the laser line profile;

[0035] Determine the degree and position of deformation based on the extracted laser line profile and the specific direction and position of the profile;

[0036] The deformation degree and position are input into the trained classification model to determine whether there are uneven defects and the type of defects to obtain the detection result.

[0037] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0038] The present invention provides an automated fruit surface defect detection method based on image recognition, comprising: using a laser projector to project line light on the surface of a target fruit, and using a camera to record the laser lines passing through the fruit surface at a preset angle to obtain initial image data; transmitting the initial image data to a computer through an image acquisition card; in the computer, denoising the initial image data to obtain a denoised image; performing image enhancement processing on the denoised image to obtain an enhanced image; performing histogram equalization on the enhanced image to obtain an image to be analyzed; analyzing the laser line morphology in the image to be analyzed to determine whether there are uneven defects on the fruit surface, and marking the defective parts on the image and recording the specific situation. The present invention has the advantages of being fast, accurate, automated, visualized and flexible, and can effectively improve the detection efficiency and accuracy of defects in the fruit production process, and is helpful to ensure product quality and improve production efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0040] Figure 1 A flow chart of a method provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0041] 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.

[0042] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0043] Figure 1 A flow chart of a method provided by an embodiment of the present invention, such as Figure 1 As shown, the present invention provides an automatic fruit surface defect detection method based on image recognition, comprising:

[0044] Step 100: Use a laser projector to project line light onto the surface of the target fruit, and use a camera to record the laser line passing through the surface of the fruit at a preset angle to obtain initial image data;

[0045] Step 200: transmitting the initial image data to a computer via an image acquisition card;

[0046] Step 300: In a computer, denoising the initial image data to obtain a denoised image;

[0047] Step 400: performing image enhancement processing on the denoised image to obtain an enhanced image;

[0048] Step 500: performing histogram equalization on the enhanced image to obtain an image to be analyzed;

[0049] Step 600: Analyze the laser line shape in the image to be analyzed, determine whether there are uneven defects on the fruit surface, mark the defective parts on the image and record the specific situation.

[0050] Preferably, the specific conditions include the size and shape of the defect.

[0051] Specifically, in step 1 of this embodiment, a laser projector is used to project line light onto the surface of the fruit, and then a camera is used to record the laser lines passing through the surface of the fruit at a specific angle. The camera transmits the captured image to a computer via an image acquisition card.

[0052] Furthermore, the computer of this embodiment receives the image and processes it using the fruit surface defect detection software, and then processes the image using a codec to convert it into a format suitable for analysis.

[0053] Preferably, denoising the initial image data to obtain a denoised image comprises:

[0054] Performing wavelet decomposition on the initial image data at multiple scales to obtain corresponding wavelet coefficients;

[0055] Constructing a filtering threshold according to the size and decomposition scale of the initial image data;

[0056] constructing an image filtering model using the filtering threshold;

[0057] The initial image data is filtered using the image filtering model to obtain the denoised image.

[0058] Preferably, the calculation formula of the filtering threshold is: Among them, λ j represents the filtering threshold at the jth decomposition scale, σ j represents the standard deviation of the noise at the jth decomposition scale, N j represents the signal length at the jth decomposition scale, and j represents the decomposition scale.

[0059] Specifically, it can be seen from the above filter threshold formula that as the decomposition scale increases, the threshold of each layer decreases accordingly, which is in line with the law of wavelet denoising, and thus can improve the performance of wavelet denoising.

[0060] Preferably, the calculation formula of the image filtering model is: Wherein, sign is the sign function, a is the first preset coefficient, b is the second preset coefficient, ω j,k represents the kth wavelet coefficient at the jth decomposition scale, Represents the wavelet coefficients after filtering.

[0061] Furthermore, this embodiment utilizes an image filtering model to perform a self-adjusting threshold transformation on the wavelet coefficients at each scale, thereby highlighting the detailed features of the image at different decomposition levels, suppressing the noise of the original image, and enhancing the layering of the image.

[0062] Preferably, performing image enhancement processing on the denoised image to obtain an enhanced image includes:

[0063] Detecting the denoised image using an image recognition model to obtain a proportion value under each image enhancement window;

[0064] When the proportion value in the image enhancement window is greater than a preset threshold, median denoising is performed on the image in the corresponding image enhancement window to obtain an enhanced image;

[0065] The image enhancement window is slid until the entire denoised image is traversed to obtain the enhanced image.

[0066] Preferably, the denoised image is detected by an image recognition model to obtain a proportion value under each image enhancement window, including:

[0067] Using Formula F ij =|x ij -y ij |Get the pixel difference of each pixel under each image enhancement window; where F ij represents the pixel difference of the denoised image at position (i, j), x ij Represents the pixel value of the initial image data at position (i, j), y ij Represents the pixel value of the denoised image at position (i, j);

[0068] Pixels whose pixel difference is greater than the feature threshold are taken as feature points and the number is recorded;

[0069] The ratio of the feature points to all the pixels in the image enhancement window is taken as the ratio value.

[0070] Specifically, the original filtering algorithm, such as the mean filtering algorithm, performs mean processing on the pixel points in each neighborhood (i.e., the denoising window) on the image (regardless of whether there are noise points). Therefore, the processed image will be distorted. The present invention can find the characteristic noise points on the image by utilizing the image enhancement window, and then process the corresponding characteristic noise points. It can smooth out the noise points in the image while retaining the original pixel information on the image as much as possible.

[0071] Preferably, when the proportion value in the image enhancement window is greater than a preset threshold, median denoising is performed on the image in the corresponding image enhancement window to obtain an enhanced image, including:

[0072] Using formula The image in the corresponding image enhancement window is subjected to median denoising to obtain the enhanced image; wherein f(a, b) represents the pixel value of the pixel point (a, b) after median denoising, D is an adjustable parameter, x(a, b) represents the pixel value of the pixel point (a, b) in the image enhancement window, mean(a, b) represents the pixel median of the image enhancement window, σ x (a, b) represents the variance of pixel values ​​within the image enhancement window.

[0073] Furthermore, this embodiment performs median denoising on the image in the corresponding window based on the image enhancement window, which can alleviate the problem that the existing denoising method (such as mean filter denoising) causes certain features in the image to disappear, so that the original pixel information of the image can be retained to the greatest extent. In addition, the present invention uses histogram equalization to process the image, which can improve the image interpretation effect.

[0074] Preferably, analyzing the laser line morphology in the image to be analyzed, determining whether there are uneven defects on the fruit surface, marking the defective parts on the image and recording the specific conditions, including:

[0075] Extracting the contour of the laser line in the image to be analyzed using an edge detection algorithm;

[0076] Use line tracking algorithm to obtain the specific direction and position of the laser line profile;

[0077] Determine the degree and position of deformation based on the extracted laser line profile and the specific direction and position of the profile;

[0078] The deformation degree and position are input into the trained classification model to determine whether there are uneven defects and the type of defects to obtain the detection result.

[0079] Specifically, the detection steps of this embodiment include:

[0080] 1. Analysis of laser line morphology: In the image to be analyzed, analysis of the laser line morphology is a key step. The deformation of the laser line on the surface of the fruit can reflect the concave and convex conditions of the fruit surface:

[0081] ① Edge detection: use edge detection algorithms (such as Canny edge detection, Sobel operator, etc.) to extract the contour of the laser line.

[0082] ② Line tracking: use line tracking algorithms (such as Hough transform, etc.) to obtain the specific direction and position of the laser line.

[0083] ③ Morphological analysis: according to the shape of the extracted laser line, determine its deformation degree and position. Under normal circumstances, the laser line should be straight. If there are unevenness on the surface of the fruit (such as depressions, protrusions, etc.), the laser line will be deformed accordingly (offset, bending, etc.).

[0084] 2. Defect judgment and marking: Defects on the fruit surface are judged based on the changes in the shape of the laser lines, and the specific locations are marked:

[0085] ① Morphological feature extraction: extract the morphological features of the laser lines, such as curvature, offset, etc.

[0086] ② Defect classification and threshold judgment: through the preset threshold and classification algorithm (such as support vector machine, decision tree, etc.), determine whether there are uneven defects and the type of defects (such as depressions, protrusions, etc.).

[0087] ③ Defect marking: mark the defective parts on the image, and use different colors or symbols to distinguish different types of defects.

[0088] ④ Record defect information, including the location, type, size, etc. of the defect, for subsequent processing and analysis.

[0089] 3. Continuous iteration and optimization

[0090] To improve the accuracy and robustness of detection, the algorithm can be continuously optimized, more samples can be accumulated for training, and advanced machine learning and deep learning techniques can be applied to further improve system performance.

[0091] In summary, this embodiment can accurately determine the uneven defects on the fruit surface by analyzing the morphology of the laser lines, and mark the defective parts on the image and record the specific situation. The whole process combines multiple technical links such as image acquisition, image processing, line recognition and analysis, defect judgment and result marking to ensure high accuracy and reliability of detection.

[0092] The beneficial effects of the present invention are as follows:

[0093] (1) The present invention uses a laser projector and a camera for detection without direct contact with the fruit, thereby avoiding damage to the fruit surface due to contact and maintaining the integrity and quality of the fruit.

[0094] (2) The present invention processes and analyzes images through computers to realize an automated detection process, saving labor costs and time.

[0095] (3) The present invention can accurately determine the unevenness of the fruit surface by analyzing the shape of the laser lines, thereby identifying hidden defects.

[0096] (4) The present invention marks the defective parts on the image and records the specific conditions, so that the detection results are intuitively visualized, which is convenient for operators and managers to understand the defect conditions.

[0097] (5) The present invention can record the location, size, shape and other specific conditions of each defect, which is beneficial to subsequent data analysis and quality management.

[0098] (6) The present invention can adjust parameters according to different fruit types and detection requirements to adapt to different production environments and requirements.

[0099] (7) The present invention can detect fruit surface defects under real-time monitoring, discover problems in time and take corresponding measures to improve production efficiency and product quality.

[0100] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0101] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. An automated fruit surface defect detection method based on image recognition, characterized in that: include: A laser projector is used to project line light onto the surface of the target fruit, and a camera is used to record the laser line passing through the surface of the fruit at a preset angle to obtain initial image data; Transmitting the initial image data to a computer via an image acquisition card; In a computer, denoising the initial image data to obtain a denoised image; Performing image enhancement processing on the denoised image to obtain an enhanced image; Performing histogram equalization on the enhanced image to obtain an image to be analyzed; Analyze the laser line morphology in the image to be analyzed to determine whether there are uneven defects on the fruit surface, mark the defective parts on the image and record the specific situation.

2. The method for detecting automatic fruit surface defects based on image recognition according to claim 1, characterized in that: The specific circumstances include the size and shape of the defect.

3. The automatic fruit surface defect detection method based on image recognition according to claim 1, characterized in that: Denoising the initial image data to obtain a denoised image, comprising: Performing wavelet decomposition on the initial image data at multiple scales to obtain corresponding wavelet coefficients; Constructing a filtering threshold according to the size and decomposition scale of the initial image data; constructing an image filtering model using the filtering threshold; The initial image data is filtered using the image filtering model to obtain the denoised image.

4. The automatic fruit surface defect detection method based on image recognition according to claim 3 is characterized in that: The calculation formula of the filtering threshold is: Among them, λ j represents the filtering threshold at the jth decomposition scale, σ j represents the standard deviation of the noise at the jth decomposition scale, N j represents the signal length at the jth decomposition scale, and j represents the decomposition scale.

5. The automatic fruit surface defect detection method based on image recognition according to claim 4, characterized in that: The calculation formula of the image filtering model is: Wherein, sign is the sign function, a is the first preset coefficient, b is the second preset coefficient, ω j,k represents the kth wavelet coefficient at the jth decomposition scale, Represents the wavelet coefficients after filtering.

6. The automatic fruit surface defect detection method based on image recognition according to claim 1 is characterized in that: Performing image enhancement processing on the denoised image to obtain an enhanced image includes: Detecting the denoised image using an image recognition model to obtain a proportion value under each image enhancement window; When the proportion value in the image enhancement window is greater than a preset threshold, median denoising is performed on the image in the corresponding image enhancement window to obtain an enhanced image; The image enhancement window is slid until the entire denoised image is traversed to obtain the enhanced image.

7. The automatic fruit surface defect detection method based on image recognition according to claim 1 is characterized in that: The denoised image is detected using an image recognition model to obtain a proportion value under each image enhancement window, including: Using formula F ij =|x ij -y ij |Get the pixel difference of each pixel under each image enhancement window; where F ij represents the pixel difference of the denoised image at position (i, j), x ij Represents the pixel value of the initial image data at position (i, j), y ij Represents the pixel value of the denoised image at position (i, j); Pixels whose pixel difference is greater than the feature threshold are taken as feature points and the number is recorded; The ratio of the feature points to all the pixels in the image enhancement window is taken as the ratio value.

8. The automatic fruit surface defect detection method based on image recognition according to claim 1 is characterized in that: When the proportion value in the image enhancement window is greater than a preset threshold, median denoising is performed on the image in the corresponding image enhancement window to obtain an enhanced image, including: Using formula The image in the corresponding image enhancement window is subjected to median denoising to obtain the enhanced image; wherein f(a, b) represents the pixel value of the pixel point (a, b) after median denoising, D is an adjustable parameter, x(a, b) represents the pixel value of the pixel point (a, b) in the image enhancement window, mean(a, b) represents the pixel median of the image enhancement window, σ x (a, b) represents the variance of pixel values ​​within the image enhancement window.

9. The automatic fruit surface defect detection method based on image recognition according to claim 1 is characterized in that: Analyze the laser line shape in the image to be analyzed, determine whether there are uneven defects on the fruit surface, mark the defective parts on the image and record the specific situation, including: Extracting the contour of the laser line in the image to be analyzed using an edge detection algorithm; Use line tracking algorithm to obtain the specific direction and position of the laser line profile; Determine the degree and position of deformation based on the extracted laser line profile and the specific direction and position of the profile; The deformation degree and position are input into the trained classification model to determine whether there are uneven defects and the type of defects to obtain the detection result.

Citation Information

Cited By

  • Sugarcane grasping and placing system and method based on vision and mechanical arm end effector

    WO2026148566A1