A method and system for detecting a chemical fertilizer

By combining multi-scale sliding window segmentation and illumination compensation model with gray-level co-occurrence matrix, and using kernel principal component analysis, gradient direction distribution and texture consistency analysis are constructed, solving the feature quantification problem under complex working conditions in fertilizer testing, and realizing efficient and accurate detection of fertilizer quality.

CN122134642APending Publication Date: 2026-06-02ORDOS AGRI & ANIMAL HUSBANDRY TECH EXTENSION CENT

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ORDOS AGRI & ANIMAL HUSBANDRY TECH EXTENSION CENT
Filing Date
2026-02-04
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing visual inspection methods for fertilizers are ill-suited to complex working conditions and cannot accurately decouple the true quality characteristics of fertilizers from imaging interference factors, resulting in insufficient inspection accuracy.

Method used

Multi-scale sliding window segmentation of fertilizer images is adopted, and features are extracted by combining illumination compensation model and gray-level co-occurrence matrix. Features are compressed by kernel principal component analysis, and gradient direction distribution and texture consistency analysis are constructed to accurately locate defect areas.

Benefits of technology

It significantly improves the automation level and accuracy of fertilizer testing, achieves stable mapping under complex working conditions, and improves the efficiency and accuracy of quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122134642A_ABST
    Figure CN122134642A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for detecting fertilizers, relating to the field of fertilizer detection technology using image extraction. The method includes: segmenting particle images using a multi-scale sliding window, extracting hue, saturation, and brightness components, and combining this with an illumination compensation model to eliminate illumination effects and noise interference. Then, high-dimensional feature vectors are compressed using kernel principal component analysis to construct gradient direction distribution and texture consistency analysis, accurately locating defect areas. Subsequently, by comparing the local features of defective and normal areas, local features of the defective area are extracted, and the texture consistency and color component differences of adjacent sub-blocks are analyzed to output the defect location coordinates and a comprehensive quality rating. This invention establishes a fertilizer visual feature quantification system adapted to complex working conditions, achieving a stable mapping between particle physical properties and imaging features, and improving the accuracy of automated detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of fertilizer detection technology using image extraction, and more particularly to a method and system for detecting fertilizer. Background Technology

[0002] As a crucial input in agricultural production, fertilizer quality directly impacts crop yield and soil health. Traditional fertilizer quality testing relies primarily on manual sampling and chemical analysis. However, manual judgment is prone to subjectivity and inefficiency, while chemical testing is costly and destructive to samples. With the increasing scale of agriculture, the demand for rapid and non-destructive fertilizer quality testing is becoming increasingly urgent, prompting vision-based intelligent detection technology to become a research hotspot.

[0003] Current visual inspection methods for fertilizers mostly employ fixed thresholds or simple image processing algorithms, which are insufficient to handle the complex scenarios in actual production. The accumulation morphology of fertilizer particles on conveyor belts is highly variable, and unstable lighting conditions can lead to color feature distortion; existing methods cannot dynamically adapt to these interfering factors. More importantly, fertilizer quality evaluation requires a comprehensive assessment of multi-dimensional features such as particle uniformity and color, but traditional algorithms can only extract single surface features and lack the ability to model the correlations between features.

[0004] The technical challenges lie in two interdependent dimensions: feature quantification and dynamic adaptation. The physical properties of fertilizer granules fluctuate with the production process, and the size distribution of granules within the same batch may be non-uniform, requiring the detection system to possess dynamic feature extraction capabilities. Furthermore, the coupling relationship between the reflective properties of the granule surface and color saturation makes it easy for conventional image segmentation algorithms to misjudge normal reflections as quality defects. For example, when granule edges are blurred, existing methods struggle to distinguish between genuine quality unevenness and imaging errors caused by the shooting angle.

[0005] Establishing a quantitative system for the visual features of fertilizers that adapts to complex working conditions and achieving a stable mapping between particle physical properties and imaging features has become a key issue in improving the accuracy of automated detection. Therefore, accurately decoupling the true quality characteristics of fertilizers from imaging interference factors in a variable production environment has become a core challenge in overcoming existing technological bottlenecks. Summary of the Invention

[0006] This invention provides a method and system for detecting fertilizers, in order to establish a quantitative system for the visual features of fertilizers that can adapt to complex working conditions, achieve a stable mapping between particle physical properties and imaging features, and improve the accuracy of automated detection.

[0007] This invention provides a method for detecting chemical fertilizers, executed by a computer, comprising: The original image sequence of fertilizer particles on the conveyor belt is obtained, and based on the original image sequence, a multi-scale sliding window method is used to segment multiple local region image blocks. Each local region image block is separated to obtain hue, saturation and brightness components, and the initial visual component data is obtained. Based on the local image patch, the average brightness is adjusted using a preset illumination compensation model to obtain the adjusted image feature data; Based on the initial visual component data, the contrast features and entropy distribution of the local region are extracted using the gray-level co-occurrence matrix. The adjusted image feature data is then merged with the contrast features and the entropy distribution to obtain a high-dimensional joint feature vector. Based on the high-dimensional joint feature vector, the kernel principal component analysis method is used for compression to determine the dimensionality-reduced particle feature representation. Based on the reduced particle feature representation, an image gradient operator is used to obtain the intensity change of the particle edge region and determine the gradient direction distribution frequency in the local region. The particle edge region is divided into multiple contrast analysis sub-blocks, and based on the contrast analysis sub-blocks, the Euclidean distance is used to evaluate the texture consistency difference between adjacent sub-blocks to obtain the texture continuity distribution of the edge region. Based on the texture continuity distribution and the gradient direction distribution frequency, the smoothness of the edge region is determined. If the smoothness exceeds a preset threshold, the corresponding region is marked as an abnormal region, and the location of the quality defect in the abnormal region is determined. The abnormal region corresponding to the quality defect location is compared with the normal region to extract the local features of the abnormal region. Based on the local features, the texture consistency and color component differences of adjacent sub-blocks are analyzed, and the defect location coordinates and comprehensive quality rating are output.

[0008] According to a fertilizer detection method provided by the present invention, the step of adjusting the average brightness of the image based on the local region image block using a preset illumination compensation model to obtain adjusted image feature data includes: Based on the local image patch, the average brightness is adjusted using a preset illumination compensation model to obtain preliminarily adjusted image data; Based on the initially adjusted image data, the hue, saturation, and luminance components are separated to obtain component data; Based on the component data, the brightness of a local area is determined. If the brightness of the local area exceeds a preset range, the range of areas to be processed is determined based on the brightness of the local area and the preset range. Based on the aforementioned region, a bilateral filtering method is used to smooth high-frequency noise, resulting in smoothed image data. The target brightness component and edge intensity information are extracted from the smoothed image data. If residual noise is detected in the smoothed image data based on the target brightness component and the edge intensity information, the region is smoothed a second time to obtain the adjusted image feature data.

[0009] According to a fertilizer detection method provided by the present invention, the method involves merging the adjusted image feature data with the contrast features and the entropy distribution to obtain a high-dimensional joint feature vector, and then using kernel principal component analysis to compress the high-dimensional joint feature vector to determine the dimensionality-reduced particle feature representation. The method includes: The adjusted image feature data is normalized to obtain standardized image feature data; Based on the initial visual component data, the contrast features and entropy distribution are calculated using the gray-level co-occurrence matrix method to obtain the texture-related data representation. The standardized image feature data and the texture-related data representation are concatenated to form a high-dimensional joint feature vector containing multi-dimensional information. Based on the high-dimensional joint feature vector, the kernel principal component analysis method is used for compression processing to determine the feature set after dimensionality reduction. If the contribution rate of a component in the dimensionality-reduced feature set is lower than a preset threshold, then the component in the dimensionality-reduced feature set that is lower than the preset threshold is removed to obtain a simplified feature representation. The simplified feature representation is standardized to obtain the dimensionality-reduced particle feature representation.

