1. Introduction
Reliable grading must detect both obvious blemishes and hidden internal flaws such as bruises, early decay, or cell damage that elude human inspectors and standard colorimetric (RGB) and near-infrared (NIR) cameras. Left undetected, these hidden defects not only shorten shelf life and increase waste but can also trigger costly recalls and erode consumer trust. A truly robust solution must non-destructively detect internal injuries and measure a fruit’s external form, ensuring only structurally sound, blemish-free produce moves through the supply chain and meets stringent regulatory and buyer standards. However, today’s automated approaches typically rely on manual inspection or simple RGB/NIR imaging systems, which, despite being faster than purely human checks, remain subjective and surface-bound, often missing subsurface damage entirely.
Automated machine-vision and deep-learning (DL) grading pipelines have been developed for a wide variety of fruits and have demonstrated the ability to non-destructively sort produce by external traits (shape, color, size, surface defects) and proxies for internal quality (sweetness, firmness) with over 90% accuracy. In apple grading, early mechanical systems and sensor-based methods extracted features such as geometry, color, and firmness to categorize cultivars and detect bruises [
1,
2,
3,
4]. More recently, convolutional neural networks on RGB images—employing one-stage detectors (YOLOv5, YOLOv4) for blemish segmentation and classification networks (AlexNet, VGG variants) for final grade assignment—have further improved speed and accuracy on benchmark datasets [
5,
6,
7,
8,
9]. Parallel efforts in tomato grading have combined shape (eccentricity), size (2D area), color (mean RGB), and contour analyses, via online sorting rigs, maturity classifiers, and dual-view frameworks, to achieve similar high-throughput performance [
10,
11,
12]. Despite these successes, all RGB+DL approaches remain limited to surface inspection and 2D morphology, missing subsurface defects and true three-dimensional shape. In addition, the black-box nature of deep learning models often limits their interpretability, posing challenges for trust, traceability, and adoption in agricultural grading tasks [
13,
14].
Hyperspectral imaging (HSI) directly addresses these surface-only blind spots by capturing a continuous reflectance spectrum at every pixel, revealing the chemical and structural signatures of subsurface bruising and early decay that RGB+DL pipelines miss. For instance, in apples, visible and near-infrared (VNIR)/short-wave infrared (SWIR) HSI combined with multivariate analyses (PLS, PCA) and optimized classifiers (GS-SVM, GA-SVM) has discriminated bruise severity and even age with accuracies often exceeding 90% [
15,
16,
17]. In tomatoes, VIS/NIR HSI with ant-colony-optimized wavelength selection and PLS-DA/ANN models has classified simulated bruise levels at up to 100% accuracy while reducing spectral variables by more than 70% [
18]; multivariate classifiers detect early decay before any visual sign with over 90% accuracy [
19]; and SEM-validated studies show bruised regions exhibit reflectance drops near 810 nm, yielding 90.9% PLS-DA performance [
20]. However, HSI alone lacks direct 3D localization and cannot measure true bruise dimensions or overall fruit geometry, metrics that, together with size and roundness, underpin USDA-style grading. Additionally, because HSI alone lacks depth cues, it can struggle to interpret complex shapes or shadowed regions with high accuracy. In such cases, systems often need to combine HSI with external geometric information or rely on complex 2D image processing steps to approximate shape and size, which can introduce errors [
21].
Beyond RGB-based and hyperspectral imaging, 3D-sensing methods such as stereo vision and time-of-flight (ToF) sensors have also been used in agriculture for fruit grading and plant phenotyping [
22,
23]. However, stereo vision depends heavily on surface texture, making it unreliable for the smooth, uniform surfaces of many fruits, while ToF sensors often lack the spatial resolution needed for fine geometric measurements and can struggle with shadows, occlusions, and high-speed sorting. Fringe Projection Profilometry (FPP) addresses many of these limitations by projecting structured light patterns independent of surface texture, enabling robust, sub-millimeter-accurate 3D reconstruction [
24]. With its ability to rapidly capture full fruit geometry in a single scan, FPP may represent a more precise and high-throughput alternative for fruit grading applications.
In this paper, we introduce a unified 4D-grading system that integrates VNIR/SWIR hyperspectral imaging with high-resolution 3D scanning to deliver fully non-destructive and objective assessment of both internal and external quality attributes for spherical fruits. Our unified 4D-grading pipeline begins by reconstructing each fruit’s surface mesh in MATLAB to extract the two equatorial diameters and height, which are then sorted into
to compute Mohsenin’s sphericity index (see
Section 3.1). Next, we calculate the spectral-difference defect flag from VNIR and SWIR reflectance cubes to identify subsurface bruising (see
Section 2.3). Fruits flagged as defective proceed down the Defect branch, where measured bruise length and sphericity determine Grade 1, Grade 2, or Reject, while non-defective specimens follow the Non-Defective branch and are graded solely by sphericity. In parallel, the longest span
a is compared against USDA size bins to assign Small through Extra Large (see
Section 4). Finally, quality and size classes are concatenated into a single grade. We demonstrate our method on a small set of apple and tomato samples, indicating that 4D fusion has the potential to complement single-modality techniques by improving early defect detection, while remaining compatible with real-time automated packing lines.
4. Fruit Grading Strategies
Having established our spectral-difference defect flag (
Section 3.2) and 3D-shape measurement pipeline (
Section 3.1), we now integrate these modalities into a unified decision-tree framework that assigns both quality and size grades. We adopt a decision-tree structure because it offers clear, interpretable rules at each node, mirrors the stepwise logical flow of human grading decisions, and allows simple tuning of numerical thresholds for different fruit types or market classes.
The use of sphericity as a geometric grading parameter is motivated by USDA shape standards, which assign higher quality grades to fruits that are “well formed” or “fairly well formed,” and penalize irregular or misshapen specimens [
33]. Sphericity provides a clear and consistent way to measure how round a fruit is, making it a useful indicator of shape regularity. Prior studies have reported sphericity values ranging from 0.84 to 0.93 across four tomato cultivars [
34], 0.82 to 1.00 in a sample of 100 tomatoes [
35], and 0.86 to 0.98 across various apple cultivars [
36]. These ranges align with the 80–100% values observed in our dataset. We therefore adopt sphericity-based thresholds in our 4D-grading system to reflect USDA shape expectations and trends in the prior literature. Building on these trends, we note that tomatoes also tend to be more spherical than apples in the literature and are visually more sensitive to shape deformities in the market; we therefore apply slightly stricter sphericity thresholds to tomatoes than apples in our pipeline. Moreover, in our decision framework, the combination of sphericity and bruise severity enables a tiered grading system: fruits with the highest sphericity and minimal bruising receive top grades, while those with lower sphericity and a greater extent of defects are assigned lower grades. This mirrors USDA logic, where the absence of shape deformities and physical damage corresponds to higher grade classifications, ensuring that our system mimics both the structure and intent of official grading standards.
Our unified 4D pipeline begins by reconstructing the fruit’s surface mesh (
Section 3.1) and immediately extracting two key metrics: Mohsenin’s sphericity
as computed by Equation (
16), which captures overall roundness, and the longest span
a from the ordered set
, which underlies USDA size classification [
33,
37].
Next, we assess tissue integrity via the spectral-difference score as defined in Equation (
13). Any fruit with a spectral difference
is routed into the Defective branch; all others proceed as Non-Defective. Within the Non-Defective branch, quality is assigned solely on
. Specimens with sphericity values exceeding defined thresholds are assigned Premium or Grade 1/2. In the Defective branch, we measure bruise length
on the 3D mesh via Equation (
14) and combine it with
according to the rules in
Figure 7 for apples and
Figure 8 for tomatoes to yield Grade 1, Grade 2, or Reject.
Finally, size class is determined by comparing the longest span
a to USDA diameter bins (Small–Extra Large) and the fruit’s definitive label is formed by concatenating its quality grade and size class (e.g., “Grade 1 Large”).
Figure 7 illustrates the full decision tree for apples and
Figure 8 that for tomatoes.
Although we have demonstrated our 4D-grading pipeline on apples and tomatoes, the same approach can be applied to nearly any spherical fruit simply by tuning a few spectral-difference and geometric thresholds.
4.1. Apples
As shown in
Figure 7, we first compute Mohsenin’s sphericity index
(Equation (
16)) from the ordered principal spans
. We then evaluate the spectral-difference flag as defined in Equation (
13). Any apple with
(2%) or a manual VNIR/SWIR mask is routed into the Defective branch; all others follow the Non-Defective branch. Non-Defective Apples: Grading is based solely on sphericity
(
Table 1).
Defective Apples: We measure bruise length
on the 3D mesh (via Equation (
14)) and combine it with
to assign Grade 1, Grade 2, or Reject per
Table 2.
Size Classification: In both branches, we compare the longest span
a against USDA apple size bins (
Table 3) to assign Small through Extra Large.
The final apple label concatenates the quality grade (Premium/Grade 1/Grade 2/Reject) with the size class (Small/Medium/Large/Extra Large), e.g., “Grade 1 Large.”
Figure 7 illustrates our apple grading decision tree.
4.2. Tomatoes
As shown in
Figure 8, for each tomato, we first compute Mohsenin’s sphericity index
(Equation (
16)) from the three sorted spans
. Similarly, we then evaluate the spectral-difference flag as defined in Equation (
13).
Non-Defective: If
, grade by sphericity alone using
Table 4.
Defective: If
, measure 3D bruise length
via Equation (
14) and combine with
as per
Table 5.
Finally, in both branches we compare the longest span
a against USDA tomato size bins (
Table 6) and concatenate quality + size (e.g., “Grade 1 Large”).
Figure 8 illustrates our tomato grading decision tree.
6. Discussion
Our results demonstrate that fusing hyperspectral and 3D geometry into a single 4D-grading pipeline yields a more complete, objective picture of fruit quality than either modality alone. By flagging subsurface bruising or internal damage via a spectral-difference rule and then quantifying true 3D size and roundness, we can assign USDA-style grades with greater confidence, reduce false negatives on early defects, and minimize the over-grading of misshapen but healthy fruit. In a commercial packing line, this could translate to less manual labor and re-sorting, lower waste rates, and more consistent compliance with buyer contracts. Moreover, because all of our spectral and geometric features reduce to a handful of easily interpretable scalars, the system lends itself to real-time hardware implementation (e.g., GPU pipelines) and straightforward integration into existing conveyor-belt sorters.
The apple results (
Table 7) showed that Apple 3, with a spectral-difference score of 3.5% and bruise length of 12.4 mm, was correctly flagged as defective, illustrating the ability of the hyperspectral threshold to capture internal bruising. Apple 2, which was non-defective but had the lowest sphericity (83.4%), demonstrates how shape irregularities alone can reduce grade under the sphericity-based rules. In tomatoes (
Table 8), Tomato 2’s high sphericity (97.2%) but defective grade highlights how internal damage cannot be inferred from geometry alone, reinforcing the importance of combining modalities. Furthermore, the measured sphericity ranges (83–97%) are consistent with those reported in previous studies for apple and tomato cultivars, as already discussed in
Section 4, supporting the accuracy of the 3D-reconstruction component of our pipeline.
However, a major limitation of this study is the very small sample size, which prevents any statistically robust conclusions about system performance in real-world, highly variable agricultural environments. The results presented here should therefore be interpreted as a proof of concept demonstrating feasibility only. Although the precision of structured-light 3D scanning could theoretically influence geometric parameters such as sphericity and bruise length, the FPP system used in this study has sub-millimeter accuracy, which is sufficient for the size range and defect characteristics of the tested fruits. Additionally, the grading thresholds we employed incorporate margins that minimize the impact of small variations in 3D measurements. Achieving true industrial throughput will require significantly larger and more diverse datasets, as well as more extensive feature registration, to fully optimize the algorithms and improve generalizability across cultivars, defect types, and production conditions.
At the same time, we recognize that real-time deployment will require further optimization. First, computational load could be reduced through adaptive sampling strategies and the use of GPU-based parallel computation to accelerate both hyperspectral and 3D processing [
38]. Second, prior studies have demonstrated that robust registration between hyperspectral and 3D data in prior work [
25,
39]; defects identified directly from hyperspectral analysis could be automatically mapped onto the 3D mesh, eliminating the need for manual 3D-feature extraction and further streamlining the pipeline. Benchmarking the resulting end-to-end pipeline on data transfer rates, per-fruit processing time, and overall computational bottlenecks will require more research and bigger datasets.
Although we did not perform direct quantitative comparisons against single-modality HSI, 3D imaging, or advanced deep-learning approaches, our interpretable decision-tree framework offers a distinct advantage: it provides clear grading logic tied to measurable physical thresholds. This transparency enables stakeholders to understand and adjust thresholds for different cultivars, defect severities, or market requirements without retraining a complex black-box model. This flexibility makes the framework well-suited for early-stage deployment and future adaptation across different packing-line environments. While interpretability is a key strength of our decision-tree framework, it may also limit its ability to capture subtle defects or complex patterns. Future work could explore hybrid approaches that combine the transparency of decision trees with the predictive power of advanced machine learning models.
While we demonstrated 4D grading on bruising in apples and tomatoes, the same framework is readily customizable to any surface or subsurface defect—sunscald, bacterial spot, catface deformities, internal decay, etc.—simply by adjusting the spectral and size thresholds to match each USDA defect definition. In our study, we selected a fixed spectral-difference threshold () based on values reported in the prior literature rather than training a data-driven classifier. This approach reflects both the limited sample size and our emphasis on interpretability, ensuring the grading logic remains transparent and reproducible. In contrast to traditional methods that rely on machine learning (e.g., SVM and ANN) or deep learning to learn decision boundaries from large labeled datasets, our fixed-threshold rule offers a robust, low-complexity alternative appropriate for early-stage deployment. Overall, this proof-of-concept study highlights the potential of 4D hyperspectral/geometry fusion for fruit inspection and its suitability for broader automated quality control applications.
7. Conclusions
In this work, we have proposed a practical, decision-tree-based framework that fuses VNIR/SWIR hyperspectral data with 3D geometric measurements to grade nearly spherical fruits. By first computing Mohsenin’s sphericity index and then applying a simple 2% spectral-difference defect flag, our pipeline routes each specimen into “Defective” or “Non-Defective” branches, uses 3D-bruise-length measurements where appropriate, and finally assigns USDA-style quality and size grades. Applied to a handful of apple and tomato samples, this 4D fusion approach offers an interpretable alternative to single-modality or black-box models, allowing packers to adjust grading thresholds easily for different fruit varieties and market requirements.
While our initial results demonstrate the feasibility of integrating spectral and geometric cues in a unified grading system, further work is needed to automate 3D-parameter extraction, validate performance across larger and more varied datasets, and extend the method to other types of produce. The modular decision-tree structure ensures that, by tuning only a few numerical cutoffs, the same grading logic can be adapted to new fruits or evolving industry standards. We therefore view this 4D hyperspectral approach not as a radical departure but as a flexible, easy-to-integrate alternative that complements existing packing-line technologies and may help improve consistency and objectivity in automated fruit grading.