Method and device for measuring edible rate of pomelo fruit based on machine vision and X-ray imaging
Through machine vision and X-ray imaging technology, the problem of insufficient accuracy and efficiency in detecting the edible rate of pomelo fruits has been solved, and the rapid, efficient and accurate detection of the edible rate of pomelo fruits has been achieved.
Patent Information
- Application Number
- CN202410245655.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-05
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-03-05
AI Technical Summary
Existing technology is difficult to achieve accurate, rapid and non-destructive testing of pomelo fruit edible rate, resulting in insufficient detection accuracy and efficiency.
A pomelo fruit edible rate measurement method based on machine vision and X-ray imaging is used to collect pomelo fruit appearance images, image segmentation, slice fitting, and establish a pulp model thickness map. The internal information of the pomelo fruit is obtained and the pulp is calculated by combining the X-ray images. Thickness and volume, thereby measuring edible rate.
The rapid and efficient detection of the edible rate of pomelo fruit is achieved, with improved accuracy and a simple detection process. One pomelo fruit only needs to collect one X-ray image to complete the measurement.
Smart Images

Figure CN118096779B
Abstract
Description
Technical Field
[0001] The invention relates to image processing, and more particularly to a method and device for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging. Background Art
[0002] The quality inspection and grading of agricultural products are of great significance to the industry in improving economic benefits and upgrading development. The edible rate is a key indicator of the internal quality of pomelo, which refers to the content of pulp in the pomelo. However, due to the randomness of fruit shape growth, that is, the fruit shapes are different, the skin is thick, and the fruit is large, the edible rate has problems of insufficient accuracy and efficiency in actual detection. At present, there are few reports on non-destructive detection methods for the edible rate of pomelo, and it has not been effectively applied in actual production. In order to meet the requirements of the pomelo industry for accurate and rapid non-destructive detection of edible rate, the present invention proposes a pomelo edible rate measurement algorithm based on machine vision and X-ray imaging. Summary of the invention
[0003] In view of this, the present invention provides a method and device for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging.
[0004] In order to achieve the above object, the present invention adopts the following technical solution:
[0005] A method for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging comprises the following steps:
[0006] Step 1, collecting pomelo fruit appearance images;
[0007] Step 2, segmenting the pomelo appearance image and removing the pomelo background image;
[0008] Step 3, slicing the pomelo fruit appearance image, determining endpoints on the slices, and determining the outer contour of the pomelo fruit slices using a B-spline curve interpolation fitting method based on the endpoints;
[0009] Step 4, based on the outer contour of the pomelo slice, with the horizontal diameter and the vertical diameter being the x-axis and y-axis directions respectively, a pulp model thickness map is established for the pulp area in the pomelo three-dimensional model along the shooting direction of the X-ray image;
[0010] Step 5: The value of each point in the flesh model thickness map represents the flesh thickness of the point along the shooting direction of the X-ray image.
[0011] Optionally, before collecting the pomelo appearance image, Zhang calibration is performed using an RGB camera, and distortion correction is performed based on camera intrinsic parameters, extrinsic parameters, and distortion coefficients.
[0012] Optionally, make corrections based on the geometric relationship to obtain the actual width D of the pomelo:
[0013]
[0014] Where w is the pixel width of the pomelo in the image; d is the distance from the pomelo to the camera, and the distance d between other pomelo fruits and the camera after correction is defined as:
[0015]
[0016] Where d m is the distance between a medium-sized pomelo and the camera, w m is the width of a medium-sized grapefruit pixel, and f is the focal length of the camera.
[0017] Optionally, in step 2, a threshold segmentation method is used to capture the pomelo fruit area, and a dual-channel fusion processing method is used to convert the appearance image of the pomelo fruit from the RGB color space to the HSI color space, and the hue H channel and the lightness I channel are extracted and threshold segmented respectively. The two parts are superimposed to obtain a complete pomelo fruit area.
[0018] Optionally, in step 4, in the X-ray image, the pixel thicknesses t1 and t2 of the peel at both ends of each slice are obtained, and the average value is taken as the average pixel thickness t of the pomelo slice, and the thickness t is shrunk inward on the outer contour of the pomelo slice, that is, the polar diameter of each point of the outer contour is reduced by t, and the obtained new contour line can be used as the contour of the pulp slice.
[0019] A device for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging, using a method for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging, comprising: a conveyor belt, an RGB camera, a camera bracket and an X-ray detection device; the RGB camera is fixed on the camera bracket and is used to adjust the position of the pomelo fruit; the conveyor belt is used to convey the pomelo fruit; the X-ray detection device is provided with a radiation source and is used to perform X-ray detection on the pomelo fruit.
[0020] It can be seen from the above technical solutions that, compared with the prior art, the present invention provides a method and device for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging, which has the following beneficial effects:
[0021] 1. By using a conveyor belt, the edible rate of pomelo fruit can be quickly and efficiently detected during the movement.
[0022] 2. Only one X-ray image needs to be collected for one pomelo fruit, with a simple structure and fast detection.
[0023] 3. X-ray imaging technology can obtain internal image information of pomelo fruit and has accurate detection effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] 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 or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0025] Figure 1 It is a structural schematic diagram of the present invention;
[0026] Figure 2 This is the fitting diagram of pomelo slice;
[0027] Figure 3 To fit the X-ray grayscale and flesh model thickness map;
[0028] 1- camera holder, 2- RGB camera, 3- conveyor belt, 4- pomelo fruit, 5- X-ray detection equipment, 6- radiation source, 7- conveyor belt direction. DETAILED DESCRIPTION
[0029] 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.
[0030] The embodiment of the present invention discloses a method for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging, comprising the following steps:
[0031] like Figure 1 As shown, 1 is a camera holder, 2 is an RGB camera, 3 is a conveyor belt, 4 is a pomelo, 5 is an X-ray detection device, 6 is a radiation source, and 7 is the direction of the conveyor belt. The pomelo 4 enters from the left end of the conveyor belt, and the appearance image of the pomelo is first acquired. The appearance image of the pomelo is acquired using three RGB cameras 2 and 8mm lenses, where camera A is vertically downward to shoot the upper part of the pomelo; camera B and camera C are both at an angle of 30° in the horizontal plane, shooting the left and right sides of the pomelo respectively. To reduce external light interference, the appearance image acquisition is performed in a dark box. To fix the posture more uniformly, the pomelo is placed flat on a special round tray. After the appearance image of the pomelo is acquired, it is transported along the conveyor belt to the X-ray detection device 5. To ensure a more accurate fit between the X-ray image and the appearance image, the posture of the pomelo at this time should be consistent with that when the appearance image is acquired.
[0032] Before collecting image data, the RGB camera is calibrated by Zhang, and distortion correction is performed based on the camera's intrinsic parameters, extrinsic parameters, and distortion coefficients. Correction can be performed based on the geometric relationship to obtain the actual width D of the pomelo:
[0033]
[0034] Where w is the pixel width of the pomelo in the image; d is the distance from the pomelo to the camera. The error of the actual distance between the object and the camera has a certain impact on the measurement accuracy. Therefore, the distance between the medium-sized pomelo and the camera is selected as the benchmark, and the distance d between other pomelo and the camera after correction can be defined as:
[0035]
[0036] Where d m is the distance between a medium-sized pomelo and the camera, w m is the width of a medium-sized grapefruit pixel, and f is the focal length of the camera.
[0037] Image segmentation is required to extract the grapefruit area in the image. The grapefruit and the background in the image are obviously different, so the threshold segmentation method is used to intercept the grapefruit area. The dual-channel fusion processing method has higher segmentation accuracy. The appearance image of the grapefruit is converted from the RGB color space to the HSI color space, and the hue H channel and the lightness I channel are extracted and threshold segmented respectively. The two parts are superimposed to form the complete grapefruit area. The bilinear interpolation method is used to make the grapefruit pixels in the appearance image highly unified. There are large differences in the grayscale values of the flesh, peel and background in the X-ray image. Threshold segmentation can also be used to accurately obtain the whole fruit and flesh areas in the X-ray image. In order to facilitate the measurement of edible rate, bilinear interpolation is also used to unify the grapefruit pixels in both the X-ray image and the appearance image.
[0038] like Figure 2 As shown in the figure, the grapefruit area of the appearance image is divided into n slices from top to bottom. In order to fit the three appearance images in three-dimensional space, it is necessary to determine the baseline in the image. Select several points at the top of the fruit stem and solve the average value of the horizontal coordinates of these points, i.e., u M At point (u M ,0) Draw a vertical line downward as the baseline. The left endpoint L of the i-th slice can be calculated i The distance to the baseline is D Li , left endpoint R i The distance to the baseline is D Ri The three appearance images collected for each pomelo fruit can extract six endpoints of the slice, namely A L , A R , B L , B R , C Land C R The position of the baseline M is taken as the pole, the distance from the endpoint to the baseline is the polar diameter, and the polar angle is determined according to the angle between the camera and the horizontal plane, so as to determine the position of each endpoint of the slice in polar coordinates. Figure 2 Based on these endpoints, the outer contour of the pomelo slice is determined using the B-spline curve interpolation fitting method.
[0039] In the X-ray image, the pixel thickness t1 and t2 of the peel at both ends of each slice can be obtained as Figure 2 , and take the average of the two as the average pixel thickness t of the pomelo slice. The fitted outer contour of the pomelo slice has been obtained above. On this basis, the thickness t is shrunk inward, that is, the polar diameter of each point of the outer contour is reduced by t. The new contour line obtained can be used as the contour of the flesh slice. Figure 2 .
[0040] The pulp area ( Figure 3 a) Establish the flesh model thickness map along the X-ray image shooting direction. Figure 3 b, where the value of each point in the two-dimensional graph represents the flesh thickness of the point along the direction of the X-ray image. The flesh area in the X-ray image is intercepted as the flesh X-ray grayscale image as shown in Figure 3 d. Each point in the flesh thickness image and the flesh X-ray image has a one-to-one correspondence in the actual flesh. Therefore, an appropriate fitting method can be used to solve the function formula of the thickness of a certain point in the flesh in the thickness map and the grayscale in the X-ray image, as shown in the following figure: Figure 3 e. Use the fitting function to correct the flesh grayscale image and get the corrected flesh thickness image as shown in Figure 3 f, at this time, the value of each point in the image is the pulp thickness fitted at that point, and the sum of the values of all points in the image is the optimized pulp volume.
[0041] According to GTFM, the final corrected edible rate E can be obtained c Such as:
[0042]
[0043] Where ρ F is the density of pomelo pulp, m P is the weight of the whole grapefruit; g ij is the gray value of the i-th row and j-th column in the pulp X-ray image; H and W are the height and width of the pulp X-ray image, respectively; f is the fitting function of thickness and grayscale.
[0044] The experiment used 180 pomelo fruits to test the algorithm and classified the pomelo fruit quality into five levels, with an average classification accuracy of 90.55%.
[0045] See also Figure 1The present embodiment discloses a device for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging, and a method for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging, comprising: a conveyor belt, an RGB camera, a camera bracket and an X-ray detection device; the RGB camera is fixed on the camera bracket to adjust the position of the pomelo fruit; the conveyor belt is used to convey the pomelo fruit; the X-ray detection device is provided with a radiation source to perform X-ray detection on the pomelo fruit.
[0046] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0047] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging, characterized in that: The following steps are involved: Step 1, collecting pomelo fruit appearance images; Step 2, segmenting the pomelo appearance image and removing the pomelo background image; Step 3, slicing the pomelo fruit appearance image, determining endpoints on the slices, and determining the outer contour of the pomelo fruit slices using a B-spline curve interpolation fitting method based on the endpoints; The grapefruit area of the appearance image is divided into n slices from top to bottom; in order to fit the three appearance images in three-dimensional space, it is necessary to determine the baseline in the image; select several points at the top of the fruit stem and solve the average value of the horizontal coordinates of these points, i.e., uM; draw a vertical line downward from point (uM, 0) as the baseline; it can be calculated that the distance from the left endpoint Li of the i-th slice to the baseline is DLi, and the distance from the left endpoint Ri to the baseline is DRi; the six endpoints of the slices can be extracted from the three appearance images collected for each grapefruit, namely AL, AR, BL, BR, CL and CR; the position of the baseline M is taken as the pole, the distance from the endpoint to the baseline is the polar diameter, and the polar angle is determined according to the angle between the camera and the horizontal plane, so as to determine the position of each endpoint of the slice in polar coordinates; Based on these endpoints, the outer contour of the pomelo slice is determined using the B-spline curve interpolation fitting method; Step 4, based on the outer contour of the pomelo slice, with the horizontal diameter and the vertical diameter being the x-axis and y-axis directions respectively, a pulp model thickness map is established for the pulp area in the pomelo three-dimensional model along the shooting direction of the X-ray image; Step 5, the value of each point in the flesh model thickness map represents the flesh thickness of the point along the shooting direction of the X-ray image; With the horizontal diameter and the vertical diameter as the x-axis and y-axis directions respectively, the flesh area in the three-dimensional model of pomelo is used to establish a flesh model thickness map along the shooting direction of the X-ray image, where the value of each point in the two-dimensional map represents the flesh thickness of the point along the shooting direction of the X-ray image; the flesh area in the X-ray image is intercepted as the flesh X-ray grayscale image; the flesh thickness image and each point in the flesh X-ray image are one-to-one corresponding in the actual flesh; therefore, an appropriate fitting method is used to solve the function formula of the thickness of a certain point in the flesh in the thickness map and the grayscale in the X-ray image, and the flesh grayscale image is corrected using the fitting function to obtain the corrected flesh thickness map. At this time, the value of each point in the image is the fitted flesh thickness of the point, and the sum of the values of all points in the image is the optimized flesh volume; according to GTFM, the final corrected edible rate Ec can be obtained as: In the formula, ρ F is the density of pomelo pulp, m p is the weight of the whole grapefruit; g ij is the gray value of the i-th row and j-th column in the pulp X-ray image; H and W are the height and width of the pulp X-ray image, respectively; f is the fitting function of thickness and grayscale.
2. The method for measuring edible rate of pomelo fruit based on machine vision and X-ray imaging according to claim 1, characterized in that: Before collecting the appearance image of pomelo, the RGB camera was used for Zhang calibration, and distortion correction was performed based on the camera's intrinsic parameters, extrinsic parameters, and distortion coefficients.
3. The method for measuring edible rate of pomelo fruit based on machine vision and X-ray imaging according to claim 1, characterized in that: Correct according to the geometric relationship to obtain the actual width D of the pomelo: Where w is the pixel width of the pomelo in the image; d is the distance from the pomelo to the camera, and the distance d between the pomelo and the camera after correction is defined as: Where, d m is the distance between a medium-sized pomelo and the camera, w m is the width of a medium-sized grapefruit pixel, and f is the focal length of the camera.
4. The method for measuring edible rate of pomelo fruit based on machine vision and X-ray imaging according to claim 1, characterized in that: In step 2, the pomelo fruit area is intercepted by the threshold segmentation method, and the appearance image of the pomelo fruit is converted from the RGB color space to the HSI color space by using the dual-channel fusion processing method. The hue H channel and the lightness I channel are extracted and threshold segmented respectively. The two parts are superimposed to obtain the complete pomelo fruit area.
5. The method for measuring edible rate of pomelo fruit based on machine vision and X-ray imaging according to claim 1, characterized in that: In step 4, in the X-ray image, the pixel thicknesses t1 and t2 of the peel at both ends of each slice are obtained, and the average value is taken as the average pixel thickness t of the pomelo slice. The thickness t is shrunk inward on the outer contour of the pomelo slice, that is, the polar diameter of each point of the outer contour is reduced by t, and the new contour line obtained can be used as the contour of the flesh slice.
6. A device for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging, using any one of the methods for measuring the edible rate of pomelo fruit based on machine vision and X-ray imaging according to claims 1-5, comprising: Conveyor belts, RGB cameras, camera stands, and X-ray inspection equipment; The RGB camera is fixed on the camera bracket and is used to adjust the position of the pomelo fruit; The conveyor belt is used to convey pomelo fruit; The X-ray detection device is provided with a radiation source for performing X-ray detection on pomelo fruit.