[0010] According to a fertilizer detection method provided by the present invention, the step of obtaining the intensity change of particle edges and determining the gradient direction distribution frequency in a local region based on the dimensionality-reduced particle feature representation includes: Based on the dimensionality-reduced particle feature representation, the dimensionality-reduced particle feature data is processed using an image gradient operator to obtain the intensity change information of the particle edges; Based on the intensity change information, the preliminary division range of the edge region is determined; Based on the preliminary division of the edge region, the gradient direction distribution within the local region is constructed; Based on the gradient direction distribution, a statistical method is used to generate the gradient direction distribution frequency within the local region.

[0011] According to a method for detecting fertilizer provided by the present invention, the step of dividing the particle edge region into multiple comparative analysis sub-blocks based on the gradient direction distribution frequency, and evaluating the texture consistency difference between adjacent sub-blocks using Euclidean distance based on the comparative analysis sub-blocks to obtain the texture continuity distribution of the edge region includes: Based on the gradient direction distribution frequency, the particle edge region is divided into multiple contrast analysis sub-block units, and based on the contrast analysis sub-blocks, the texture feature data within each sub-block is obtained; Based on the texture feature data, the Euclidean distance is used to calculate the texture consistency difference between adjacent sub-blocks, and the degree of consistency distribution is determined. Based on the stated degree value, the texture continuity characteristics of each sub-block within the edge region are analyzed to determine the overall mapping data of the continuous distribution. Based on the continuous distribution of the overall mapping data, combined with the dimensionality-reduced particle feature representation, the particle edge texture description result is determined. Based on the particle edge texture description results, a depth analysis is performed on the particle edge region to determine the variation trend of particle features among different sub-blocks, and the texture continuity distribution of the edge region is determined based on the variation trend.

[0012] According to a fertilizer detection method provided by the present invention, the smoothness of the edge region is determined based on the texture continuity distribution and the gradient direction distribution frequency. If the smoothness exceeds a preset threshold, the corresponding region is marked as an abnormal region, and the location of the quality defect in the abnormal region is determined. The method includes: Based on the texture continuity distribution, the gradient direction of each sub-block is analyzed and the frequency distribution characteristics of the gradient direction are calculated to determine the smoothness of the edge region; If the smoothness exceeds a preset threshold, the corresponding region is marked as an abnormal region, and a preliminary set of labels for the abnormal regions is generated. Based on the initial annotation set, combined with the color distribution data of adjacent sub-blocks, the contrast features of color distribution are extracted, and based on the contrast features, it is determined whether the abnormal area meets the preset color anomaly conditions, and the color verification result is output. Based on the color verification results, the gradient characteristics of the abnormal region are obtained; If the difference between the gradient characteristics and the gradient characteristics of the adjacent regions is greater than a preset difference range, then the abnormal region is confirmed as a quality defect region, and the quality defect location of the quality defect region is generated.

[0013] According to a fertilizer detection method provided by the present invention, the method includes extracting local features of the defect area based on the location of the quality defect, analyzing the texture consistency and color component differences of adjacent sub-blocks based on the local features, and outputting the defect location coordinates and a comprehensive quality rating, including: Based on the location of the quality defect, local texture features and color component information of the defect area are extracted to obtain the local features of the quality defect location; Based on the local features, the differences in texture consistency and color components between adjacent sub-blocks are analyzed to obtain a comprehensive difference value. If the comprehensive difference value exceeds a preset threshold, the corresponding sub-block is determined to be a potential quality defect area, and the defect location coordinates of the quality defect area are output. Based on the coordinates of the defect location and combined with the feature description of the normal area, a quality anomaly distribution map of the particle surface is generated, wherein the quality anomaly distribution map includes the distribution of the quality defect area; Based on the quality anomaly distribution map, the proportion and distribution density of the quality defect area are calculated, and based on the proportion and distribution density, combined with the running speed parameter of the conveyor belt, the uniformity index of the batch fertilizer particles is determined. Based on the uniformity index, combined with the proportion and the distribution density, the quality defect area is assessed to determine the comprehensive quality rating.

[0014] This invention also provides a fertilizer detection system, comprising: The image acquisition module is used to acquire the original image sequence of fertilizer particles on the conveyor belt, and based on the original image sequence, to segment multiple local region image blocks using a multi-scale sliding window method, and to separate each local region image block to obtain hue, saturation and brightness components, thereby obtaining initial visual component data. The adjustment module is used to adjust the average brightness of the local region image block using a preset illumination compensation model to obtain adjusted image feature data. The merging module is used to extract the contrast features and entropy distribution of local regions based on the initial visual component data using the gray-level co-occurrence matrix, merge the adjusted image feature data with the contrast features and the entropy distribution to obtain a high-dimensional joint feature vector, and compress the high-dimensional joint feature vector using the kernel principal component analysis method to determine the dimensionality-reduced particle feature representation. The distribution frequency determination module is used to determine the gradient direction distribution frequency in a local region by using an image gradient operator to obtain the intensity change of the particle edge region based on the dimensionality-reduced particle feature representation. The continuity distribution determination module is used to divide the particle edge region into multiple comparison analysis sub-blocks, and based on the comparison analysis sub-blocks, use Euclidean distance to evaluate the texture consistency difference between adjacent sub-blocks to obtain the texture continuity distribution of the edge region; The defect location determination module is used to determine the smoothness of the edge region based on the texture continuity distribution and the gradient direction distribution frequency. If the smoothness exceeds a preset threshold, the corresponding region is marked as an abnormal region, and the quality defect location of the abnormal region is determined. The quality analysis module is used to compare the abnormal area corresponding to the quality defect location with the normal area to extract the local features of the abnormal area, and based on the local features, analyze the texture consistency and color component differences of adjacent sub-blocks, and output the defect location coordinates and comprehensive quality rating.

[0015] This invention provides a method and system for detecting fertilizer particles. Addressing the challenges of inconsistent lighting, complex particle edge features, and insufficient defect identification accuracy in fertilizer particle quality detection on conveyor belts, the invention employs a multi-scale sliding window approach to segment particle images, extracting hue, saturation, and brightness components. A lighting compensation model is then used to eliminate lighting effects and noise interference. Furthermore, high-dimensional feature vectors are compressed using kernel principal component analysis to construct gradient direction distribution and texture consistency analysis, accurately locating defect areas. Subsequently, by comparing the local features of defective and normal areas, local features of the defective area are extracted, and the texture consistency and color component differences between adjacent sub-blocks are analyzed to output the defect location coordinates and a comprehensive quality rating. This invention significantly improves the automation level and accuracy of particle quality detection, providing an efficient solution for quality control in industrial production. It establishes a fertilizer visual feature quantification system adaptable to complex working conditions, achieving a stable mapping between particle physical properties and imaging features, and improving the accuracy of automated detection. Attached Figure Description

[0016] Figure 1 This is one of the flowcharts illustrating a fertilizer detection method provided in an embodiment of the present invention; Figure 2 This is a second schematic flowchart of a fertilizer detection method provided in an embodiment of the present invention; Figure 3 This is the third flowchart of a fertilizer detection method provided in an embodiment of the present invention; Figure 4 This is the fourth flowchart of a fertilizer detection method provided in an embodiment of the present invention; Figure 5 This is the fifth flowchart illustrating a fertilizer detection method provided in this embodiment of the invention; Figure 6This is a schematic flowchart of a fertilizer detection method provided in an embodiment of the present invention; Figure 7 This is the seventh flowchart of a fertilizer detection method provided in this embodiment of the invention. Detailed Implementation

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

