A method and system for detecting surface anomalies in pigs based on 3D point cloud analysis

By using multi-view 3D point cloud acquisition and precise registration technology, combined with local features and historical thresholds, the problems of illumination and non-rigid motion in the detection of surface anomalies in pigs were solved, achieving highly stable and efficient anomaly detection.

CN123118495APending Publication Date: 2026-11-17HEFEI LASSETER ROBOT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611276337.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-21
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing technologies are susceptible to the effects of light, shadow, stains and color differences in detecting surface anomalies in pigs, and they are difficult to handle the non-rigid movements and local mismatches of pigs, resulting in insufficient detection stability.

Method used

The system employs multi-view 3D point cloud acquisition, marker-assisted registration, nearest-point iterative fine registration, local non-rigid correction, missing point confidence completion, and fusion of geometric features and deep hierarchical features. Combined with local normal surface statistical distribution and historical thresholds, it performs anomaly judgment and classification.

Benefits of technology

It improves the stability and accuracy of detecting surface abnormalities in pigs, reduces the false detection rate, and increases detection efficiency and automation, adapting to the detection needs of pigs of different breeds, sizes, and growth stages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123118495A_ABST
    Figure CN123118495A_ABST
Patent Text Reader

Abstract

This application discloses a method and system for detecting surface anomalies in pigs based on 3D point cloud analysis. The method acquires multi-view 3D point cloud data of pigs, performs time synchronization, background separation, noise removal, marker-assisted initial registration, and nearest-point iterative fine registration on the point cloud to reconstruct a complete point cloud model of the pig. Subsequently, it extracts features such as curvature, normal vector change, surface concavity / convexity, height deviation, point density change, and depth level features, and determines suspected abnormal regions based on local adaptive thresholds. This application also addresses non-rigid registration errors caused by pig movement, missing points caused by occlusion, and threshold drift caused by differences in pig body size, making the detection process suitable for continuous channel-type detection scenarios in large-scale farms. This method can reduce the impact of lighting, shadows, and surface color differences on the detection results, improving the accuracy of identifying surface anomalies such as scars, rashes, ulcers, and swelling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of anomaly detection technology, specifically to a method and system for detecting surface anomalies in pigs based on three-dimensional point cloud analysis. Background Technology

[0002] In large-scale pig farms, wounds, ulcers, papules, swelling, and abnormal protrusions on the skin of pigs are important external manifestations of disease, fighting injuries, parasite infections, or abnormal feeding environments. Current detection methods mainly rely on manual inspections, requiring personnel to observe the pigs' physical condition in the pigpen and judge for abnormalities based on experience. This method is greatly affected by personnel experience, observation angle, pig activity levels, and lighting conditions in the pigpen, and is prone to missed or delayed detection when there are many pigs.

[0003] Existing image detection schemes mostly use two-dimensional images for surface anomaly identification. While two-dimensional images can reflect changes in color, texture, and brightness, they struggle to directly capture depth variations on the pig's surface. When anomalies manifest as slight bumps, shallow depressions, or localized swelling, color changes in two-dimensional images are not obvious, and detection results are easily affected by shadows, stains, skin color differences, fence occlusion, and camera exposure variations. Three-dimensional vision technology can acquire the spatial morphology of target surfaces and has been applied in pig body size measurement, weight estimation, and behavioral analysis. However, pigs are non-rigid living targets, exhibiting breathing, walking, head turning, tail wagging, and body twisting during data acquisition, making it difficult to maintain complete consistency between point clouds from multiple perspectives. Traditional nearest-point iterative registration is sensitive to initial positions, easily leading to local mismatches when the pig's surface has high similarity and lacks obvious geometric corners. Furthermore, existing point cloud processing methods are typically geared towards modeling general objects or body size measurement, lacking mechanisms for constructing local geometric features specific to pig surface anomalies, determining anomaly thresholds, reliably completing missing points, and post-segmentation classification, resulting in insufficient stability in real-world farm environments. Summary of the Invention

[0004] The purpose of this invention is to provide a method and system for detecting surface anomalies in pigs based on three-dimensional point cloud analysis, so as to solve the problems mentioned in the background art.

[0005] To achieve the above objectives, the present invention provides the following technical solution: On the one hand, the present invention provides a method for detecting surface anomalies in pigs based on three-dimensional point cloud analysis, comprising the following steps: S1. Collect multi-view 3D point cloud data of pigs, and perform background separation and noise removal on the multi-view point clouds; S2. Multi-view point cloud alignment is performed by using nearest-point iterative registration assisted by marker points to reconstruct a complete point cloud model of the pig body; S3. Extract local geometric features and depth-level features from the complete point cloud model; S4. Based on the features, determine the suspected abnormal regions and generate an abnormal region mask through a point cloud segmentation network; S5. Extract connected components and classify anomaly types from abnormal regions; S6. Output the location, type, and confidence level of the anomaly.

