Monitoring video enhancement method for farm

By combining frame-by-frame processing and an artifact mask-guided non-local mean filter with an animal prior model, the problems of distinguishing animals from backgrounds and removing artifacts in farm videos are solved, thereby improving video quality and continuity, making it suitable for smart farming monitoring systems.

CN120634901AActive Publication Date: 2025-09-12EGG NO 1 FOOD CO LTD

Patent Information

Application Number
CN202511123946.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-12
Publication Date
2025-09-12
Estimated Expiration
2045-08-12

AI Technical Summary

Technical Problem

Existing video enhancement technology does not work well in farm environments. It cannot effectively distinguish farmed animals from the background, and there are artifacts and noise, which affect the video quality and subsequent analysis.

Method used

By processing the surveillance video frame by frame, the target farmed animal mask is extracted and the artifact mask is generated. The artifact mask is used to guide the non-local mean filter to process the background area. The brightness and chromaticity are enhanced by combining the prior model of the key body parts of the animal, and an inter-frame information propagation and fusion mechanism is introduced.

Benefits of technology

It achieves refined processing of farmed animals and backgrounds, significantly improves video quality, removes artifacts and noise, ensures video temporal continuity, and obtains clear and smooth surveillance videos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120634901A_ABST
    Figure CN120634901A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of video processing, and particularly relates to a monitoring video enhancement method for a farm, which aims to solve the technical problem of low quality of an enhanced video in the prior art, and comprises the following steps: S1, processing each frame of image in a monitoring video sequence frame by frame; s2, distinguishing a target animal area from a background area, and identifying and generating an artifact mask; s3, aiming at the background area, carrying out key smoothing processing on the artifact position to inhibit the artifact; s4, for the image of the target animal area, performing adaptive nonlinear enhancement on the brightness component, and performing color correction on the chrominance component; s5, performing pixel-level fusion on the enhanced target animal area and the background area; and S6, spreading the information of the previous frame to the current frame by using the forward optical flow field, and carrying out weighted fusion on the information of the previous frame and the current frame. According to the method, the target bred animals, the background areas and the artifacts are accurately distinguished, so that refined and differentiated processing of pictures is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of video processing, and in particular relates to a monitoring video enhancement method for a farm. Background Art

[0002] With the rapid development of smart farming technologies, video surveillance systems play a vital role in modern farms, enabling contactless, around-the-clock monitoring of animal health, behavioral patterns, feeding habits, and overall welfare. High-quality surveillance video is essential for intelligent management functions such as precision feeding, early disease warning, and behavioral abnormality analysis. However, farm environments are often harsh and complex, plagued by variable and insufficient lighting conditions, high airborne dust concentrations, flying mosquitoes, and obstructive cobwebs. These factors collectively result in poor quality in captured surveillance video, manifested by dim image brightness, low contrast, blurred details, significant noise, and various dynamic and static artifacts. This severely impacts the efficiency and accuracy of manual observation and poses significant challenges to subsequent computer vision analysis tasks, such as individual recognition and body posture assessment.

[0003] Existing video enhancement technologies, such as histogram equalization-based methods, low-light enhancement algorithms based on Retinex theory, and various denoising filters, can improve the overall visual quality of videos to a certain extent. However, they have significant limitations when applied to the specific scenarios of animal husbandry. First, most of these general algorithms process the entire image indiscriminately, failing to effectively distinguish between the farmed animals (the central focus) and the complex background environment. This often results in enhancing the farmed animals while also amplifying noise and artifacts in the background, even introducing new distortion. Second, existing technologies lack dedicated detection and suppression mechanisms for specific artifacts commonly found in animal husbandry (such as spider webs and flying insects), making it difficult to effectively remove these structural interferences. Furthermore, when processing video sequences, independent frame-by-frame enhancement methods ignore the temporal correlation between frames, easily causing brightness flicker and jitter in the output video, disrupting the continuity and smoothness of the video and hindering the continuous tracking and analysis of the animal's dynamic behavior. Therefore, developing an enhancement method that can accurately identify and target farmed animals, effectively suppress specific environmental artifacts, and ensure the smoothness of video timing is of great significance for improving the practical value of smart farming monitoring systems. Summary of the Invention