[0018] Reference Figure 1 This invention provides a method for detecting fertilizers, comprising the following steps: Step 100: Obtain the original image sequence of fertilizer particles on the conveyor belt, and based on the original image sequence, use the multi-scale sliding window method to segment multiple local region image blocks, and separate each local region image block to obtain hue, saturation and brightness components, and obtain initial visual component data. First, the original image sequence of fertilizer particles on the conveyor belt is continuously acquired by an image acquisition device. Then, based on the original image sequence, a multi-scale sliding window method is used to intelligently segment each frame of the image to adaptively capture local regional features at different spatial scales by changing the window size, thereby generating a series of local regional image blocks that cover the complete image content.

[0019] Next, color space analysis is performed on each segmented local image patch, transforming it from the original color model to a color space more suitable for human visual perception. This process separates three independent visual components: hue, saturation, and brightness, yielding initial visual component data. The hue, saturation, and brightness components obtained in this separation process collectively constitute the initial visual component data characterizing the visual properties of fertilizer, providing a structured, decomposed feature foundation for subsequent quality detection or classification. This step achieves the transformation from the original image sequence to standardized visual component data, preserving local detail information at multiple scales while enhancing feature resolvability through component separation.

[0020] Step 200: Based on the local region image block, the average brightness is adjusted using a preset illumination compensation model to obtain the adjusted image feature data; After obtaining the initial visual component data, the brightness component is optimized and noise is processed. Based on local image patches, the brightness component of each region is intelligently adjusted using a preset illumination compensation model. This illumination compensation model is used to compensate for brightness deviations caused by uneven ambient lighting or differences in device imaging. By calculating and adjusting the average brightness of the region, the overall brightness distribution tends to be more balanced and standardized, thereby obtaining a local brightness that more accurately reflects the brightness characteristics of the object itself.

[0021] After obtaining the calibrated local brightness, further analysis is performed to determine the image region requiring focused processing. This region can be determined based on brightness thresholds, gradient variations, or specific region growing strategies to precisely locate the image portion containing effective particle information or features to be analyzed. For the determined region, a bilateral filtering method is used to smooth high-frequency noise. Bilateral filtering is a nonlinear filtering technique that simultaneously considers pixel spatial proximity and brightness similarity, effectively suppressing high-frequency noise while preserving the sharpness and clarity of key details such as particle edges and textures. The final result is adjusted image feature data with significantly reduced noise and complete detail preservation.

[0022] Step 300: Based on the initial visual component data, the contrast features and entropy distribution of the local region are extracted using the gray-level co-occurrence matrix. The adjusted image feature data is merged with the contrast features and the entropy distribution to obtain a high-dimensional joint feature vector. Based on the high-dimensional joint feature vector, the kernel principal component analysis method is used for compression to determine the dimensionality-reduced particle feature representation. After obtaining the adjusted image feature data, deeper texture and statistical information is further mined from the initial visual component data. Specifically, for each local region in the initial visual component data, the gray-level co-occurrence matrix method is used for analysis. By quantifying the joint conditional probability of gray-level pixels with specific spatial relationships in the initial visual component data, the texture structure of the region can be effectively characterized, and two key texture statistics are extracted. These statistics include contrast features and entropy distribution. Contrast features are used to describe the magnitude of gray-level variation and texture clarity within a local region, reflecting the local contrast and groove depth of the image. Entropy distribution is used to measure the complexity and randomness of information in the image texture, characterizing the degree of texture disorder or uniformity.

[0023] Subsequently, the adjusted image feature data is deeply fused and merged with contrast features and entropy distribution that characterize texture sharpness and complexity. This allows for the combination of particle color, brightness, and enhanced local structural information with deeply mined texture statistics at the feature level, thereby constructing a high-dimensional joint feature vector with richer information dimensions and a more complete descriptive level. This high-dimensional joint feature vector is used to comprehensively encode multiple attributes of the particle's visual appearance.

[0024] Because high-dimensional joint feature vectors may contain information redundancy or have nonlinear data structures, direct use may lead to low computational efficiency or weakened model generalization ability. Therefore, kernel principal component analysis (KPCA) is used to compress and extract features from high-dimensional joint feature vectors. KPCA transforms the original feature space into a higher-dimensional implicit space through nonlinear kernel function mapping, enabling linear principal component analysis. This effectively captures and preserves the complex nonlinear structure and key discriminative information in the data. After compression, a new feature set with reduced dimensionality but highly condensed discriminative information is generated while preserving the original data variance and main patterns to the maximum extent, resulting in a dimensionality-reduced granular feature representation.

[0025] Step 400: Based on the reduced particle feature representation, the intensity change of the particle edge region is obtained by using the image gradient operator, and the gradient direction distribution frequency in the local region is determined. The obtained dimensionality-reduced particle feature representation is analyzed using an image gradient operator for the corresponding image region. By applying this image gradient operator, significant changes in pixel intensity in particle edge regions are captured and quantified, thereby accurately obtaining gradient intensity information characterizing contour and structural abrupt changes. After obtaining the gradient intensity information, the directional attributes of the gradient are further explored. By statistically analyzing the gradient directions at all significant edge points within the local region, the frequency of occurrence in different angle intervals is calculated, thus determining the gradient direction distribution frequency within the local region. This gradient direction distribution frequency characterizes the main orientation, angle preference, and geometric complexity and anisotropy of the edge contour within the region. For example, regular particles may exhibit a dominant directional pattern, while irregular or aggregated particles may exhibit a more uniform or chaotic directional distribution.

[0026] Step 500: Based on the gradient direction distribution frequency, the particle edge region is divided into multiple contrast analysis sub-blocks, and based on the contrast analysis sub-blocks, the Euclidean distance is used to evaluate the texture consistency difference between adjacent sub-blocks to obtain the texture continuity distribution of the edge region. After obtaining the frequency distribution of the particle edge regions and their gradient directions, the particle edge regions of interest are systematically divided into a series of regular or adaptive contrastive analysis sub-blocks. This discretizes continuous edge regions into smaller, independently analyzable and comparable local units. For each sub-block, quantitative features characterizing its internal texture pattern are extracted. Subsequently, Euclidean distance is used as a consistency metric to calculate and evaluate the similarity of texture features between spatially adjacent or paired sub-blocks. The magnitude of the Euclidean distance directly reflects the consistency difference in texture patterns between adjacent sub-blocks; a smaller distance indicates more similar and continuous textures, while a larger distance signifies abrupt changes or significant inconsistencies in the texture at that local level.

[0027] By calculating and evaluating all adjacent sub-block pairs within the entire edge region, a texture continuity distribution describing how texture similarity varies spatially within the edge region is generated. This texture continuity distribution can be a distribution map or a dataset, reflecting the uniformity, abrupt changes, and gradation trends of the texture structure along the particle edge contour. For example, a uniformly textured particle will exhibit a high degree of consistency in the texture continuity distribution of its edge region; while particles with surface defects, foreign matter contamination, or adhesion will show high differences between specific sub-block pairs, thus identifying anomalous discontinuities in the continuity distribution.