[0006] Specifically, the multi-view point cloud acquisition uses a depth camera array set on both sides and above the channel, with an acquisition frequency of 20 to 60 frames per second, and time synchronization is achieved through a synchronization trigger unit.

[0007] Specifically, pig body point cloud separation includes: initially removing background points based on spatial range, then using density clustering to select point cloud clusters that match the pig's size, shape, and number of points, and further using statistical outlier and radius outlier removal algorithms to eliminate noise.

[0008] Specifically, point cloud registration uses marker point matching to determine the initial pose. Then, marker point constraints and normal vector consistency constraints are added in the nearest point iteration. The pig body is divided into multiple local surface regions for local registration to reduce non-rigid motion errors.

[0009] Specifically, after the complete point cloud model is generated, the confidence level of the missing point regions is filled in. The confidence level of the filled points is determined by the missing width, boundary point density, view coverage, and curvature continuity. Low confidence points do not participate in anomaly classification.

[0010] Specifically, local geometric features include curvature, normal vector change, surface concavity / convexity, height deviation, and point density change. Depth-level features are obtained by a multi-scale point cloud feature extraction network. Anomaly detection thresholds are adaptively determined based on the statistical distribution of local normal surfaces and can be adjusted in conjunction with historical thresholds.

[0011] Specifically, suspected abnormal regions are finely segmented using a point cloud segmentation network. The network input consists of the 3D coordinates, geometric features, and depth-level features of each point, and the output is the point-by-point anomaly probability. The connected region area and boundary features are used to further filter out noise.

[0012] Specifically, the anomaly type classification uses a support vector classifier, a multilayer perceptron classifier, or a cascade of both. Based on the area, average curvature, maximum height deviation, intensity variance, texture entropy, and boundary irregularity of the candidate anomaly region, it outputs scars, rashes, ulcers, swelling, or normal false positives.

[0013] Specifically, the confidence level is jointly determined by the anomaly segmentation probability, anomaly type classification probability, candidate anomaly region point cloud completeness, viewpoint coverage quantity, and local feature differences. Short-term consistency verification is performed in consecutive frames to reduce false alarms due to motion or occlusion.

[0014] On the other hand, the present invention also provides a pig surface anomaly detection system that implements the above-described pig surface anomaly detection method based on three-dimensional point cloud analysis, comprising: The synchronous triggering unit is used to control the synchronous acquisition of data by each depth camera; The point cloud processing unit is used to complete point cloud separation, denoising, registration, reconstruction, and credibility completion for pig bodies; The anomaly analysis module is used to perform feature extraction, segmentation of suspected anomaly regions, classification of anomaly types, and confidence calculation. The data storage module is used to store the original point cloud, the reconstructed point cloud, the anomaly detection results, and the historical detection records; A visual interface is provided to display the location, type, confidence level, and treatment recommendations for abnormal pigs. The depth camera array includes a first depth camera located on the left side of the pig passage, a second depth camera located on the right side of the pig passage, and a third depth camera located above the pig passage. The first and second depth cameras are used to acquire point clouds of the pig's side, and the third depth camera is used to acquire point clouds of the pig's back. The anomaly analysis module also includes a historical comparison unit, which is used to align the currently detected abnormal area with the historical surface point cloud of the same pig, and to judge the development trend of the anomaly based on the changes in the area of ​​the abnormal area, the changes in the height of the protrusion, and the changes in the confidence level.

[0015] Compared with the prior art, the present invention has at least the following beneficial effects.

[0016] This application utilizes multi-view 3D point cloud acquisition, marker-assisted registration, nearest-point iterative fine registration, local non-rigid correction, confidence-based missing point completion, and fusion processing of geometric and depth-level features to directly acquire the 3D spatial morphological information of pig bodies. This overcomes the limitations of traditional 2D image detection, which is susceptible to effects from lighting, shadows, stains, and color differences. It exhibits higher recognition stability for surface abnormalities such as scars, rashes, ulcers, and swelling. Furthermore, this application determines the anomaly judgment threshold through the statistical distribution of local normal surfaces and calculates confidence levels by combining historical thresholds, point cloud completeness, viewpoint coverage, and short-term consistency verification. To meet the testing needs of pigs of different breeds, body sizes, growth stages, and sampling postures, this application reduces false detections caused by non-rigid movement, fence obstruction, local missing points, and single-frame noise. Furthermore, it employs a processing flow that first segments suspected abnormal areas and then classifies abnormality types, ensuring that abnormality localization and abnormality identification are independent yet mutually verified. This improves the detection accuracy of small-area abnormalities, multiple coexisting abnormalities, and abnormalities with irregular boundaries. A visual interface can output abnormality location, abnormality type, abnormal area, abnormality trend, and confidence level, thereby enhancing the automation, detection efficiency, and management timeliness of pig health inspections in large-scale farms. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart of the method of the present invention.