[0004] The present invention provides a method for enhancing monitoring videos of a farm, so as to solve the technical problem of low quality of enhanced videos in the prior art.

[0005] To solve the above problems, the present invention provides a method for enhancing surveillance video of a farm, which adopts the following technical solutions: A method for enhancing surveillance video of a farm, comprising the following steps: S1, processes each frame of the surveillance video sequence frame by frame; S2: For the current frame, extract the target farmed animal mask to distinguish the target animal area from the background area in the frame; combine the inter-frame motion information and local high-frequency texture features of the current frame and historical frames to identify and generate an artifact mask marking spider webs, flying insects or dust; S3, for the background area, use the artifact mask to guide the non-local mean filter, focus on smoothing the artifact position to suppress the artifact, filter out the background noise, and obtain the enhanced background area; S4, decomposing the image of the target animal region into luminance and chrominance components; generating a luminance adjustment weight map using a preset prior model of key animal body parts, and performing adaptive nonlinear enhancement on the luminance component; performing color correction on the chrominance component based on a color distribution prior extracted from a library of images of specific animal species; fusing the enhanced luminance component and the color-corrected chrominance component to reconstruct the enhanced target animal region; S5, based on the target farmed animal mask, the enhanced target animal area and the background area are pixel-wise fused to generate a single-frame enhanced image; S6, calculates the forward optical flow field between the current frame and the processed previous frame, uses the forward optical flow field to propagate the information of the previous frame to the current frame, and performs weighted fusion with the current frame to generate the final enhanced frame.

[0006] Compared with the existing technology, the present invention achieves refined and differentiated processing of the picture by accurately distinguishing the target farmed animals, background areas and artifacts. Not only can the background area be targeted and smoothed using the artifact mask, effectively removing common structural interferences such as spider webs, flying insects and dust in the monitoring picture, significantly improving the purity of the background; it can also enhance the brightness of the animal body in combination with the prior model of its key body parts, and correct its chromaticity based on the color distribution of the species, so that the animal's body contours and texture details are clearer, and the color performance is more realistic and natural, which is conducive to subsequent manual observation and intelligent analysis. In addition, by introducing the inter-frame information propagation and fusion mechanism, the temporal continuity of the processed video sequence is effectively guaranteed, avoiding screen flickering and jitter, and ultimately obtaining a high-quality monitoring video with overall clarity, prominent subject and smooth playback.

[0007] Furthermore, in S2, the absolute value of the difference between the grayscale image of the current frame and the previous frame is calculated to generate a motion information map; the grayscale image of the current frame is convolved with the Laplace operator to extract the high-frequency texture map; the motion information map and the high-frequency texture map are binarized respectively, and then a pixel-level logical OR operation is performed to identify dynamic artifacts with motion characteristics or static artifacts with static high-frequency texture, thereby generating a final artifact mask.

[0008] The absolute value of the grayscale difference between frames is used to capture dynamic artifacts, and the Laplace operator is used to extract high-frequency information to capture static artifacts, thus achieving differentiated processing.

[0009] Furthermore, in S3, for pixel positions marked as artifacts by the artifact mask, the search window radius of the non-local mean filter is set to 10 pixels, and the filter weight parameter h is set to 15; for pixel positions marked as non-artifacts by the artifact mask, the search window radius of the non-local mean filter is set to 3 pixels, and the filter weight parameter h is set to 8.

[0010] The artifact area is strongly repaired and the normal background area is lightly modified, which not only eliminates the artifacts but also retains the original information of the background area.