[0028] Step 600: Based on the texture continuity distribution and the gradient direction distribution frequency, determine the smoothness of the edge region. If the smoothness exceeds a preset threshold, mark the corresponding region as an abnormal region and determine the location of the quality defect in the abnormal region. After obtaining the texture continuity distribution and gradient direction distribution frequency, a comprehensive evaluation of the overall morphological regularity of the particle edge region is performed to identify potential quality defects. By fusing the texture continuity distribution, which characterizes the micro-texture coherence, with the gradient direction distribution frequency, which reflects the macro-edge orientation consistency, a smoothness index characterizing the overall regularity and uniformity of the edge region can be calculated. This smoothness index quantifies the overall fluctuation degree of the edge region in texture detail and geometric contour; higher smoothness indicates a more uniform and regular edge; conversely, lower smoothness implies abrupt texture breaks, directional disorder, or geometric distortion at the edge.

[0029] Next, the calculated smoothness value is compared with a preset severity threshold. This threshold, determined based on prior knowledge or standard sample training, is used to distinguish between normal and abnormal edges. If the smoothness index exceeds the preset threshold, it indicates that the region exhibits significant discontinuities or irregularities in texture or geometry, exceeding the normal variation range; therefore, the corresponding region is marked as an abnormal region. Furthermore, based on all marked abnormal regions, the location of quality defects within the abnormal regions can be determined.

[0030] Step 700: Compare the abnormal area corresponding to the quality defect location with the normal area to extract the local features of the abnormal area, and based on the local features, analyze the texture consistency and color component differences of adjacent sub-blocks, and output the defect location coordinates and comprehensive quality rating.

[0031] After identifying the location of the quality defect, a detailed analysis and comprehensive assessment of the defect is conducted. First, the defect location is systematically compared with its surrounding normal area. This difference analysis allows for the extraction of unique local features of the defect area. These local features may include more specific texture patterns, morphological parameters, or attribute combinations that are distinctly different from other areas within the defect. Next, the microstructure of the defect area and its boundaries is further analyzed in depth. By examining the texture consistency of adjacent sub-blocks within the defect area, the degree of texture breakage or disorder caused by the defect can be quantified. Simultaneously, by comparing the color component differences between the defect location and the normal area, it can be determined whether there are color anomalies, contamination, or compositional variations.

[0032] Finally, by integrating all analysis results, the spatial coordinates of the defect location are output; and based on in-depth analysis of local features, a comprehensive quality rating is generated, including defect size, type, contrast, and potential impact. This comprehensive quality rating quantifies and classifies the quality status of particles, providing a basis for decision-making in closed-loop control of the production process and determination of product quality.

[0033] This invention provides a method and system for detecting fertilizer particles. Addressing the challenges of inconsistent lighting, complex particle edge features, and insufficient defect identification accuracy in fertilizer particle quality detection on conveyor belts, the invention employs a multi-scale sliding window to segment particle images, extracting hue, saturation, and brightness components. It then combines this with an illumination compensation model to eliminate the effects of lighting and noise interference. Furthermore, it uses kernel principal component analysis to compress high-dimensional feature vectors, constructing gradient direction distribution and texture consistency analysis to accurately locate defect areas. By comparing the local features of defective and normal areas, the invention extracts local features of defective areas, analyzes the texture consistency and color component differences of adjacent sub-blocks, and outputs the defect location coordinates and a comprehensive quality rating. This invention significantly improves the automation level and accuracy of particle quality detection, providing an efficient solution for quality control in industrial production. It establishes a fertilizer visual feature quantification system adaptable to complex working conditions, achieves a stable mapping between particle physical properties and imaging features, and enhances the accuracy of automated detection.

[0034] In one embodiment, please refer to Figure 2 The step of adjusting the average brightness of the image based on the local region image patch using a preset illumination compensation model to obtain adjusted image feature data includes: Step 201: Based on the local region image patch, adjust the average brightness using a preset illumination compensation model to obtain preliminarily adjusted image data; Step 202: Based on the initially adjusted image data, separate the hue, saturation, and brightness components to obtain component data; Step 203: Based on the component data, determine the brightness of the local area. If the brightness of the local area exceeds a preset range, determine the area to be processed based on the brightness of the local area and the preset range. Step 204: Based on the area range, use a bilateral filtering method to smooth high-frequency noise to obtain smoothed image data; Step 205: Extract the target brightness component and edge intensity information from the smoothed image data. If residual noise is detected in the smoothed image data based on the target brightness component and the edge intensity information, perform secondary smoothing on the region to obtain the adjusted image feature data.

[0035] First, based on the segmented local image patches, the overall brightness mean is adaptively adjusted using a preset illumination compensation model to correct imaging deviations caused by uneven ambient lighting, thus obtaining initially adjusted image data. Then, color space analysis is performed on this initially adjusted image data to separate independent hue, saturation, and brightness components, obtaining component data. Next, the brightness level of local areas is determined based on the brightness component in the component data. If the brightness of a local area exceeds a preset range, the area requiring focused processing is dynamically defined by combining the brightness value with the preset range, achieving precise localization. For the defined area, a bilateral filtering method is used for initial smoothing to effectively suppress high-frequency noise, resulting in smoothed image data. To further ensure data quality, target brightness components and edge intensity information can be extracted simultaneously from the smoothing result for noise residue detection. If noise is still detected based on the target brightness components and edge intensity information, a second smoothing process is triggered for the same area. This conditional iterative mechanism ensures sufficient denoising, ultimately outputting adjusted image feature data.

[0036] For example, in image processing, illumination compensation and feature adjustment are first performed on the average brightness of image blocks based on a preset illumination compensation model. Assuming the average brightness of the input image block is 80 (range 0-255), and the target average is 100, then the following linear transformation formula is used: Calculations were performed on each pixel to ensure consistent overall brightness and eliminate lighting differences. Analysis showed that the average brightness error after adjustment was controlled within ±2, meeting expectations. Next, the separated hue, saturation, and luminance components were normalized. Taking the luminance component as an example, its value was mapped to the range of 0 to 1 using the formula: Normalized value = (Original value - Minimum value) / (Maximum value - Minimum value). Assuming a pixel's luminance value is 120, the minimum value is 50, and the maximum value is 200, then the normalized value is (120-50) / (200-50) = 0.467. Analysis indicates that this method effectively reduced the dimensional differences between components and improved the consistency of subsequent processing. Subsequently, if the brightness of a local area exceeds the preset range (e.g., normalized brightness > 0.8 or < 0.2), bilateral filtering is activated to smooth high-frequency noise. The spatial domain standard deviation is set to 5.0, the value domain standard deviation to 25.0, and the filter window size to 9×9. The calculation results show that the noise variance decreased from 0.15 to 0.05. Simultaneously, by preserving particle edge intensity variations through value domain weighting, the edge gradient preservation rate reached over 90%. Finally, the adjusted brightness, hue, and saturation components are integrated to generate image feature data. Analysis shows that the overall image contrast is improved by approximately 15%, and feature consistency is enhanced, providing a more stable input for subsequent image classification tasks.

[0037] In this embodiment, by applying illumination compensation beforehand and adaptively triggering subsequent processing based on the brightness range, robustness to complex lighting scenes is significantly improved, and computational resource allocation is optimized. Furthermore, by employing a noise residue detection mechanism based on target brightness and edge information, noise suppression and detail preservation are balanced, preventing the loss of edge and texture information caused by excessive smoothing. This significantly improves the signal-to-noise ratio of image data while ensuring the accuracy and reliability of subsequent feature extraction.

