Method for three-dimensional reconstruction of fruit and vegetable surface, computer device and readable storage medium

CN122391517BActive Publication Date: 2026-09-08EAST CHINA JIAOTONG UNIVERSITY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202610856758.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-15
Publication Date
2026-09-08
Estimated Expiration
2046-06-15

AI Technical Summary

Technical Problem

然而,对于打蜡苹果、柑橘等具有强镜面反射特性的果蔬,易导致局部区域图像过曝,严重破坏三维重建质量

Benefits of technology

[0008] Fourthly, embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122391517B_ABST
    Figure CN122391517B_ABST
Patent Text Reader

Abstract

The application discloses a fruit and vegetable surface three-dimensional reconstruction method, a computer device and a readable storage medium, and belongs to the technical field of optical three-dimensional measurement. The method comprises the following steps: controlling a stepping motor to rotate from a first end point to a second end point in a preset angle interval at a preset step length; in the case that the stepping motor rotates one step, the following operations are performed: controlling a camera to collect a first fringe image of a preset region; determining the score of each first fringe image based on the first saturated pixel ratio and the fringe contrast of each first fringe image; after the control of the stepping motor is completed, the rotation angle of the first polarization filter corresponding to the first highest score is taken as an optimal polarization angle; and performing three-dimensional reconstruction on the surface of the target fruit and vegetable based on the optimal polarization angle. The application can improve the quality of fruit and vegetable surface three-dimensional reconstruction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of optical three-dimensional measurement technology, specifically relating to a method for three-dimensional reconstruction of fruit and vegetable surfaces, computer equipment, and readable storage medium. Background Technology

[0002] Mechanical damage (such as abrasions and indentations) and diseases are important causes of declining fruit and vegetable quality and losses. Therefore, it is necessary to inspect the surface of fruits and vegetables to reduce post-harvest loss rates.

[0003] In traditional technologies, structured light 3D measurement is one of the mainstream methods for detecting fruit and vegetable surfaces. This technology projects a coded stripe pattern onto the surface of the object being measured using a projector, collects the deformation stripes using a camera, and reconstructs the object's 3D shape through phase calculation. However, for fruits and vegetables with strong specular reflection properties, such as waxed apples and citrus fruits, it can easily lead to overexposure in local areas of the image, severely compromising the quality of the 3D reconstruction. Summary of the Invention

[0004] The purpose of this application is to provide a method, computer equipment, and readable storage medium for three-dimensional reconstruction of fruit and vegetable surfaces, which can improve the quality of three-dimensional reconstruction of fruit and vegetable surfaces.

[0005] To solve the above-mentioned technical problems, this application is implemented as follows: In a first aspect, embodiments of this application provide a method for three-dimensional reconstruction of fruit and vegetable surfaces, the method comprising: The stepper motor is controlled to rotate gradually from the first endpoint to the second endpoint of a preset angle range with a preset step size; wherein, the stepper motor is used to drive the first polarizing filter set in front of the camera to rotate; After each step of the stepper motor, the following operations are performed: control the camera to acquire the first stripe image of the preset area; determine the score of each first stripe image based on the first saturation pixel ratio and stripe contrast of each first stripe image; wherein, the preset area is the area where the target fruit and vegetable is located, and the target fruit and vegetable has a stripe pattern projected on it by a projector. After controlling the stepper motor, the rotation angle of the first polarizing filter corresponding to the highest score is taken as the optimal polarization angle. The surface of the target fruit and vegetable is reconstructed in three dimensions based on the optimal polarization angle.

[0006] In a second aspect, embodiments of this application provide a computer device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0007] Thirdly, embodiments of this application provide a computer-readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0008] Fourthly, embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.