[0019] Figure 2 This is a flowchart illustrating the multi-view point cloud registration and reconstruction process of the present invention.

[0020] Figure 3 This is a schematic comparison module diagram illustrating the principle of abnormal point cloud detection on the surface of pigs according to the present invention.

[0021] Figure 4 This is a block diagram of the overall hardware and software system architecture for pig point cloud anomaly detection in this invention. Detailed Implementation

[0022] The present invention will be described in detail below with reference to specific embodiments. These embodiments are used to illustrate the technical solutions of the present invention and are not intended to limit the scope of protection of the present invention. Equivalent substitutions made to the threshold name, sampling window, iteration termination condition, data storage method, or display method without departing from the technical concept of the present invention should be included within the scope of protection of the present invention.

[0023] like Figures 1-4 As shown, this invention provides a method for detecting surface anomalies in pigs based on three-dimensional point cloud analysis, comprising the following steps: S1. Collect multi-view 3D point cloud data of pigs, and perform background separation and noise removal on the multi-view point clouds; S2. Multi-view point cloud alignment is performed by using nearest-point iterative registration assisted by marker points to reconstruct a complete point cloud model of the pig body; S3. Extract local geometric features and depth-level features from the complete point cloud model; S4. Based on the features, determine the suspected abnormal regions and generate an abnormal region mask through a point cloud segmentation network; S5. Extract connected components and classify anomaly types from abnormal regions; S6. Output the location, type, and confidence level of the anomaly.

[0024] Example 1: A multi-view point cloud reconstruction and surface anomaly detection method for pigs, based on 3D point cloud analysis, is applied to a scenario where a single pig sequentially passes through a detection channel. One depth camera is positioned on each side of the detection channel, and another depth camera is positioned above the channel. The fields of view of the three depth cameras cover the pig's back, left side, and right side. The optical axes of the two side depth cameras are tilted downwards at 30 degrees relative to the horizontal plane, while the optical axis of the upper depth camera points towards the center of the pig's back. The depth cameras are controlled by a synchronous triggering unit, acquiring multi-view 3D point cloud frames within the same acquisition cycle, at a rate of 30 frames per second. Each point cloud frame contains depth information, spatial coordinate information, and reflection intensity information. Before acquisition, a cube calibration object with known side lengths is used to calibrate the extrinsic parameters of each depth camera, ensuring that the point clouds from each viewpoint can be transformed to the same detection channel coordinate system.

[0025] In this process, after pigs enter the detection area, points on the ground, passage walls, and distant backgrounds are first removed based on the height and lateral ranges in the passage coordinate system. For the remaining point cloud, density clustering is used to form multiple point cloud clusters. During clustering, each point is identified as a core point if it has at least eight neighboring points within a 5-cm radius. Core points are connected to form point cloud clusters. The length, height, width, and number of points in a point cloud cluster are used to determine whether it is a pig's point cloud. Point cloud clusters with a length between 80cm and 220cm, a height between 30cm and 120cm, a width between 20cm and 80cm, and a number of points greater than 30,000 are retained as pig's point clouds. Points remaining on fences, feed trough edges, and the ground are discarded due to insufficient point counts or spatial proportions that do not conform to the pig's morphology.

[0026] Furthermore, the pig point cloud underwent two-stage denoising. The first stage involved statistical outlier removal. For each point, the 30 nearest neighboring points were selected, and the average distance between that point and these 30 neighbors was calculated. The mean and standard deviation of all average distances in the entire point cloud were then calculated. A point was identified as a statistical outlier if its average distance exceeded the mean plus twice the standard deviation. The second stage involved radius-based outlier removal. For each point, the number of neighboring points within a 3-centimeter radius was checked. If the number of neighboring points was less than 5, the point was identified as isolated noise. After these two stages of denoising, the remaining point cloud was used for registration and reconstruction.