[0011] Furthermore, in S4, the animal's key posture points are pre-calibrated by the prior model of key posture parts of the animal, and a Gaussian kernel is generated with each key posture point as the center. After superimposing and normalizing all Gaussian kernels, a brightness adjustment weight map in the range of [0, 1] is generated; a nonlinear function based on Gamma correction is used. For the normalized input brightness component Enhancement is performed, where the gamma value By formula Calculated, is the enhanced brightness component, Adjust the weight for brightness.

[0012] It can distinguish the key body points from the brightness enhancement of other parts, which not only highlights the key body points but also ensures the overall continuity.

[0013] Furthermore, in S4, the color distribution prior is a color distribution of the healthy sample animal images in the image library in the CIELAB color space. * and b * Component-wise calculated mean vector and covariance matrix; The target animal region of the image to be processed is converted to CIELAB space, and the color transformation matrix is ​​applied to adjust the a * 、b * The statistical distribution of the components is adjusted so that their mean vector and covariance matrix match the mean vector and covariance matrix of the color distribution prior. After color correction is completed, it is converted back to the original color space.

[0014] It can achieve the standardization of animal colors and ensure the naturalness and continuity of colors.

[0015] Furthermore, in S6, when weighted fusion is performed with the current frame, the fusion weight is determined based on the confidence of the optical flow estimation and the structural similarity.

[0016] Furthermore, in S6, a dense optical flow algorithm is used to calculate the forward optical flow field from the previous frame to the current frame, and the reverse optical flow field from the current frame to the previous frame; an optical flow confidence map is generated through a forward-reverse optical flow consistency check; The optical flow confidence map is fused with the structural similarity map calculated between the previous frame and the current frame after distortion to obtain the final weighted fusion weight map.

[0017] Furthermore, based on the forward optical flow field, a bilinear interpolation method is used to warp the previous frame to align the current frame; Using the weighted fusion weight map, the distorted previous frame and the current frame are weighted averaged at the pixel level to generate the final enhanced frame.

[0018] Furthermore, in S1, after obtaining the surveillance video sequence to be processed, the video stream is read frame by frame by a video decoder, and each frame is decoded into independent digital image data.

[0019] Furthermore, in S2, a preset instance segmentation network is used to extract the target farmed animal mask.

[0020] The beneficial effect is that compared with the existing technology, the present invention achieves refined and differentiated processing of the picture by accurately distinguishing the target farmed animals, background areas and artifacts. Not only can the background area be targeted and smoothed using the artifact mask, effectively removing common structural interferences such as spider webs, flying insects and dust in the monitoring picture, significantly improving the purity of the background; it can also enhance the brightness of the animal body in combination with the prior model of its key body parts, and correct its chromaticity based on the color distribution of the species, so that the animal's body contours and texture details are clearer, and the color performance is more realistic and natural, which is conducive to subsequent manual observation and intelligent analysis. In addition, by introducing the inter-frame information propagation and fusion mechanism, the temporal continuity of the processed video sequence is effectively guaranteed, avoiding screen flickering and jitter, and ultimately obtaining a high-quality monitoring video with overall clarity, prominent subject and smooth playback. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 Flowchart of the surveillance video enhancement method for a farm. DETAILED DESCRIPTION

[0022] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Those skilled in the art should know that the embodiments described below are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.

[0023] Embodiments of the method for enhancing surveillance video of a farm provided by the present invention: like Figure 1 As shown, the method for enhancing surveillance video of a farm includes the following steps: S1, processes each frame of the surveillance video sequence frame by frame.

[0024] Specifically, a surveillance video sequence to be processed is obtained, the video stream is read frame by frame through a video decoder (such as FFmpeg), and each frame is decoded into independent digital image data (such as RGB format frames) as input to subsequent processing units.

[0025] S2, for the current frame, extract the target farmed animal mask to distinguish the target animal area from the background area in the frame; combine the inter-frame motion information and local high-frequency texture features of the current frame and historical frames to identify and generate an artifact mask marking spider webs, flying insects or dust.