[0009] In this embodiment, by setting a polarizing filter in front of the camera, the specular reflection component of smooth fruit and vegetable surfaces in the camera's imaging optical path is effectively suppressed through polarization filtering technology. Furthermore, a stepper motor drives the polarizing filter to rotate. With each step of the stepper motor, the camera acquires a stripe image. The optimal polarization angle is found by analyzing the saturation pixel ratio and stripe contrast of this image, and then the surface of the fruit and vegetable is reconstructed in three dimensions using this optimal polarization angle. This further reduces the specular reflection component of smooth fruit and vegetable surfaces in the camera's imaging optical path, thereby reducing the risk of overexposure in local areas and improving the quality of the three-dimensional reconstruction of the fruit and vegetable surface. Attached Figure Description

[0010] Figure 1 These are schematic diagrams of the structure of a three-dimensional reconstruction system for fruit and vegetable surfaces provided in some embodiments of this application; Figure 2 These are imaging effect diagrams provided by some embodiments of this application under the same polarization angle and four different exposure times, as well as imaging effect diagrams under the same exposure time and different polarization angles. Figure 3a These are some embodiments of the package phase map under non-polarization imaging involved in this application; Figure 3b This application relates to phase-shift code + Gray code decoding in non-polarization imaging in some embodiments; Figure 3c These are absolute phase maps under non-polarization imaging, as described in some embodiments of this application; Figure 4a These are some embodiments of the present application providing package phase maps under polarization imaging; Figure 4b This application provides phase-shift code + Gray code decoding for polarization imaging in some embodiments; Figure 4c These are absolute phase maps under polarization imaging provided in some embodiments of this application; Figure 5a These are reconstructed original images from non-polarization imaging, as described in some embodiments of this application. Figure 5bThese are reconstructed point cloud images and their partial magnified views under non-polarization imaging, as described in some embodiments of this application. Figure 6a These are reconstructed original images under polarization imaging provided in some embodiments of this application; Figure 6b These are reconstructed point cloud images and their partial magnified views under polarization imaging provided in some embodiments of this application; Figure 7 These are the original sphere images and reconstructed point cloud models provided in some embodiments of this application; Figure 8 This is a flowchart illustrating a method for three-dimensional reconstruction of fruit and vegetable surfaces provided in some embodiments of this application; Figure 9 These are optimization process data and optimization result graphs provided in some embodiments of this application; Figure 10 These are comparison images of the effects of apple surface stripe images captured at five different polarization angles, provided by some embodiments of this application. Figure 11 These are internal structural diagrams of a computer device provided in some embodiments of this application. Detailed Implementation

[0011] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0012] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0013] In one exemplary embodiment, reference is made to Figure 1 This application proposes an applicable three-dimensional reconstruction system for fruit and vegetable surfaces, which may include a projector, a camera, a first polarizing filter (analyzer) and a stepper motor assembly (not shown), a second polarizing filter (polarizer), a rotating platform and computer equipment (such as a host computer).

[0014] The projector is used to project the encoded stripe pattern. In some embodiments, the encoding strategy may be a combination of phase-shift code and Gray code.

[0015] The camera is used to capture images of stripes that deform after being projected onto the surface of fruits and vegetables.

[0016] The first polarizing filter is rotatably mounted in front of the camera lens to filter the specular reflection component from the smooth surface of fruits and vegetables; a stepper motor is used to drive the first polarizing filter to rotate.

[0017] The second polarizing filter is fixedly installed in front of the projector's light outlet to convert the natural light (or light with uncertain polarization state) emitted by the projector into specific linearly polarized light and project it onto the surface of fruits and vegetables.

[0018] The rotating platform is used to hold and rotate the fruit and vegetable samples being tested.

[0019] The computer equipment is electrically connected to the projector, camera, stepper motor, and rotating platform to output control signals and receive feedback signals (such as the stripe image from the camera), and performs 3D reconstruction based on the stripe image. It should be noted that the stripe image represents the tested fruit and vegetable sample at different rotation angles, covering the entire surface of the fruit and vegetable.

