A Method for Identifying Flat Peach Fruits Based on Illumination Compensation and Curvature Features

CN122551345APending Publication Date: 2026-08-11CHINA UNIV OF PETROLEUM (EAST CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-26
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0003]现有算法无法区分环境阴影与固有形态学阴影,往往无差别提亮缝合线暗区,导致边界梯度被抹平

Benefits of technology

[0022] This application extracts the principal curvature features of the brightness channel using the Hessian matrix, breaking the rigid assumption that all dark areas belong to environmental noise. It introduces the three-dimensional geometry of the target into the illumination compensation decision, realizing the inverse constraint of curvature on the compensation intensity. Based on the principal curvature, a penalty mask is constructed, and compensation in the deep groove area of ​​the seam is forcibly blocked to preserve the geometric gradient. Environmental shadows are completely eliminated in the flat area, which can eradicate the problem of false detection of stuck fruits in densely squeezed scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122551345A_ABST
    Figure CN122551345A_ABST
Patent Text Reader

Abstract

A method for recognizing flat peaches based on illumination compensation and curvature features is disclosed, relating to the fields of image processing and computer vision. The method involves acquiring an original color image and extracting luminance and chrominance channel matrices. A principal curvature feature matrix is ​​constructed based on the second-order partial derivatives of the luminance channel. This matrix is ​​then low-pass filtered and subjected to logarithmic difference parameters to generate a baseline compensation value. The principal curvature is converted into a penalty mask using attenuation mapping, multiplied by the baseline compensation value to obtain the target compensation value, which is then superimposed onto the luminance channel and inversely transformed with the chrominance channel to obtain the target color image. The image is input into a detection network to output the recognition result, and the logarithmic difference parameters are optimized based on the confidence level of the result. This method can accurately protect the inherent topological shadows of the target object, thereby eliminating the false detection problem of adhered fruits in dense scenes, while also meeting the real-time requirements of dynamic detection and the lightweight nature of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of image processing and computer vision technology, specifically a method for recognizing flat peaches based on illumination compensation and curvature features. Background Technology

[0002] In the location and quality grading of flat peaches, computer vision is often affected by uneven lighting. Most existing lighting compensation techniques are based on Retinex theory, estimating ambient light through Gaussian filtering and then extracting reflection features using logarithmic difference. Their core assumption is that all local dark areas originate from external light source obstruction and are considered random environmental noise that should be eliminated. However, flat peaches have a unique deep suture structure. Due to the drastic deflection of the three-dimensional surface normal in this area, incident light cannot produce effective diffuse reflection, forming inherent morphological shadows on the two-dimensional image. These shadows carry crucial gradient information for distinguishing the three-dimensional boundaries of adjacent fruits.

[0003] Existing algorithms cannot distinguish between environmental shadows and inherent morphological shadows, often indiscriminately brightening dark areas along seam lines, resulting in flattened boundary gradients. In scenarios with densely packed fruits, object detection networks, lacking boundary cues, easily misclassify multiple closely packed fruits as a single large fruit, severely limiting recognition accuracy and recall. Furthermore, existing illumination compensation methods generally have high computational costs, making it difficult to meet the needs of real-time dynamic detection; while detection models built to improve recognition accuracy are becoming increasingly complex, hindering lightweight deployment.

[0004] The aforementioned technical issues collectively constitute a long-standing industry bottleneck in the field of machine vision for peaches. Therefore, how to overcome the rigid assumption that all dark areas are environmental noise, eliminate ambient light interference while protecting the boundary information carried by the inherent morphological shadows, and balance the real-time performance of dynamic detection with the lightweight requirements of the model, has become a core technical problem that urgently needs to be solved in this field. Summary of the Invention

[0005] The purpose of this application is to provide a method for identifying flat peaches based on illumination compensation and curvature features. This method aims to overcome the rigid assumptions of existing illumination compensation techniques and achieve accurate protection of the inherent topological shadows of the target object, thereby eliminating the problem of false detection of fruits stuck together in dense scenes.

[0006] The objective of this application can be achieved through the following technical solution: Firstly, a method for identifying flat peaches based on illumination compensation and curvature characteristics, comprising the following steps:

[0007] Obtain the original color image containing the target object, and extract the first channel matrix representing its brightness characteristics and the second channel matrix representing its chromaticity characteristics respectively;

[0008] Extract the second-order partial derivative features of the first channel matrix in the spatial dimension, and construct the principal curvature feature matrix representing the surface geometric features of the target object based on the second-order partial derivative features;

[0009] The first channel matrix is ​​subjected to low-pass filtering to obtain the illumination distribution matrix, and a reference compensation matrix is ​​generated by combining the preset logarithmic difference parameter with the illumination distribution matrix.

[0010] The principal curvature feature matrix is ​​converted into a penalty mask matrix based on a preset decay mapping function. The penalty mask matrix is ​​then multiplied element-wise with the reference compensation matrix to obtain the target compensation matrix.

[0011] The target compensation matrix is ​​superimposed onto the first channel matrix to obtain the corrected first channel matrix, and the corrected first channel matrix and the second channel matrix are inversely transformed into the target color image;

[0012] The target color image is input into a preset target detection network to output the recognition result for the target object, obtain feedback optimization parameters that characterize the confidence of the recognition result, and update the preset logarithmic difference parameters based on them.

[0013] Secondly, a peach fruit recognition system based on illumination compensation and curvature characteristics includes the following modules:

[0014] The acquisition module is used to acquire the original color image containing the target object and extract the first channel matrix representing its brightness characteristics and the second channel matrix representing its chromaticity characteristics, respectively.

[0015] The feature extraction module is used to extract the second-order partial derivative features of the first channel matrix in the spatial dimension, and construct the principal curvature feature matrix representing the surface geometric features of the target object based on the second-order partial derivative features.

