A method and device for detecting respiratory rate of a pig based on infrared images

By acquiring and processing infrared images, the edge corners of pig nostrils are detected, the average pixel value of the respiratory profile is calculated, and discrete Fourier transform is used to solve the problem of the influence of ambient light and interference on the detection of pig respiratory frequency in existing technologies, thus achieving high-precision simultaneous detection of multiple pigs.

CN115998283BActive Publication Date: 2025-10-24HUNAN AGRI UNIV +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211672293.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-26
Publication Date
2025-10-24
Estimated Expiration
2042-12-26

AI Technical Summary

Technical Problem

Existing machine vision pig respiratory rate detection methods are affected by ambient light, pig behavior and environmental interference. They are not very accurate and can only detect the respiratory rate of one pig.

Method used

Infrared video image acquisition equipment was used to mark the region of interest, detect the corner points of the pig's nostrils, track the edge of the nostrils, calculate the average pixel value of the respiratory profile, and calculate the respiratory rate through discrete Fourier transform.

Benefits of technology

The stability and accuracy of pig respiratory rate detection have been improved, and the respiratory rates of multiple pigs can be detected simultaneously, reducing the impact of environmental interference.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115998283B_ABST
    Figure CN115998283B_ABST
Patent Text Reader

Abstract

The application discloses a pig respiratory frequency detection method and device based on infrared images, and the detection method comprises the following steps: (1) collecting infrared video images of a pig face by using an infrared video image collecting device; (2) marking a region of interest; (3) detecting a pig nostril edge corner point; (4) tracking the pig nostril edge corner point; (5) calculating a pig nostril respiratory profile pixel average value; and (6) calculating a pig respiratory frequency based on a discrete Fourier transform. The application is aimed at the fact that the detection precision of the existing machine vision pig respiratory frequency is influenced by environmental light, pig behaviors and environmental interference substances and the like, infrared video image equipment is used to collect infrared view images of pigs, the infrared view images are transmitted and stored into a computer, a corresponding algorithm processing and identification are carried out by a software system, and the respiratory frequency of a target pig is output by the computer. The respiratory frequency of multiple pigs can be detected at the same time, and the stability and precision of the pig respiratory frequency detection result are higher.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to infrared image technology, machine vision technology and detection and recognition technology of pig behavior, and particularly to a pig respiratory frequency detection method and device based on infrared images. BACKGROUND

[0002] The pig industry has changed from the traditional extensive breeding mode to the green and environmentally friendly intensive breeding mode. The traditional method of observing pig respiratory frequency is achieved by visually observing the up-and-down movement of the pig's chest and abdomen. However, due to the poor environment in the pig house, long-term observation in the pig house will affect the health of the workers. Moreover, relying solely on manual observation, factors such as human fatigue and cognitive level can lead to information omissions. Therefore, this method is time-consuming, labor-intensive and inaccurate. Therefore, it is an urgent need in the field to find a more reliable, accurate and convenient pig respiratory frequency detection method.

[0003] In recent years, intelligent recognition and analysis methods of animal behavior based on machine vision have been applied. Video cameras are used to collect animal movement conditions on site, obtain animal movement trajectories, calculate and record relevant experimental values, and analyze animal behavior. The system hardware generally consists of a video input device, an image acquisition card, a microprocessor, and a display screen. The system software consists of communication, parameter setting, image acquisition, recognition, behavior analysis, numerical calculation, parallel processing, data storage and query, display, and alarm modules. It has the advantages of non-contact, non-destructive, digitization, adjustable sampling period, and real-time online automatic tracking of animal movement trajectories. In 2011, Ji Bin, Zhu Weixing, etc. established a model based on the spine and abdomen line, obtained a two-dimensional signal related to respiration, and realized pig respiratory frequency detection based on machine vision, achieving good experimental results. However, this method detects the respiratory rate by measuring the change in the spine and abdomen line of the pig, and the accuracy of the image preprocessing of the pig outline directly affects the respiratory detection, resulting in overly sensitive results. Secondly, the simple background subtraction method used in the early stage of this method can only obtain a rough outline, which greatly affects the experimental results. Furthermore, this method does not perform necessary processing on the respiratory signal, which also affects the reliability of the results to some extent. In 2014, Zhu Weixing, Tang Liang, etc. established an area extraction method based on the spine and abdomen area, obtained a two-dimensional signal related to respiration, and realized pig respiratory frequency detection based on machine vision, achieving good experimental results. However, this method detects the respiratory rate by measuring the change in the spine and abdomen area of the pig standing, and due to the dirty environment in the pig house, there are many disturbances (such as pig excrement, feed, etc.), and it is difficult to extract a complete and clear spine and abdomen area under natural light conditions. At the same time, behaviors such as pig lying affect the real-time performance of detection.