[0027] In one example implementation, three circular reflective markers are temporarily placed on the back of the pig, spaced apart along the length of the pig's body, with a minimum distance of 15 cm between adjacent markers. In the point cloud from different viewpoints, the reflective markers appear as clusters of points with significantly higher intensity than the surrounding pig surface. The system first filters high-reflectivity points according to an intensity threshold, then fits the circular boundary to obtain the 3D center of each marker. Markers with the same spatial arrangement in different viewpoints are matched accordingly. After marker matching, initial rotation and translation relationships are calculated based on the positional differences between the centers of the corresponding markers, initially transforming the side and top point clouds to a unified coordinate system.

[0028] In this embodiment, after initial registration, nearest-point iteration is used for fine registration. During fine registration, for each point in the source point cloud, the point in the target point cloud that is closest and whose normal vector angle does not exceed 25 degrees is found as the corresponding point. In each iteration, the distance from the source point to the local tangent plane of the target point is calculated, and the distance between the centers of the marker points is also calculated simultaneously. If only ordinary point distances are relied upon, large smooth areas such as the flank of the pig's body are prone to slippage. Therefore, this embodiment uses the distance between the centers of the marker points as a constraint term to keep the registration process stable in overall posture. Iteration stops when the registration error decreases by less than 0.5 mm for two consecutive rounds, or when the number of iterations reaches 50. After stopping, the average overlap error between the multi-view point clouds is controlled within 5 mm.

[0029] Furthermore, due to the breathing and slight movement of pigs during data collection, directly registering the entire pig body as a rigid target would lead to local misalignment. This embodiment divides the pig's point cloud along the midline of the back into the head and neck region, forequarter region, mid-trunk region, hindquarter region, and rump region. Each region is further divided into local surface patches according to the left, back, and right sides. Local registration corrections are calculated independently for each local surface patch, and boundary points of adjacent patches share the same transition zone. Points within the transition zone receive different weights based on their distance from the centers of the adjacent patches; the closer a point is to the center of a patch, the greater its local correction impact. In this way, the local outward expansion caused by abdominal breathing will not be forcibly transmitted to the back region, and the head and neck point cloud shift caused by head turning will not disrupt the overall reconstruction of the trunk point cloud.

[0030] Optionally, after generating the complete point cloud model of the pig's body, the point cloud is subjected to surface meshing. During processing, a cross-section is first established every 2 cm along the length of the pig's body, and then surface sampling lines are formed on each cross-section from back to abdomen. For gaps between adjacent sampling lines, if the gap width is less than 6 cm and the angle between the normal vectors of the points on both sides of the gap is less than 30 degrees, the gap is considered to be caused by viewpoint occlusion or sparse point cloud, and confidence-based completion is allowed. The position of the completion point is determined by the local surface fitted by the observed points on both sides of the gap. The confidence of the completion point is jointly determined by the gap width, the density of points on both sides, the number of viewpoints covered, and the continuity of surface curvature. The smaller the gap width, the denser the points on both sides, the more viewpoints covered, and the more continuous the curvature, the higher the confidence. Completion points with a confidence level below 0.60 do not participate in anomaly classification and are only used to maintain surface display continuity.

[0031] In this embodiment, after reconstruction, the system calculates local geometric features for each point in the complete point cloud model of the pig. For curvature calculation, neighboring points within a radius of 2 to 4 cm are selected centered on the point to be calculated. Local surface fitting is performed on these neighboring points, and the curvature is determined based on the degree of local surface curvature. For normal vector change calculation, the normal vector of the point to be calculated is first determined, and then the average angle between the normal vector of the point to be calculated and the normal vectors of the neighboring points is calculated. The larger the average angle, the more drastic the surface orientation change in that area. For surface unevenness calculation, a local reference plane is first fitted among the neighboring points, and then the signed distance from the point to be calculated to this local reference plane is calculated. A positive distance with a large value indicates a local convexity, while a negative distance with a large absolute value indicates a local depression. Point density change is obtained by comparing the number of current neighboring points with the number of neighboring points on adjacent normal surfaces, and is used to identify abnormal morphologies caused by ulcer edges, scar fracture edges, and missing point clouds.

[0032] As a preferred embodiment, the local anomaly threshold is not based on a fixed empirical threshold, but is automatically determined by the local normal surface of the same pig. For each region to be detected, the system searches for a region within a 10-20 cm radius around it that has a continuous surface, low segmentation probability, no obvious missing parts, and stable point density as a local reference region. The distribution of curvature, height deviation, and intensity variation within the local reference region is then statistically analyzed, and the sum of the 95th percentile and 1.5 times the interquartile range is used as the anomaly judgment threshold for this feature. If at least two of the curvature, height deviation, and intensity variation of the region to be detected exceed the corresponding threshold, the region is marked as a suspected anomaly region. This threshold determination method allows the back, ventral side, and legs to use the reference distribution of their respective adjacent surfaces, avoiding deviations caused by the same fixed threshold in different locations.