[0016] The matrix processing module is used to perform low-pass filtering on the first channel matrix to obtain the illumination distribution matrix, and to generate a reference compensation matrix by combining the illumination distribution matrix with a preset logarithmic difference parameter.

[0017] The compensation module is used to convert the principal curvature feature matrix into a penalty mask matrix based on a preset attenuation mapping function, and to perform element-wise multiplication of the penalty mask matrix with the reference compensation matrix to obtain the target compensation matrix.

[0018] The image correction module is used to superimpose the target compensation matrix onto the first channel matrix to obtain a corrected first channel matrix, and to inversely transform the corrected first channel matrix and the second channel matrix into a target color image;

[0019] The feedback optimization module is used to input the target color image into a preset target detection network to output the recognition result for the target object, obtain feedback optimization parameters that characterize the confidence of the recognition result, and update the preset logarithmic difference parameters based on them.

[0020] Thirdly, a computer storage medium storing computer-executable instructions, which, when executed, implement the method for identifying flat peaches based on illumination compensation and curvature characteristics described in the first aspect.

[0021] Compared with the prior art, the beneficial effects of this application are:

[0022] This application extracts the principal curvature features of the brightness channel using the Hessian matrix, breaking the rigid assumption that all dark areas belong to environmental noise. It introduces the three-dimensional geometry of the target into the illumination compensation decision, realizing the inverse constraint of curvature on the compensation intensity. Based on the principal curvature, a penalty mask is constructed, and compensation in the deep groove area of ​​the seam is forcibly blocked to preserve the geometric gradient. Environmental shadows are completely eliminated in the flat area, which can eradicate the problem of false detection of stuck fruits in densely squeezed scenes.

[0023] By using the recognition confidence level as feedback, the compensation gain coefficient is adaptively updated via the hyperbolic tangent function to form a closed-loop adjustment, thereby improving cross-scene robustness under dappled light and shadow. This application only involves lightweight operators such as local second-order partial derivatives and element-wise multiplication and addition, which do not require iterative optimization and have extremely low single-frame processing overhead. It can meet the real-time dynamic detection requirements of the orchard mobile platform, does not increase the complexity of downstream networks, and is easy to deploy in lightweight embedded devices. Attached Figure Description

[0024] Figure 1 This is a schematic diagram illustrating the steps of a method for identifying flat peaches based on illumination compensation and curvature characteristics according to this application.

[0025] Figure 2 This is a schematic diagram of a module of a peach fruit recognition system based on illumination compensation and curvature characteristics according to this application. Detailed Implementation

[0026] The technical solutions 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, and not all embodiments. The components described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but only to illustrate selected embodiments of this application.

[0027] Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items. Therefore, once an item has been defined in one figure, it does not need to be further defined and explained in subsequent figures. The terms first, second, etc. are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0028] As a distinctive agricultural product in my country, the automated detection of peaches for harvesting, positioning, and quality grading has long relied on computer vision technology. However, under normal operating conditions in actual orchards and greenhouses, external environmental factors such as canopy shading and cloud cover often result in severe uneven lighting on the fruit surface, directly interfering with the accurate extraction of fruit boundaries and morphological features by the target detection model. Current technologies typically introduce a preprocessing-stage illumination compensation algorithm before the image is fed into the target detection network to improve image quality and enhance the network's recognition accuracy.

[0029] Existing illumination compensation techniques are mainly based on Retinex theory. They estimate the low-frequency ambient illumination distribution of an image through Gaussian surround filtering, then extract the inherent reflection characteristics of the object's surface using logarithmic difference operations, or use contrast-limited adaptive histogram equalization methods to stretch the brightness of local areas. The underlying premise of these methods is a set of rigid assumptions: all dark areas with local brightness attenuation in the image originate from the occlusion or uneven distribution of external light sources, and belong to environmental random noise that should be eliminated by global smoothing.

[0030] However, when the aforementioned rigid assumptions are applied to a specific target object with inherent topological characteristics, such as the flat peach, a fatal systematic bias arises. Flat peaches possess a unique deep suture structure, extending along the fruit's equator to form continuous arc-shaped grooves—a core morphological feature distinguishing flat peaches from round peaches. According to the Lambert reflection model, the suture region experiences a drastic deflection of the normal direction of the three-dimensional curved surface, resulting in almost no effective diffuse reflection of incident light. This creates a dark shadow band along the suture line on the two-dimensional image plane. This shadow is not caused by external environmental factors but is an inherent morphological shadow of the flat peach's own three-dimensional geometry, carrying crucial geometric gradient information for distinguishing the three-dimensional boundaries of adjacent fruits.

[0031] Existing illumination compensation algorithms, completely unable to perceive the essential difference between random environmental shadows and inherent morphological shadows, indiscriminately apply forced brightening to the dark areas along the seam line when performing global illumination smoothing. This operation directly causes the pixel grayscale gradients on both sides of the seam line edge to be forcibly smoothed, causing the downstream object detection network to completely lose the core geometric clues for judging the three-dimensional boundaries of adjacent fruits. In the typical harvesting scenario where fruits are densely packed and growing side by side, networks lacking effective boundary differentiation will frequently misclassify two or more flat fruits that are being squeezed together as a single large fruit. This severely restricts the recognition accuracy and recall rate of object detection systems in high-density occlusion scenarios, becoming a long-standing common industry problem in the field of peach machine vision.

[0032] Furthermore, existing illumination compensation methods generally involve large computational loads, making it difficult to meet the real-time dynamic detection requirements of orchard mobile platforms. Meanwhile, the detection models built to improve recognition accuracy are becoming increasingly complex, hindering lightweight deployment on embedded devices with limited computing power. These issues collectively constitute a long-standing industry bottleneck in the field of peach machine vision. Therefore, how to overcome the rigid assumption that all dark areas are environmental noise, eliminate ambient light interference while protecting the boundary information carried by inherent morphological shadows, and balance the real-time requirements of dynamic detection with the lightweight nature of the model, has become a core technical problem urgently needing to be solved in this field.