[0038] In one embodiment, please refer to Figure 3 The step of merging the adjusted image feature data with the contrast features and the entropy distribution to obtain a high-dimensional joint feature vector, and then using kernel principal component analysis to compress the high-dimensional joint feature vector to determine the dimensionality-reduced particle feature representation, includes: Step 301: Normalize the adjusted image feature data to obtain standardized image feature data; Step 302: Based on the initial visual component data, the contrast features and entropy distribution are calculated using the gray-level co-occurrence matrix method to obtain the texture-related data representation; Step 303: The standardized image feature data and the texture-related data representation are concatenated to form a high-dimensional joint feature vector containing multi-dimensional information; Step 304: Based on the high-dimensional joint feature vector, the kernel principal component analysis method is used for compression processing to determine the feature set after dimensionality reduction; Step 305: If the contribution rate of a component in the dimensionality-reduced feature set is lower than a preset threshold, then the component in the dimensionality-reduced feature set that is lower than the preset threshold is removed to obtain a simplified feature representation. Step 306: Standardize the simplified feature representation to obtain the dimensionality-reduced particle feature representation.

[0039] The purpose of this step is to construct an efficient and discriminative particle feature representation. First, the adjusted image feature data is normalized to eliminate dimensional differences and obtain standardized image feature data, ensuring data scale consistency. Simultaneously, based on the initial visual component data—the original hue, saturation, and brightness components—the gray-level co-occurrence matrix method is used to extract contrast features and entropy distributions that respectively characterize texture contrast and complexity, thus obtaining a texture-related data representation that delineates the microstructure of the particles. Subsequently, the standardized image feature data is concatenated and fused with the extracted deep texture features to form a high-dimensional joint feature vector that integrates color, brightness, structure, and texture statistics, providing a more comprehensive description.

[0040] Due to potential redundancy in high-dimensional vectors, kernel principal component analysis (KPCA) is used to compress the high-dimensional joint feature vectors, resulting in a dimensionality-reduced feature set. To further improve the purity and effectiveness of the feature set, a dynamic selection process based on contribution rate is employed. This automatically evaluates the contribution rate of each component in the dimensionality-reduced feature set and removes minor or noisy components with contribution rates below a preset threshold that carry little information, thereby obtaining a simplified feature representation. Finally, the simplified feature representation is standardized to unify the output scale, ultimately generating a stable, reliable, and easily processed dimensionality-reduced granular feature representation.

[0041] For example, in the process of implementing joint feature extraction and dimensionality reduction based on hue, saturation, and brightness components and gray-level co-occurrence matrix features, the input image is first converted to a color space, converting the RGB image to the HSV color space to obtain three components: hue (H), saturation (S), and brightness (V). Each component is then normalized to map its value range to between 0 and 1. For example, for an image with a resolution of 256x256, the average value of the H component is calculated to be 0.45, and the standard deviation is 0.12. The data distribution is then adjusted using a linear normalization formula. Next, based on the gray-level co-occurrence matrix, contrast features and entropy distribution are extracted. After converting the image to grayscale, a gray-level co-occurrence matrix is ​​constructed. The distance parameter is set to 1, the angle is 0 degrees, and the contrast value is calculated to be 3.25 and the entropy value to be 2.78. Through statistical analysis, the histogram feature vector of the entropy distribution is obtained, which has a length of 10 dimensions and values ​​of [0.1, 0.2, 0.15, 0.1, 0.05, 0.1, 0.1, 0.05, 0.05, 0.1]. Subsequently, the normalized HSV component feature vector (3-dimensional in length, with values ​​[0.5, 0.6, 0.4]) is concatenated with the feature vector extracted from the gray-level co-occurrence matrix (12-dimensional in length, including contrast and entropy distribution) to form a 15-dimensional high-dimensional joint feature vector, with specific values ​​[0.5, 0.6, 0.4, 3.25, 2.78, 0.1, 0.2, 0.15, 0.1, 0.05, 0.1, 0.1, 0.05, 0.05, 0.1]. Then, the high-dimensional vector was reduced in dimensionality using kernel principal component analysis (KPI). A radial basis function kernel with a sigma parameter of 1.5 was used to calculate eigenvalues ​​and eigenvectors, yielding the cumulative contribution rate. The contribution rates of the first five principal components were 0.35, 0.25, 0.15, 0.1, and 0.05, respectively, totaling 0.9, exceeding the preset threshold of 0.85. Therefore, these five principal components were retained, resulting in a 5-dimensional eigenvector with values ​​of [1.2, 0.8, 0.5, 0.3, 0.2]. These steps completed the entire transformation process from the original image to the dimensionality-reduced particle feature representation.

[0042] In this embodiment, a feature engineering chain was constructed, from normalization, texture extraction, multi-dimensional fusion to nonlinear dimensionality reduction, which improves the representational ability and robustness of features. Furthermore, a dynamic feature selection step based on a contribution rate threshold was introduced after dimensionality reduction, which can adaptively remove noisy features with low information content, thereby further improving the discriminativeness and effectiveness of the feature set while reducing dimensionality.

[0043] In one embodiment, please refer to Figure 4 The step of using an image gradient operator to obtain the intensity change of particle edges and determine the gradient direction distribution frequency in a local region based on the dimensionality-reduced particle feature representation includes: Step 401: Based on the dimensionality-reduced particle feature representation, the dimensionality-reduced particle feature data is processed using an image gradient operator to obtain the intensity change information of the particle edges; Step 402: Based on the intensity change information, determine the preliminary division range of the edge region; Step 403: Based on the preliminary division of the edge region, construct the gradient direction distribution within the local region; Step 404: Based on the gradient direction distribution, a statistical method is used to generate the gradient direction distribution frequency in the local region.

[0044] First, based on the image data corresponding to the dimensionality-reduced particle feature representation, an image gradient operator is used to capture abrupt changes in pixel intensity at the particle contour, thereby obtaining intensity change information characterizing edge sharpness and geometric abrupt changes. Then, based on this intensity change information, a preliminary division range of the particle edges is defined by setting a threshold or a region growing strategy. Within this preliminary division range, the gradient direction of each edge pixel is further calculated, and a gradient direction distribution describing the set of local region edge orientations is constructed based on the gradient direction of each edge pixel. Finally, based on this gradient direction distribution, statistical methods are used to accumulate and normalize the frequencies of different gradient direction angles, thereby generating a gradient direction distribution frequency that can quantify edge orientation preferences and consistency.

[0045] In this embodiment, particle feature representation is combined with classical gradient operator analysis to achieve mapping and focusing analysis from the dimensionality-reduced feature space to the edge direction, so that the feature representation includes color and texture information, as well as specific spatial structure resolution capabilities.

[0046] In one embodiment, please refer to Figure 5 The process involves dividing the particle edge region into multiple contrast analysis sub-blocks based on the gradient direction distribution frequency, and using Euclidean distance to evaluate the texture consistency differences between adjacent sub-blocks based on these contrast analysis sub-blocks, thereby obtaining the texture continuity distribution of the edge region. This includes: Step 501: Based on the gradient direction distribution frequency, the particle edge region is divided into multiple contrast analysis sub-block units, and based on the contrast analysis sub-blocks, the texture feature data within each sub-block is obtained; Step 502: Based on the texture feature data, calculate the texture consistency difference between adjacent sub-blocks using Euclidean distance to determine the degree of consistency distribution. Step 503: Based on the stated degree value, analyze the texture continuity characteristics of each sub-block within the edge region to determine the overall mapping data of the continuous distribution; Step 504: Based on the continuous distribution of the overall mapping data and combined with the dimensionality-reduced particle feature representation, determine the particle edge texture description result; Step 505: Based on the particle edge texture description results, perform depth analysis on the particle edge region to determine the variation trend of particle features among different sub-blocks, and determine the texture continuity distribution of the edge region based on the variation trend.