[0033] In one alternative implementation, suspected anomalous regions are fed into a point cloud segmentation network for fine segmentation. The input to the point cloud segmentation network is the 3D coordinates, curvature, normal vector change, surface roughness, height deviation, point density change, and reflection intensity of each point. The network first extracts boundary details in a small neighborhood, then extracts the region morphology in a larger neighborhood, and finally fuses the shallow boundary information with the deep semantic information, outputting the probability that each point belongs to an anomalous region. Points with a probability greater than 0.50 are initially marked as anomalous points. Subsequently, connected component analysis is performed on the anomalous points, and connected components with an area less than 1 square centimeter and without continuous high-curvature boundaries around them are removed as noise.

[0034] Furthermore, the classification stage is performed on a per-connected-part basis. For each candidate anomaly region, the system calculates the region area, mean curvature, maximum height deviation, intensity variance, texture entropy, and boundary irregularity. Scars typically appear as elongated or strip-shaped areas with high boundary irregularity and some areas showing shallow depressions; rashes typically appear as multiple small raised or dot-like areas with increased local curvature but small height deviations; ulcers typically appear as local depressions accompanied by abrupt boundary changes; swelling typically appears as large areas with relatively smooth boundaries and consistently positive height deviations. The classifier outputs the anomaly type based on these features and combines the classification result with the segmentation probability to form the final confidence score.

[0035] Therefore, the method described in this application can output detection results within 3 to 5 seconds of a single pig passing through the detection channel. The output results include the location of the abnormal area on the pig model, the abnormality type, the abnormal area, the maximum depression or protrusion height, and the confidence level. For example, when there is a strip-shaped wound on the left side of the back, the system marks the area in the 3D pig model and outputs the wound category and corresponding confidence level; when there are multiple small papules on the ventral side, the system merges multiple adjacent small connected regions into the same abnormal event, avoiding splitting the same rash into multiple independent alarms.

[0036] Example 2: This embodiment addresses the local temporal correction of non-rigid movements in live pigs. Pigs do not pass through the detection channel in a stable posture, but rather pause, turn sideways, lower their heads, or sway slightly during the acquisition process. To reduce the impact of such movements on point cloud reconstruction, this embodiment adds a local temporal correction step to the existing embodiment. A depth camera continuously acquires multiple frames of point clouds, retaining at least 5 valid frames for each pig. The system first extracts the back midline, the highest point of the shoulder, and the highest point of the rump from each frame of point cloud, and then establishes a sequence of pig postures based on these structural points. Between adjacent frames, if the overall displacement of the back midline is less than 3 cm and the rotation angle is less than 8 degrees, the two frames are considered fusionable frames; frames exceeding this range are only used as supplementary observation frames and do not directly participate in the fusion of the complete model.

[0037] Local temporal correction does not treat the entire pig as a rigid body. The system divides the point cloud into multiple segments ranging from 10 to 20 centimeters in length along the length of the pig's body, and calculates the displacement and rotation of each segment relative to the reference frame. During calculation, points with stable curvature, high point density, and not belonging to suspected anomalous regions are first selected as stable points within the segment. Then, the local motion of the segment is determined based on the correspondence between stable points. Suspected anomalous regions are excluded from motion estimation to avoid misinterpreting wound edges, ulcer depressions, or swelling protrusions as posture changes.

[0038] Furthermore, the local motion of adjacent segments needs to meet smoothing constraints. When the local motion of a segment is significantly greater than that of the two adjacent segments, the system checks whether the segment has occlusion or insufficient point cloud data. If the number of valid points in the segment is less than 70% of the number of valid points in a normal segment, the motion of the segment is corrected by weighted average of adjacent segments; if the number of valid points meets the requirements, the motion of the segment is retained, indicating that a local sway or twist has indeed occurred in that area. Through this processing, the system can distinguish between true pose changes and misregistration caused by occlusion.

[0039] In some embodiments, the point cloud after local temporal correction is also used to establish a short-term health baseline. For five consecutive frames of point cloud data of the same pig, if a local region shows increased curvature or significant height deviation in at least four frames, the system considers it a stable anomaly candidate region; if an anomaly only appears in a single frame and is accompanied by a sudden drop in point density, the anomaly is downweighted. This method can reduce false alarms caused by pig hair reflection, water droplets, dust, or temporary occlusion by fences.