[0026] Specifically, a pre-set instance segmentation network is used to extract the target farmed animal mask. The current frame is then fed into a Mask R-CNN network pre-trained on a farmed animal dataset. The Mask R-CNN network outputs a pixel-level binary mask for each identified animal. The pixel-level binary masks of all animals are combined to form the target farmed animal mask. The Horn-Schunck optical flow method is used to calculate the dense optical flow field between the current and previous frames to obtain pixel-level motion vectors. Simultaneously, the Laplacian of Gaussian operator is applied to the current frame to detect high-frequency texture regions in the image. Connected domains with large motion vector amplitudes and small areas are labeled as flying insects or dust particles. Elongated connected domains with strong high-frequency texture response but near-zero motion vector amplitudes are labeled as spider webs. The labeled regions are then merged to generate a unified artifact mask.

[0027] In an optional embodiment, combining inter-frame motion information and local high-frequency texture features of the current frame and historical frames to identify and generate an artifact mask marking spider webs, flying insects, or dust includes the following steps: Calculate the absolute value of the difference between the grayscale image of the current frame and the previous frame to generate a motion information map; The Laplacian operator is used to convolve the grayscale image of the current frame to extract the high-frequency texture map; After the motion information map and high-frequency texture map are binarized respectively, a pixel-level logical OR operation is performed to identify dynamic artifacts with motion characteristics or static artifacts with static high-frequency textures to generate the final artifact mask.

[0028] Specifically, to identify dynamic artifacts such as flying insects and dust particles, the current and previous frames are converted into 8-bit grayscale images, and the absolute difference in grayscale values ​​between the two frames is calculated pixel by pixel. For example, if a pixel's grayscale value was 120 in the previous frame and 155 in the current frame, the absolute difference is 35. A motion threshold is set, such as 30, and any pixel with a difference greater than 30 is marked as a moving point, generating a binary motion information map. This method can capture flying insects or drifting dust particles that move between frames.

[0029] Specifically, to identify static high-frequency artifacts like spiderwebs, a 3x3 Laplacian operator is convolved with the grayscale image of the current frame. The Laplacian operator enhances high-frequency details such as edges and fine lines in the image, resulting in a high-intensity response of the spiderweb's thread structure in the processed high-frequency texture map. This high-frequency texture map is then binarized, for example, by setting a threshold of 50 and marking pixels with a response value above 50 as high-frequency texture points.

[0030] The motion information map and the high-frequency texture map are merged through a pixel-level logical OR operation. A pixel marked in either the motion information map or the high-frequency texture map is marked as an artifact in the final artifact mask, ensuring accurate identification of objects ranging from dynamic flying insects and dust particles to static spider webs.

[0031] In S3, for the background area, the artifact mask is used to guide the non-local mean filter to perform focused smoothing on the artifact position to suppress the artifact and filter out the background noise to obtain the enhanced background area.

[0032] When applying the non-local mean filter, a larger filter window and a higher filter weight parameter are set for background pixels within the area indicated by the artifact mask to strongly blur and eliminate cobwebs, flying insects, and dust traces; for other background pixels not within the area indicated by the artifact mask, a smaller filter window and a lower filter weight parameter are used to perform gentle noise filtering to retain effective details in the background, thereby achieving differentiated background enhancement.

[0033] Specifically, for pixel positions marked as artifacts by the artifact mask, the search window radius of the non-local means filter is set to 10 pixels, and the filter weight parameter h is set to 15; for pixel positions marked as non-artifacts by the artifact mask, the search window radius of the non-local means filter is set to 3 pixels, and the filter weight parameter h is set to 8.

[0034] When processing a pixel marked as an artifact by the artifact mask, such as a point on a spiderweb, a strong smoothing strategy is employed. A large search window of 21x21 pixels, or a radius of 10 pixels, is defined, centered around the pixel being processed. The filter weight parameter h is set to a high value of 15. The non-local means filter searches for similar patches around the pixel being processed within a large neighborhood, allowing even patches with significant differences to be included in the averaging calculation. This produces a significant blurring effect, effectively smoothing out the artifact and blending it into the background.