[0020] It should be noted that before performing 3D reconstruction of fruit and vegetable surfaces using the fruit and vegetable surface 3D reconstruction system, system calibration is required, that is, calibrating the relative positional relationship between the camera and the projector, in order to obtain the system's geometric parameters.

[0021] It should be noted that the polarizing filter in front of the camera can only filter the polarized component of ambient light, or filter some reflected light using the Brewster angle principle. However, since the projector projects unpolarized light, its specular reflection has vibrational components in all directions. A single polarizing filter cannot achieve physical "complete extinction," and theoretically, the effect is extremely poor. Therefore, in this embodiment, in addition to setting a first polarizing filter in front of the camera, a second polarizing filter is also set in front of the projector.

[0022] To verify the effectiveness of the embodiments of this application, a comparative experiment is provided. For example... Figure 2 As shown, Figure 2The images include those taken at the same polarization angle and four different exposure times, as well as those taken at the same exposure time but with different polarization angles. The different exposure times are 20000ms, 10000ms, 4000ms, and 2000ms. It can be seen that with decreasing exposure time, highlights weaken as the exposure time decreases, but remain relatively noticeable. However, after increasing polarization (i.e., adjusting the polarization angle), even at an exposure time of 20000ms, there are still no obvious highlights. In other words, polarization technology has a significant effect on suppressing highlights.

[0023] Furthermore, this application embodiment also provides a comparative experiment to verify the superiority of the present application embodiment in improving the quality of three-dimensional reconstruction of fruit and vegetable surfaces. This superiority is specifically verified by comparing the phase decoding effect. It can be understood that, with other conditions of three-dimensional reconstruction remaining unchanged, the better the phase decoding effect, the higher the quality of the three-dimensional reconstruction.

[0024] like Figure 3a , Figure 3b and Figure 3c ,as well as Figure 4a , Figure 4b and Figure 4c The figures shown represent the enveloping phase map, phase-shift code + Gray code decoding, and absolute phase map under non-polarized imaging; and the enveloping phase map, phase-shift code + Gray code decoding, and absolute phase map under polarized imaging. Figure 3c and Figure 4c It can be observed that the cross-section of the absolute phase map under polarization imaging is very smooth and noise-free, while the cross-section of the absolute phase map under non-polarization imaging is significantly less smooth and noisy. That is, the quality of the absolute phase map obtained by decoding under polarization imaging is significantly better than that obtained by decoding under non-polarization imaging.

[0025] Furthermore, this application embodiment also provides a comparative experiment to verify the superiority of this application embodiment in improving the quality of three-dimensional reconstruction of fruit and vegetable surfaces. This superiority is specifically verified by comparing the three-dimensional reconstruction point clouds of apples.

[0026] like Figure 5a and Figure 5b ,as well as Figure 6a and Figure 6b The images shown are the original reconstruction image under non-polarized imaging, the reconstructed point cloud image under non-polarized imaging, and their magnified local images; and the original reconstruction image under polarized imaging, the reconstructed point cloud image under polarized imaging, and their magnified local images.

[0027] It is evident that the point cloud reconstructed by polarization imaging has higher integrity, especially the point cloud missing problem in the highlight area of ​​the apple is significantly improved.

[0028] Furthermore, this application embodiment also provides a comparative experiment to verify the superiority of this application embodiment in improving the quality of three-dimensional reconstruction of fruit and vegetable surfaces. This superiority is specifically verified by comparing the three-dimensional reconstruction accuracy of an 80mm standard sphere.

[0029] like Figure 7 As shown, Figure 7 The dataset contains the original sphere image and the reconstructed point cloud model, used to quantitatively evaluate the 3D reconstruction accuracy of non-polarized and polarized imaging. The 3D reconstruction accuracy of non-polarized imaging is lower than that of polarized imaging. This 3D reconstruction accuracy is characterized by the root mean square error (RMS), which is negatively correlated with 3D reconstruction accuracy.