[0040] As shown above, this embodiment primarily addresses the issue of inconsistency in underlying data caused by the movement of live pigs. Traditional multi-view point cloud reconstruction typically assumes that the target remains stationary at the moment of acquisition, but this assumption is unstable in pig detection scenarios. This embodiment, through frame-by-frame filtering, local segment motion estimation, adjacent segment smoothing constraints, and short-term consistency verification, enables the reconstruction model to both preserve true surface anomalies and reduce false anomalies caused by non-rigid motion. This embodiment can serve as technical support for subsequent responses to review comments regarding the processing of non-rigid live point clouds.

[0041] Example 3: This embodiment presents an adaptive anomaly detection method for addressing local threshold drift. In this embodiment, pigs of different breeds, growth stages, and skin conditions exhibit significant surface differences. The same deviation in curvature or height may be considered normal skin undulation on the back of a piglet, but may indicate abnormal swelling on the abdomen of a finishing pig. To address the false detection problem caused by a fixed threshold, this embodiment establishes a locally adaptive threshold and an individual pig's historical threshold based on Embodiment 1.

[0042] The system first divides the pig's body surface into the back, left abdomen, right abdomen, rump, shoulder and neck, and adjacent limb regions. Local normal surface samples are then created for each region. The selection criteria for local normal surface samples include: an anomaly probability output by the segmentation network is below 0.20, point cloud integrity is above 0.85, local curvature is not located in the top 10% of the curvature distribution within the region, and there are no surrounding anomaly candidate regions larger than 2 square centimeters. Points meeting these criteria are included in the normal surface sample for that region.

[0043] As can be seen, in this embodiment, the threshold calculation uses the statistical distribution within the region rather than a fixed empirical value. Taking the curvature threshold as an example, the system first sorts the curvature of normal surface samples in the region from smallest to largest, takes the 95th percentile as the basic upper limit, then calculates the difference between the 75th percentile and the 25th percentile as the interquartile range, and finally adds 1.5 times the interquartile range to the basic upper limit as the curvature anomaly threshold. The height deviation threshold and intensity change threshold are determined in the same way. If the number of samples in the current region is less than 1000 points, the system expands the neighborhood range; if it is still insufficient after expansion, normal samples from symmetrical regions of the same pig are used to supplement it. For example, if there are insufficient samples from the left abdomen, samples from the right abdomen that meet the normal conditions are used in the calculation.

[0044] In addition, historical thresholds are used to account for individual differences among pigs. The system saves the normal surface distribution from the most recent 3 to 10 tests for each pig. When the quality of the current test is good and no large-scale abnormalities are found, the normal surface distribution is written into the history. In the next test, the current local threshold is compared with the historical local threshold; if the difference is less than 20%, the weighted result of the current threshold and the historical threshold is taken as the final threshold; if the difference is greater than 20%, the system checks for changes in sampling distance, missing point clouds, or water covering the pig's body surface, and lowers the confidence level of the current test. Thus, changes in the pig's body surface caused by natural growth can be gradually reflected in the threshold, while sudden sampling anomalies will not immediately change the threshold.

[0045] It should be noted that this application does not use a single feature exceeding a threshold as the final basis for anomaly determination. When the curvature exceeds the threshold but the height deviation and intensity change do not, the region is determined as a low-risk candidate region and enters the segmentation network for verification. When at least two of the curvature, height deviation, and intensity change exceed the threshold, the region directly enters the anomaly candidate region. When all three exceed the threshold and the connected area exceeds 3 square centimeters, the region is marked as a high-priority anomaly candidate region. This hierarchical method avoids alarms caused by single-point noise and can prioritize the detection of anomalies with larger areas or significant changes.

[0046] Therefore, in this embodiment, the local adaptive threshold and the historical threshold together solve the threshold drift problem caused by differences in pig size, breed, and changes in collection conditions. This embodiment is particularly suitable for scenarios involving mixed detection of multiple batches of pigs in large-scale farms, and can enhance the stability of the method when it migrates between different pig herds.

[0047] Example 4: This embodiment addresses the reliable completion and false alarm suppression of occlusion-related missing points. In pig passageways, occlusion factors such as fences, waterers, ear tags, tail swinging, or adjacent pigs approaching can cause partial missing point clouds on the body surface. Directly treating missing boundaries as anomalous boundaries can easily lead to misjudging occlusion as injuries or ulcers. To solve this problem, this embodiment adds missing point identification, reliable completion, and anomaly weighting processing after reconstruction.