[0033] Therefore, such as Figure 1 As shown, this application provides a method for identifying flat peaches based on illumination compensation and curvature features, including the following steps:

[0034] Obtain the original color image containing the target object, and extract the first channel matrix representing its brightness characteristics and the second channel matrix representing its chromaticity characteristics respectively;

[0035] Extract the second-order partial derivative features of the first channel matrix in the spatial dimension, and construct the principal curvature feature matrix representing the surface geometric features of the target object based on the second-order partial derivative features;

[0036] The first channel matrix is ​​subjected to low-pass filtering to obtain the illumination distribution matrix, and a reference compensation matrix is ​​generated by combining the preset logarithmic difference parameter with the illumination distribution matrix.

[0037] The principal curvature feature matrix is ​​converted into a penalty mask matrix based on a preset decay mapping function. The penalty mask matrix is ​​then multiplied element-wise with the reference compensation matrix to obtain the target compensation matrix.

[0038] The target compensation matrix is ​​superimposed onto the first channel matrix to obtain the corrected first channel matrix, and the corrected first channel matrix and the second channel matrix are inversely transformed into the target color image;

[0039] The target color image is input into a preset target detection network to output the recognition result for the target object, obtain feedback optimization parameters that characterize the confidence of the recognition result, and update the preset logarithmic difference parameters based on them.

[0040] I. Original Image Acquisition and Color Space Brightness Separation;

[0041] The original color image is obtained by acquiring a three-channel image containing the target object (red, green, and blue). Because the RGB color space encodes luminance and chrominance information in three independent channels, the numerical differences between channels caused by the gradual change in red and green color on the fruit surface can easily be misinterpreted as spatial gradient changes in luminance distribution, thus interfering with subsequent curvature extraction and illumination estimation based on the luminance channel. Therefore, this step first converts the color space of the original color image to the CIELAB color space.

[0042] The CIELAB color space is a device-independent color description system with uniform perception. Its core design concept lies in physically decoupling the human visual system's perception of luminance information from its perception of chrominance information. After completing the non-linear color space conversion from RGB to CIELAB, luminance component data is extracted based on the CIELAB color space as the first channel matrix, and a data set containing red-green axis chrominance components and yellow-blue axis chrominance components is extracted based on the CIELAB color space as the second channel matrix.

[0043] The first channel matrix (i.e., the brightness L channel) only carries the brightness intensity information of each pixel, which is completely independent of the physiological color distribution of the fruit surface; the second channel matrix (i.e., the combined data set of the a and b channels) carries the hue and chroma information of the fruit peel, which remains unchanged in subsequent processing to preserve the original color characteristics of the fruit.

[0044] This step outputs two independent first-channel and second-channel matrices. The separated first-channel matrix will serve as the sole basic data input for subsequent suture principal curvature extraction and ambient lighting estimation calculations, fundamentally eliminating the interference of physiological color differences on the fruit surface on shadow area judgment. The second-channel matrix remains unchanged throughout the entire lighting compensation process. After brightness correction is completed in step S5, it will be used to reconstruct the target color image together with the corrected first-channel matrix.

[0045] II. Construction of the principal curvature feature matrix based on the second-order partial derivative characteristics;

[0046] The suture line of the peach-shaped surface exhibits a deep groove structure in its three-dimensional geometry. According to the Lambert reflection model, the surface normal direction of this groove region undergoes a drastic abrupt change in the direction perpendicular to the suture line, leading to a sharp attenuation of reflected light intensity. In the brightness image, this manifests as a strong minimum value band with a U-shaped or V-shaped abyss-like attenuation of grayscale values. The essential mathematical characteristic of the brightness minimum region is precisely the second-order partial derivative with a very large positive value in the direction of the minimum value, which is the physical quantity characterized by the largest eigenvalue of the Hessian matrix. Therefore, the topological curvature of the suture line can be quantified using the second-order partial derivative characteristic of the first channel matrix in the spatial dimension.

[0047] First, the first channel matrix is ​​filtered using a Gaussian smoothing filter with a first preset scale to output a smoothed brightness matrix. This smoothing operation uses a two-dimensional Gaussian kernel function with a preset standard deviation parameter (usually between 1.0 and 2.0) to perform convolution. The purpose is to filter out the high-frequency noise response caused by the microstructures of the fruit skin (such as fine hairs and uneven waxy layers), so that the subsequent second-order partial derivative calculation can accurately focus on the macroscopic curvature structure at the suture line level, rather than producing a false curvature response to image acquisition noise.

[0048] Secondly, the second-order spatial partial derivatives of the smoothed brightness matrix in the horizontal, vertical, and two intersecting directions are extracted using an edge detection operator, and the coordinates of each pixel are calculated. A Hessian matrix is ​​constructed at each pixel. The Hessian matrix is ​​a matrix representation of the local quadratic form of the luminance surface centered at the pixel. Its four components correspond to the second-order partial derivatives of the luminance function in the horizontal-horizontal, horizontal-vertical (i.e., intersecting directions), and vertical-vertical directions, respectively. In engineering implementation, the second-order spatial partial derivatives in each direction can be approximated by applying the Sobel or Scharr operator twice consecutively to obtain numerical differentiation results. The Hessian matrix at each pixel is constructed in the following form:

[0049] ;

[0050] in, For the coordinates The Hessian matrix of the pixel at that location. and These are the second-order partial derivatives of the brightness function in the horizontal and vertical directions, respectively. and It is the mixed second-order partial derivative of the two intersecting directions.

