Apple mildew core detection method based on optical path length and fruit color correction
Through the detection method based on optical path length and fruit color correction, the problem of fruit diameter, position and fruit color difference in the prior art affecting detection accuracy is solved, and high-precision recognition of mold apples is achieved.
Patent Information
- Application Number
- CN202510081705.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-04-04
AI Technical Summary
The existing apple mold heart detection methods are easy to affect the recognition accuracy due to the difference in fruit diameter, fruit posture and fruit color differences, and it is difficult to effectively detect mold heart apples.
Using a detection method based on optical path length and fruit color correction, the apple is illuminated by a halogen lamp to measure the transmitted light intensity and optical path length, combined with RGB images and near-infrared spectral data, a path length and color correction model is established to reduce prediction errors and improve recognition accuracy.
It effectively reduces the prediction error caused by the difference in fruit diameter, position and color, and significantly improves the recognition accuracy of moldy apples.
Smart Images

Figure CN119757243A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of crop detection, and in particular to a method for detecting apple core mold based on optical path length and fruit color correction. Background Art
[0002] Apple core disease, also known as heart rot, is the main disease that harms the internal quality of apples. The main period of occurrence of apple core disease is during the fruit ripening and storage period. Most early and mid-ripening apples cannot be distinguished from the outside after they are ripe and harvested, but the diseased fruits that enter the market or the hands of consumers are inedible; after late-ripening varieties enter the fruit warehouse, the disease will continue to spread and become ill during the storage period, causing the entire fruit to rot and have no edible value. The neurotoxins contained in core disease have toxicological effects such as affecting fertility, causing cancer and immunity. Current related core detection schemes include the method with announcement number CN104865203B, but this type of scheme is easily affected by differences in fruit diameter, fruit posture and fruit color, which can easily affect the accuracy of its identification. Summary of the invention
[0003] In order to solve the above technical problems, the present invention provides a method for detecting apple core mold based on optical path length and fruit color correction, which can effectively reduce the prediction error caused by differences in fruit diameter, fruit posture and fruit color, and effectively improve the recognition accuracy of apple core mold.
[0004] The technical solution adopted by the present invention to solve the technical problem is: an apple moldy core detection device based on optical path length and fruit color correction,
[0005] The invention comprises a detection room, wherein a detection platform is arranged in the detection room, a camera is arranged on one side of the detection platform, a halogen lamp for irradiating downwards is arranged above the detection platform, and a detection probe of a near-infrared spectrometer is arranged below the detection platform.
[0006] A device for detecting apple core mold based on optical path length and fruit color correction comprises a detection chamber, wherein a detection platform is arranged in the detection chamber, a camera is arranged on one side of the detection platform, a halogen lamp for irradiating downwards is arranged above the detection platform, and a detection probe of a near-infrared spectrometer is arranged below the detection platform.
[0007] A method for detecting apple core mold based on optical path length and fruit color correction comprises the following steps:
[0008] S1 uses a halogen lamp to illuminate apples, uses a near-infrared spectrometer to measure the intensity of light transmitted through each apple, takes an RGB image of the apple, and measures the optical path length when the apple is illuminated;
[0009] S2 calculates the conversion coefficient ρ based on the longest diameter A0 of the apple in the incident direction of light measured by a vernier caliper and the pixel length a0 of the longest diameter in the incident direction of light in the apple RGB image, thereby obtaining an apple optical path length prediction model;
[0010] S3 takes the predicted optical path length x as the independent variable and the transmitted light intensity as the dependent variable, establishes a transmitted light intensity prediction model based on the optical path length, and obtains the predicted transmitted light intensity;
[0011] S4 takes the apple color index R value, G value, B value, L value, a value, and b value as independent variables and the transmitted light intensity as the dependent variable to establish a transmitted light intensity prediction model based on color information, and obtains the transmitted light intensity n predicted based on the color parameters of the apple to be tested. pre ;
[0012] S5 combines the optical path length and the color correction method to construct the transmitted light intensity correction equation to obtain the corrected near-infrared information y cor .
[0013] S6 takes the corrected transmitted light intensity as input and the apple core rot grade as output, and builds an apple core rot detection model based on PLSR.
[0014] Preferably, the pixel length of the longest diameter of the light incident direction in the collected apple RGB image is a 0, Use a vernier caliper to measure the longest diameter A of the apple in the direction of incident light. 0, And calculate the conversion coefficient ρ according to the following formula.
[0015] ρ=A0 / a0
[0016] The optical path length prediction model:
[0017] x=ρa
[0018] Where x represents the predicted optical path length, and a represents the average pixel length of the apple image area along the incident direction of the light.
[0019] Establish the index equation of apple transmitted light intensity:
[0020]
[0021] Where k is a constant term (incident light intensity), and the matrix y i is the transmitted light intensity at the key wavelength point i corresponding to the batch of apples, μ i is the absorption coefficient of healthy apple, and the independent variable x is the predicted optical path length;
[0022] The collected apple RGB image is cropped. The incident light in the image forms a light spot on the surface of the apple. Only the image of the light spot width is retained. The edge detection algorithm canny is used to draw the edge of the apple in the image. The average pixel length of the halogen lamp light intercepted by the apple edge is counted. Based on the average pixel length, the predicted standard optical path length x0 is obtained;
[0023] Correction equation for transmitted light intensity based on optical path length:
[0024]
[0025] x0 is the standard optical path length, x is the predicted optical path length of the measured apple, b is the measured transmitted light intensity, y is the measured op,i is the transmitted light intensity at the key wavelength point i after correction based on the optical path length.
[0026] Preferably, in step S3, a number of apples with a fruit diameter of a standard optical path length x0 are selected, and their fruit surfaces are photographed with a camera to extract R value, G value, B value, L value, a value, and b value, and their transmitted light intensity is obtained with a near-infrared spectrometer.
[0027] Design a key transmitted light intensity regression network, which includes an input layer M, a hidden layer H*3, and an output layer N, where the hidden layer structure is Dense-BatchNormalization-Relu;
[0028] The R value, G value, B value, L value, a value, and b value are regarded as input features m, and the transmitted light intensity at the key characteristic wavelength point of moldy core disease is regarded as the target value n to train the model;
[0029] The color mean R0, G0, B0, L0, a0, and b0 of this batch of apples are defined as standard color parameters, and the transmitted light intensity n predicted by the input model is nor ; Input the color parameters R, G, B, L, a, b of the apple to be tested into the model to predict the transmitted light intensity n pre .
[0030] The color-based transmitted light intensity correction formula is:
[0031] n color =n pre -n nor +b
[0032] Where n pre is the transmitted light intensity predicted based on the measured apple color parameters, n nor is the transmitted light intensity predicted based on the standard apple color parameters, b is the transmitted light intensity of the apple measured by the near-infrared spectrometer, and n color is the transmitted light intensity corrected based on the apple color.
[0033] Preferably, a batch of apples are selected for near-infrared spectral transmission light intensity collection, and the transmission light intensity of the characteristic wavelength related to rotten core disease is selected. The correction method based on optical path length and the correction method based on fruit color are used to obtain the near-infrared transmission light intensity at the key wavelength point i after correction:
[0034]
[0035] A batch of apple samples were imaged and their near-infrared spectral data collected. They were then cut one by one and divided into healthy apples, slightly moldy apples, and severely moldy apples according to the moldy core area. The key characteristic wavelength of the moldy core disease was selected and the aforementioned correction method based on optical path length and fruit color was used to obtain the corrected transmitted light intensity, which was used as input. The moldy core grade of the apples was used as output, and an apple moldy core disease detection model was constructed based on PLSR.
[0036] The moldy core disease detection model is obtained as follows:
[0037]
[0038] Where w is the weight vector; b is the bias term, X is the transmitted light intensity at the key characteristic wavelength point related to the apple core rot disease to be tested, It is the core rot grade of the apples to be tested.
[0039] When this method is used to detect core rot, the near-infrared spectrum transmitted light intensity of the apples to be tested is collected, and the transmitted light intensity of the characteristic wavelength related to core rot is selected. The correction method based on optical path length and the correction method based on fruit color are used to obtain the corrected near-infrared transmitted light intensity, which is then input into the constructed apple core rot detection model to obtain the test results.
[0040] Advantages of the present invention: The prediction model based on optical path length and fruit color correction proposed in the present invention can effectively reduce the prediction error caused by differences in fruit diameter, fruit posture and fruit color, and effectively improve the recognition accuracy of moldy apples. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] 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 description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only two of the drawings of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 This is a schematic diagram of an apple moldy core detection device based on optical path length and fruit color correction according to an embodiment of the present invention;
[0043] Figure 2 A schematic diagram of color-based projection light intensity correction according to an embodiment of the present invention; DETAILED DESCRIPTION
[0044] In order to deepen the understanding of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. The embodiments are only used to explain the present invention and do not limit the protection scope of the present invention.
[0045] Example
[0046] like Figure 1 As shown, an apple core mold detection device based on optical path length and fruit color correction is provided.
[0047] The invention comprises a detection room, wherein a detection platform is arranged in the detection room, a camera is arranged on one side of the detection platform, a halogen lamp for irradiating downwards is arranged above the detection platform, and a detection probe of a near-infrared spectrometer is arranged below the detection platform.
[0048] A device for detecting apple core mold based on optical path length and fruit color correction comprises a detection chamber, wherein a detection platform is arranged in the detection chamber, a camera is arranged on one side of the detection platform, a halogen lamp for irradiating downwards is arranged above the detection platform, and a detection probe of a near-infrared spectrometer is arranged below the detection platform.
[0049] A method for detecting apple core mold based on optical path length and fruit color correction comprises the following steps:
[0050] S1 uses a halogen lamp to illuminate apples, uses a near-infrared spectrometer to measure the intensity of light transmitted through each apple, takes an RGB image of the apple, and measures the optical path length when the apple is illuminated;
[0051] S2 calculates the conversion coefficient ρ based on the longest diameter A0 of the apple in the incident direction of light measured by a vernier caliper and the pixel length a0 of the longest diameter in the incident direction of light in the apple RGB image, thereby obtaining an apple optical path length prediction model;
[0052] S3 takes the predicted optical path length x as the independent variable and the transmitted light intensity as the dependent variable, establishes a transmitted light intensity prediction model based on the optical path length, and obtains the predicted transmitted light intensity;
[0053] S4 takes the apple color index R value, G value, B value, L value, a value, and b value as independent variables and the transmitted light intensity as the dependent variable to establish a transmitted light intensity prediction model based on color information, and obtains the transmitted light intensity n predicted based on the color parameters of the apple to be tested. pre ;
[0054] S5 combines the optical path length and the color correction method to construct the transmitted light intensity correction equation to obtain the corrected near-infrared information y cor .
[0055] S6 takes the corrected transmitted light intensity as input and the apple core rot grade as output, and builds an apple core rot detection model based on PLSR.
[0056] Preferably, the pixel length of the longest diameter of the light incident direction in the collected apple RGB image is a 0, Use a vernier caliper to measure the longest diameter A of the apple in the direction of incident light. 0, And calculate the conversion coefficient ρ according to the following formula.
[0057] ρ=A0 / a0
[0058] The optical path length prediction model:
[0059] x=ρa
[0060] Where x represents the predicted optical path length, and a represents the average pixel length of the apple image area along the incident direction of the light.
[0061] Establish the index equation of apple transmitted light intensity:
[0062]
[0063] Where k is a constant term (incident light intensity), and the matrix y i is the transmitted light intensity at the key wavelength point i corresponding to the batch of apples, μ i is the absorption coefficient of healthy apple, and the independent variable x is the predicted optical path length;
[0064] The collected apple RGB image is cropped. The incident light in the image forms a light spot on the surface of the apple. Only the image of the light spot width is retained. The edge detection algorithm canny is used to draw the edge of the apple in the image. The average pixel length of the halogen lamp light intercepted by the apple edge is counted. Based on the average pixel length, the predicted standard optical path length x0 is obtained;
[0065] Correction equation for transmitted light intensity based on optical path length:
[0066]
[0067] x0 is the standard optical path length, x is the predicted optical path length of the measured apple, b is the measured transmitted light intensity, y is the measured op is the transmitted light intensity at the key wavelength point i after correction based on the optical path length.
[0068] Preferably, in step S3, a number of apples with a fruit diameter of a standard optical path length x0 are selected, and their fruit surfaces are photographed with a camera to extract R value, G value, B value, L value, a value, and b value, and their transmitted light intensity is obtained with a near-infrared spectrometer.
[0069] Design a key transmitted light intensity regression network, which includes an input layer M, a hidden layer H*3, and an output layer N, where the hidden layer structure is Dense-BatchNormalization-Relu;
[0070] The R value, G value, B value, L value, a value, and b value are regarded as input features m, and the transmitted light intensity at the key characteristic wavelength point of moldy core disease is regarded as the target value n to train the model;
[0071] The color mean R0, G0, B0, L0, a0, and b0 of this batch of apples are defined as standard color parameters, and the transmitted light intensity n predicted by the input model is nor ; Input the color parameters R, G, B, L, a, b of the apple to be tested into the model to predict the transmitted light intensity n pre .
[0072] The color-based transmitted light intensity correction formula is:
[0073] n color =n pre -n nor +b
[0074] where n pre is the transmitted light intensity predicted based on the measured apple color parameters, n nor is the transmitted light intensity predicted based on the standard apple color parameters, b is the transmitted light intensity of the apple measured by the near-infrared spectrometer, and n color is the transmitted light intensity corrected based on the apple color.
[0075] Preferably, a batch of apples are selected for near-infrared spectral transmission light intensity collection, and the transmission light intensity of the characteristic wavelength related to rotten core disease is selected. The correction method based on optical path length and the correction method based on fruit color are used to obtain the near-infrared transmission light intensity at the key wavelength point i after correction:
[0076]
[0077] A batch of apple samples were imaged and their near-infrared spectral data collected. They were then cut one by one and divided into healthy apples, slightly moldy apples, and severely moldy apples according to the moldy core area. The key characteristic wavelength of the moldy core disease was selected and the aforementioned correction method based on optical path length and fruit color was used to obtain the corrected transmitted light intensity, which was used as input. The moldy core grade of the apples was used as output, and an apple moldy core disease detection model was constructed based on PLSR.
[0078] The moldy core disease detection model is obtained as follows:
[0079]
[0080] Where w is the weight vector; b is the bias term, X is the transmitted light intensity at the key characteristic wavelength point related to the apple core rot disease to be tested, It is the core rot grade of the apples to be tested.
[0081] When this method is used to detect core rot, the near-infrared spectrum transmitted light intensity of the apples to be tested is collected, and the transmitted light intensity of the characteristic wavelength related to core rot is selected. The correction method based on optical path length and the correction method based on fruit color are used to obtain the corrected near-infrared transmitted light intensity, which is then input into the constructed apple core rot detection model to obtain the test results.
[0082] Advantages of the present invention: The prediction model based on optical path length and fruit color correction proposed in the present invention can effectively reduce the prediction error caused by differences in fruit diameter, fruit posture and fruit color, and effectively improve the recognition accuracy of moldy apples.
[0083] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0084] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. An apple core mold detection device based on optical path length and fruit color correction, characterized in that: The invention comprises a detection room, wherein a detection platform is arranged in the detection room, a camera is arranged on one side of the detection platform, a halogen lamp for irradiating downwards is arranged above the detection platform, and a detection probe of a near-infrared spectrometer is arranged below the detection platform.
2. A method for detecting apple core mold based on optical path length and fruit color correction, characterized in that: The following steps are involved: S1 uses a halogen lamp to illuminate apples, uses a near-infrared spectrometer to measure the intensity of light transmitted through each apple, takes an RGB image of the apple, and measures the optical path length when the apple is illuminated; S2 calculates the conversion coefficient ρ based on the longest diameter A0 of the apple in the incident direction of light measured by a vernier caliper and the pixel length a0 of the longest diameter in the incident direction of light in the apple RGB image, thereby obtaining an apple optical path length prediction model; S3 takes the predicted optical path length x as the independent variable and the transmitted light intensity as the dependent variable, establishes a transmitted light intensity prediction model based on the optical path length, and obtains the predicted transmitted light intensity; S4 takes the apple color index R value, G value, B value, L value, a value, and b value as independent variables and the transmitted light intensity as the dependent variable, establishes a transmitted light intensity prediction model based on color information, and obtains the transmitted light intensity predicted based on the color parameters of the apple to be tested; S5 combines the optical path length and the color correction method to construct the transmitted light intensity correction equation to obtain the corrected near-infrared information y cor . S6 takes the corrected transmitted light intensity as input and the apple core rot grade as output, and builds an apple core rot detection model based on PLSR.
3. The method for detecting moldy apples based on optical path length and fruit color correction according to claim 2, characterized in that: The pixel length of the longest diameter of the incident light in the apple RGB image is a 0, Use a vernier caliper to measure the longest diameter A0 of the apple in the direction of incident light, and calculate the conversion coefficient ρ according to the following formula: ρ=A0 / a0.
4. The method for detecting moldy apples based on optical path length and fruit color correction according to claim 3, characterized in that: The optical path length prediction model: x=ρa Where x represents the predicted optical path length, and a represents the average pixel length of the apple image area along the incident direction of the light.
5. The method for detecting moldy apples based on optical path length and fruit color correction according to claim 4, characterized in that: Establish the index equation of apple transmitted light intensity: Where k is a constant term (incident light intensity), and the matrix y i is the transmitted light intensity at the key wavelength point i corresponding to the batch of apples, μ i is the absorption coefficient of healthy apple at the key wavelength point i, and the independent variable x is the predicted optical path length; The collected apple RGB image is cropped. The incident light in the image forms a light spot on the surface of the apple. Only the image of the light spot width is retained. The edge detection algorithm canny is used to draw the edge of the apple in the image. The average pixel length of the halogen lamp light intercepted by the apple edge is counted. Based on the average pixel length, the predicted standard optical path length x0 is obtained; Correction equation for transmitted light intensity based on optical path length: x0 is the standard optical path length, x is the predicted optical path length of the measured apple, b is the measured transmitted light intensity, y is the measured op,i is the transmitted light intensity at the key wavelength point i after correction based on the optical path length.
6. The method for detecting moldy apples based on optical path length and fruit color correction according to claim 2, characterized in that: Step S3: select a number of apples with a fruit diameter of a standard optical path length x0, use a camera to shoot their fruit surfaces and extract R value, G value, B value, L value, a value, and b value, use a near-infrared spectrometer to obtain their transmitted light intensity, and design a key transmitted light intensity regression network, which includes an input layer M, a hidden layer H*3, and an output layer N, wherein the hidden layer structure is Dense-BatchNormalization-Relu; The R value, G value, B value, L value, a value, and b value are regarded as input features m, and the transmitted light intensity at the key characteristic wavelength of molty core disease is regarded as the target value n, and a transmitted light intensity prediction model based on fruit color is trained; The color mean values of this batch of apples, R0, G0, B0, L0, a0, and b0, are used as standard color parameters, and the transmitted light intensity n obtained by the input model is nor is the transmitted light intensity predicted based on the standard apple color; the color mean values of the apples to be tested R, G, B, L, a, b are used as color parameters one by one, and the transmitted light intensity n obtained by the input model is pre is the transmitted light intensity predicted based on the color of the apple to be tested; The color-based transmitted light intensity correction formula is: n color =n pre -n nor +b Where n pre is the transmitted light intensity predicted based on the measured apple color parameters, n nor is the transmitted light intensity predicted based on the standard apple color parameters, b is the transmitted light intensity of the apple measured by the near-infrared spectrometer, and n color is the transmitted light intensity corrected based on the apple color.
7. The method for detecting apple moldy core based on optical path length and fruit color correction according to claim 2, characterized in that: Preferably, a batch of apples are selected for near-infrared spectral transmission light intensity collection, and the transmission light intensity of the characteristic wavelength related to rotten core disease is selected. The correction method based on optical path length and the correction method based on fruit color are used to obtain the near-infrared transmission light intensity at the key wavelength point i after correction:
8. The method for detecting moldy apples based on optical path length and fruit color correction according to claim 2, characterized in that: Collect pictures and near-infrared spectral data of a batch of apple samples, then cut them one by one and divide them into healthy apples, slightly moldy apples, and severely moldy apples according to the moldy core area; select the key characteristic wavelength of moldy core disease and use the aforementioned correction method based on optical path length and fruit color to obtain the corrected transmitted light intensity, which is used as input, and the moldy core grade of apples is used as output, and an apple moldy core disease detection model is constructed based on PLSR; The moldy core disease detection model is obtained as follows: Where w is the weight vector; b is the bias term, X is the transmitted light intensity at the key characteristic wavelength point related to the apple core rot disease to be tested, is the core rot grade of the apples to be tested; When this method is used to detect core rot, the near-infrared spectrum transmitted light intensity of the apples to be tested is collected, and the transmitted light intensity of the characteristic wavelength related to core rot is selected. The correction method based on optical path length and the correction method based on fruit color are used to obtain the corrected near-infrared transmitted light intensity, which is then input into the constructed apple core rot detection model to obtain the test results.
Citation Information
Patent Citations
Device for automatically detecting apple core rot
CN104865203B