Intelligent monitoring and analysis method for beef cattle intake based on video stream
By performing chroma space conversion and separating illumination components in video stream images, dividing overlapping blocks, setting local contrast limits, and combining color and texture threshold segmentation, the position of the cow's head is detected. This solves the problem of the impact of illumination changes and shadow interference on image segmentation and enables accurate monitoring of beef cattle feed intake.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INST OF ANIMAL SCI & VETERINARY HUBEI ACADEMY OF AGRI SCI
- Filing Date
- 2025-09-02
- Publication Date
- 2026-05-19
AI Technical Summary
Existing image analysis techniques are easily affected by changes in lighting, shadow interference, and background complexity when processing feed trough scenes, resulting in unstable image segmentation results and difficulty in accurately distinguishing feed from the environmental background. In particular, when the feed trough boundary is blurred or the cow's head is obscured, the segmentation and detection accuracy decreases.
By converting single-frame RGB images of beef cattle sheds in the video stream to logarithmic chromaticity space, separating the illumination and reflection components, generating shadow-suppressed feed trough images, dividing them into overlapping blocks, calculating enhancement priority score matrices, setting local contrast limits for blocks, and using adaptive histogram equalization to limit contrast amplitudes, regional enhanced feed images are obtained. These images are then segmented using color and texture thresholds, boundary coordinates are extracted, cattle head positions are detected, and feeding action feature vectors are established. Through feature vector serialization within a continuous time window, the feed intake index is calculated.
It improves the distinction between the feed area and the background, enhances the prominence of texture and boundary features within the area, enables precise detection of feeding behavior and accurate monitoring of feed intake, and reduces the impact of changes in lighting and shadow interference.
Smart Images