[0051] Subsequently, the eigenvalue set of the Hessian matrix corresponding to each pixel is extracted. For the second-order real symmetric Hessian matrix of each pixel, two real eigenvalues ​​can be precisely solved. and And it is agreed that they should be arranged in descending order of absolute value, that is, satisfying Among them, the eigenvalue with the largest absolute value The corresponding feature vector direction is the principal curvature direction of the brightness surface in the neighborhood of that pixel in the direction of the most drastic grayscale change. The absolute value of the value quantitatively describes the degree of curvature in that principal direction.

[0052] Therefore, extract the eigenvalue with the largest absolute value from the eigenvalue set of the eigenvalues ​​of the Hessian matrix corresponding to each pixel. As the maximum principal curvature value of the corresponding pixel, a one-sided truncation operation is performed on it: extract the maximum principal curvature value greater than zero and retain its original value, and uniformly truncate the maximum principal curvature value less than or equal to zero to a fixed zero value. The maximum principal curvature value after processing of each pixel is arrayed to form the principal curvature feature matrix.

[0053] The physical basis for the above-mentioned truncation operation is that the suture line of the peach exhibits a brightness depression (minimum value), and the vertical cross-section direction... Mathematically, this must be a positive value; while the high-gloss raised areas on the fruit surface correspond to brightness raised areas (maximum values), which... Negative values ​​should be excluded to avoid highlight areas being misidentified as curvature feature areas. Therefore, the principal curvature feature matrix... The construction rules satisfy:

[0054] ;

[0055] in, The coordinates of the principal curvature feature matrix The element value at that position, It is the eigenvalue with the largest absolute value in the corresponding eigenvalue set.

[0056] This step outputs a principal curvature feature matrix that is strictly aligned with the original image size. The connected regions with maximal element values ​​in this matrix accurately map the actual physical grooves of the suture line, while regions with element values ​​approaching zero correspond to flat surfaces or high-gloss raised areas of the fruit peel. This principal curvature feature matrix will directly serve as the sole data source for constructing the penalty mask matrix, breaking the isolation between feature extraction and compensation execution in the traditional illumination compensation process, and establishing a direct causal link between topological geometric features and optical compensation intensity.

[0057] III. Exponential decay mapping of anisotropic penalty mask matrix;

[0058] The core objective of this step is to convert the curvature response values ​​of each pixel in the principal curvature feature matrix into suppression weights for illumination compensation based on a preset attenuation mapping function, thereby constructing a penalty mask matrix.

[0059] Specifically, the element values ​​in the principal curvature feature matrix and the preset curvature sensitivity are obtained. The ratio is used as the normalized curvature parameter, and the distribution interval is obtained based on the normalized curvature parameter through the exponential decay mapping function. decay weight value The penalty mask matrix is ​​formed by arraying the attenuation weight values ​​corresponding to each pixel. The mathematical expression of this preset attenuation mapping function satisfies:

[0060] ;

[0061] in, For the penalty mask matrix located at coordinates The attenuation weight value at that point, The coordinates of the principal curvature feature matrix The element value at that position, This is the preset curvature sensitivity.

[0062] The design logic of the aforementioned exponential decay mapping function is a nonlinear mapping mechanism derived through rigorous causal derivation. From the perspective of the function's monotonicity and extreme value behavior: when a pixel is located in a flat fruit peel area or a randomly shaded area caused by leaf occlusion, the curvature response of that area... Approaching zero, the normalized curvature parameter obtained after substituting into the function approaches zero, and the output of the exponential function... Approaching one means that the pixel will be allowed to receive almost full illumination compensation, thereby effectively eliminating the interference of uneven ambient lighting.

[0063] Conversely, when a pixel is located in the deep groove region of the suture line, the principal curvature response of that region... The value is extremely positive; after substituting it into the function, the normalized curvature parameter becomes extremely large, and the output of the exponential function... The light compensation at that pixel will be reduced to near zero at an exponential rate, meaning that the inherent geometric shadow of the stitching will be precisely exempted.

[0064] Preset curvature sensitivity As a core hyperparameter for controlling the decay rate, the suture line region can be extracted from a batch of peach images under normal lighting conditions. The mean was used as the calibration basis to ensure that the inflection point of the decay function (i.e., the point where the compensation is compressed to about 37%) is exactly within the typical response range of the suture curvature.

[0065] The output of this step contains all element values ​​distributed as follows: Penalty mask matrix within the interval Geometrically, this matrix is ​​a nonlinear normalized mapping of the principal curvature feature matrix; physically, it is an anisotropic compensation weight map with pixel-level granularity. This matrix is ​​then multiplied element-wise with the baseline compensation matrix (Hadamard product operation) to perform refined dynamic cropping of the compensation amount in different regions.

[0066] IV. Extraction of low-frequency illumination distribution and calculation of benchmark compensation matrix;

[0067] This step is based on the Retinex physical model to estimate the macroscopic illumination distribution in the image caused by the external lighting environment, and based on this, calculates the theoretical brightening amount required to eliminate uneven ambient illumination, generating a baseline compensation matrix.

[0068] First, the first channel matrix is ​​convolved using a Gaussian surround filter of a second preset scale to output an illumination distribution matrix representing illumination attenuation characteristics. The second preset scale employs a large-scale center-surround Gaussian function, whose scale parameter is typically set between one-third and one-half of the average pixel diameter of the target object in the image, and is significantly larger than the first preset scale. The low-pass filtering effect of the large-scale Gaussian kernel function effectively suppresses high-frequency details and mid-frequency textures in the image, separating and extracting the slowly changing macroscopic ambient illumination distribution from the image, and outputting the illumination distribution matrix. .

