
Yali pear is a traditional and excellent main cultivated variety of white pear strain in my country. It occupies an important position in the country's export fruit and
makes outstanding contributions to export earnings every year. In order to enhance the status and competitiveness of Yali pear in the international market and
meet consumers' demand for high-end fruits with beautiful appearance and good quality, it is necessary to detect Yali pear bruises. This paper takes Yali pear as
the research object, collects hyperspectral images of samples by reflection, and preliminarily explores the detection method of Yali pear subcutaneous bruises
based on hyperspectral reflectance image analysis. Different degrees of bruises are prepared by making samples fall freely from different heights and hit the
ground. The experimental results show that within the 400-1000 nm band, the relative reflectivity of the unbruised sample is greater than that of the bruised
sample, and the more severe the bruise, the smaller the relative reflectivity value. The results of principal component analysis of the hyperspectral reflectance
image in the 400-1000 nm band show that the segmentation of the bruised area can be achieved by sequentially performing median filtering, threshold segme
ntation, filling processing and connected area area screening on the fourth principal component image. This result lays the foundation for the subsequent quan
titative detection of the bruised area of Yali pear.
1. Sample preparation
60 pear samples of the same size and color and without surface defects were divided into 4 groups, 15 in each group. Groups 1-3 samples fell freely from heights
of 58, 43 and 32 cm, respectively, and formed collision bruises of varying degrees by impacting the ground. Group 4 samples had no bruises on the surface and
were used as the control group. Since the samples were in free fall, it was impossible to control the point of impact between the samples and the ground. Howeve
r, in order to ensure that the selected region of interest was located at the same position of all samples, thereby avoiding the influence of the different positions
of the region of interest on the results, 8 samples with bruises at the equator were finally selected from each group for subsequent analysis. During the entire
experiment, all samples were stored in a laboratory environment (about 7.5℃, relative humidity 61%).
2. Reflection hyperspectral image acquisition
First, turn on the fiber optic light source. After preheating, adjust the object distance, lens rotation and moving speed of the electric displacement platform by
observing whether the reconstructed pseudo-color image is clear and distortion-free, so that the hyperspectral camera can image clearly. Then place a standard
white plate (polytetrafluoroethylene plate) on the stage, adjust the camera exposure time according to the principle of no saturation of spectral signal, obtain the
white plate reflectance spectrum, perform white calibration on the hyperspectral camera, and save it. Then cover the lens cap, perform dark field calibration on
the hyperspectral camera, and save it. Then adjust the number of frames of hyperspectral image acquisition according to the length and width of the sample in
the field of view. Finally, place the sample on the stage, adjust the bruised part to the vertex of the scanning surface, and collect the hyperspectral reflectance
image of the sample once every 24 hours, for a total of 3 times.
3 Results and Discussion
3.1 Relative reflectance spectrum analysis of the bruised area
In the acquired hyperspectral image, a 50*50 area at the same position of the equator is selected as the region of interest (Region of interest: ROI), and the relative
reflectance spectrum of the area is obtained. Then the relative reflectance spectrum of each group of samples is averaged.
Figure 2 shows the average relative reflectance spectrum of each group of samples at 0, 24 and 48 hours after the collision. It can be seen that in the 400-1000nm
band, the relative reflectivity of the undamaged samples is greater than that of the damaged samples, and the more severe the damage, the smaller the relative
reflectivity of the sample. In addition, as time goes by, regardless of the degree of damage to the sample, the relative reflectivity of the damaged area of the
sample gradually decreases.

3.2 Segmentation of the damaged area
The first four principal component images are obtained by principal component analysis of the reflectance hyperspectral image in the 400-1000 nm band, as shown
in Figure 3. As can be seen from the figure, the grayscale difference between the damaged area and the normal area in the second and fourth principal component
images is obvious.
In the second principal component image (PC-2), the damaged area is darker in color and has a smaller grayscale value, while the normal area is lighter in color and
has a larger grayscale value. In the fourth principal component image (PC-4), the situation is just the opposite, the damaged area is lighter in color, and the normal
area is darker in color.

Due to the rough surface of the pear, many noise points are formed in the second and fourth principal component images, so the second and fourth principal component images cannot be directly used for the segmentation of the bruised area. In addition, the grayscale values of the black spots on the pear skin in the second principal component image are very close to the noise points, so the fourth principal component image is selected for the segmentation of the bruised area. First, the PC-4 is median filtered, and then the filtered image is threshold segmented. The threshold value set here is 170, followed by filling processing, and finally the number of pixels in each connected area in the result image is calculated. The connected area with a number of pixels greater than 200 is retained, which is the bruised area. The step-by-step processing results of the image segmentation process are shown in Figure 4.

4. Conclusion
Based on the hyperspectral reflectance imaging system, this study explored the detection method of bruises on duck pears. The study found that within the
400-1000nm band, the relative reflectivity of the undamaged samples was greater than that of the bruised samples, and the more severe the bruise, the smaller the
relative reflectivity of the sample. As time goes by, regardless of the degree of bruise, the relative reflectivity of the bruised area of the sample gradually decreases.
The results of principal component analysis of the hyperspectral reflectance images in the 400-1000 nm band show that there is a significant difference in grayscale
between the bruised area and the normal area in the second and fourth principal component images. However, in the second principal component image, the black
spots on the surface of the duck pear are close to the grayscale values of the noise points formed by the rough surface of the duck pear, which is not conducive to
the segmentation of the bruised area. Therefore, by performing median filtering, threshold segmentation, filling processing and connected area area screening on
the fourth principal component image in turn, the bruised area is finally segmented out, laying the foundation for the subsequent quantitative detection of the bruised
area of the duck pear.