Figure CN121095200B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image analysis technology, and in particular to a method for intelligent monitoring and analysis of beef cattle feed intake based on video streams. Background Technology
[0002] Image analysis technology focuses on digital images and uses computer vision, pattern recognition, and image processing to detect, segment, and recognize structural features, texture features, color distribution, and motion information contained in images.
[0003] Image analysis techniques primarily rely on the direct detection and recognition of structural, textural, color, and motion features of images. However, when processing feed trough scenes, they are easily affected by changes in lighting, shadow interference, and background complexity, leading to unstable image segmentation results and difficulty in accurately distinguishing feed from the environmental background. Furthermore, existing feature extraction processes are mostly based on global features or single indicators, which can reduce segmentation and detection accuracy when feed trough boundaries are blurred or cattle heads are obscured. Therefore, improvements are needed. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of existing technologies and propose a method for intelligent monitoring and analysis of beef cattle feed intake based on video streams.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: a method for intelligent monitoring and analysis of beef cattle feed intake based on video streams, comprising the following steps:
[0006] The single-frame RGB image of the beef cattle shed in the video stream is converted to the logarithmic chromaticity space and separated into illumination and reflection components to obtain the shadow-suppressed feed trough image.
[0007] The shadow-suppressed feed trough image is divided into overlapping blocks, an enhancement priority score matrix is calculated and generated, and a contrast limit amplitude of local contrast limit adaptive histogram equalization is set for the corresponding block according to the enhancement priority score matrix to obtain the regional enhanced feed image.
[0008] Based on the enhanced feed image of the region, the feed trough area is segmented by setting color and texture thresholds, and the boundary coordinates are extracted to establish a segmented feed trough mask. In the region inside the segmented feed trough mask, the position of the beef cattle's head is detected to establish a feeding action feature vector.
[0009] Based on the feature vectors of multiple feeding actions collected within a continuous time window, a time-ordered texture descriptor sequence is obtained to determine whether the head of the beef cattle is within the feeding trough area, and the cumulative feed intake index is calculated.
[0010] Preferably, the step of acquiring the shadow-suppressed feed trough image is as follows:
[0011] Based on a single-frame RGB image of beef cattle shed, logarithmic transformation is performed on the three color channels pixel by pixel and chromaticity is normalized according to the channel intensity ratio. The intensity of each pixel is calculated, the intensity is labeled as illumination information, and the remaining ratio after chromaticity normalization is labeled as reflection information. The pixel correspondence at the channel level is maintained and the value range of boundary pixels is clipped to obtain the illumination component and reflection component.
[0012] Based on the illumination component and the reflection component, spatial weights and grayscale weights are set on the illumination component according to the pixel neighborhood radius and the absolute value of the grayscale difference, and bilateral filtering is performed to suppress local intensity fluctuations. On the reflection component, the local pixel variance is statistically calculated using a fixed-size sliding window, and the gain of the reflection component is adjusted and the value range is truncated according to the variance ratio to generate a smooth illumination component and a reflection component enhanced according to the local variance.
[0013] Based on the smoothed illumination component and the reflection component enhanced according to the local variance, the intensity and chromaticity pairing relationship in the logarithmic chromaticity space is recovered pixel by pixel, and channel-level exponential operation is performed to backmap to the RGB channel order. At the same time, overflow and overflow of out-of-bounds pixels are cropped while maintaining consistency with the input size to form a shadow-suppressed feeder image.
[0014] Preferably, the step of obtaining the enhanced priority score matrix is as follows:
[0015] Based on the shadow suppression feeder image, the entire image is slidably segmented according to a fixed window size and step size. The row and column coordinate indices and the coverage pixel range of each overlapping block are recorded. The pixel set and position index of all overlapping blocks are matched one by one to generate an overlapping block set.
[0016] Based on the set of overlapping blocks, a grayscale histogram is constructed for the pixel set of each overlapping block, and the entropy value is calculated and then normalized to obtain the local structure entropy value. At the same time, the corresponding region is extracted from the global saliency map, and the average saliency value is calculated and then normalized to obtain the visual saliency value. The block priority intensity value is calculated.
[0017] Based on the priority intensity values of all overlapping blocks, the priority intensity value of each overlapping block is written into a raster matrix with the same size as the shadow suppression feeder image according to the row and column coordinate index. The average value is taken for cases where the same pixel is covered by multiple overlapping blocks to eliminate redundancy accumulation, thereby generating an enhanced priority score matrix.
[0018] Preferably, the step of acquiring the region-enhanced feed image is as follows:
[0019] Based on the enhancement priority score matrix, first, the minimum and maximum values in the enhancement priority score matrix are counted. Then, the minimum to maximum values are divided into multiple continuous intervals according to a fixed number of segments. On each interval, the corresponding contrast limit amplitude of the local contrast limit adaptive histogram equalization is set. An equidistant mapping table from the intensity interval to the local contrast limit amplitude is established to obtain the local contrast limit amplitude matrix.
[0020] According to the local contrast limitation amplitude matrix, the corresponding pixel regions are extracted block by block in the shadow suppression feed trough image, the gray-level histogram of the pixel region is calculated and statistically analyzed, the histogram is truncated according to the local contrast limitation amplitude, and the truncated part is evenly distributed to each gray level to complete the redistribution process of histogram equalization, and a set of block-enhanced feed patches is obtained.
[0021] Based on the block-enhanced feed image set, the grid with the same size as the shadow suppression feed trough image is backfilled according to the coordinate order of each block. The average value is taken for cases where the same pixel is covered by multiple blocks to avoid cumulative deviation. Linear interpolation is used at the block edges to smooth pixel differences and generate a region-enhanced feed image.
[0022] Preferably, the step of obtaining the segmented feed trough mask is as follows:
[0023] Based on the enhanced feed image of the region, the pixel color distribution and texture gradient distribution are read sequentially according to the image range where the feed trough is located. The difference between the pixel color distribution and the color threshold is compared and the pixel index that meets the threshold is output. Then, the difference between the texture gradient distribution and the texture threshold is compared and the pixel index that meets the threshold is output. The intersection operation of the two types of indexes is performed to obtain the set of boundary points of the feed trough region. The row and column coordinates of the boundary point set are extracted to form a segmented feed trough mask.
[0024] Preferably, the step of obtaining the feeding action feature vector is as follows:
[0025] According to the segmented feed trough mask, the pixel area is scanned line by line inside the mask and the geometric shape of the connected area is detected. Candidate areas that conform to the outline of the beef cattle head are judged in the geometric shape. The candidate areas are smoothed by the outline boundary and filtered by the area to obtain the position of the beef cattle head.
[0026] Based on the location of the beef head, the pixel region of the beef head's snout is extracted, the second central moment of the region is calculated and the matrix result of the second central moment is recorded. At the same time, a gray-level co-occurrence matrix is constructed in the region and the statistical result of the gray-level co-occurrence matrix is recorded. The matrix result of the second central moment and the statistical result of the gray-level co-occurrence matrix are sequentially concatenated into a numerical sequence of fixed length to establish a feeding action feature vector.
[0027] Preferably, the step of obtaining the time-ordered texture descriptor sequence is as follows:
[0028] Based on multiple feeding action feature vectors collected within a continuous time window, the texture descriptor dimension component of each feeding action feature vector is extracted one by one, a one-to-one correspondence between time index and texture component is established, and they are combined into a texture descriptor sequence in chronological order to obtain a time-sorted texture descriptor sequence.
[0029] Preferably, the step of obtaining the cumulative food intake index is as follows:
[0030] Based on the time-sorted texture descriptor sequence, the difference between texture components under adjacent time indices is calculated one by one and a difference vector is generated. At the same time, the segmented feed trough mask is read and it is determined whether the head of the beef cattle is within the mask area. The determination result is written into the determination identifier sequence corresponding to the time index to obtain the perturbation difference record and the determination identifier sequence in the feed trough.
[0031] Based on the perturbation difference record and the judgment identifier sequence in the feed trough, the cumulative feed intake index is calculated.
[0032] Compared with the prior art, the advantages and positive effects of the present invention are as follows:
[0033] In this invention, by performing chromaticity space transformation and separating illumination and reflection components on a single frame of a cattle shed RGB image, shadow interference can be suppressed, making the feeding trough area appear more stable in the image. The shadow-suppressed feeding trough image is divided into overlapping blocks, and a priority matrix is generated by calculating local structural features and visual saliency features. This allows the local enhancement process to be adjusted based on actual feature distribution rather than a single global index, improving the flexibility and accuracy of contrast adjustment in local areas. Combined with the enhancement priority matrix, adaptive contrast limits are set for different blocks, improving the distinction between the feed area and the background, making texture and boundary features within the area more prominent. Based on the regionally enhanced image... By segmenting the feeding trough area and extracting boundary coordinates through color and texture thresholds, a more accurate feeding trough range is obtained. Within this range, the position of the cow's head is detected, making subsequent feeding behavior analysis more targeted. After detecting the cow's head, the second moment and gray-level co-occurrence matrix are extracted with the snout as the center and combined into a feature vector, which can capture the movement texture and geometric changes, enhancing the ability to represent subtle differences in feeding behavior. Through the serialization of multiple feature vectors within a continuous time window, the texture difference between adjacent time moments is calculated and cumulatively analyzed, establishing a quantitative expression of the intensity of feeding disturbance, which helps to stably detect continuous feeding behavior, thereby making the monitoring results of feed intake more accurate. Attached Figure Description
[0034] Figure 1 This is a schematic diagram of the steps of the present invention. Detailed Implementation
[0035] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0036] Please see Figure 1 This invention provides a technical solution: a method for intelligent monitoring and analysis of beef cattle feed intake based on video streams, comprising the following steps:
[0037] The single-frame RGB image of the beef cattle shed in the video stream is converted to the logarithmic chromaticity space and separated into illumination and reflection components to obtain the shadow-suppressed feed trough image.
[0038] The shadow-suppressed feed trough image is divided into overlapping blocks, an enhancement priority score matrix is calculated and generated, and the contrast limit amplitude of local contrast limit adaptive histogram equalization is set for the corresponding block based on the enhancement priority score matrix to obtain the regional enhanced feed image.
[0039] Based on the region-enhanced feed image, the feed trough area is segmented by setting color and texture thresholds, and the boundary coordinates are extracted to establish a segmented feed trough mask. Within the segmented feed trough mask, the position of the beef cattle's head is detected, and a feeding action feature vector is established.
[0040] Based on the feature vectors of multiple feeding actions collected within a continuous time window, a time-ordered texture descriptor sequence is obtained to determine whether the head of the beef cattle is within the feeding trough area, and the cumulative feed intake index is calculated.
[0041] The steps for obtaining the shadow-suppressed feed trough image are as follows:
[0042] Based on a single-frame RGB image of beef cattle shed, logarithmic transformation is performed on the three color channels pixel by pixel and chromaticity is normalized according to the channel intensity ratio. The intensity of each pixel is calculated, the intensity is labeled as illumination information, and the remaining ratio after chromaticity normalization is labeled as reflection information. The pixel correspondence at the channel level is maintained and the value range of boundary pixels is clipped to obtain the illumination component and reflection component.
[0043] Based on the illumination component and the reflection component, spatial weights and grayscale weights are set on the illumination component according to the pixel neighborhood radius and the absolute value of the grayscale difference, and bilateral filtering is performed to suppress local intensity fluctuations. On the reflection component, the local pixel variance is statistically calculated using a fixed-size sliding window, and the gain of the reflection component is adjusted and the value range is truncated according to the variance ratio to generate a smooth illumination component and a reflection component enhanced according to the local variance.
[0044] Based on the smoothed illumination component and the reflection component enhanced according to the local variance, the intensity and chromaticity pairing relationship in the logarithmic chromaticity space is recovered pixel by pixel, and channel-level exponential operation is performed to backmap to the RGB channel order. At the same time, overflow and overflow of out-of-bounds pixels are cropped while maintaining consistency with the input size, forming a shadow-suppressed feeder image.
[0045] Specifically, based on a single frame of a beef cattle shed RGB image, the R, G, and B color channel values of each pixel in the image are first logarithmically transformed. The specific transformation function is as follows: ,in This is the original pixel value of the channel. Adding 1 avoids calculations for values of zero. This transformation converts the multiplicative relationship between illumination and reflection into an additive one. Then, to separate illumination and reflection information, the illumination component of each pixel is calculated. This component is obtained by averaging the channel values after three logarithmic transformations. This average This is identified as illumination information, and then the calculated illumination component is subtracted from each logarithmically transformed channel value. This yields the reflection information for each channel; for example, the reflection information for the red channel is... The same process is applied to the green and blue channels to separate chromaticity information from luminance information. After separating illumination and reflection information, channel-level pixel correspondence is maintained. Specifically, two independent data structures are generated: one is a single-channel grayscale image, where the value of each pixel is equal to the corresponding illumination component. The other is a three-channel color image, where the R, G, and B values of the pixels correspond to the three calculated reflection information components. At the same time, value range clipping is performed on the pixels in the image boundary area. It checks whether all calculated illumination and reflection component values exceed the standard display range. For example, for an 8-bit image in the range of 0 to 255, any value less than 0 is forced to be 0, and any value greater than 255 is forced to be 255, thus obtaining the illumination and reflection components.
[0046] Based on the illumination and reflection components, bilateral filtering is applied to the illumination component image. For each pixel in the image, its new gray value is determined by the weighted average of its neighboring pixels. The weights are determined by two Gaussian functions: spatial distance and gray-level difference. The spatial weights are calculated based on the Euclidean distance between pixels, with a fixed neighborhood radius set, for example, a 7x7 pixel window as the neighborhood, corresponding to the spatial standard deviation. When set to 3, the grayscale weight is calculated based on the absolute value of the difference between the grayscale values of neighboring pixels and the center pixel, and the grayscale standard deviation. The setup references a calibration dataset containing 100 images of cattle sheds under different lighting conditions, and iteratively tests different... The value chosen minimizes the average gradient in the shadow area while maintaining the texture clarity of the feed area; this value was ultimately set to 50. Multiplying these two weights yields the final filter weights, completing the smoothing of the illumination component. Simultaneously, on the three-channel reflection component image, a fixed-size sliding window (e.g., 9x9 pixels) is used, traversing the entire image with a step size of 1 pixel. At each window position, the variance of all pixel values in the R, G, and B channels is independently calculated to obtain the local variance. Then, based on the ratio of the local variance to the pre-calculated global average variance of the entire reflection component image, the gain of the center pixel of the window is adjusted. The gain coefficient is calculated as follows: ,in It is the global standard deviation. It represents the local standard deviation, and 1.2 is the empirical enhancement coefficient, selected by comparing the clarity of feed texture before and after enhancement. To prevent the denominator from being a tiny constant, the original reflection component value is multiplied by this gain coefficient and then the value range is truncated. Values below 0 in the calculation result are corrected to 0, and values above 255 are corrected to 255, generating a smooth illumination component and a reflection component enhanced according to the local variance.
[0047] Based on the smoothed illumination component and the reflection component enhanced according to local variance, data reconstruction is performed on each pixel. The pixel value at the corresponding coordinate in the smoothed illumination component image is added one by one to the pixel values of the R, G, and B channels at the corresponding coordinate in the reflection component image enhanced according to local variance. This restores the intensity-chromaticity pairing relationship in the logarithmic color space. For example, for coordinates... The pixel whose new logarithmic space red channel value is ,in It is the smoothed illumination component value. This is the enhanced reflection component red channel value. The same operation is performed on the G and B channels. After pairing, channel-level exponential operations are performed on the recombined three-channel image to backmap the pixel values from logarithmic space to the original RGB color space. The inverse transform formula is: ,in It is the recombined logarithmic space channel value. This is the linear RGB space channel value after back-mapping. The subtraction operation corresponds to the initial logarithmic transformation of adding 1. Since the exponential operation and previous processing may cause the calculated pixel value to exceed the standard 8-bit image display range, i.e., the interval [0, 255], it is necessary to perform boundary clipping on all channel values of all pixels. Specifically, each calculated channel value is checked. If the value is less than 0, underflow clipping is performed and its value is set to 0. If the value is greater than 255, overflow clipping is performed and its value is set to 255. At the same time, it is ensured that the width and height of the output image are completely consistent with the size of the input single-frame beef cattle shed RGB image without any scaling or cropping, forming a shadow-suppressed feed trough image.
[0048] The steps to obtain the enhanced priority score matrix are as follows:
[0049] Based on the shadow suppression feeder image, the entire image is slidably segmented according to a fixed window size and step size. The row and column coordinate indices and the coverage pixel range of each overlapping block are recorded. The pixel set and position index of all overlapping blocks are matched one by one to generate an overlapping block set.
[0050] Based on the set of overlapping blocks, a grayscale histogram is constructed for the pixel set of each overlapping block, and the entropy value is calculated and normalized to obtain the local structure entropy value. Simultaneously, the corresponding region is extracted from the global saliency map, and the average saliency value is calculated and normalized to obtain the visual saliency value. The block priority intensity value is then calculated using the following formula:
[0051] ;
[0052] in, For the first The priority strength value of each overlapping block. For the first The normalized local structure entropy value of each overlapping block For the first Normalized visual saliency values of overlapping blocks The saliency modulation coefficient is used to modulate the amplification effect of visual saliency on the local structural entropy value. The basic saliency weight is used to ensure the independent contribution of visual saliency values to priority intensity values;
[0053] Based on the priority intensity values of all overlapping blocks, the priority intensity value of each overlapping block is written into a raster matrix with the same size as the shadow suppression feeder image according to the row and column coordinate index. The average value is taken for cases where the same pixel is covered by multiple overlapping blocks to eliminate redundancy accumulation, and an enhanced priority score matrix is generated.
[0054] Specifically, based on the shadow suppression feed trough image, a fixed window size of 64x64 pixels and a fixed step size of 32 pixels are set. This window size selection is based on statistical analysis of a large number of cattle shed monitoring videos. It was found that in typical feed trough images, the average size of feed texture units and unevenly lit shadow blocks is approximately 60x60 pixels. Therefore, a 64x64 pixel window can completely cover these feature areas. Simultaneously, the 32-pixel step size ensures a 50% overlap rate, providing a smooth transition between adjacent blocks and avoiding block effects. Then, starting from the top left corner of the image, i.e., coordinates (0, 0), a sliding segmentation operation is performed. The first block covers a pixel range of rows 0 to 63 and columns 0 to 63, with its row and column coordinate indices recorded as (0, 0). The second block moves one step to the right, covering a pixel range of rows 0 to 63 and columns 32 to 95, with its row and column coordinate indices recorded as (0, 0). 1) This process continues until the window slides to the rightmost edge of the image. Then, the window moves down one step, returning to the leftmost edge of the image, and begins a new row segmentation. For example, for a 1920x1080 image, the horizontal direction will be segmented into... Each block will be vertically divided into... There are 59 x 32 = 1888 overlapping blocks in total. For each segmented block, the RGB values of all the pixels contained therein, as well as its corresponding row and column coordinate indices (e.g., (row index, column index)), are stored as a data unit. Finally, the data units of all blocks are collected to generate an overlapping block set.
[0055] formula: The above formula dynamically calculates the enhancement priority of each image block by combining the complexity of the local structure with the visual saliency. Whether a region needs enhancement depends not only on its own information content (derived from the local structure entropy value) but also on its own information content. Its manifestation also depends on whether it is the visual focus in the entire scene (as determined by its visual salience value). (reflected) in the formula The term is used as a modulation factor, utilizing visual saliency values. local structural entropy value Enlarging the image means that the more visually important an area is, the higher the priority of its texture and detail will be. Controlling the intensity of this amplification, and The policy ensures that even if a region has little texture information (low entropy), it can still obtain a basic priority score as long as it is significant enough, thus preventing important but smooth regions from being ignored.
[0056] It is the first The normalized local structure entropy value of an overlapping block is obtained by first converting all pixels within the specified overlapping block from the RGB color space to the grayscale space, then counting the number of pixels at all grayscale levels from 0 to 255 within the block, constructing a grayscale histogram with 256 entries, and calculating the probability of each grayscale level based on the histogram. ,in It's grayscale, then the formula for calculating information entropy is used. Calculate the original entropy value of the block. This entropy value reflects the complexity of the texture within the block; the higher the entropy value, the richer the texture. Finally, to eliminate the influence of differences in entropy value ranges between different images, the entropy values of all blocks need to be normalized. First, calculate the maximum entropy value among all overlapping blocks in the entire image. and minimum value Then apply the minimum-maximum normalization formula. The entropy value is scaled to a range of 0 to 1. For example, if the original entropy value calculated in a block is 5.8, and the entropy value range of all blocks in the current image is [2.5, 7.5], then the normalized local structure entropy value of that block is... Calculated as .
[0057] It is the first The steps for obtaining the normalized visual saliency value of the overlapping blocks are as follows: First, a global saliency map of the entire shadow-suppressed feeder image needs to be generated. Here, the spectral residual method is used for calculation. This method analyzes the logarithmic spectrum of the image spectrum, subtracts its smoothed version to obtain the spectral residual, and then transforms it back to the spatial domain through inverse Fourier transform, thereby obtaining a saliency map that highlights abnormal or rare regions in the image. Each pixel value in this map represents its visual saliency level. After generating the global saliency map, for the first... For each overlapping block, the corresponding region in the global saliency map is extracted, and the average saliency value of all pixels within that region is calculated to obtain the original average saliency value of the block. Similar to the local structure entropy value, it is also necessary to normalize the average significance value of all blocks and calculate the maximum value among all blocks. and minimum value And apply the minimum-maximum normalization formula This maps values to a range of 0 to 1. For example, if the average saliency value of a block is calculated to be 120, and the average saliency value range of all blocks in the current image is [30, 200], then the normalized visual saliency value of that block is... Calculated as .
[0058] This is the saliency modulation coefficient. The coefficient is set based on a calibration dataset containing 500 images of cattle troughs under different lighting conditions, feed filling amounts, and cattle positions. For each image, three livestock experts manually labeled the areas most in need of contrast enhancement, such as areas with blurred textures but actually containing important feed. Then, the coefficient is set... The value range is [0, 5]. The test is performed by iterating through the data in increments of 0.1. For each... The algorithm calculates the enhancement priority score matrix for all images and performs subsequent region enhancement operations. Finally, it calculates the average local variance of the enhanced image within the expert-annotated regions, aiming to maximize this average local variance. The optimal value is determined by statistically analyzing all 500 images. The values are calculated, and their average value is taken as the final coefficient value. After the above calibration process, the final coefficient value is determined. The value is 2.8.
[0059] This is the basic significance weight; the setting of this coefficient is related to... The determination process is carried out in a coordinated manner, in the determination After setting it to 2.8, fix the value, and then set... The value range is [0, 2], and it is traversed with a step size of 0.1. The goal is to ensure that visually important regions with simple textures (low entropy) (such as a cow's nose suddenly protruding into a feeding trough) receive sufficient enhancement priority. The evaluation criteria are the decrease in the structural similarity index (SSIM) between the enhanced image and the original image in the expert-annotated "low entropy, high significance" region, and the contrast improvement ratio between the region and the surrounding background. A value is selected that results in a high contrast improvement ratio while reducing the SSIM by no less than 0.85. This value, in a way that improves the visibility of key areas without severely damaging the original structure, was ultimately determined after testing and weighing the calibration dataset. The value is 0.6.
[0060] Calculations based on parameters:
[0061] For a specific overlapping block Obtain its parameter values according to the aforementioned steps.
[0062] Normalized local structure entropy ,
[0063] Normalized visual saliency value ,
[0064] Significant modulation coefficient ,
[0065] Basic significance weight ,
[0066] Substitute these values into the formula,
[0067] ;
[0068] ;
[0069] ;
[0070] ;
[0071] ;
[0072] This result indicates that the first The priority intensity value of the overlapping block is 1.95744. This value combines the texture complexity and visual importance of the block. This score will be directly used in subsequent steps to determine the intensity of local contrast enhancement for the block. The higher the value, the more the block is judged to need enhancement, and the greater the contrast limit will be assigned. For example, if the priority intensity value is divided into 5 levels, a score close to 2.0 is mapped to the enhancement intensity of level 4 or 5, while a score below 0.5 is only assigned to the weak enhancement of level 1.
[0073] Based on the priority intensity values of all overlapping blocks, a two-dimensional raster matrix with the same width and height as the shadow suppression slot image is first initialized, with all elements initially set to 0. This matrix will serve as an accumulator to store the priority score for each pixel position. Next, each block in the previously generated set of overlapping blocks is traversed, and its row and column coordinate indices and calculated priority intensity values are read. For example, for row and column coordinate indices (m, n), the priority intensity value is... The block is defined to determine the range of pixels it covers in the original image, i.e., from the row... arrive , from column arrive The region is then assigned a priority strength value. The value is added to the current value at the corresponding pixel position in the raster matrix. Since there is overlap between blocks, a pixel may be covered by multiple blocks. For example, a pixel located in the center of the image may be covered by up to 4 blocks (top left, top right, bottom left, and bottom right) at the same time. Therefore, another counting matrix of the same size as the raster matrix is needed to record the number of times each pixel is covered. Whenever the priority intensity value of a block is accumulated to a certain area of the raster matrix, the element value in the corresponding counting matrix of that area is incremented by 1. After traversing all overlapping blocks and completing the accumulation, the raster matrix is averaged pixel by pixel. That is, the value of each element in the raster matrix is divided by the count value at the corresponding position in the counting matrix to obtain the final average priority score of the pixel, and an enhanced priority score matrix is generated.
[0074] The steps for acquiring region-enhanced feed images are as follows:
[0075] Based on the enhancement priority score matrix, the minimum and maximum values in the enhancement priority score matrix are first counted. Then, the minimum to maximum values are divided into multiple continuous intervals according to a fixed number of segments. On each interval, the corresponding contrast limit amplitude of the local contrast limit adaptive histogram equalization is set. An equidistant mapping table from the intensity interval to the local contrast limit amplitude is established to obtain the local contrast limit amplitude matrix.
[0076] Based on the local contrast limit amplitude matrix, the corresponding pixel regions are extracted block by block in the shadow suppression feed trough image, the gray-level histogram of the pixel region is calculated and statistically analyzed, the histogram is truncated according to the local contrast limit amplitude, and the truncated part is evenly distributed to each gray level to complete the redistribution process of histogram equalization, and a set of block-enhanced feed patches is obtained.
[0077] Based on the set of block-enhanced feed patches, the patches are backfilled into a grid with the same size as the shadow-suppressed feed trough image according to their coordinate order. The average value is taken when the same pixel is covered by multiple patches to avoid cumulative deviation. Linear interpolation is used at the patch edges to smooth pixel differences and generate a region-enhanced feed image.
[0078] Specifically, based on the enhanced priority score matrix, the process first iterates through all elements to determine its global minimum and maximum values. For example, after a full matrix scan, the minimum value is 0.15 and the maximum value is 2.10. Next, a fixed number of segments is set to 10. This value is determined after considering both the smoothness of the enhancement effect and computational efficiency. Too few segments would lead to abrupt changes in the enhancement magnitude, while too many would increase unnecessary computational complexity. Then, using the obtained minimum value of 0.15, maximum value of 2.10, and number of segments of 10, the entire priority score range is divided into 10 equal-width continuous intervals. The width of each interval is calculated as follows: The resulting intervals are [0.15, 0.345), [0.345, 0.540), up to [1.905, 2.10]. Then, corresponding local contrast limits are set for these 10 intervals using adaptive histogram equalization, with the limit range set to [1.5, 7.0]. The lowest limit of 1.5 is assigned to the interval with the lowest priority score, providing slight detail enhancement with almost no noise. The highest limit of 7.0 is assigned to the interval with the highest priority score, providing strong enhancement of texture details. This range [1.5, 7.0] was determined by testing 1000 sample images with different feed and lighting conditions, and by evaluating the naturalness and artifact levels of the enhanced image using an image quality assessment algorithm (such as BRISQUE). A linear mapping relationship is established between the limit range and the priority score interval. The limit range for each interval is calculated as follows: ,in Using the interval number from 1 to 10, an equidistant mapping table is established, containing 10 entries of intensity intervals to local contrast limit amplitudes. Finally, based on this mapping table and the original enhancement priority score matrix, a local contrast limit amplitude matrix with the same size as the original matrix is generated. Specifically, each pixel in the enhancement priority score matrix is traversed, its priority score is read, it is determined which interval the score belongs to, and then the contrast limit amplitude value corresponding to that interval is written into the same position in the new matrix to obtain the local contrast limit amplitude matrix.
[0079] Based on the local contrast constraint magnitude matrix, using the same 64x64 pixel window size and 32 pixel stride as when generating the overlapping block set, a sliding operation is performed on the shadow suppression feeder image. For each extracted 64x64 pixel region, firstly, the values corresponding to that region are extracted from the local contrast constraint magnitude matrix, and the average of these values is calculated. This average is used as the unique local contrast constraint magnitude for that pixel region. For example, the average constraint magnitude for a pixel region is 5.2. Next, the 64x64 pixel region is converted to a grayscale image, and its grayscale histogram of 4096 pixels is calculated. This histogram has 256 entries, corresponding to grayscale levels from 0 to 255. Subsequently, the truncation threshold of the histogram is calculated based on the local contrast constraint magnitude of 5.2. The calculation method is to multiply the constraint magnitude by the total number of pixels in the region and divide by the number of grayscale levels. The integer part is 83. This means that any pixel count value of any gray level in the histogram that exceeds 83 will be truncated to 83. For example, the original count value of gray level 120 is 110, so the excess part will be truncated to 83. 27 pixels will be temporarily removed. This truncation process is applied to all 256 gray levels. The total number of removed pixels is accumulated; for example, a total of 600 pixels are removed. Then, these 600 pixels are evenly redistributed among all 256 gray levels, with an additional [number] pixels added to each gray level. 1 pixel, the remaining The pixels are then assigned to the first 88 gray levels in sequence, with one more pixel added to each level. After the histogram redistribution process is completed, the cumulative distribution function is calculated based on this modified histogram, and the standard histogram equalization mapping relationship is applied to update the gray values of the original pixel regions to the enhanced values. Each enhanced patch and its original coordinate index are saved together to obtain a set of enhanced feed patches.
[0080] Based on the block-enhanced feed tile set, a blank image raster of the same size and data type (floating-point) as the shadow suppression feed trough image is first created. Simultaneously, another blank weight raster of the same size is created to record weights. All pixel values in both rasters are initialized to 0. Next, each 64x64 enhanced tile in the block-enhanced feed tile set is traversed, generating a corresponding 64x64 two-dimensional weight window for each tile. The weight distribution of this window uses a bilinear interpolation mode, with a weight of 1 at the center point, linearly decreasing towards the edges to near 0. Specifically, for any relative coordinate within the tile... (in The weights of pixels ranging from 0 to 63 are... Calculated as Then, using the original coordinate order of the patches as the basis for backfilling, each pixel value within a patch is multiplied by its corresponding weight value, and the result is accumulated at the corresponding position in the blank image raster. Simultaneously, the weight value of that pixel is also accumulated at the corresponding position in the blank weight raster. Since the patches overlap, a pixel position is accumulated by the data and weights of multiple patches. After all patches have been backfilled and accumulated, the image raster stores the weighted sum of pixel values for each pixel, while the weight raster stores the weight sum of each pixel. Finally, a pixel-by-pixel operation is performed on the image raster, dividing the value of each pixel by the weight sum of the corresponding position in the weight raster. Through this weighted averaging method, the pixel values of all overlapping areas are smoothly merged, effectively avoiding the block effect and cumulative deviation that may occur at the patch stitching points, generating a region-enhanced feed image.
[0081] The steps to obtain the segmented feed trough mask are as follows:
[0082] Based on the region-enhanced feed image, the pixel color distribution and texture gradient distribution are read sequentially according to the image range where the feed trough is located. The difference between the pixel color distribution and the color threshold is compared and the pixel index that meets the threshold is output. Then, the difference between the texture gradient distribution and the texture threshold is compared and the pixel index that meets the threshold is output. The intersection operation of the two types of indexes is performed to obtain the set of boundary points of the feed trough region. The row and column coordinates of the boundary point set are extracted to form the segmented feed trough mask.
[0083] Specifically, based on region-enhanced feed images, the approximate image range where the feed trough is located is first defined according to a preset region of interest (ROI). This range is usually manually defined by the operator during the initial system configuration. For example, in a 1920x1080 image, it is set to the area from pixel row 400 to 1080 and pixel column 0 to 1920. Then, within this range, the image is converted from the RGB color space to the HSV color space, and the values of its H (hue), S (saturation), and V (lightness) channels are read pixel by pixel to form color distribution information. Simultaneously, the values of the feed trough within this range are... The image is converted to grayscale, and the gradient of each pixel in the horizontal and vertical directions is calculated using the 3x3 Sobel operator. The gradient magnitude is then obtained by calculating the square root of the sum of the squares of the two gradients, forming the texture gradient distribution. Next, the HSV value of each pixel is compared with a preset color threshold. This color threshold is obtained by calibrating 100 images of feed troughs containing only feed under different lighting conditions. Specifically, the HSV values of feed pixels in all calibrated images are counted, and the mean and standard deviation of the H, S, and V channels are calculated. Finally, the color threshold is set to the range of H channel values in the [20, ... The S channel is in the range [40, 180], and the V channel is in the range [50, 220]. Pixels whose values for all three channels fall within this range are recorded. Simultaneously, the gradient magnitude of each pixel is compared with a texture threshold, which is set based on the prior knowledge that feed usually has richer texture than the feed trough wall. By analyzing the average gradient magnitude distribution of the feed area in the calibration image, the texture threshold is set to a gradient magnitude greater than 35. Pixels whose gradient magnitude meets this condition are also recorded. Finally, a logical AND operation is performed on the set of pixel indices filtered by the color threshold and the set of pixel indices filtered by the texture threshold to obtain the intersection of the two sets. The pixels in this intersection are considered to be the internal points of the feed trough area. A contour search algorithm is applied to these internal point sets to extract their outermost boundary, forming a segmented feed trough mask.
[0084] The steps for obtaining the feature vector of the feeding action are as follows:
[0085] Based on the segmented feed trough mask, the pixel region is scanned line by line inside the mask and the geometric shape of the connected region is detected. Candidate regions that conform to the outline of the beef cattle head are identified in the geometric shape. The candidate regions are smoothed by the outline boundary and filtered by the area to obtain the position of the beef cattle head.
[0086] Based on the location of the beef cattle's head, the pixel region of the snout area of the beef cattle's head is extracted, the second central moment of the region is calculated and the matrix result of the second central moment is recorded. At the same time, a gray-level co-occurrence matrix is constructed in the region and the statistical result of the gray-level co-occurrence matrix is recorded. The matrix result of the second central moment and the statistical result of the gray-level co-occurrence matrix are sequentially concatenated into a numerical sequence of fixed length to establish a feeding action feature vector.
[0087] Specifically, based on the segmented feed trough mask, a completely black background image with the same size as the original image is created. The pixels corresponding to the region inside the mask (i.e., the feed trough region) in the region-enhanced feed image are copied onto this new image. Then, within the mask region of the new image, the system scans row by row, starting from the first row, and applies a connected component labeling algorithm based on the two-pass method to detect all independent pixel clusters. For each detected connected component, a series of geometric parameters are calculated, including area (total number of pixels), perimeter, width and height of the minimum bounding rectangle, and convex hull area. These geometric parameters are then compared with a preset beef cattle head contour standard to filter candidate regions. This standard is based on statistical analysis of overhead images of 500 different cattle heads. The specific criteria obtained from the analysis are as follows: the area must be between 4000 and 25000 pixels, the aspect ratio (width of the minimum bounding rectangle divided by its height) must be between 0.6 and 1.4, and the density (area of the region divided by its convex hull area) must be greater than 0.88. A connected region is considered a candidate region only if it meets all three conditions. For all candidate regions that pass the screening, a Gaussian smoothing filter is applied to their contour boundaries, with a smoothing radius of 5 pixels to eliminate burrs caused by inaccurate segmentation. After smoothing, the area is screened again to remove regions whose area changes exceed ±10% of the original area due to smoothing. The geometric center coordinates of the finally retained regions are determined as the head position of the beef.
[0088] Based on the location of the cow's head, firstly, according to its geometric center and the size of its smallest bounding rectangle, the lower 40% of the rectangle is extracted as the pixel region of the cow's snout. This proportion is determined based on the general characteristics of the cow's head anatomy from a top-down view. Next, within this snout pixel region, the second-order central moment of its shape is calculated, specifically including... (Variance of pixel distribution in the x-direction) (Variance of pixel distribution in the y-direction) and (Covariance of pixels in the x and y directions), arrange these three moment values in order. The image is arranged to form a 3D shape description vector and recorded as the matrix result of the second-order central moments. At the same time, the image of the mouth and nose pixel region is converted into an 8-bit grayscale image, and its grayscale levels are quantized from 256 levels to 32 levels. Then, a gray-level co-occurrence matrix (GLCM) is constructed based on this quantized grayscale image. During construction, the distance between pixel pairs is set to 1, and the directions are 0 degrees, 45 degrees, 90 degrees and 135 degrees, thus obtaining four GLCMs. Five standard texture statistics are calculated for these four GLCMs: contrast, dissimilarity, homogeneity, energy and correlation. Then, the calculation results of each statistic in the four directions are averaged to obtain five final texture descriptors, which are recorded as the statistical results of the gray-level co-occurrence matrix. Finally, the matrix result of the 3D second-order central moments obtained above is sequentially concatenated with these five averaged texture descriptors to form a fixed-length 8-dimensional numerical sequence, which establishes the feeding action feature vector.
[0089] The steps to obtain the time-ordered texture descriptor sequence are as follows:
[0090] Based on multiple feeding action feature vectors collected within a continuous time window, the texture descriptor dimension component of each feeding action feature vector is extracted one by one. A one-to-one correspondence between the time index and the texture component is established, and the components are combined in chronological order to form a texture descriptor sequence, resulting in a time-sorted texture descriptor sequence.
[0091] Specifically, based on multiple feeding action feature vectors collected within a continuous time window, a fixed time window length is set, such as 60 seconds, and data is collected at a sampling interval of 1 second, thus obtaining 60 feeding action feature vectors within one window. For these 60 feature vectors arranged in chronological order, each vector is accessed sequentially, and the last 5 dimensions of each 8-dimensional vector are extracted, namely the five texture descriptor dimension components calculated from the gray-level co-occurrence matrix: contrast, dissimilarity, homogeneity, energy, and correlation. A one-to-one correspondence is established between each time point (from 1 second to 60 seconds) and the corresponding 5-dimensional texture component vector, forming a pairing list of time indexes and texture data. For example, the entry with time index t corresponds to a vector. Next, all texture component vectors in this pairing list are arranged and combined in ascending order of time index to form a 60x5 matrix. Each row of this matrix represents the texture state at a point in time, and each column represents the change of a texture feature over time. This matrix is the time-ordered texture descriptor sequence.
[0092] The steps to obtain the cumulative food intake index are as follows:
[0093] Based on the time-sorted texture descriptor sequence, the difference between texture components under adjacent time indices is calculated one by one and a difference vector is generated. At the same time, the segmented feed trough mask is read and it is determined whether the beef cattle head is within the mask area. The determination result is written into the determination identifier sequence corresponding to the time index to obtain the perturbation difference record and the determination identifier sequence in the feed trough.
[0094] Based on the perturbation difference record and the in-feeding trough identification sequence, the cumulative feed intake index is calculated using the following formula:
[0095] ;
[0096] ;
[0097] ;
[0098] in, For the first Instantaneous disturbance score for each time index, For the first A valid perturbation value with temporal memory for each time index. To calculate the cumulative food intake index, This represents the number of feature vectors representing feeding actions within a continuous time window. For the first The value of the determination flag in the feed trough corresponding to each time index is either one or zero. For the first The texture descriptor dimension of the time index is the first. Each component value For the first The texture descriptor dimension of the time index is the first. Each component value The number of components in the texture descriptor dimension. For the first The weights of each texture descriptor component, For perturbation sensitivity factor, For perturbation memory factors, It is the first Normalization factor for each texture descriptor component.
[0099] Specifically, based on the time-ordered sequence of texture descriptors, starting from time index t=2 and ending at the last index t=W (where W=60) of the time window, the difference between the texture component vector at the current time index t and the texture component vector at the previous time index t-1 is calculated element-wise. For example, the first component of the difference vector at time t is... The second component is This process continues, generating a 5-dimensional difference vector for each time point t (from 2 to 60). All these difference vectors constitute the perturbation difference record. Simultaneously, for each time index t (from 1 to 60), the segmentation trough mask corresponding to that time point is read, and the geometric center coordinates of the head position of the beef cattle detected at the same time point are obtained. Then, it is determined whether the center coordinate point falls within the area defined by the segmentation trough mask. If the coordinate point is within the mask area, the determination flag corresponding to that time index t is set to 1, indicating that the head of the cattle is in the trough. If the coordinate point is outside the mask area, the determination flag is set to 0, indicating that the head of the cattle is not in the trough. The determination results (0 or 1) of all time indices are arranged in chronological order to form a sequence of length 60, namely the trough determination flag sequence. Finally, the perturbation difference record and the trough determination flag sequence are obtained.
[0100] formula: ,
[0101] ,
[0102] ;
[0103] The above formula establishes a quantitative model to estimate the cumulative feed intake based on the changes in feed texture caused by the cow's head within the feeding trough area. It captures instantaneous feed disturbances by calculating the weighted and normalized difference between texture descriptors at adjacent time points, and then divides by a normalization factor. This converts the absolute changes in different texture features into dimensionless relative changes using a logarithmic function. The application of this method is to perform nonlinear compression on large relative changes, making their contribution to the total score more gradual, and avoiding the disproportionate impact of a single drastic action on the result. The formula... It is an exponential moving average model that incorporates the time-series memory effect, scoring the current instantaneous disturbance. Compared with historical effective perturbation values By employing weighted fusion, the assessment of foraging is made to reflect the intensity of foraging behavior over a period of time, rather than relying solely on the current moment.
[0104] It is the first The weights of each texture descriptor component are obtained as follows: Using a video dataset containing 20 different cattle, each feeding for one hour, accompanied by actual feed intake per minute recorded by a high-precision electronic scale as the ground truth, first, a time-sorted sequence of texture descriptors is calculated for all videos in the dataset. Then, for five texture descriptors (contrast, dissimilarity, homogeneity, energy, and correlation), Principal Component Analysis (PCA) is used to evaluate the contribution of each descriptor to distinguishing between "feeding" and "non-feeding" states (manually labeled). The absolute value of each descriptor's loading on the first principal component is used as its initial importance metric. Next, these importance metrics are normalized to a sum of 1, serving as the initial weights. Finally, gradient descent is used to fine-tune and optimize these weights, with the objective function being minimizing the mean square error between the calculated cumulative feed intake index and the actual feed intake. The resulting weight vector is: These correspond to contrast, dissimilarity, homogeneity, energy, and correlation, respectively.
[0105] It is the first The normalization factor for each texture descriptor component is obtained by selecting video clips from the video dataset with a total duration exceeding 10 hours, showing cattle near the feeding trough but not feeding (e.g., simply standing, watching, or drinking). For these "baseline" video clips, their temporally ordered texture descriptor sequences are calculated. Then, for each texture descriptor (u=1 to 5), the standard deviation of its temporal series across all baseline clips is calculated. This standard deviation reflects the natural fluctuation of the feature when there is no feeding activity and is used as the normalization factor for that feature. This method allows subsequent difference calculations to measure whether the variation exceeds the normal noise range. For example, after statistical analysis of the baseline data, the normalization factors (i.e., standard deviations) for the five texture descriptors are as follows: Contrast heterogeneity homogeneity ,energy Correlation .
[0106] This is the perturbation sensitivity factor, now a dimensionless global adjustment parameter used to adjust the system's overall sensitivity to normalized texture changes. Its value is determined through a calibration experiment. In the experiment, a known weight of feed sample (e.g., 10 grams) was prepared to simulate the feeding behavior of cattle. The feed was moved at different speeds and amplitudes, while video was recorded and the normalized texture change was calculated. The value range is set to [0.5, 5.0], and the test is performed in increments of 0.1. For each Value, calculate the instantaneous disturbance score caused by the stirring of 10 grams of feed. The average value, choose one The value is determined such that the average score is as close as possible to a preset target value (e.g., set to 1.0, representing a standard feeding unit). In this way, the calculated perturbation score is correlated with the actual physical perturbation amount. After calibration, the final value is determined. The value is 1.5.
[0107] It is the perturbation memory factor, which controls the rate at which historical perturbation information decays within the current valid perturbation value. Its value ranges from 0 to 1, with a smaller value being... A value of 0 indicates that historical information dominates, and the system responds slowly to instantaneous changes; conversely, a value of 0 indicates a faster response. The value was determined by analyzing the cattle's feeding rhythm. Cattle feeding is usually not an isolated action, but a series of continuous chewing and swallowing processes. Through observation of numerous feeding videos, a typical feeding cycle (from the time the cow's head enters the feed trough to the time it lifts it) was found to last an average of about 3-5 seconds. To determine the effective perturbation value... To smoothly reflect the activity intensity within this cycle, the half-life of the perturbation memory factor is set to approximately 2.5 seconds, based on the exponential decay half-life formula. And considering that the sampling interval is 1 second, it is possible to solve it in reverse. The value is calculated as follows: ,so ,therefore For ease of calculation, take .
[0108] Calculations based on parameters:
[0109] Set time window , The time index ranges from t=1 to 4.
[0110] Texture descriptor sequence as follows:
[0111] ;
[0112] ;
[0113] ;
[0114] ;
[0115] In-feed trough identification sequence for: ;
[0116] Time t=2:
[0117] ;
[0118] ;
[0119] ;
[0120] ;
[0121] ;
[0122] ;
[0123] ;
[0124] ;
[0125] , ;
[0126] Time t=3:
[0127] ;
[0128] ... (similar calculations)
[0129] ;
[0130] ;
[0131] Time t=4:
[0132] ;
[0133] ... (similar calculations)
[0134] ;
[0135] ;
[0136] Cumulative food intake index :
[0137] ;
[0138] ;
[0139] The results show that within the selected 4-second time window, the calculated cumulative feed intake index is 0.403. This is a dimensionless relative value, and its magnitude is proportional to the cattle's feeding intensity and duration. This index can be accumulated over longer time scales (such as one hour or one day) to obtain an indicator that reflects the cattle's total feed intake. For example, the C values calculated from all time windows within a day can be added together to obtain the daily cumulative feed intake index. If this index is consistently lower than the healthy feed intake benchmark value set by the ranch based on the cattle breed and growth stage (e.g., the daily index is lower than 70% of the average), the system can issue an early warning to alert ranch managers to pay attention to the cattle's health status.
[0140] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. A method for intelligent monitoring and analysis of beef cattle feed intake based on video stream, characterized in that, Includes the following steps: The single-frame RGB image of the beef cattle shed in the video stream is converted to the logarithmic chromaticity space and separated into illumination and reflection components to obtain the shadow-suppressed feed trough image. The shadow-suppressed feed trough image is divided into overlapping blocks, an enhancement priority score matrix is calculated and generated, and a contrast limit amplitude of local contrast limit adaptive histogram equalization is set for the corresponding block according to the enhancement priority score matrix to obtain the regional enhanced feed image. Based on the enhanced feed image of the region, the feed trough area is segmented by setting color and texture thresholds, and the boundary coordinates are extracted to establish a segmented feed trough mask. In the region inside the segmented feed trough mask, the position of the beef cattle's head is detected to establish a feeding action feature vector. Based on the feature vectors of multiple feeding actions collected within a continuous time window, a time-ordered texture descriptor sequence is obtained to determine whether the head of the beef cattle is within the feeding trough area and to calculate the cumulative feed intake index. The steps for obtaining the shadow-suppressed feed trough image are as follows: Based on a single-frame RGB image of beef cattle shed, logarithmic transformation is performed on the three color channels pixel by pixel and chromaticity is normalized according to the channel intensity ratio. The intensity of each pixel is calculated, the intensity is labeled as illumination information, and the remaining ratio after chromaticity normalization is labeled as reflection information. The pixel correspondence at the channel level is maintained and the value range of boundary pixels is clipped to obtain the illumination component and reflection component. Based on the illumination component and the reflection component, spatial weights and grayscale weights are set on the illumination component according to the pixel neighborhood radius and the absolute value of the grayscale difference, and bilateral filtering is performed to suppress local intensity fluctuations. On the reflection component, the local pixel variance is statistically calculated using a fixed-size sliding window, and the gain of the reflection component is adjusted and the value range is truncated according to the variance ratio to generate a smooth illumination component and a reflection component enhanced according to the local variance. Based on the smoothed illumination component and the reflection component enhanced according to the local variance, the intensity and chromaticity pairing relationship in the logarithmic chromaticity space is recovered pixel by pixel and channel-level exponential operation is performed to backmap to the RGB channel order. At the same time, overflow and overflow of out-of-bounds pixels are cropped and kept consistent with the input size to form a shadow-suppressed feeder image. The steps for obtaining the enhanced priority score matrix are as follows: Based on the shadow suppression feeder image, the entire image is slidably segmented according to a fixed window size and step size. The row and column coordinate indices and the coverage pixel range of each overlapping block are recorded. The pixel set and position index of all overlapping blocks are matched one by one to generate an overlapping block set. Based on the set of overlapping blocks, a grayscale histogram is constructed for the pixel set of each overlapping block, and the entropy value is calculated and normalized to obtain the local structure entropy value. Simultaneously, the corresponding region is extracted from the global saliency map, and the average saliency value is calculated and normalized to obtain the visual saliency value. The block priority intensity value is then calculated using the following formula: ; in, For the first The priority strength value of each overlapping block. For the first The normalized local structure entropy value of each overlapping block For the first Normalized visual saliency values of overlapping blocks For significant modulation coefficients, Basic significance weight; Based on the priority intensity values of all overlapping blocks, the priority intensity value of each overlapping block is written into a raster matrix with the same size as the shadow suppression feeder image according to the row and column coordinate index. The average value is taken for cases where the same pixel is covered by multiple overlapping blocks to eliminate redundancy accumulation, and an enhanced priority score matrix is generated. The steps for acquiring the region-enhanced feed image are as follows: Based on the enhancement priority score matrix, first, the minimum and maximum values in the enhancement priority score matrix are counted. Then, the minimum to maximum values are divided into multiple continuous intervals according to a fixed number of segments. On each interval, the corresponding contrast limit amplitude of the local contrast limit adaptive histogram equalization is set. An equidistant mapping table from the intensity interval to the local contrast limit amplitude is established to obtain the local contrast limit amplitude matrix. According to the local contrast limitation amplitude matrix, the corresponding pixel regions are extracted block by block in the shadow suppression feed trough image, the gray-level histogram of the pixel region is calculated and statistically analyzed, the histogram is truncated according to the local contrast limitation amplitude, and the truncated part is evenly distributed to each gray level to complete the redistribution process of histogram equalization, and a set of block-enhanced feed patches is obtained. Based on the block-enhanced feed image set, the grid with the same size as the shadow suppression feed trough image is backfilled according to the coordinate order of each block. The average value is taken for the case where the same pixel is covered by multiple blocks to avoid cumulative deviation. Linear interpolation is used at the block edges to smooth pixel differences and generate a region-enhanced feed image. The steps for obtaining the segmented feed trough mask are as follows: Based on the enhanced feed image of the region, the pixel color distribution and texture gradient distribution are read sequentially according to the image range where the feed trough is located. The difference between the pixel color distribution and the color threshold is compared and the pixel index that meets the threshold is output. Then the difference between the texture gradient distribution and the texture threshold is compared and the pixel index that meets the threshold is output. The intersection operation of the two types of indexes is performed to obtain the set of boundary points of the feed trough region. The row and column coordinates of the boundary point set are extracted to form a segmented feed trough mask. The steps for obtaining the feature vector of the feeding action are as follows: According to the segmented feed trough mask, the pixel area is scanned line by line inside the mask and the geometric shape of the connected area is detected. Candidate areas that conform to the outline of the beef cattle head are judged in the geometric shape. The candidate areas are smoothed by the outline boundary and filtered by the area to obtain the position of the beef cattle head. Based on the location of the beef head, the pixel region of the beef head's snout is extracted, the second central moment of the region is calculated and the matrix result of the second central moment is recorded. At the same time, a gray-level co-occurrence matrix is constructed in the region and the statistical result of the gray-level co-occurrence matrix is recorded. The matrix result of the second central moment and the statistical result of the gray-level co-occurrence matrix are sequentially concatenated into a numerical sequence of fixed length to establish a feeding action feature vector. The steps for obtaining the time-ordered texture descriptor sequence are as follows: Based on multiple feeding action feature vectors collected within a continuous time window, the texture descriptor dimension component of each feeding action feature vector is extracted one by one, a one-to-one correspondence between time index and texture component is established, and they are combined into a texture descriptor sequence in time order to obtain a time-sorted texture descriptor sequence. The steps for obtaining the cumulative food intake index are as follows: Based on the time-sorted texture descriptor sequence, the difference between texture components under adjacent time indices is calculated one by one and a difference vector is generated. At the same time, the segmented feed trough mask is read and it is determined whether the head of the beef cattle is within the mask area. The determination result is written into the determination identifier sequence corresponding to the time index to obtain the perturbation difference record and the determination identifier sequence in the feed trough. Based on the disturbance difference record and the in-feeding trough identification sequence, the cumulative feed intake index is calculated using the following formula: ; ; ; in, For the first Instantaneous disturbance score for each time index, For the first A valid perturbation value with temporal memory for each time index. To calculate the cumulative food intake index, This represents the number of feature vectors representing feeding actions within a continuous time window. For the first The value of the determination flag in the feed trough corresponding to each time index is either one or zero. For the first The texture descriptor dimension of the time index is the first. Each component value For the first The texture descriptor dimension of the time index is the first. Each component value The number of components in the texture descriptor dimension. For the first The weights of each texture descriptor component, For perturbation sensitivity factor, For perturbation memory factors, It is the first The normalization factor for each texture descriptor component.