[0069] Secondly, a reference compensation matrix is ​​generated based on preset logarithmic difference parameters and the illumination distribution matrix. The preset logarithmic difference parameters include a luminance constant. Gain coefficient With zero constant Luminance constant Represents the ideal global target brightness reference value (typically set to 255 in 8-bit quantized images); gain coefficient The overall strength used to adjust the compensation amount is initially set by engineering experience, with a zero constant as a precaution. It is a very small positive number (usually 0.01), and its function is to prevent the logarithmic function from overflowing when pixel values ​​close to zero appear in the illumination distribution matrix.

[0070] Obtain the brightness constant The logarithm of the first logarithm is obtained, and the coordinates of the illumination distribution matrix are obtained. pixel value at With the aforementioned zero constant The logarithm of the sum (i.e., the second logarithm). The difference between the first logarithm and the second logarithm is obtained, and this difference is compared with the gain coefficient. Multiply the values ​​to output the compensation value for each pixel, and combine the compensation values ​​for each pixel into a base compensation matrix. The mathematical expression of this process satisfies:

[0071] ;

[0072] in, The reference compensation matrix is ​​located at coordinates The compensation value at that location. The coordinates of the illumination distribution matrix are... Pixel value at that location, The brightness constant is This is the gain coefficient. To prevent zero constant.

[0073] The physical basis of the above logarithmic difference model lies in the fact that, according to Retinex theory, the image brightness signal... It can be decomposed into the intrinsic reflectivity of the surface. (Target attributes) and incident light The product of (noise components), i.e. In the logarithmic field, the above multiplicative relation is transformed into an additive relation: This allows for the subtraction and elimination of illumination components through logarithmic difference. The Weber-Fechner law further demonstrates that the human visual system's perception of brightness follows the logarithmic law, and the compensation amount obtained from the logarithmic difference operation has a good linear correspondence with the amount of brightness loss perceived by the human eye, effectively avoiding the systematic imbalance problem of undercompensation in dark areas and overcompensation in bright areas in the linear compensation model.

[0074] This step outputs the baseline compensation matrix. This matrix reflects the theoretically required brightening values ​​to eliminate ambient lighting unevenness at each pixel of the entire image without considering any geometric constraints. This matrix will be selectively cropped by the penalty mask matrix, applying compensation only in low curvature regions (ambient shadows) and suppressing them to near-zero values ​​in high curvature regions (stitching shadows).

[0075] V. Anisotropic Constraint Fusion and Image Reconstruction;

[0076] This step performs pixel-level fusion of microscopic geometric topological constraints (penalty mask matrix) and macroscopic ambient lighting compensation (reference compensation matrix) to generate a target compensation matrix with anisotropic constraints. Based on this, image brightness correction and color space reconstruction are performed. First, the penalty mask matrix and the reference compensation matrix are multiplied by a Hadamard product (element-by-element multiplication) to obtain the target compensation matrix. Then, the first channel matrix and the target compensation matrix are added to obtain the corrected first channel matrix. The mathematical expression of this fusion process satisfies:

[0077] ;

[0078] in, For the first channel matrix in the correction, located at coordinates The brightness value at that location, This corresponds to the original brightness value in the first channel matrix. For the penalty mask matrix located at coordinates The attenuation weight value at that point, The reference compensation matrix is ​​located at coordinates The compensation value at that location.

[0079] The physical operating logic of the above fusion formula possesses precise causal self-consistency. For areas of foliage obstruction or other randomly shaded areas caused by uneven external lighting, its curvature response... The corresponding penalty weight The fusion formula degenerates into This means applying near-full baseline compensation to brighten the area, effectively eliminating ambient light interference; for the inherent shadow area of ​​the suture line, its curvature response The maximum value corresponds to the penalty weight. The fusion formula degenerates into This means that the brightness value of the area remains almost unchanged, and the geometric gradient information of the suture line is preserved without loss.

[0080] Next, the modified first channel matrix and the second channel matrix are inversely transformed into the target color image. This step involves modifying the modified brightness channel matrix. The target lightness-chroma three-dimensional tensor is obtained by splicing the unmodified red-green axis chroma component matrix and yellow-blue axis chroma component matrix in the channel dimension. Then, it is decoded from the CIELAB color space to the device-independent color space through a nonlinear inverse mapping function, and then mapped to the linear red-green-blue feature matrix through a preset color space transformation weight matrix. Finally, a nonlinear companding operation is performed using a preset gamma correction function to normalize the pixel values ​​to a preset image bit depth range, and the target color image is output.

[0081] This step outputs a target color image after anisotropic constraint compensation processing. Visually, the image effectively eliminates large areas of uneven ambient lighting shadows, and the overall brightness of the fruit surface tends to be uniform. At the same time, the dark geometric groove shadows in the suture line area are completely preserved, and the pixel grayscale gradients on both sides of the suture line edge are clearly distinguishable. This high-fidelity reconstructed target color image will be directly input into a preset target detection network to provide the network with lossless 3D pose determination cues.

[0082] VI. Target detection network inference and recognition result output;

[0083] The target color image is input into a preset target detection network. This preset target detection network adopts the YOLO11 architecture, which consists of a feature extraction backbone layer, a cross-scale fusion network layer (neck network), and a multi-task prediction head layer connected in series. The target color image undergoes multi-level convolution and downsampling operations in the backbone layer to extract shallow feature maps containing fruit edge gradient information and deep feature maps containing global semantic information of the fruit. The shallow and deep feature maps are then subjected to feature upsampling and channel concatenation in the neck network to output a target tensor set that fuses multi-scale features. The target tensor set is processed by the localization regression branch and classification branch of the head layer, and redundant overlapping prediction boxes are removed by a non-maximum suppression algorithm to output the recognition result for the target object.