[0004] In summary, the detection accuracy of the respiratory rate of pigs by the existing machine vision is affected by environmental light, pig behavior, and environmental interference, and only one pig's respiratory rate can be detected at the same time. SUMMARY

[0005] In view of the defects in the prior art, the purpose of the present application is to provide a pig respiratory rate detection method and device based on infrared images to solve the problems in the background art.

[0006] In order to achieve the above-mentioned purpose, the present application provides a pig respiratory rate detection method based on infrared images, comprising:

[0007] (1) using an infrared video image acquisition device to acquire an infrared video image of the pig's face;

[0008] (2) marking the region of interest;

[0009] (3) pig nostril edge corner point detection;

[0010] (4) pig nostril edge corner point tracking;

[0011] (5) pig nostril respiratory cross-sectional pixel average value calculation;

[0012] (6) pig respiratory rate calculation based on discrete Fourier transform.

[0013] Preferably, step (2) comprises the following steps:

[0014] A. manually marking the region of interest around the nostril area using a rectangular frame;

[0015] B. marking the region of interest on the infrared image of the pig's face;

[0016] C. automatically tracking using corner point detection and registration process.

[0017] Preferably, step (3) comprises the following steps:

[0018] Selecting pixel intensity as corner point feature point and tracking to detect respiratory rate; using minimum feature detection method to realize corner point detection;

[0019] The corner point detector scans the image through a window function, and moves the window in different directions to determine the average change of image intensity. The operation formula of the corner point detector can be expressed as:

[0020] E(p, q) = ∑ x ∑ y ω(x, y) [I(x+p, y+p) - I(x, y)] 2E =∑∑ω(x, y)[pI(x+p, y+q)-I(x, y)]2#(1)

[0021] The above expression is simplified using Taylor series expansion:

[0022] I(x+p, y+q)-I(x, y)≈pI x +qI y #(2)

[0023] E(p, q)≈∑ x ∑ y ω(x, y)[pI x +qI y ] 2 #(3) gives:

[0024] The matrix representation is:

[0025]

[0026] In which M can be represented as:

[0027] α and β are eigenvalues of the matrix M, define a parameter R as:

[0028] R = min(αβ)#(6)

[0029] When the value of R is greater than a threshold value, the region is considered as a corner point.

[0030] Preferably, step (4) comprises the following steps:

[0031] Selecting the edge of the pig's nostril as a tracking point, tracking the tracking point, calculating the displacement between the sequence images, thereby realizing infrared image registration;

[0032] For the sequence infrared images, in which x, y represent the pixel coordinates of the tracking point, t represents the time sequence, then the pixel value of the infrared image is I(x, y, t); assuming that only displacement occurs between images and the brightness does not change compared with the previous frame image, then:

[0033] I(x, y, t) = I(x+d x , y+d y , t+τ)#(7)