[0035] For pixels marked as non-artifacts in the artifact mask, such as those in animal hair regions, a mild detail-preserving strategy is employed. The search window radius of the non-local means filter is reduced to 3 pixels, meaning the search is performed within a local range of 7x7 pixels. The filter weight parameter h is also reduced to 8. The smaller search range and lower h value make the filter more demanding on the similarity of image patches, averaging primarily very similar regions. This has the effect of slightly removing background noise while maximally preserving the fine texture of the animal hair and the overall clarity of the image, avoiding excessive blurring.

[0036] S4, for the image of the target animal area, decompose it into brightness component and chromaticity component; use the preset animal key body part prior model to generate a brightness adjustment weight map, and perform adaptive nonlinear enhancement on the brightness component; based on the color distribution prior extracted from the specific animal species image library, perform color correction on the chromaticity component; fuse the enhanced brightness component and the color-corrected chromaticity component to reconstruct the enhanced target animal area.

[0037] Convert the pixels of the target animal area from RGB color space to YC b C r Color space, get the brightness component Y and chrominance component C b 、C r The pre-trained HRNet network is used to detect key body points such as the head and back of the animal. Gaussian distribution heat maps are generated at these key body points and superimposed to form a brightness adjustment weight map. For the brightness component Y, Gamma correction is applied, where the Gamma value of each pixel is dynamically adjusted according to the weight value of its corresponding position on the brightness adjustment weight map. The higher the weight, the greater the brightness improvement. For the chrominance component C b and C r , using histogram matching technology, its color histogram is matched to a target color distribution model that has been established by analyzing a large number of healthy standard animal image libraries in order to correct the color deviation. Finally, the enhanced Y component and the corrected C b 、C rThe components are recombined and converted back to RGB color space.

[0038] Specifically, the prior model of the animal's key body parts pre-calibrates the key body points in areas such as the animal's head, spine, and limbs; a Gaussian kernel is generated with each key body point as the center, and all Gaussian kernels are superimposed and normalized to generate a brightness adjustment weight map in the range of [0, 1].

[0039] Adopting nonlinear function based on Gamma correction For the normalized input brightness component Enhancement is performed, where the gamma value By formula Calculated, is the enhanced brightness component, Adjust the weight for brightness.

[0040] Specifically, a priori model for a specific animal breed is loaded, such as a dog body model containing 17 key body points, which define the positions of nose, eyes, ears, shoulders, hips and limb joints. When processing a frame of image, the specific coordinates of the 17 key body points are detected. With each coordinate as the center, a two-dimensional Gaussian distribution map is generated, and its standard deviation can be set to 5% of the length of the short side of the image to ensure a moderate range of influence. The 17 Gaussian distribution maps are superimposed and the final result is normalized so that the values ​​of all pixels in the image fall between 0 and 1, forming a brightness adjustment weight map. The weight value of the main body area of ​​the animal in the image is close to 1, while the weight value of the background area is close to 0.

[0041] The brightness enhancement process acts on the brightness channel of the image, and its input brightness component Normalized to the range of 0 to 1. The core of the enhancement is to use a gamma value that varies with spatial position. For each pixel in the image, its gamma value According to the formula Dynamic calculation. For example, a pixel at the center of an animal's spine has a weight Probably 0.98, the calculated gamma value The value is . Lower gamma value There will be a significant brightness improvement effect. In the background area far away from the animal, the weight Maybe 0.05, the calculated gamma value The value is . Gamma value close to 1 The change in brightness is minimal: the animal subject is highlighted, while the background remains largely unchanged.

[0042] In an optional embodiment, the color distribution prior is a color distribution of the healthy sample animal images in the image library in the CIELAB color space. * and b * The mean vector and covariance matrix of the components are calculated; the target animal area of ​​the image to be processed is converted to CIELAB space, and the a in the target animal area is adjusted by applying the color transformation matrix * 、b * The statistical distribution of the components is adjusted so that their mean vector and covariance matrix match the mean vector and covariance matrix of the color distribution prior. After color correction is completed, it is converted back to the original color space.