[0084] The recognition results include two core types of data: first, spatial location data representing the physical bounding box of the target object in the corresponding two-dimensional image space and its corresponding location regression probability value; second, semantic category data representing the physiological maturity stage attribute of the target object and its corresponding maximum classification probability value. The location regression probability value measures the accuracy of the predicted bounding box in covering the actual target area; the semantic category data divides the peach fruit into three categories according to its physiological development state: immature, semi-mature, and mature. The maximum classification probability value is the highest category membership probability among these three categories.

[0085] The recognition results output in this step serve as dual data outputs. On the one hand, they are used directly for the orchard robot's positioning and quality grading decisions in the form of spatial positioning data and semantic category data. On the other hand, the positioning regression probability value and maximum classification probability value contained therein will serve as the data source for updating the driving parameters, realizing an end-to-end feedback closed loop for the overall recognition process.

[0086] VII. Feedback optimization of parameter extraction and update of preset logarithmic difference parameters;

[0087] This step extracts feedback optimization parameters and uses them to drive the adaptive update of the gain coefficient in the preset logarithmic difference parameters, constructing a closed-loop optimization mechanism for the entire recognition process. A preset number of physical bounding boxes are extracted from the recognition results within the current image processing batch. For each physical bounding box, the product of its corresponding localization regression probability value and the maximum classification probability value is obtained as the joint confidence score. The joint confidence score reflects the comprehensive quality of the detection results in both localization accuracy and semantic classification accuracy.

[0088] When excessive illumination compensation leads to suture line gradient distortion, the false detection probability of adhered fruits increases, while the localization regression probability decreases. Conversely, insufficient illumination compensation results in residual environmental shadows, degrading feature extraction quality and reducing the maximum classification probability. Therefore, the joint confidence score comprehensively reflects the overall impact of illumination compensation quality on downstream detection results. The arithmetic mean of the joint confidence scores for each extracted physical bounding box is obtained and used as a feedback optimization parameter characterizing the overall recognition quality of the current image processing batch. .

[0089] Obtain the feedback optimization parameters Compared with the preset confidence threshold The difference between them is used as the confidence bias, combined with a preset sensitivity scaling factor. and base learning rate For the current gain coefficient Perform an update to obtain the updated gain coefficient. This is then applied to the next batch of image processing. The mathematical expression of this update mechanism satisfies:

[0090] ;

[0091] The design of the above update formula embodies two layers of logic. First, directional adaptive adjustment: when the joint confidence average of the current image processing batch... Below the preset confidence threshold At that time, confidence bias When the value is positive, the output of the hyperbolic tangent function is positive, and the gain coefficient is automatically increased, meaning that the next batch will receive stronger illumination compensation, which helps maintain recognition quality when ambient lighting conditions become dimmer; conversely, when... When the deviation is negative, the gain coefficient is automatically adjusted to avoid overcompensation when the ambient light is sufficient.

[0092] Secondly, bounded gradient constraint: hyperbolic tangent function Force any input to be mapped The bounded interval means that no matter how drastically the confidence bias expands due to sudden changes in illumination, the absolute value of the single update step size is always strictly limited to a certain range. Within this range, it fundamentally prevents system instability caused by drastic parameter fluctuations under extreme lighting conditions. Sensitivity scaling factor Then used in Adjusting the transition rate between the linear response segment and the saturation segment of the function. The larger the value, the more sensitive the parameter update is to the confidence bias. The smaller the value, the more conservative and stable the update process tends to be.

[0093] This step outputs the updated gain coefficient. This value will replace the original gain coefficient in the next image processing batch and serve as the preset logarithmic difference parameter used for the calculation of the baseline compensation matrix, thereby realizing a complete closed-loop control in which the front-end illumination compensation intensity is adaptively adjusted by the quality of the recognition result.

[0094] In another implementation, such as Figure 2 As shown, this application also provides a peach fruit recognition system based on illumination compensation and curvature characteristics, including the following modules:

[0095] The acquisition module is used to acquire the original color image containing the target object and extract the first channel matrix representing its brightness characteristics and the second channel matrix representing its chromaticity characteristics, respectively.

[0096] Specifically, the acquisition module can use an industrial-grade color camera to capture images of the peach fruit. The acquired red, green and blue three-channel images are mapped to the CIELAB color space through a color space conversion algorithm, and the lightness component data and chroma component data are extracted from them to generate the first channel matrix and the second channel matrix, providing standardized data input for the subsequent processing of each module.

[0097] The feature extraction module is used to extract the second-order partial derivative features of the first channel matrix in the spatial dimension, and construct the principal curvature feature matrix representing the surface geometric features of the target object based on the second-order partial derivative features.

[0098] Specifically, the feature extraction module sequentially performs Gaussian smoothing filtering, Hessian matrix construction, eigenvalue decomposition, and one-sided truncation operations, outputting a principal curvature feature matrix that reflects the physical curvature distribution of the suture line. This matrix is ​​the core data driver for the entire anisotropic constraint mechanism.

[0099] The matrix processing module is used to perform low-pass filtering on the first channel matrix to obtain an illumination distribution matrix, and to generate a reference compensation matrix by combining the illumination distribution matrix with a preset logarithmic difference parameter.

[0100] Specifically, the matrix processing module extracts the macroscopic ambient illumination distribution through a large-scale Gaussian surround filter, and calculates the theoretically required baseline brightening values ​​for each pixel in the entire image based on the logarithmic difference physical model, generating a baseline compensation matrix.

[0101] The compensation module is used to convert the principal curvature feature matrix into a penalty mask matrix based on a preset attenuation mapping function, and to perform element-wise multiplication of the penalty mask matrix with the reference compensation matrix to obtain the target compensation matrix.

[0102] Specifically, the compensation module maps the principal curvature feature matrix to a distribution of element values ​​using an exponential decay function. The penalty mask matrix within the interval is used, and a Hadamard product operation is performed between it and the baseline compensation matrix to achieve cropping of the compensation amount in the suture region at the pixel level.