[0048] In this embodiment, the system first identifies missing regions. If a region has consecutive missing points in the sampling grid on the pig's surface, and the number of view coverage points in the point cloud surrounding the missing region is less than 2, then the region is marked as a view missing region. If the point density at the boundary of the missing region drops sharply, but the curvature and normal vector changes of adjacent observed points remain gradual, then the region is determined to be occluded. If the curvature at the boundary of the missing region changes abruptly, the height deviation is obvious, and the position is stable in multiple consecutive frames, then the region is not directly identified as occlusion, but enters the anomaly candidate process.

[0049] Furthermore, reliable completion employs a local reference surface. The system selects a ring-shaped neighborhood with a width of 3 to 8 cm outside the boundary of the missing region, removes points marked as suspected anomalies, and then fits the remaining points to the local reference surface. Completion points are generated along the direction of the reference surface, with the completion spacing consistent with the average point distance of the surrounding point cloud. Each completed point is assigned a reliability score. The reliability score is determined by four factors: the width of the missing region, the density of boundary points, the number of adjacent viewpoints, and the smoothness of the surface. When the width of the missing region is less than 3 cm, the density of boundary points is not less than 80% of that of the surrounding normal region, the number of adjacent viewpoints is more than 2, and the surface is smooth, the reliability of the completed point is high; when the width of the missing region exceeds 8 cm or is inferred only from a single viewpoint, the reliability of the completed point is low.

[0050] In one optional implementation, the anomaly classifier receives completion confidence as input. If the proportion of low-confidence completion points in a candidate anomaly region exceeds 40%, the final confidence of the candidate anomaly region is reduced; if the boundary of the candidate anomaly region is mainly composed of real observation points, and the anomaly morphology remains stable in consecutive frames, the confidence of the region is not reduced due to local completion. For elongated defects formed by fence occlusion, the system identifies them based on their fixed position in the channel coordinate system and excludes such regions from the candidate regions for pig anomalies.

[0051] Therefore, the method of this application can avoid misjudging point cloud defects, fence obstructions, and insufficient viewing angles as abnormal pig skin, while not concealing real wounds, ulcers, or swelling. This embodiment enhances the applicability of this application in complex farm environments, and is particularly suitable for scenarios with a limited number of cameras, frequent changes in pig body posture, or obstructions in the passageway environment.

[0052] Example 5: In this embodiment of the application, after the detection system completes the anomaly classification, it maps the abnormal areas to a three-dimensional model of the pig's body. The three-dimensional model of the pig's body is marked with locations in the head and neck, back, left abdomen, right abdomen, rump, and adjacent areas of the limbs. Each abnormal area has a unique detection number, which corresponds to the abnormality type, abnormal area, maximum protrusion height or maximum depression depth, first detection time, current confidence level, and historical trend.

[0053] Additionally, when the abnormality type is a wound with an area exceeding 5 square centimeters, or when the abnormality type is swelling with a maximum protrusion height exceeding 8 millimeters, the system marks the abnormality as a high-priority event requiring manual review. When the abnormality type is a rash and the number of punctate abnormalities in the same area exceeds 5, the system marks it as a clustered skin abnormality. When the same pig shows an abnormality in the same location in two consecutive tests, and the abnormal area increases by more than 20%, the system outputs a warning of continued deterioration. The above rules are directly triggered by the test data and do not rely on subjective human judgment.

[0054] Optionally, when the system is deployed in the weighing channel, the pig's identification information is obtained by an electronic ear tag reader. The detection results are then written to the data storage module after being bound to the pig's identification information. Farmers can view a 3D model of the pig in a visual interface; abnormal areas are displayed in different colors and arranged from highest to lowest confidence. For low-confidence abnormalities, the interface displays a review suggestion; for high-confidence abnormalities, the interface displays isolation, observation, or treatment suggestions. These suggestions do not change the detection algorithm's judgment; they only serve as prompts for farm management.

[0055] As can be seen from the above, this application not only provides a point cloud algorithm processing flow, but also provides an implementation method that matches the hardware channels, data storage, and visualization interface of the aquaculture farm, enabling the detection results to directly serve aquaculture management. Through 3D point cloud reconstruction, local feature extraction, anomaly segmentation, anomaly classification, and confidence assessment, this application can form a complete closed loop from data acquisition to anomaly output.