[0034] In which d x , d y is the displacement, τ is the time variable, let d = (d x , dy represents the displacement variation.

[0035] From the above formula, the position of each pixel point in the image at time t is shifted by d, and each pixel point in the corresponding window of the image at time t+τ is obtained. The purpose of the tracking algorithm is to solve the displacement d.

[0036] Define the error ε as:

[0037]

[0038] In the formula, W is the feature window.

[0039] Use I to represent the image at time t, and J to represent the image at time t+τ. Use integration to represent formula 8, which is equivalent to:

[0040]

[0041] In the formula, X=(x, y) is the pixel coordinate.

[0042] According to the Taylor formula expansion, we get:

[0043]

[0044]

[0045] In order to solve the displacement d, let At this time, ε takes the minimum value. Then we have:

[0046]

[0047] Where,

[0048] Formula 12 can be transformed as:

[0049] ∫∫ W [J(X)-I(X)]g(X)dX=-[∫∫ W g(X)g T (X)dX]d#(13)

[0050] Let

[0051] Z=-[∫∫ W g(X)g T (X)dX]#(14)

[0052] e=∫∫ W [J(X)-I(X)]g(X)dX#(15)

[0053] The displacement d can be obtained as:

[0054] d=Z -1e#(16)

[0055] The displacement between two frames of images is obtained, and then the two frames are registered according to the displacement amount to obtain the edge pixel points of the pig nostril in each frame of image.

[0056] Preferably, step (5) comprises the following steps:

[0057] The respiratory frequency of the pig is reflected by the change rule of the average value of the pixel of the respiratory profile of the pig.

[0058] A. Obtaining the coordinates of the center pixel point of the nostril circle

[0059] According to the pixel points of the nostril wall of the infrared image, the coordinates O(x0, y0) of the center pixel point of the nostril circle are calculated by formula (17) and (18).

[0060]

[0061]

[0062] In the formula, n is the number of all pixel points on the nostril wall; (x i , y i ) is the coordinates of the pixel points on the nostril wall;

[0063] B. Obtaining the radius and equation of the nostril circle

[0064] The calculation of the radius of the nostril circle is shown in formula (19); and the equation of the nostril circle is shown in formula (20).

[0065]

[0066] (x-x0) 2 +(y-y0) 2 =r 2 #(20)

[0067] C. Obtaining the average value of the pixel of the respiratory profile

[0068] Since the temperature change of the pixel points on the nostril wall caused by respiration is small, the pixel points passing through the nostril circle are removed, all the pixel points in the circle constitute the respiratory profile, and the average value of the pixel of the respiratory profile is shown in formula (21).

[0069]

[0070] In the formula, C aver is the average value of the pixel of the respiratory profile; m is the number of the pixel points of the respiratory profile; and C i is the pixel value of the pixel points of the respiratory profile.

[0071] Preferably, step (6) comprises the following steps:

[0072] A. Collecting the average pixel value data discrete points of the respiratory profile by experiment;

[0073] B. Randomly selecting 200 continuous points from the average pixel value points of the respiratory profile and drawing a fitting curve;

[0074] The pig breathes at a uniform speed, and the average pixel value-time curve of the respiratory profile has obvious periodicity, and the curve fitting is performed by using discrete Fourier transform;

[0075] C. Calculating the respiratory frequency;

[0076] The period T of one complete respiratory process can be calculated by formula (22),

[0077]

[0078]

[0079] In the formula, Δt i The absolute value of the time difference between adjacent peak points is substituted into all peak points to obtain the average value of the absolute value of the time difference between adjacent peak points, that is, the respiratory period; and T is substituted into formula (23) to obtain the respiratory frequency F of the pig.

[0080] The application also provides a respiratory frequency detection device for pigs based on infrared images, which is characterized by comprising a field infrared image acquisition device, a video acquisition card, a computer, and corresponding image acquisition, transmission and storage algorithms.

[0081] The application has the following beneficial effects:

[0082] The application provides a respiratory frequency detection method and device for pigs based on infrared images, and the detection precision of the respiratory frequency of pigs by the existing machine vision is affected by environmental light, pig behavior, environmental interference and the like. BRIEF DESCRIPTION OF DRAWINGS

[0083] Figure 1 The figure is a flowchart of the detection method of the application;

[0084] Figure 2 The figure is a structural schematic diagram of the infrared video image acquisition system;

[0085] Figure 3Schematic diagram of the detection of corner points at the edge of the pig's nostril in the present invention;

[0086] Figure 4 This is a scatter plot of the average pixel value of the pig nostril breathing profile versus time;

[0087] Figure 5 This is the pixel average-time fitting curve of the pig nostril breathing profile; DETAILED DESCRIPTION

[0088] The present invention will be described in detail below with reference to specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those skilled in the art, several variations and improvements can be made without departing from the scope of the present invention. These all fall within the scope of protection of the present invention.

[0089] Reference Figures 1 to 5 The present invention provides a method and device for detecting the respiratory rate of a pig based on infrared images. The present invention provides a method for detecting the respiratory rate of a pig based on infrared images, comprising:

[0090] (1) using infrared video image acquisition equipment to collect infrared video images of pig faces;

[0091] (2) Mark the area of ​​interest;

[0092] (3) Pig nostril edge corner detection;

[0093] (4) Tracking of the corner points at the edge of the pig’s nostril;

[0094] (5) Calculation of pixel averages of the pig nostril respiratory profile;

[0095] (6) Calculation of pig respiratory frequency based on discrete Fourier transform.

[0096] In one embodiment, in step (1), reference Figure 2 The infrared video capture device was fixed to a tripod, and the pig remained in a recumbent / standing position. The infrared video capture device was kept level with the pig's nostrils and at a distance of 0.5 meters. The present invention is based on motion tracking, so during the infrared video capture process, the pig's head and the infrared imager were kept as still as possible to avoid random shaking or sudden disappearance from the frame. At the same time, to minimize the error introduced by sudden temperature changes in the test results, the infrared video capture was selected in an indoor environment with no significant temperature fluctuations, and the infrared video capture duration was 60 seconds.

[0097] In one of the embodiments, the change of hot spot is detected by detecting the region of the nostril instead of the whole face, as the temperature near the nose and earlobe is lower than other parts of the face due to the lack of blood supply. In addition, they are in direct contact with the environment, and the convective effect of respiratory gas will cause a cooling effect in these areas. Therefore, the nose region is the most suitable region to track the respiratory cycle.

[0098] Step (2) includes the following steps:

[0099] A. Manually label the region of interest around the nostril region using a rectangular box;

[0100] B. Initialize the region containing the entire pig nostril as the region of interest, label the region of interest on the infrared image of the pig face;

[0101] C. Automatically track using corner detection and registration process.

[0102] In one of the embodiments, the region with large intensity change in all directions in the image is considered as a corner point, and in the thermal image, the intensity of the pixel is directly related to the temperature. Therefore, due to the influence of the breathing phenomenon, the pixel points near the nostril have a higher intensity change. Therefore, the temperature rise near the nostril will cause a large change in pixel intensity. Step (3) includes the following steps:

[0103] Reference Figure 3 , select the pixel intensity as the corner feature point and track to detect the respiratory frequency; use the minimum feature detection method to realize the corner detection;

[0104] The corner detector scans the image through a window function, and moves the window in different directions to determine the average change of image intensity; the operation formula of the corner detector can be expressed as:

[0105] E(p, q) = ∑ x ∑ y ω(x, y) [I(x + p, y + p) - I(x, y)] 2 In formula (1), E represents the sum of squared differences between the original window and the window after moving; p represents the window displacement in the x direction; q represents the window displacement in the y direction; ω(x, y) represents the weighting function of the window; I(x + p, y + p) represents the intensity of the pixel in the window after moving; I(x, y) represents the intensity of the pixel in the original window;

[0106] Simplify the above expression using Taylor series expansion:

[0107] I(x + p, y + q) - I(x, y) ≈ pI x + qI y (2)

[0108] E(p, q) ≈ ∑x ∑ y ω(x, y)[pI x +qI y ] 2 #(3) gives:

[0109] The matrix representation is:

[0110]

[0111] where M can be represented as:

[0112] α and β are eigenvalues of the matrix M, and a parameter R is defined as:

[0113] R = min(αβ) #(6)

[0114] When the value of R is greater than a threshold value, the region is considered as a corner point.

[0115] In one embodiment, reliable feature points in a frame of image are referred to as tracking points, and a cross-correlation measurement is performed on the tracking points between image frames to find the positions of the tracking points in the next frame of image, so that the displacement between the two frames of image can be calculated.

[0116] Step (4) includes the following steps: detecting the corner points of the infrared image in step 3, selecting the pig nostril edge as the tracking point, tracking the tracking point, and calculating the displacement between the sequence images to realize the registration of the infrared image.

[0117] For a sequence of infrared images, where x, y represent the pixel coordinates of the tracking point, and t represents the time sequence, the pixel value of the infrared image is I(x, y, t); assuming that only displacement occurs between images and the brightness does not change compared with the previous frame of image, then:

[0118] I(x, y, t) = I(x+d x , y+d y , t+τ) #(7)

[0119] where d x , d y is the displacement, τ is the time variable, and d = (d x , d y ) represents the displacement change.

[0120] From the above formula, shifting the position of each pixel point in the image at time t by d, the corresponding pixel points in the window of the image at time t+τ can be obtained; the purpose of the tracking algorithm is to solve the displacement d;

[0121] Define the error ε as:

[0122]

[0123] In the formula, W is a characteristic window.

[0124] Using I to represent the image at time t and J to represent the image at time t+τ, the formula 8 is expressed by integration, which is equivalent to:

[0125]

[0126] In the formula, X=(x, y) is a pixel coordinate.

[0127] According to the Taylor formula expansion, we have:

[0128]

[0129]

[0130] In order to solve the offset d, let At this time, ε takes the minimum value. Then we have:

[0131]

[0132] Wherein,

[0133] The formula 12 can be transformed into:

[0134] ∫∫ W [J(X)-I(X)]g(X)dX=-[∫∫ W g(X)gT(X)dX]d#(13)

[0135] Let

[0136] Z=-[∫∫ W g(X)g T (X)dX]#(14)

[0137] e=∫∫ W [J(X)-I(X)]g(X)dX#(15)

[0138] The offset d can be obtained:

[0139] d=Z -1 e#(16)

[0140] The displacement between the two images is obtained, and then the two frames are registered according to the displacement, so as to obtain the edge pixel points of the pig nostrils in each frame image.

[0141] In one embodiment, the pixel value in the infrared image corresponds to the temperature value, and the temperature change of the airflow in the nostrils is caused when the pig breathes, so the average value of the respiratory profile pixels is used to express the temperature change of the airflow in the nostrils. The step (5) comprises the following steps:

[0142] The respiratory frequency of the pig is reflected by the change rule of the average value of the pixels of the respiratory profile of the pig.

[0143] A. Obtaining the coordinates of the center pixel of the nostril circle

[0144] According to the pixel points of the nostril wall in the infrared image, the coordinates of the center pixel O(x0, y0) are calculated by using the formulas (17) and (18).

[0145]

[0146]

[0147] In the formula, n is the number of all the pixel points on the nostril wall; (x i , y i ) is the coordinates of the pixel points on the nostril wall;

[0148] B. Obtaining the radius and equation of the nostril circle

[0149] The calculation of the radius of the nostril circle is shown in the formula (19); and the equation of the nostril circle is shown in the formula (20).

[0150]

[0151] (x-x0) 2 +(y-y0) 2 =r 2 #(20)

[0152] C. Obtaining the average value of the pixels of the respiratory profile

[0153] Since the temperature change of the pixel points on the nostril wall caused by respiration is small, the pixel points on the nostril circle are removed, all the pixel points in the circle constitute the respiratory profile, and the average value of the pixels of the respiratory profile is shown in the formula (21).

[0154]

[0155] In the formula, C aver is the average value of the pixels of the respiratory profile; m is the number of the pixel points of the respiratory profile; and C i is the pixel value of the pixel points of the respiratory profile.

[0156] In one embodiment, when the respiratory frequency of the pig is determined, the period of one complete respiration is determined according to the average value of the pixels of the respiratory profile-time curve, and then the respiratory frequency is obtained. Since the respiratory profile pixel average value data collected by the test is composed of discrete points, the extreme points of the curve cannot be determined by the test data, and thus the respiratory period cannot be obtained, so it is necessary to convert the discrete pixel data into continuous data.

[0157] The step (6) comprises the following steps: Figure 4 ,

[0158] A. collecting the average pixel value data discrete points of the respiratory profile by experiment;

[0159] B. Since the distribution of the discrete points is nonlinear and periodic, the curve fitting is carried out by using the discrete Fourier transform. The principle of Fourier transform is that any continuous measured time sequence or signal can be expressed as an infinite superposition of sine and cosine wave signals of different frequencies, and the signal is converted from the time domain to the frequency domain to further study the frequency spectrum structure and variation law of the signal. The frequency, amplitude and phase value of the superposed sine and cosine functions are obtained by curve fitting, and the specific expression of the fitting function is obtained. 200 continuous points are randomly selected from the average pixel value point set of the respiratory profile, and the fitting curve is drawn;

[0160] Reference Figure 5 , the pig breathes at a constant speed, and the average pixel value-time curve of the respiratory profile has obvious periodicity, and the curve fitting is carried out by using the discrete Fourier transform; the curve contains 10 peak points, indicating that the pig has completed 5 breathing processes in 20 seconds;

[0161] C. calculating the respiratory frequency;

[0162] The period T of one complete breathing process can be calculated by formula (22),

[0163]

[0164]

[0165] In the formula: Δt i represents the absolute value of the time difference between adjacent peak points, and the average value of the absolute value of the time difference between adjacent peak points can be obtained by substituting all the peak points, that is, the respiratory period; then T is substituted into formula (23) to obtain the respiratory frequency F of the pig.

[0166] A pig respiratory frequency detection device based on infrared image is also provided, characterized by comprising a field infrared image acquisition device, a video acquisition card, a computer and corresponding image acquisition, transmission and storage algorithms. The field infrared image acquisition device is used for collecting, transmitting and storing infrared video images into the computer, and then the software system is used for corresponding algorithm processing and recognition, and the computer is used for outputting the respiratory frequency of the target pig.

[0167] The beneficial effects of the present application are:

[0168] The application provides a pig respiratory frequency detection method and device based on infrared images, and the detection accuracy of the pig respiratory frequency of the existing machine vision is influenced by environmental light, pig behavior, environmental interference and the like, infrared video image equipment is used to collect infrared view images of pigs, the infrared view images are transmitted and stored into a computer, corresponding algorithm processing and identification are performed by a software system, and the respiratory frequency of target pigs is output by the computer, the respiratory frequencies of multiple pigs can be detected at the same time, and the stability and accuracy of the pig respiratory frequency detection result are higher.

[0169] The above is a further detailed description of the application in combination with specific embodiments, and the specific implementation of the application cannot be limited to the description. For ordinary skilled persons in the technical field of the application, some simple deductions or replacements can be made without departing from the concept of the application.

Claims

1. A method for detecting the respiratory rate of a pig based on an infrared image, characterized in that, Comprising: (1) collecting infrared video images of pig faces using infrared video image acquisition equipment; (2) marking the region of interest; (3) pig nostril edge corner point detection; (4) pig nostril edge corner point tracking; (5) pig nostril respiratory profile pixel average value calculation; (6) pig respiratory frequency calculation based on discrete Fourier transform; Step (3) comprises the following steps: Selecting pixel intensity as a corner point feature point and tracking to detect respiratory frequency; a minimum feature detection method is used to realize corner point detection; The corner point detector scans the image through a window function, and moves the window in different directions to determine the average change of image intensity; the operation formula of the corner point detector can be expressed as: In the formula, E represents the sum of squared differences between the original window and the window after moving; p represents the window displacement in the x direction; q represents the window displacement in the y direction; ω(x, y) represents the weighting function of the window; I(x+p, y+p) represents the intensity of the pixel in the window after moving; I(x, y) represents the intensity of the pixel in the original window; The above expression is simplified using Taylor series expansion: I(x+p, y+q) - I(x, y) = pI x + qI y (2) Obtained: E(p,q)≈Σ x ∑ y ω(x,y)[pI x +qI y ] 2 (3) The matrix is represented as: In the formula, M can be represented as: α and β are the eigenvalues of the matrix M, and a parameter R is defined as: R = min (αβ) (6) When the value of R is greater than a threshold value, the region is considered as a corner point.

2. The method of detecting the respiratory rate of a pig based on an infrared image according to claim 1, characterized in that, Step (2) comprises the following steps: A. Marking the region of interest around the nostril area using a rectangular frame manually; B. Marking the region of interest on the infrared image of the pig face; C. Automatically tracking using the corner point detection and registration process. 3.The method of claim 1, wherein, Step (4) comprises the following steps: Selecting the pig nostril edge as a tracking point, tracking the tracking point, calculating the displacement amount between the sequence images, and thereby realizing infrared image registration; For the sequence infrared images, where x, y represent the pixel coordinates of the tracking point, and t represents the time sequence, the pixel value of the infrared image is I(x, y, t); assuming that only displacement occurs between images and the brightness does not change compared with the previous frame image, then: I(x, y, t) = I(x + d x ,y + d y ,t + τ) (7) where d x is the displacement, τ is the time variable, and let d = (d x , d y ) represent the displacement change. y is the displacement, τ is the time variable, and let d = (d x , d y ) represent the displacement change. From the above formula, by shifting the position of each pixel point in the t time image by d, the corresponding window of the t+τ time image can be obtained; the purpose of the tracking algorithm is to solve the displacement d; Define the error amount ε as: In the formula, W is a feature window; Using I to represent the t time image and J to represent the t+τ time image, the formula 8 is expressed by integration, which is equivalent to: In the formula, X = (x, y) is the pixel coordinate; According to the Taylor formula expansion, the following is obtained: To solve the offset d, let At this time ε takes a minimum value; then there is: wherein, The formula 12 can be transformed as: ∫∫ W [J(X)-I(X)]g(X)dX=-[∫∫ W g(X)g T (X)dX]d (13) Let Z = - [∫∫ W g(X)g T (X)dX] (14) e = ∫∫ W [J(X) - I(X)]g(X)dX (15) The displacement d can be obtained: d = Z -1 e (16) The displacement between the two frames of images is obtained, and then the two frames are registered according to the displacement amount to obtain the pig nostril edge pixel points in each frame image. 4.The method of claim 1, wherein, Step (5) comprises the following steps: The respiratory frequency of the pig is reflected by the change rule of the average value of the pig respiratory profile pixels; A. Calculate the nostril center pixel point coordinates According to the nostril wall pixel points of the infrared image, the nostril center pixel point coordinates O(x0, y0) are calculated through formulas (17) and (18); where n is the number of all pixel points on the nostril wall; (x i ,y i ) is the pixel point coordinate on the nostril wall; B. Calculate the radius and equation of the nostril circle The calculation of the nostril circle radius is shown in formula (19); the equation of the nostril circle is shown in formula (20); (x - x0) 2 + (y - y0) 2 = r 2 (20) C. Calculate the average value of the respiratory profile pixels Because the temperature change of the pixel points on the nostril wall caused by breathing is small, the pixel points on the nostril circle are eliminated, all the pixel points in the circle constitute a breathing profile, and the average value of the breathing profile pixel is shown in equation (21); In the formula, C aver is the average value of the respiratory profile pixels; m is the number of respiratory profile pixels; C i is the pixel value of the respiratory profile pixel. 5.The method of claim 1, wherein, The step (6) comprises the following steps: A. collecting the discrete points of the average value of the breathing profile pixel by experiment; B. selecting 200 continuous points from the average value of the breathing profile pixel and drawing a fitting curve; The pig breathes at a constant speed, the average value of the breathing profile pixel-time curve has obvious periodicity, and the curve fitting is performed by using discrete Fourier transform; C. calculating the breathing frequency; The period T of one complete breathing process can be calculated by equation (22), where Δt i The absolute value of the time difference between adjacent peak points is represented by T, and the average value of the absolute value of the time difference between adjacent peak points is obtained by substituting all peak points into T, which is the respiratory cycle. Then, the respiratory frequency F of the pig is obtained by substituting T into equation (23).

6. A respiratory rate detection apparatus for a pig based on infrared images, characterized by The device adopts the pig breathing frequency detection method based on infrared image according to any one of claims 1-5, comprises a field infrared image acquisition device, a video acquisition card, a computer and corresponding image acquisition, transmission and storage algorithms; the field infrared image acquisition device is used for collecting, transmitting and storing the infrared video image into the computer, then the software system is used for corresponding algorithm processing and identification, and the computer is used for outputting the breathing frequency of the target pig.

Citation Information

Patent Citations

  • Method and apparatus for determining respiratory characteristics of an animal

    WO2015030611A1