[0047] After obtaining the gradient direction distribution frequency, the particle edge region is further subdivided into multiple comparative analysis sub-blocks based on this frequency. This division method dynamically adjusts the gradient direction change rate or frequency itself to ensure high directional consistency within each sub-block. Within each sub-block, its corresponding texture feature data is extracted or calculated. Then, based on the texture feature data, Euclidean distance is used as a metric to calculate the feature similarity between all spatially adjacent sub-block pairs to quantify their texture consistency differences, thus obtaining a series of consistency distribution degree values ​​characterizing the degree of local similarity. Based on these degree values, through spatial interpolation or aggregation analysis, the continuity or abrupt changes in texture features throughout the edge region can be depicted, and a continuous distribution of overall mapping data can be constructed.

[0048] Furthermore, the overall mapping data describing the coherence of the texture space is fused and cross-validated with the dimensionality-reduced particle feature representation containing color and basic texture information. This fusion is not a simple splicing, but rather a correlation and enhancement at the feature level to determine the particle edge texture description result.

[0049] The grain edge texture description result is a composite descriptive model that comprehensively portrays the texture characteristics of grain edge regions. This is achieved by deeply fusing and correlating the overall mapping data representing the continuous distribution of texture space with the dimensionality-reduced grain feature representation including color, brightness, and basic texture. Furthermore, this grain edge texture description result includes the spatial variation pattern of the texture and the underlying visual attributes that constitute the texture. The spatial variation pattern refers to the texture's spatial variation pattern, i.e., whether the texture along the edge represented by the continuous distribution mapping data is a uniform transition or exhibits sudden breaks and abnormal undulations, reflecting the macroscopic geometric organization of the texture. The underlying visual attributes that constitute the texture are the color tone, contrast, and basic texture statistics of the region provided by the dimensionality-reduced feature representation. Finally, because the particle edge texture description results are both sensitive, that is, able to capture subtle physical fractures or material inhomogeneities through texture continuity, and stable, that is, able to eliminate pseudo texture abrupt changes caused by interference such as simple lighting changes through multi-dimensional basic features, they provide reliable and rich discrimination criteria for accurately distinguishing between real structural defects (such as cracks and gaps) and harmless natural surface texture changes.

[0050] Finally, based on the particle edge texture description results, a deep analysis is conducted on the particle edge region. This analysis focuses on the spatial variation patterns and trends of particle features (such as texture statistics) between different sub-blocks. First, along the particle edge contour, in the order of sub-blocks, the trajectory of one or more key particle features is traced to identify whether the key particle features exhibit a smooth gradient (indicating a natural texture transition), periodic fluctuations (possibly related to regular textures), or steep, abrupt changes at certain points (strongly suggesting the presence of cracks, impurities, or boundary anomalies). This trend analysis provides gradient information of key particle features in the spatial dimension, revealing a more comprehensive and coherent structural pattern than comparing the differences between two adjacent sub-blocks in isolation. Key particle features can be numerical values ​​of specific texture statistics, the mean of color components, etc.

[0051] Finally, the constructed continuity distribution is calibrated based on this trend, resulting in a highly reliable texture continuity distribution for edge regions. In other words, the final continuity distribution is defined and calibrated by the results of this trend analysis. For example, regions with smoothly changing eigenvalues ​​are assigned high continuity scores, while points where eigenvalues ​​change abruptly are marked as continuity breakpoints. This calibration method makes the quantitative distribution of texture continuity a mapping and measure of the smoothness of the variation trend in the particle feature space.

[0052] For example, regarding the dimensionality-reduced particle feature representation, firstly, principal component analysis (PCA) is used to reduce the dimensionality of the high-dimensional particle feature data. Assuming the original feature dimension is 50, the first five principal components are retained after dimensionality reduction, resulting in a cumulative explained variance ratio of 90%, thus obtaining a low-dimensional feature vector representation. Next, the Sobel operator is used to calculate the gradient information of the particle image. Specifically, convolution operations are performed on the image in the horizontal and vertical directions to obtain the gradient magnitude and direction. For example, a gradient magnitude of 12.5 and a direction of 45 degrees for a pixel indicates a significant change in edge intensity. Then, a histogram of gradient direction distribution frequency is constructed within a local region. The gradient direction is divided into eight intervals, each covering a 45-degree range. The frequency of the gradient direction within each interval is statistically analyzed. For example, the frequency in the 0-45 degree interval is 30%, the frequency in the 45-90 degree interval is 25%, and so on, forming a histogram describing the local texture features. Furthermore, the area around the particle edge is divided into multiple contrast analysis sub-blocks. Assuming each sub-block is 8x8 pixels, a total of 16 sub-blocks are created. The mean and standard deviation of the grayscale value are calculated for each sub-block. For example, a sub-block with a mean grayscale value of 120 and a standard deviation of 15 reflects its texture characteristics. Subsequently, Euclidean distance is used to evaluate the texture consistency of adjacent sub-blocks. The square root of the sum of the squares of the differences in the mean and standard deviation of grayscale values ​​between two sub-blocks is calculated. Assuming an Euclidean distance of 5.2 between two sub-blocks indicates small texture differences. Finally, based on the Euclidean distance results of all adjacent sub-blocks, the proportion of sub-blocks with a distance less than the threshold of 10.0 is statistically analyzed. Assuming a proportion of 80%, this indicates high texture continuity in the edge region. A texture continuity distribution map is then generated for subsequent particle classification tasks, where it is fused with other features to improve classification accuracy.

[0053] In this embodiment, the spatial relationship analysis of texture is upgraded from the traditional pixel level or fixed window level to a structural level analysis based on dynamic sub-block units and considering the adjacency relationship. This can more sensitively identify the gradual changes and local breaks in texture, providing a powerful analysis tool for detecting subtle defects or material inhomogeneities.

[0054] In one embodiment, please refer to Figure 6 The smoothness of the edge region is determined based on the texture continuity distribution and the gradient direction distribution frequency. If the smoothness exceeds a preset threshold, the corresponding region is marked as an abnormal region, and the location of the quality defect in the abnormal region is determined, including: Step 601: Based on the texture continuity distribution, analyze the gradient direction of each sub-block and calculate the frequency distribution characteristics of the gradient direction to determine the smoothness of the edge region; Step 602: If the smoothness exceeds a preset threshold, the corresponding region is marked as an abnormal region, and a preliminary annotation set of the abnormal regions is generated. Step 603: Based on the preliminary annotation set and the color distribution data of adjacent sub-blocks, extract the contrast features of color distribution, and based on the contrast features, determine whether the abnormal area meets the preset color anomaly conditions, and output the color verification result. Step 604: Based on the color verification result, obtain the gradient characteristics of the abnormal region; Step 605: If the difference between the gradient characteristic and the gradient characteristic of the adjacent region is greater than a preset difference range, then the abnormal region is confirmed as a quality defect region, and the quality defect location of the quality defect region is generated.

[0055] First, based on the established texture continuity distribution, the gradient direction features within each sub-block are analyzed in depth. The frequency distribution of this gradient direction is statistically calculated to comprehensively evaluate the regularity and uniformity of the edge region, thereby quantifying its smoothness. This smoothness reflects the degree of consistency of the edge in texture coherence and geometric orientation. If the smoothness exceeds a preset threshold, it indicates significant abnormal fluctuations or discontinuities in the region. This region is then marked as an abnormal region, and a preliminary annotation set containing all such regions is generated.

[0056] To improve judgment accuracy and reduce false alarms, a multi-feature verification mechanism is introduced. Specifically, based on the initial annotation set, the color distribution data of adjacent sub-blocks is further analyzed to extract the contrast features between the abnormal area and the surrounding normal area in the color space. Based on these contrast features, it is determined whether the abnormal area meets the preset color anomaly conditions, such as the presence of color spots, pollution, or material discoloration. The color verification result is then output, thus performing a secondary screening of anomalies from a color dimension.