[0043] Specifically, to build a color distribution prior model, researchers collected, for example, 500 images of healthy golden retrievers taken under standard lighting conditions. For each image, the dog's hair region was segmented manually or automatically. The pixels in the hair region were converted from the RGB color space to the CIELAB color space. * component (representing red and green) and b * Component (representing yellow-blue shades), calculate its overall mean vector and 2x2 covariance matrix. For example, the target mean vector obtained may be [14.5, 45.8]. This target mean vector and covariance matrix together constitute the digital file of the coat color of a healthy golden retriever.

[0044] When processing an image to be corrected, the target animal region in the image is identified and its pixels are converted to CIELAB space. * and b * The current mean vector and covariance matrix of the components. If the light is cold, the current mean vector is [10.2, 35.1], which deviates from the color distribution prior model. An affine transformation matrix is ​​calculated mathematically, which can map the current statistical distribution to the target statistical distribution of the color distribution prior model. This transformation is applied to each pixel a in the target animal area. * and b * After correction, the image is converted from CIELAB space back to the original RGB color space, making the color of the animals look more natural and healthy.

[0045] S5, based on the target farmed animal mask, the enhanced target animal area and the background area are pixel-wise fused to generate a single-frame enhanced image.

[0046] Create a blank image with the same size as the current frame. Iterate over each pixel coordinate. If the pixel coordinate is marked as an animal in the target farmed animal mask, copy the pixel value of the corresponding coordinate in the enhanced target animal region to the blank image. Conversely, if the pixel coordinate is marked as animal background in the target farmed animal mask, copy the pixel value of the corresponding coordinate in the enhanced background region. Finally, fill all pixels to form a complete single-frame enhanced image.

[0047] S6, calculates the forward optical flow field between the current frame and the processed previous frame, uses the forward optical flow field to propagate the information of the previous frame to the current frame, and performs weighted fusion with the current frame to generate the final enhanced frame.

[0048] Specifically, the fusion weight is determined jointly based on the confidence of the optical flow estimation and the structural similarity.

[0049] The PWC-Net deep learning optical flow model is used to calculate the forward optical flow field from the previous frame to the current frame. The forward optical flow field is used to perform pixel-level warping on the previous frame to align its content with the current frame.

[0050] The confidence of the optical flow estimate is evaluated by calculating the difference between the forward and backward optical flows. The structural similarity index (SSIM) is used to calculate the structural similarity between the aligned previous and current frames on small local patches. The confidence score is multiplied by the structural similarity index to obtain a per-pixel fusion weight. The aligned previous and current frames are linearly combined pixel by pixel based on the fusion weights, resulting in a final enhanced frame that retains the current frame's enhancement while incorporating information from previous frames and is more temporally stable.

[0051] In an optional embodiment, a dense optical flow algorithm is used to calculate the forward optical flow field from the previous frame to the current frame, and the reverse optical flow field from the current frame to the previous frame is calculated; an optical flow confidence map is generated through a forward-backward optical flow consistency check; the optical flow confidence map is fused with a structural similarity map calculated between the previous frame and the current frame after distortion to obtain a final weighted fusion weight map.

[0052] Specifically, a forward optical flow field is calculated, which provides a motion vector pointing to its corresponding position in the current frame for each pixel in the previous frame. At the same time, a reverse optical flow field is also calculated. In order to evaluate the reliability of the optical flow, a consistency check is performed. For example, the pixel at coordinates (100, 150) in the previous frame has its forward optical flow vector pointing to (102, 151) in the current frame. The pixel at coordinates (102, 151) in the current frame should have its reverse optical flow vector pointing back to (100, 150) in the previous frame. If the Euclidean distance between the pointed-back position and the original position is less than one pixel, the motion estimate here is considered reliable, and the pixel is assigned a high value close to 1 in the optical flow confidence map; conversely, if the Euclidean distance is large, a low value close to 0 is assigned.