[0030] In one exemplary embodiment, this application proposes a method for three-dimensional reconstruction of fruit and vegetable surfaces. The method for three-dimensional reconstruction of fruit and vegetable surfaces provided in this application will be described in detail below with reference to the accompanying drawings and specific embodiments and application scenarios.

[0031] Reference Figure 8 The method includes steps 802-808. Wherein: Step 802: Control the stepper motor to rotate gradually from the first endpoint to the second endpoint of the preset angle range with a preset step size; wherein, the stepper motor is used to drive the first polarizing filter set in front of the camera to rotate.

[0032] In some embodiments, the preset angle range represents the range of angles within which the stepper motor can rotate during the polarization angle optimization process. The preset angle range can be [0°, 90°]. Here, polarization angle optimization refers to finding the optimal polarization angle from the preset angle range. When the first polarizing filter rotates to this optimal polarization angle, it can minimize the specular reflection component of the smooth fruit and vegetable surface in the camera imaging optical path.

[0033] It should be noted that the process of rotating the first polarizing filter to [0°, 90°] is a mirror image of the process of rotating it to [90°, 180°], while the process of rotating it to [180°, 360°] is a complete repetition of the process of rotating it to [0°, 180°]. Therefore, generally, a preset angle range of [0°, 90°] is sufficient to achieve omnidirectional polarization angle optimization.

[0034] In some embodiments, the preset step size represents the angle change of the stepper motor after each rotation. The size of the preset step size is negatively correlated with the optimization accuracy and positively correlated with the optimization efficiency. The specific value of the preset step size is not specifically limited in this application embodiment. For example, if the preset step size is 10°, the stepper motor needs to rotate 9 times to complete the step-by-step rotation process.

[0035] In some embodiments, the rotation angle of the stepper motor is synchronized with the rotation angle of the first polarizing filter. For example, if the rotation angle of the stepper motor is 0°, the rotation angle of the first polarizing filter is also 0°; if the rotation angle of the stepper motor is 10°, the rotation angle of the first polarizing filter is also 10°.

[0036] Step 804: After each stepper motor completes one rotation, the following operations are performed: control the camera to acquire the first stripe image of the preset area; determine the score of each first stripe image based on the first saturation pixel ratio and stripe contrast of each first stripe image; wherein, the preset area is the area where the target fruit and vegetable is located, and the target fruit and vegetable has a stripe pattern projected on it by a projector.

[0037] In some embodiments, the fringe pattern used in the polarization angle optimization process may be one pattern from the fringe pattern sequence used in subsequent 3D reconstruction processes, such as the first pattern in the fringe pattern sequence. The fringe pattern sequence may include four patterns of four-step phase shift and several patterns of Gray code. This ensures that the optical response of the testing (i.e., polarization angle optimization) environment is completely consistent with that of the actual working environment.

[0038] In some embodiments, the target fruits and vegetables are those with smooth surfaces or specular reflective properties, and may include, but are not limited to: apples, citrus fruits, plums, tomatoes, and eggplants.

[0039] In some embodiments, the first saturated pixel ratio refers to the proportion of the number of pixels in the first stripe image whose grayscale value reaches or exceeds a preset saturation threshold to the total number of pixels in the preset area. The preset saturation threshold can be determined based on the camera's bit depth; for example, for an 8-bit image, the preset saturation threshold can be set to 255 or a value near 255.

[0040] It is understandable that "saturation" in the saturated pixel ratio refers to the brightness of a pixel reaching the camera's limit. When the surface of fruits and vegetables is highly reflective, bright spots will appear in the image captured by the camera. This causes some stripes on the surface of the fruits and vegetables to be unable to be reflected in the image due to the influence of reflection, resulting in the pixel values ​​at the locations of the bright spots being unusable for reconstruction. Therefore, the goal of this embodiment is to reduce the saturated pixel ratio.