[0057] After color verification, the gradient characteristics of the abnormal region are obtained, such as the statistical features of the gradient intensity or the clustering pattern of the direction distribution. Finally, by comparing the gradient characteristics of the abnormal region with the gradient characteristics of its directly adjacent normal region, if the difference between the two is greater than a preset reasonable range, the region is finally confirmed as a true quality defect region from a geometrical perspective, and the quality defect location information is generated.

[0058] This embodiment overcomes the false detections that may result from judging a single texture feature by cross-validating color and gradient information, significantly improving the accuracy and reliability of defect identification. Furthermore, by simultaneously observing texture coherence, color consistency, and edge smoothness, it achieves intelligent decision-making through multi-evidence fusion, moving beyond single-indicator alarms.

[0059] In one embodiment, please refer to Figure 7The process involves extracting local features of the defect area based on the location of the quality defect, analyzing the texture consistency and color component differences of adjacent sub-blocks based on these local features, and outputting the defect location coordinates and a comprehensive quality rating. This includes: Step 701: Based on the location of the quality defect, extract the local texture features and color component information of the defect area to obtain the local features of the location of the quality defect; Step 702: Based on the local features, analyze the texture consistency difference and color component difference between adjacent sub-blocks to obtain a comprehensive difference value. If the comprehensive difference value exceeds a preset threshold, determine that the corresponding sub-block is a potential quality defect area and output the defect location coordinates of the quality defect area. Step 703: Based on the defect location coordinates and combined with the feature description of the normal area, generate a quality anomaly distribution map of the particle surface, wherein the quality anomaly distribution map includes the distribution of the quality defect area; Step 704: Based on the quality anomaly distribution map, calculate the proportion and distribution density of the quality defect area, and based on the proportion and distribution density, combined with the running speed parameters of the conveyor belt, determine the uniformity index of the batch of fertilizer particles. Step 705: Based on the uniformity index, combined with the proportion and the distribution density, perform a quality assessment on the quality defect area to determine the comprehensive quality rating.

[0060] This step aims to achieve refined quantification of defects and an overall assessment of the quality of the entire batch of particles. First, based on the location of the quality defect, local texture features and color component information within the defect area are extracted to construct a set of local features characterizing the defect's attributes. Then, for these local features, the differences in texture consistency and color components between the defect area and adjacent normal sub-blocks are analyzed, and these two differences are merged into a comprehensive difference value. If this value exceeds a preset threshold that can be dynamically adjusted according to production standards, the precise coordinates of the corresponding sub-block are confirmed as the quality defect area, yielding the defect location coordinates.

[0061] After obtaining the coordinates of all defect locations, these coordinates are integrated with the feature descriptions of normal areas to generate a quality anomaly distribution map on the particle surface. This quality anomaly distribution map reflects the aggregation state, dispersion, and relative positional relationship of defects to normal areas. Furthermore, based on this quality anomaly distribution map, the area (or number) proportion of quality defect regions in the entire batch of samples and their spatial distribution density are calculated.

[0062] Next, the obtained static defect statistics are combined with dynamic production parameters, namely the conveyor belt speed. By considering the overall proportion, distribution density, and operating speed, a batch uniformity index is calculated, reflecting the distribution of defects across two dimensions: time and space. This uniformity index is a key indicator for assessing production consistency and stability. Finally, based on this uniformity index, combined with the defect proportion and distribution density, a multi-level quality assessment model is constructed. This quality assessment model not only determines the severity of individual defects but also comprehensively evaluates the batch product quality consistency, the scope of defect impact, and the stability of the production process, thereby outputting a comprehensive quality rating to provide a basis for production decisions.

[0063] In this embodiment, defect statistics (proportion, density) obtained from static image analysis are combined with dynamic parameters (running speed) of the production line to generate a uniformity index that is more practically meaningful for production guidance, making quality assessment more in line with the real scenario of continuous production.

[0064] The following describes a fertilizer detection system provided by the present invention. The fertilizer detection system described below and the fertilizer detection method described above can be referred to in correspondence.

[0065] This invention also provides a fertilizer detection system, comprising: The image acquisition module is used to acquire the original image sequence of fertilizer particles on the conveyor belt, and based on the original image sequence, to segment multiple local region image blocks using a multi-scale sliding window method, and to separate each local region image block to obtain hue, saturation and brightness components, thereby obtaining initial visual component data. The adjustment module is used to adjust the average brightness of the local region image block using a preset illumination compensation model to obtain adjusted image feature data. The merging module is used to extract the contrast features and entropy distribution of local regions based on the initial visual component data using the gray-level co-occurrence matrix, merge the adjusted image feature data with the contrast features and the entropy distribution to obtain a high-dimensional joint feature vector, and compress the high-dimensional joint feature vector using the kernel principal component analysis method to determine the dimensionality-reduced particle feature representation. The distribution frequency determination module is used to determine the gradient direction distribution frequency in a local region by using an image gradient operator to obtain the intensity change of the particle edge region based on the dimensionality-reduced particle feature representation. The continuity distribution determination module is used to divide the particle edge region into multiple comparison analysis sub-blocks, and based on the comparison analysis sub-blocks, use Euclidean distance to evaluate the texture consistency difference between adjacent sub-blocks to obtain the texture continuity distribution of the edge region; The defect location determination module is used to determine the smoothness of the edge region based on the texture continuity distribution and the gradient direction distribution frequency. If the smoothness exceeds a preset threshold, the corresponding region is marked as an abnormal region, and the quality defect location of the abnormal region is determined. The quality analysis module is used to compare the abnormal area corresponding to the quality defect location with the normal area to extract the local features of the abnormal area, and based on the local features, analyze the texture consistency and color component differences of adjacent sub-blocks, and output the defect location coordinates and comprehensive quality rating.

[0066] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting chemical fertilizers, characterized in that, Executed by a computer, including: The original image sequence of fertilizer particles on the conveyor belt is obtained, and based on the original image sequence, a multi-scale sliding window method is used to segment multiple local region image blocks. Each local region image block is separated to obtain hue, saturation and brightness components, and the initial visual component data is obtained. Based on the local image patch, the average brightness is adjusted using a preset illumination compensation model to obtain the adjusted image feature data; Based on the initial visual component data, the contrast features and entropy distribution of the local region are extracted using the gray-level co-occurrence matrix. The adjusted image feature data is then merged with the contrast features and the entropy distribution to obtain a high-dimensional joint feature vector. Based on the high-dimensional joint feature vector, the kernel principal component analysis method is used for compression to determine the dimensionality-reduced particle feature representation. Based on the reduced particle feature representation, an image gradient operator is used to obtain the intensity change of the particle edge region and determine the gradient direction distribution frequency in the local region. Based on the gradient direction distribution frequency, the particle edge region is divided into multiple comparative analysis sub-blocks, and based on the comparative analysis sub-blocks, the Euclidean distance is used to evaluate the texture consistency difference between adjacent sub-blocks to obtain the texture continuity distribution of the edge region. Based on the texture continuity distribution and the gradient direction distribution frequency, the smoothness of the edge region is determined. If the smoothness exceeds a preset threshold, the corresponding region is marked as an abnormal region, and the location of the quality defect in the abnormal region is determined. The abnormal region corresponding to the quality defect location is compared with the normal region to extract the local features of the abnormal region. Based on the local features, the texture consistency and color component differences of adjacent sub-blocks are analyzed, and the defect location coordinates and comprehensive quality rating are output.