[0053] After obtaining the optical flow confidence map, the consistency of the structural information is evaluated. The enhanced result of the previous frame is warped using the forward optical flow field to geometrically align it with the current frame. Using a method such as the Structural Similarity Index (SSIM), the structural similarity between the warped previous frame and the current frame is compared block by block within a sliding window of, for example, 11x11 pixels, to generate a structural similarity map.

[0054] The optical flow confidence map is fused with the structural similarity map by multiplying them pixel by pixel. Only when the optical flow estimate for a pixel is reliable and its local image structure remains highly consistent over time will it receive a high weight, such as 0.9, in the final weighted fusion weight map.

[0055] Specifically, during weighted fusion, based on the forward optical flow field, the bilinear interpolation method is used to warp the previous frame to align the current frame; using the final weighted fusion weight map, the warped previous frame and the current frame are weighted averaged at the pixel level to generate the final enhanced frame.

[0056] Specifically, the warping process aims to accurately map the previous frame to the coordinate system of the current frame based on the motion of the object. The forward optical flow field is the coordinate of each pixel position in the current frame. Provides a source, i.e. its corresponding position in the previous frame The source position is usually not an integer coordinate, for example, it may be (123.4, 456.7). To obtain the pixel value of non-integer coordinates, bilinear interpolation is used. Find the four nearest integer coordinate pixels around (123.4, 456.7) in the previous frame, and perform a weighted average of the color values ​​of the four pixels according to the distance, so as to calculate a smooth and accurate interpolation result as the distorted image in The pixel value at the location.

[0057] Specifically, the process of generating the final enhanced frame is a pixel-by-pixel weighted fusion operation. For any pixel in the current frame, its final color value is determined by the distorted previous frame and the current frame, and the contribution ratio of the two is determined by the value of the final weighted fusion weight map at the pixel point. To control. Its calculation formula is: .

[0058] For example, in an area with slow and clear motion, The value can be as high as 0.8, and 80% of the final result comes from the previous frame after temporal smoothing, which effectively suppresses noise. In an area where occlusion or fast motion occurs, A low value, such as 0.1, will result in 90% of the final result coming from the current frame, thus avoiding introducing artifacts like ghosting or blurring.

[0059] In addition, in the description of this specification, “a plurality of” means at least two, for example, two, three or more, etc., unless otherwise clearly and specifically defined.

Claims

1. A method for enhancing surveillance video of a farm, characterized in that: The following steps are involved: S1, processes each frame of the surveillance video sequence frame by frame; S2: For the current frame, extract the target farmed animal mask to distinguish the target animal area from the background area in the frame; combine the inter-frame motion information and local high-frequency texture features of the current frame and historical frames to identify and generate an artifact mask marking spider webs, flying insects or dust; S3, for the background area, use the artifact mask to guide the non-local mean filter, focus on smoothing the artifact position to suppress the artifact, filter out the background noise, and obtain the enhanced background area; S4, for the image of the target animal area, decompose it into brightness component and chrominance component; A brightness adjustment weight map is generated using a preset prior model of key animal body parts, and the brightness component is adaptively nonlinearly enhanced. The chromaticity component is color corrected based on the color distribution prior extracted from the image library of specific animal species. The enhanced brightness component and the color-corrected chromaticity component are fused to reconstruct the enhanced target animal area. S5, based on the target farmed animal mask, the enhanced target animal area and the background area are pixel-wise fused to generate a single-frame enhanced image; S6, calculates the forward optical flow field between the current frame and the processed previous frame, uses the forward optical flow field to propagate the information of the previous frame to the current frame, and performs weighted fusion with the current frame to generate the final enhanced frame.

2. The method for enhancing surveillance video of a farm according to claim 1, characterized in that: In S2, the absolute value of the difference between the grayscale images of the current frame and the previous frame is calculated to generate a motion information map; the grayscale image of the current frame is convolved with the Laplacian operator to extract the high-frequency texture map; the motion information map and the high-frequency texture map are binarized respectively, and then a pixel-level logical OR operation is performed to identify dynamic artifacts with motion characteristics or static artifacts with static high-frequency texture, thereby generating the final artifact mask.