[0041] In some embodiments, stripe contrast refers to the degree of brightness difference between the bright and dark parts of the stripes in a first stripe image, used to characterize the sharpness of the stripe signal. In some embodiments, it is obtained by calculating the ratio of the difference between the maximum and minimum values ​​of pixel grayscale values ​​within a preset area to the sum of the two (i.e., Michelson contrast); or, it is characterized by calculating the standard deviation of all pixel grayscale values ​​within the preset area.

[0042] It is understandable that the 3D reconstruction of fruit and vegetable surfaces relies on the black and white stripes in the striped image, and the reconstruction quality is affected by the contrast of the black and white stripes (i.e., the brightness difference mentioned above). If the contrast is small, the black and white stripes are not distinct enough, resulting in poor reconstruction quality; if the contrast is large, the black and white stripes are distinct, resulting in high reconstruction quality. Therefore, the goal of this embodiment is to improve stripe contrast.

[0043] Step 806: After completing the control of the stepper motor, the rotation angle of the first polarizing filter corresponding to the highest score is taken as the optimal polarization angle.

[0044] Step 808: Perform three-dimensional reconstruction of the surface of the target fruit and vegetable based on the optimal polarization angle.

[0045] In some embodiments, for each fruit or vegetable to be inspected, an optimal polarization angle can be found, and then a stepper motor can be controlled to drive the first polarization filter to rotate to the optimal polarization angle.

[0046] In some embodiments, three-dimensional reconstruction of the surface of the target fruit and vegetable based on the optimal polarization angle includes: The projector is controlled to project a sequence of stripe patterns; wherein the stripe patterns in the stripe pattern sequence are projected onto the surface of the target fruit and vegetable after passing through a second polarizing filter; the camera is controlled to acquire a third stripe image of the preset area; the rotating platform is controlled to rotate to the next acquisition angle and return to the step of controlling the projector to project the stripe pattern sequence, until the omnidirectional image acquisition of the surface of the target fruit and vegetable is completed. A three-dimensional reconstruction of the surface of the target fruit and vegetable is performed using all acquired stripe images.

[0047] In some embodiments, the three-dimensional reconstruction of the surface of the target fruit and vegetable using all acquired stripe images may include: preprocessing the acquired stripe images, including denoising and contrast enhancement; extracting the wrapping phase value of each pixel using a four-step phase shifting method; performing phase unrolling with Gray code assistance to obtain the absolute phase distribution; converting the absolute phase into three-dimensional coordinates based on the system geometric parameters obtained from calibration; generating point cloud data of the fruit and vegetable surface based on the three-dimensional coordinates; and constructing a complete three-dimensional surface model using a triangulation algorithm.

[0048] In some embodiments, after constructing a complete three-dimensional surface model using a triangulation algorithm, reconstruction accuracy metrics (such as root mean square (RMS) error) can be calculated to assess reconstruction quality.

[0049] This embodiment effectively suppresses the specular reflection component of smooth fruit and vegetable surfaces in the camera's imaging optical path by placing a polarizing filter in front of the camera. Furthermore, a stepper motor drives the polarizing filter to rotate. With each step of the stepper motor, the camera acquires a stripe image. The optimal polarization angle is found by analyzing the saturation pixel ratio and stripe contrast of this image, and then a 3D reconstruction of the fruit and vegetable surface is performed using this optimal polarization angle. This further reduces the specular reflection component of smooth fruit and vegetable surfaces in the camera's imaging optical path, reducing the risk of overexposure in localized areas and thus improving the quality of the 3D reconstruction of the fruit and vegetable surface.

[0050] In one embodiment, the aforementioned control stepper motor rotates gradually from the first endpoint of a preset angle range to the second endpoint with a preset step size. This can be a single optimization (also known as a search), meaning the process ends when the second endpoint is reached. For example, if the preset angle range is [0°, 90°] and the preset step size is 1°, then after rotating 90 steps from the first endpoint of the preset angle range, the second endpoint is reached, at which point the optimization task is completed.