2. The method for detecting fertilizer according to claim 1, characterized in that, The step of adjusting the average brightness of the image based on the local region image patch using a preset illumination compensation model to obtain adjusted image feature data includes: Based on the local image patch, the average brightness is adjusted using a preset illumination compensation model to obtain preliminarily adjusted image data; Based on the initially adjusted image data, the hue, saturation, and luminance components are separated to obtain component data; Based on the component data, the brightness of a local area is determined. If the brightness of the local area exceeds a preset range, the range of areas to be processed is determined based on the brightness of the local area and the preset range. Based on the aforementioned region, a bilateral filtering method is used to smooth high-frequency noise, resulting in smoothed image data. The target brightness component and edge intensity information are extracted from the smoothed image data. If residual noise is detected in the smoothed image data based on the target brightness component and the edge intensity information, the region is smoothed a second time to obtain the adjusted image feature data.

3. The method for detecting fertilizer according to claim 1, characterized in that, The process of merging the adjusted image feature data with the contrast features and the entropy distribution to obtain a high-dimensional joint feature vector, and then using kernel principal component analysis to compress the high-dimensional joint feature vector to determine the dimensionality-reduced particle feature representation, includes: The adjusted image feature data is normalized to obtain standardized image feature data; Based on the initial visual component data, the contrast features and entropy distribution are calculated using the gray-level co-occurrence matrix method to obtain the texture-related data representation. The standardized image feature data and the texture-related data representation are concatenated to form a high-dimensional joint feature vector containing multi-dimensional information. Based on the high-dimensional joint feature vector, the kernel principal component analysis method is used for compression processing to determine the feature set after dimensionality reduction. If the contribution rate of a component in the dimensionality-reduced feature set is lower than a preset threshold, then the component in the dimensionality-reduced feature set that is lower than the preset threshold is removed to obtain a simplified feature representation. The simplified feature representation is standardized to obtain the dimensionality-reduced particle feature representation.

4. The method for detecting fertilizer according to claim 1, characterized in that, The step of using the reduced-dimensional particle feature representation and employing an image gradient operator to obtain the intensity changes of particle edges and determine the gradient direction distribution frequency within a local region includes: Based on the dimensionality-reduced particle feature representation, the dimensionality-reduced particle feature data is processed using an image gradient operator to obtain the intensity change information of the particle edges; Based on the intensity change information, the preliminary division range of the edge region is determined; Based on the preliminary division of the edge region, the gradient direction distribution within the local region is constructed; Based on the gradient direction distribution, a statistical method is used to generate the gradient direction distribution frequency within the local region.

5. The method for detecting fertilizer according to claim 1, characterized in that, The process involves dividing the particle edge region into multiple contrast analysis sub-blocks based on the gradient direction distribution frequency, and using Euclidean distance to evaluate the texture consistency differences between adjacent sub-blocks based on these contrast analysis sub-blocks, thereby obtaining the texture continuity distribution of the edge region. This includes: Based on the gradient direction distribution frequency, the particle edge region is divided into multiple contrast analysis sub-block units, and based on the contrast analysis sub-blocks, the texture feature data within each sub-block is obtained; Based on the texture feature data, the Euclidean distance is used to calculate the texture consistency difference between adjacent sub-blocks, and the degree of consistency distribution is determined. Based on the stated degree value, the texture continuity characteristics of each sub-block within the edge region are analyzed to determine the overall mapping data of the continuous distribution. Based on the continuous distribution of the overall mapping data, combined with the dimensionality-reduced particle feature representation, the particle edge texture description result is determined. Based on the particle edge texture description results, a depth analysis is performed on the particle edge region to determine the variation trend of particle features among different sub-blocks, and the texture continuity distribution of the edge region is determined based on the variation trend.

6. The method for detecting fertilizer according to claim 1, characterized in that, Based on the texture continuity distribution and the gradient direction distribution frequency, the smoothness of the edge region is determined. If the smoothness exceeds a preset threshold, the corresponding region is marked as an abnormal region, and the location of the quality defect in the abnormal region is determined, including: Based on the texture continuity distribution, the gradient direction of each sub-block is analyzed and the frequency distribution characteristics of the gradient direction are calculated to determine the smoothness of the edge region; If the smoothness exceeds a preset threshold, the corresponding region is marked as an abnormal region, and a preliminary set of labels for the abnormal regions is generated. Based on the initial annotation set, combined with the color distribution data of adjacent sub-blocks, the contrast features of color distribution are extracted, and based on the contrast features, it is determined whether the abnormal area meets the preset color anomaly conditions, and the color verification result is output. Based on the color verification results, the gradient characteristics of the abnormal region are obtained; If the difference between the gradient characteristics and the gradient characteristics of the adjacent regions is greater than a preset difference range, then the abnormal region is confirmed as a quality defect region, and the quality defect location of the quality defect region is generated.

7. The method for detecting fertilizer according to claim 1, characterized in that, Based on the location of the quality defect, local features of the defect area are extracted, and based on these local features, the texture consistency and color component differences of adjacent sub-blocks are analyzed. The defect location coordinates and a comprehensive quality rating are then output, including: Based on the location of the quality defect, local texture features and color component information of the defect area are extracted to obtain the local features of the quality defect location; Based on the local features, the differences in texture consistency and color components between adjacent sub-blocks are analyzed to obtain a comprehensive difference value. If the comprehensive difference value exceeds a preset threshold, the corresponding sub-block is determined to be a potential quality defect area, and the defect location coordinates of the quality defect area are output. Based on the coordinates of the defect location and combined with the feature description of the normal area, a quality anomaly distribution map of the particle surface is generated, wherein the quality anomaly distribution map includes the distribution of the quality defect area; Based on the quality anomaly distribution map, the proportion and distribution density of the quality defect area are calculated, and based on the proportion and distribution density, combined with the running speed parameter of the conveyor belt, the uniformity index of the batch fertilizer particles is determined. Based on the uniformity index, combined with the proportion and the distribution density, the quality defect area is assessed to determine the comprehensive quality rating.

8. A fertilizer detection system, characterized in that, include: The image acquisition module is used to acquire the original image sequence of fertilizer particles on the conveyor belt, and based on the original image sequence, to segment multiple local region image blocks using a multi-scale sliding window method, and to separate each local region image block to obtain hue, saturation and brightness components, thereby obtaining initial visual component data. The adjustment module is used to adjust the average brightness of the local region image block using a preset illumination compensation model to obtain adjusted image feature data. The merging module is used to extract the contrast features and entropy distribution of local regions based on the initial visual component data using the gray-level co-occurrence matrix, merge the adjusted image feature data with the contrast features and the entropy distribution to obtain a high-dimensional joint feature vector, and compress the high-dimensional joint feature vector using the kernel principal component analysis method to determine the dimensionality-reduced particle feature representation. The distribution frequency determination module is used to determine the gradient direction distribution frequency in a local region by using an image gradient operator to obtain the intensity change of the particle edge region based on the dimensionality-reduced particle feature representation. The continuity distribution determination module is used to divide the particle edge region into multiple comparison analysis sub-blocks, and based on the comparison analysis sub-blocks, use Euclidean distance to evaluate the texture consistency difference between adjacent sub-blocks to obtain the texture continuity distribution of the edge region; The defect location determination module is used to determine the smoothness of the edge region based on the texture continuity distribution and the gradient direction distribution frequency. If the smoothness exceeds a preset threshold, the corresponding region is marked as an abnormal region, and the quality defect location of the abnormal region is determined. The quality analysis module is used to compare the abnormal area corresponding to the quality defect location with the normal area to extract the local features of the abnormal area, and based on the local features, analyze the texture consistency and color component differences of adjacent sub-blocks, and output the defect location coordinates and comprehensive quality rating.