[0103] The image correction module is used to superimpose the target compensation matrix onto the first channel matrix to obtain a corrected first channel matrix, and to inversely transform the corrected first channel matrix and the second channel matrix into a target color image.

[0104] Specifically, the image correction module performs matrix addition fusion to generate the corrected first channel matrix, and reconstructs the target color image through a non-linear inverse color space transformation from CIELAB to RGB.

[0105] The feedback optimization module is used to input the target color image into a preset target detection network to output the recognition result for the target object, obtain feedback optimization parameters that characterize the confidence of the recognition result, and update the preset logarithmic difference parameters based on them.

[0106] Specifically, the feedback optimization module feeds the target color image into the YOLO11 detection network, extracts the localization regression probability value and the maximum classification probability value from the output recognition result, calculates the mean of the joint confidence score as the feedback optimization parameter, and adaptively adjusts the gain coefficient through the bounded gradient update rule driven by the hyperbolic tangent function to achieve closed-loop optimization.

[0107] Through the above technical solution, the present invention can achieve the following technical effects: 1) By constructing a Hessian matrix and extracting the principal curvature feature matrix from the second-order partial derivative features of the first channel matrix, the rigid assumption that all dark areas in the prior art are environmental noise is fundamentally broken. For the first time, the inherent topological geometry of the target object is introduced into the decision loop of illumination compensation, realizing the white-box inverse constraint of surface curvature on illumination compensation intensity. This coupling mechanism has a clear physical meaning: the second-order partial derivative of the image brightness channel mathematically accurately maps the true three-dimensional curvature of the target surface, thereby transforming the unobservable three-dimensional geometric information into an explicit data structure that can directly participate in pixel-level operations.

[0108] 2) By using a preset attenuation mapping function, the principal curvature feature matrix is ​​converted into a penalty mask matrix distributed in the (0,1] interval, achieving fine-grained dynamic control of the compensation intensity at the pixel level. In the deep groove region of the suture line, the curvature response value is extremely large, the penalty weight decays exponentially and approaches zero, the illumination compensation is forcibly blocked, and the original geometric gradient of the suture line is preserved without loss. In the flat fruit peel region or the random shadow region of the environment, the curvature response approaches zero, the penalty weight approaches one, and the illumination compensation acts in a near-full manner, effectively eliminating external illumination interference. This anisotropic processing mechanism simultaneously achieves the two physically orthogonal goals of eliminating environmental shadows and protecting geometric shadows within a set of fusion formula frameworks, enabling the preset target detection network to obtain high-fidelity fruit edge gradient information, completely eradicating the industry problem of misjudging adhered fruits as a single target in densely squeezed scenes.

[0109] 3) By using the recognition confidence of the preset target detection network as a feedback optimization parameter, and employing the hyperbolic tangent function with bounded nonlinear characteristics to perform discrete-time state updates on the gain coefficients, an adaptive adjustment mechanism is constructed. This mechanism can automatically adjust the illumination compensation intensity according to the real-time detection quality, achieving smooth parameter updates when scene illumination conditions change. This effectively avoids image quality fluctuations caused by drastic parameter oscillations, significantly improving the system's cross-scene robustness and long-term stability under conditions such as orchard dappled lighting. This invention only involves lightweight operators such as local second-order partial derivatives and element-wise multiplication and addition, requiring no iterative optimization, resulting in extremely low single-frame processing overhead. It meets the real-time dynamic detection requirements of the orchard mobile platform without increasing the complexity of downstream networks, and is easy to deploy in lightweight embedded devices.

[0110] In another embodiment, this application also provides a computer storage medium storing computer-executable instructions, which, when executed, implement the aforementioned method for identifying flat peaches based on illumination compensation and curvature characteristics.

[0111] The above embodiments are only used to illustrate the technical methods of this application and are not intended to limit it. Although this application has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical methods of this application without departing from the spirit and scope of the technical methods of this application.

Claims

1. A method for identifying a flat peach fruit based on illumination compensation and curvature features, characterized in that, Includes the following steps: Obtain the original color image containing the target object, and extract the first channel matrix representing its brightness characteristics and the second channel matrix representing its chromaticity characteristics respectively; Extract the second-order partial derivative features of the first channel matrix in the spatial dimension, and construct the principal curvature feature matrix representing the surface geometric features of the target object based on the second-order partial derivative features; The first channel matrix is ​​subjected to low-pass filtering to obtain the illumination distribution matrix, and a reference compensation matrix is ​​generated by combining the preset logarithmic difference parameter with the illumination distribution matrix. The principal curvature feature matrix is ​​converted into a penalty mask matrix based on a preset decay mapping function. The penalty mask matrix is ​​then multiplied element-wise with the reference compensation matrix to obtain the target compensation matrix. The target compensation matrix is ​​superimposed onto the first channel matrix to obtain the corrected first channel matrix, and the corrected first channel matrix and the second channel matrix are inversely transformed into the target color image; The target color image is input into a preset target detection network to output the recognition result for the target object, obtain feedback optimization parameters that characterize the confidence of the recognition result, and update the preset logarithmic difference parameters based on them.

2. The method according to claim 1, wherein, The process of constructing the principal curvature feature matrix includes: The first channel matrix is ​​filtered using a Gaussian smoothing filter with a first preset scale to output a smooth brightness matrix; extracting second-order spatial partial derivatives of the smoothed luminance matrix in horizontal, vertical and two crossed directions using edge detection operators , , , , and constructing a Hessian matrix for each pixel ; Extract the eigenvalue set of the Hessian matrix corresponding to each pixel, and extract the eigenvalue with the largest absolute value in the eigenvalue set as the maximum principal curvature value of the corresponding pixel. Extract the maximum principal curvature value that is greater than zero, and uniformly truncate the maximum principal curvature values ​​that are less than or equal to zero to a fixed zero value. The principal curvature feature matrix is ​​constructed by arraying the maximum principal curvature values ​​of each pixel after processing. ; in, For the coordinates The Hessian matrix of the pixel at that location. The coordinates of the principal curvature feature matrix The element value at that position, It is the eigenvalue with the largest absolute value in the corresponding eigenvalue set.