[0051] In one embodiment, controlling the stepper motor to rotate gradually from the first endpoint to the second endpoint of a preset angle range with a preset step size can involve more than two optimization steps, constituting a coarse-to-fine (CtF) search task. Specifically, taking two optimization steps as an example, controlling the stepper motor to rotate gradually from the first endpoint to the second endpoint of the preset angle range with a preset step size includes: The stepper motor is controlled to rotate gradually from the first endpoint to the second endpoint of the preset angle range in a first preset step size.

[0052] Determine the first angle corresponding to the second highest score, and determine the second angle corresponding to the first angle; and use the first angle and the second angle as the third endpoint and the fourth endpoint respectively to obtain a new angle interval; wherein the new angle interval is contained within the preset angle interval.

[0053] The stepper motor is controlled to rotate gradually within the new angle range with a second preset step size; wherein the second preset step size is smaller than the first preset step size.

[0054] The search is divided into two stages: a coarse stage with a first preset step size and a fine stage with a second preset step size. The coarse stage quickly identifies a new angle range containing the optimal polarization angle from a wide range, while the fine stage performs a precise search for the optimal polarization angle within this new angle range.

[0055] In some embodiments, determining the second angle corresponding to the first angle includes: During the process of controlling the stepper motor to rotate gradually, the first score and the second score of the two third angles adjacent to the first angle are obtained respectively; If the first score is greater than the second score, the third angle corresponding to the first score will be used as the second angle. If the first score is less than the second score, the third angle corresponding to the second score will be used as the second angle. If the first score is equal to the second score, the third angle corresponding to the first score or the third angle corresponding to the second score shall be used as the second angle.

[0056] In some embodiments, the score is calculated using the following formula: in, This indicates that the first polarizing filter has been rotated to an angle. In this case, the score of the corresponding first stripe image; and These are weighting coefficients. ; This indicates that the first polarizing filter has been rotated to an angle. In the case of [the first stripe image], the percentage of the first saturated pixels; This indicates that the first polarizing filter has been rotated to an angle. In the case of [condition], the stripe contrast of the corresponding first stripe image.

[0057] As shown in the formula above, the saturation pixel ratio is negatively correlated with the score, while the stripe contrast is positively correlated with the score. Therefore, the weaker the bright spots in the stripe pattern and the clearer and more distinct the stripes, the higher the score.

[0058] The following example illustrates the two optimization processes described above. The optimization process data and results are as follows: Figure 9 As shown.

[0059] First, a coarse-stage global traversal is performed: the stepper motor is controlled to perform a global traversal within the range of [0°, 90°] in 10° increments, rotating sequentially to 0°, 10°, 20°, ..., 90°. At each rotation angle, the projector is controlled to project a single test stripe pattern (i.e., one pattern in the stripe pattern sequence) and the camera is controlled to capture the stripe image. Ten scores are calculated based on the ten stripe images.

[0060] Secondly, the optimization interval is locked: the second highest score is found from the 10 scores, and the first angle corresponding to the second highest score is determined. Compare with its adjacent third angle and The first and second scores are used to determine the side with the larger score, thus locking in a 10° target range. Where the first score is greater than the second score, the new angle range is […]. , ].