3. The method for enhancing surveillance video of a farm according to claim 1, characterized in that: In S3, for pixel positions marked as artifacts by the artifact mask, the search window radius of the non-local means filter is set to 10 pixels, and the filter weight parameter h is set to 15; for pixel positions marked as non-artifacts by the artifact mask, the search window radius of the non-local means filter is set to 3 pixels, and the filter weight parameter h is set to 8.

4. The method for enhancing surveillance video of a farm according to claim 1, characterized in that: In S4, the animal's key posture points are pre-calibrated by the prior model of key posture parts. A Gaussian kernel is generated with each key posture point as the center. All Gaussian kernels are superimposed and normalized to generate a brightness adjustment weight map in the range of [0, 1]. A nonlinear function based on Gamma correction is used. For the normalized input brightness component Enhancement is performed, where the gamma value By formula Calculated, is the enhanced brightness component, Adjust the weight for brightness.

5. The method for enhancing surveillance video of a farm according to claim 1, characterized in that: In S4, the color distribution prior is a color distribution of the healthy sample animal images in the image library in the CIELAB color space. * and b * Component-wise calculated mean vector and covariance matrix; The target animal region of the image to be processed is converted to CIELAB space, and the color transformation matrix is ​​applied to adjust the a * 、b * The statistical distribution of the components is adjusted so that their mean vector and covariance matrix match the mean vector and covariance matrix of the color distribution prior. After color correction is completed, it is converted back to the original color space.

6. The method for enhancing surveillance video of a farm according to claim 1, characterized in that: In S6, when weighted fusion is performed with the current frame, the fusion weight is determined based on the confidence of the optical flow estimation and the structural similarity.

7. The method for enhancing surveillance video of a farm according to claim 6, characterized in that: In S6, the dense optical flow algorithm is used to calculate the forward optical flow field from the previous frame to the current frame, and the reverse optical flow field from the current frame to the previous frame; the forward-backward optical flow consistency check is performed to generate an optical flow confidence map; The optical flow confidence map is fused with the structural similarity map calculated between the previous frame and the current frame after distortion to obtain the final weighted fusion weight map.

8. The method for enhancing surveillance video of a farm according to claim 7, characterized in that: Based on the forward optical flow field, the bilinear interpolation method is used to warp the previous frame to align the current frame; Using the weighted fusion weight map, the distorted previous frame and the current frame are weighted averaged at the pixel level to generate the final enhanced frame.

9. The method for enhancing surveillance video of a farm according to any one of claims 1 to 8, characterized in that: In S1, after obtaining the surveillance video sequence to be processed, the video stream is read frame by frame through a video decoder, and each frame is decoded into independent digital image data.

10. The method for enhancing surveillance video of a farm according to any one of claims 1 to 8, characterized in that: In S2, the preset instance segmentation network is used to extract the target farmed animal mask.

Citation Information

Patent Citations

  • Video illumination enhancement method and system based on generative adversarial network

    CN110852965A

  • Camera damage detection method and system based on average optical flow gradient

    CN114372966A

  • Intelligent agriculture monitoring and adjusting method based on Internet of Things

    CN117115210A

  • Image feature enhancement method based on scene and target decoupling

    CN118570102A

  • Real-time video quality optimization and enhancement method based on deep learning

    CN119418254A

Cited By

  • Dangerous waste treatment monitoring and early warning method based on video analysis

    CN120877196A

  • Intelligent monitoring method and system for rumination behaviors of cattle herds

    CN121482830A

  • Anti-counterfeiting information generation method and device based on surface features, equipment and medium

    CN121563573A

  • Pixel-level activity amount-based live pig health detection method and system

    CN122091213A

  • A method and system for detecting pig health based on pixel-level activity levels

    CN122091213B