3. The method according to claim 2, wherein the method is characterized by, The process of generating the baseline compensation matrix includes: The first channel matrix is ​​convolved using a Gaussian surround filter of a second preset scale to output an illumination distribution matrix that characterizes illumination attenuation features, wherein the second preset scale is larger than the first preset scale. The preset logarithmic difference parameter includes a luminance constant. Gain coefficient With zero constant The first logarithmic value of the brightness constant is obtained, and the second logarithmic value of the sum of the pixel values ​​in the illumination distribution matrix and the zero-prevention constant is obtained. The difference between the first logarithmic value and the second logarithmic value is obtained, and the difference is multiplied by the gain coefficient to output the compensation value corresponding to each pixel. The compensation values ​​corresponding to each pixel are combined into a reference compensation matrix. ; in, The reference compensation matrix is ​​located at coordinates The compensation value at that location. The coordinates of the illumination distribution matrix are... The pixel value at that location.

4. The method according to claim 1, wherein the method is characterized by, The process of obtaining the penalty mask matrix includes: obtaining a ratio of an element value in the principal curvature feature matrix to a preset curvature sensitivity as a normalized curvature parameter, and obtaining a distribution interval of the normalized curvature parameter as an attenuation weight value, and arraying the attenuation weight values corresponding to the respective pixel points to form a penalty mask matrix; ; wherein, is an attenuation weight value in the penalty mask matrix located at coordinates , is an element value in the principal curvature feature matrix located at coordinates , is a preset curvature sensitivity.

5. The method according to claim 1, wherein the method is characterized by, The process of obtaining the corrected first channel matrix includes: The penalty mask matrix and the reference compensation matrix are subjected to a Hadamard product operation to obtain the target compensation matrix, and the first channel matrix and the target compensation matrix are subjected to a matrix addition operation to obtain the corrected first channel matrix. ; in, For the first channel matrix in the correction, located at coordinates The brightness value at that location, This corresponds to the original brightness value in the first channel matrix. For the penalty mask matrix located at coordinates The attenuation weight value at that point, The reference compensation matrix is ​​located at coordinates The compensation value at that location.

6. The method for identifying flat peaches based on illumination compensation and curvature characteristics according to claim 1, characterized in that, The process of obtaining feedback optimization parameters includes: The recognition results include spatial positioning data representing the physical bounding box of the target object and its corresponding positioning regression probability value, and semantic category data representing the physiological maturity stage attributes of the target object and its corresponding maximum classification probability value. Extract a preset number of physical bounding boxes from the recognition results in the current image processing batch. For each physical bounding box, obtain the product of its corresponding localization regression probability value and the maximum classification probability value as the joint confidence score. Obtain the average value of the joint confidence scores corresponding to each extracted physical bounding box as the feedback optimization parameter.

7. The method for identifying flat peaches based on illumination compensation and curvature characteristics according to claim 3, characterized in that, The process of updating the preset logarithmic difference parameters includes: Obtain the feedback optimization parameters Compared with the preset confidence threshold The difference between them is used as the confidence bias, and combined with a preset sensitivity scaling factor. and base learning rate For the current gain coefficient Perform an update to obtain the updated gain coefficient. ,in, The hyperbolic tangent function is used to apply the updated gain coefficients to the next batch of image processing. 8.The method of claim 1, wherein the method further comprises: determining a curvature feature of the peach fruit based on the curvature of the peach fruit; and determining the illumination compensation based on the curvature feature of the peach fruit. The process of extracting the first channel matrix and the second channel matrix includes: Obtain a red, green, and blue three-channel image containing the target object as its original color image. Convert the color space of the original color image to the CIELAB color space. Extract the lightness component data based on the CIELAB color space as the first channel matrix. Extract a data set containing red-green axis chromaticity components and yellow-blue axis chromaticity components based on the CIELAB color space as the second channel matrix.

9. A peach fruit identification system based on illumination compensation and curvature characteristics, characterized in that, Includes the following modules: The acquisition module is used to acquire the original color image containing the target object and extract the first channel matrix representing its brightness characteristics and the second channel matrix representing its chromaticity characteristics, respectively. The feature extraction module is used to extract the second-order partial derivative features of the first channel matrix in the spatial dimension, and construct the principal curvature feature matrix representing the surface geometric features of the target object based on the second-order partial derivative features. The matrix processing module is used to perform low-pass filtering on the first channel matrix to obtain the illumination distribution matrix, and to generate a reference compensation matrix by combining the illumination distribution matrix with a preset logarithmic difference parameter. The compensation module is used to convert the principal curvature feature matrix into a penalty mask matrix based on a preset attenuation mapping function, and to perform element-wise multiplication of the penalty mask matrix with the reference compensation matrix to obtain the target compensation matrix. The image correction module is used to superimpose the target compensation matrix onto the first channel matrix to obtain a corrected first channel matrix, and to inversely transform the corrected first channel matrix and the second channel matrix into a target color image; The feedback optimization module is used to input the target color image into a preset target detection network to output the recognition result for the target object, obtain feedback optimization parameters that characterize the confidence of the recognition result, and update the preset logarithmic difference parameters based on them.

10. A computer storage medium storing computer-executable instructions, which, when executed by a processor, cause the processor to perform acts comprising: When the computer-executable instructions are executed, they implement the method for identifying flat peaches based on illumination compensation and curvature characteristics as described in any one of claims 1-8.