[0061] Next, perform a detailed local search: control the stepper motor to jump to... , with a step size of 1° in [ , The system performs a detailed traversal within the [database name], sequentially projecting, collecting, and calculating scores.

[0062] Finally, the optimal polarization angle is locked: the highest score obtained from the local search process is determined, i.e., the corresponding... Figure 9 The highest point of the "function value" is determined, and the rotation angle of the first polarizing filter corresponding to the highest score is also determined. Assuming the optimal polarization angle. It is 0.6. The value is 0.4. At this point, the polarization angle is 38°, the saturation pixel ratio is 0.2758, and the stripe contrast ratio is 0.6180. According to the scoring formula mentioned above, the score can be calculated to be approximately 0.6817. 0.6817 is the maximum value of all scores during the optimization process. Therefore, after the optimization is completed, 38° is taken as the optimal polarization angle. The stepper motor is controlled to physically lock this optimal polarization angle, thereby completing the selection of the adaptive polarization angle.

[0063] like Figure 10 As shown, Figure 10 This image shows a comparison of the effects of images of apple surface stripes taken at five different polarization angles (0°, 20°, 40°, 60°, and 80°). Notably, at a polarization angle of 40°, the image shows no obvious overexposure.

[0064] In some embodiments, the weighting coefficients can be constant values.

[0065] In some embodiments, since some fruits and vegetables have strong specular reflection characteristics, while others have darker skin and moderate specular reflection, weighting coefficients can be determined based on the characteristics of the target fruits and vegetables. That is, the weighting coefficients can be non-fixed values.

[0066] Specifically, for fruits and vegetables with strong specular reflection characteristics, the primary task is to eliminate overexposure blind spots (i.e., bright spots). Therefore, saturation suppression is given a higher weight, that is, reducing the contribution of saturated pixel ratio to the score and increasing the contribution of stripe contrast to the score. For fruits and vegetables with darker skin and moderate specular reflection, stripe contrast has a more prominent impact on phase resolution. Therefore, stripe contrast is given a higher weight, that is, reducing the contribution of stripe contrast to the score and increasing the contribution of saturated pixel ratio to the score.

[0067] In some embodiments, the weighting coefficients can be determined using the variety information of the target fruits and vegetables. Specifically, the method further includes: Obtain the variety of the target fruit and vegetable.

[0068] The weighting coefficient is determined based on the variety and the preset mapping relationship; wherein the preset mapping relationship is used to record the association between the variety and the weighting coefficient.

[0069] In some embodiments, the preset mapping relationship can be recorded in a table; that is, the weighting coefficients can be determined by looking up a table. Specifically: For a single fruit or vegetable variety (such as apple), an optimal weighting coefficient lookup table is pre-established through experiments for different surface conditions (such as maturity and wax layer thickness). During actual measurement, the corresponding weighting coefficient is directly retrieved based on the variety information selected by the user.

[0070] For example, for fruits with strong specular reflection properties, such as waxed apples and citrus fruits, the primary task is to eliminate overexposure blind spots. Therefore, saturation suppression is given a higher weight, for example, by setting... , For fruits with darker skins and moderate specular reflection, such as plums and tomatoes, the effect of fringe contrast on phase resolution is more pronounced. Therefore, a higher weight is given to fringe contrast, for example, by setting... , .

[0071] In some embodiments, before determining the weighting coefficients, the stepper motor is controlled to rotate gradually from the first endpoint to the second endpoint of a preset angle range with a preset step size, the following steps are also included: The camera is controlled to acquire a second stripe image of a preset area; wherein the rotation angle of the first polarizing filter is a preset polarization angle.

[0072] The weighting coefficients are calculated using the following formula: in, This indicates the preset polarization angle; This indicates the percentage of the second saturated pixels in the second stripe image; This is an empirical coefficient.

[0073] In some embodiments, the preset polarization angle can be any angle, such as 0°.

[0074] In some embodiments, The value can range from 0.8 to 1.2.

[0075] In some embodiments, after controlling the camera to acquire a second stripe image of a preset area, the weighting coefficients can be generated based on the second stripe image by calling a deep learning classification model. For example, the deep learning classification model is a trained lightweight convolutional neural network (CNN).

[0076] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0077] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 11As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a method for three-dimensional reconstruction of fruit and vegetable surfaces. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0078] Those skilled in the art will understand that Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0079] In one embodiment, a computer-readable storage medium is provided, on which a program or instructions are stored, which, when executed by a processor, implement the steps in the above-described method embodiments.

[0080] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0081] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0082] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 application.