[0056] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for detecting surface anomalies in pigs based on three-dimensional point cloud analysis, characterized in that, Includes the following steps: S1. Collect multi-view 3D point cloud data of pigs, and perform background separation and noise removal on the multi-view point clouds; S2. Multi-view point cloud alignment is performed by using nearest-point iterative registration assisted by marker points to reconstruct a complete point cloud model of the pig body; S3. Extract local geometric features and depth-level features from the complete point cloud model; S4. Based on the features, determine the suspected abnormal regions and generate an abnormal region mask through a point cloud segmentation network; S5. Extract connected components and classify anomaly types from abnormal regions; S6. Output the location, type, and confidence level of the anomaly.

2. The method for detecting surface anomalies in pigs based on three-dimensional point cloud analysis according to claim 1, characterized in that, The multi-view point cloud acquisition uses a depth camera array set on both sides and above the channel, with an acquisition frequency of 20 to 60 frames per second, and time synchronization is achieved through a synchronization trigger unit.

3. The method for detecting surface anomalies in pigs based on three-dimensional point cloud analysis according to claim 1, characterized in that, Pig body point cloud separation includes: initially removing background points based on spatial range, then using density clustering to select point cloud clusters that match the pig's size, shape, and number of points, and further using statistical outlier and radius outlier removal algorithms to eliminate noise.

4. The method for detecting surface anomalies in pigs based on three-dimensional point cloud analysis according to claim 1, characterized in that, Point cloud registration uses marker point matching for initial pose determination. Subsequently, marker point constraints and normal vector consistency constraints are added in the nearest point iteration. The pig body is divided into multiple local surface regions for local registration to reduce non-rigid motion errors.

5. The method for detecting surface anomalies in pigs based on three-dimensional point cloud analysis according to claim 1, characterized in that, After the complete point cloud model is generated, the confidence level of the missing point regions is filled in. The confidence level of the filled points is determined by the missing width, boundary point density, view coverage, and curvature continuity. Points with low confidence level do not participate in anomaly classification.

6. The method for detecting surface anomalies in pigs based on three-dimensional point cloud analysis according to claim 1, characterized in that, Local geometric features include curvature, normal vector change, surface concavity / convexity, height deviation, and point density change. Depth-level features are obtained by a multi-scale point cloud feature extraction network. The anomaly judgment threshold is adaptively determined based on the statistical distribution of the local normal surface and can be adjusted in conjunction with historical thresholds.

7. The method for detecting surface anomalies in pigs based on three-dimensional point cloud analysis according to claim 1, characterized in that, Suspected abnormal regions are finely segmented using a point cloud segmentation network. The network input consists of the 3D coordinates, geometric features, and depth-level features of each point. The output is the point-by-point anomaly probability, and the connected region area and boundary features are used to further filter out noise.

8. The method for detecting surface anomalies in pigs based on three-dimensional point cloud analysis according to claim 1, characterized in that, Anomaly type classification uses a support vector classifier, a multilayer perceptron classifier, or a cascade of both. Based on the area, average curvature, maximum height deviation, intensity variance, texture entropy, and boundary irregularity of the candidate anomaly region, it outputs scars, rashes, ulcers, swelling, or normal false positives.

9. The method for detecting surface anomalies in pigs based on three-dimensional point cloud analysis according to claim 1, characterized in that, The confidence level is jointly determined by the anomaly segmentation probability, anomaly type classification probability, candidate anomaly region point cloud completeness, viewpoint coverage quantity, and local feature differences. Short-term consistency verification is performed in consecutive frames to reduce false alarms due to motion or occlusion.

10. A pig surface anomaly detection system that implements the pig surface anomaly detection method based on three-dimensional point cloud analysis as described in claims 1 to 9, characterized in that, include: The synchronous triggering unit is used to control the synchronous acquisition of data by each depth camera; The point cloud processing unit is used to complete point cloud separation, denoising, registration, reconstruction, and credibility completion for pig bodies; The anomaly analysis module is used to perform feature extraction, segmentation of suspected anomaly regions, classification of anomaly types, and confidence calculation. The data storage module is used to store the original point cloud, the reconstructed point cloud, the anomaly detection results, and the historical detection records; A visual interface is provided to display the location, type, confidence level, and treatment recommendations for abnormal pigs. The depth camera array includes a first depth camera located on the left side of the pig passage, a second depth camera located on the right side of the pig passage, and a third depth camera located above the pig passage. The first and second depth cameras are used to acquire point clouds of the pig's side, and the third depth camera is used to acquire point clouds of the pig's back. The anomaly analysis module also includes a historical comparison unit, which is used to align the currently detected abnormal area with the historical surface point cloud of the same pig, and to judge the development trend of the anomaly based on the changes in the area of ​​the abnormal area, the changes in the height of the protrusion, and the changes in the confidence level.