[0083] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for three-dimensional reconstruction of fruit and vegetable surfaces, characterized in that, The method for three-dimensional reconstruction of fruit and vegetable surfaces includes: The stepper motor is controlled to rotate gradually from the first endpoint to the second endpoint of a preset angle range with a first preset step size; wherein, the stepper motor is used to drive the first polarizing filter set in front of the camera to rotate; Determine the first angle corresponding to the second highest score, and determine the second angle corresponding to the first angle; and use the first angle and the second angle as the third endpoint and the fourth endpoint respectively to obtain a new angle interval; wherein, the new angle interval is contained within the preset angle interval; The stepper motor is controlled to rotate gradually within the new angle range in a second preset step size; wherein the second preset step size is smaller than the first preset step size; After each stepper motor completes one rotation, the following operations are performed: The camera is controlled to acquire a first stripe image of a preset area; based on the first saturation pixel ratio and stripe contrast of each first stripe image, a score is determined for each first stripe image; wherein, the preset area is the area where the target fruit and vegetable are located, and a stripe pattern is projected onto the target fruit and vegetable by a projector; the score is calculated using the following formula: in, This indicates that the first polarizing filter has been rotated to an angle. In this case, the score of the corresponding first stripe image; and These are weighting coefficients. ; This indicates that the first polarizing filter has been rotated to an angle. In the case of [the first stripe image], the percentage of the first saturated pixels; This indicates that the first polarizing filter has been rotated to an angle. In the case of [the first stripe image], the stripe contrast is [the value of the first stripe image]. After controlling the stepper motor, the rotation angle of the first polarizing filter corresponding to the highest score is taken as the optimal polarization angle. The surface of the target fruits and vegetables is reconstructed in three dimensions based on the optimal polarization angle. Before controlling the stepper motor to rotate gradually from the first endpoint to the second endpoint of the preset angle range in preset step sizes, the method further includes: The camera is controlled to acquire a second stripe image of a preset area; wherein the rotation angle of the first polarizing filter is a preset polarization angle; The weighting coefficients are calculated using the following formula: in, This indicates the preset polarization angle; This indicates the percentage of the second saturated pixels in the second stripe image; This is an empirical coefficient; or, Based on the second stripe image, a deep learning classification model is invoked to generate the weighting coefficients.

2. The method for three-dimensional reconstruction of fruit and vegetable surfaces according to claim 1, characterized in that, Determining the second angle corresponding to the first angle includes: During the process of controlling the stepper motor to rotate gradually, the first score and the second score of the two third angles adjacent to the first angle are obtained respectively; If the first score is greater than the second score, the third angle corresponding to the first score will be used as the second angle. If the first score is less than the second score, the third angle corresponding to the second score will be used as the second angle. If the first score is equal to the second score, the third angle corresponding to the first score or the third angle corresponding to the second score shall be used as the second angle.

3. The method for three-dimensional reconstruction of fruit and vegetable surfaces according to claim 1, characterized in that, The method further includes: Obtain the varieties of the target fruits and vegetables; The weighting coefficient is determined based on the variety and the preset mapping relationship; wherein the preset mapping relationship is used to record the association between the variety and the weighting coefficient.

4. The method for three-dimensional reconstruction of fruit and vegetable surfaces according to claim 1, characterized in that, The three-dimensional reconstruction of the surface of the target fruits and vegetables based on the optimal polarization angle includes: The projector is controlled to project a stripe pattern sequence; wherein the stripe pattern in the stripe pattern sequence is projected onto the surface of the target fruit and vegetable after passing through a second polarizing filter; The camera is controlled to acquire the third stripe image of the preset area; The rotating platform is controlled to rotate to the next acquisition angle, and then the control of the projector to project the stripe pattern sequence is returned until the omnidirectional image acquisition of the surface of the target fruit and vegetable is completed.

5. A computer device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the three-dimensional reconstruction method for fruit and vegetable surfaces as described in any one of claims 1-4.

6. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the three-dimensional reconstruction method for fruit and vegetable surfaces as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Structured light three-dimensional measurement method and device for polarization self-rotation filtering

    CN118482665A