## ABSTRACT

## Key words

## INTRODUCTION

Marinello, F., A. Pezzuolo, D. Cillis, F. Gasparini, and L. Sartori. 2015. Application of Kinect-Sensor for three-dimensional body measurements of cows. Pages 661–669 in 7th European Conference on Precision Livestock Farming, ECPLF 2015. European Conference on Precision Livestock Farming, Milan, Italy.

**2-D**) vision, thermal vision (

**3-D**) vision using one or multiple 3-D cameras (

Marinello, F., A. Pezzuolo, D. Cillis, F. Gasparini, and L. Sartori. 2015. Application of Kinect-Sensor for three-dimensional body measurements of cows. Pages 661–669 in 7th European Conference on Precision Livestock Farming, ECPLF 2015. European Conference on Precision Livestock Farming, Milan, Italy.

Marinello, F., A. Pezzuolo, D. Cillis, F. Gasparini, and L. Sartori. 2015. Application of Kinect-Sensor for three-dimensional body measurements of cows. Pages 661–669 in 7th European Conference on Precision Livestock Farming, ECPLF 2015. European Conference on Precision Livestock Farming, Milan, Italy.

## MATERIALS AND METHODS

### Image Acquisition

**AMS**, Astronaut A4, Lely Industries N.V., Maassluis, the Netherlands). Near one of the AMS, an image acquisition setup was constructed (Figure 1). The setup was placed next to the exit of the AMS so that cows could enter it immediately after milking. The setup consisted of a cow selection box, an electronic weighing scale, a 3-D camera, and a computer that connected and controlled the setup.

**ID**) receiver (long-range wireless base unit, SCR, Netanya, Israel) was mounted on the side of the box. The receiver automatically identified the cow in the setup through an ID tag (HR-LD, SCR) around its neck. The floor of the box was an iron plate (2.8 × 0.8 × 0.15 m) attached to an electronic weighing scale (AllScales, Hank Maas B.V., Veen, the Netherlands). One load cell was attached to each corner under the iron plate, and all 4 could weigh up to 1,500 kg with a measurement precision of 0.5 kg. These load cells were connected to a digital weight indicator that showed a stable weight every second when the difference between the currently measured weight and the previous weight was no more than 1 kg.

*xy*plane to capture the greatest possible amount of information on a cow's body. The angles to the other 2 planes were 0°. Moreover, the center of the camera lens was on the centerline of the box in the

*x*direction, 0.50 m from the entrance gate in the

*y*direction, and 1.95 m above the iron plate of the weighing scale in the

*z*direction (Figure 2).

### Image Analysis

*xyz*coordinates. The coordinates represented the relative position of each point on the object to the center of the camera lens in the

*x*,

*y*, and

*z*directions. The raw 3-D image included the surface of a cow's body, the frames of the selection box, the weighing scale, and image noise.

#### Step 1. Cow Body Segmentation

**ROI**) in the

*x*,

*y*, and

*z*directions and selecting points within the ROI as the cow body. The ROI boundaries in the

*x*and y directions were assumed to be the positions of the metal frames of the selection box. These boundaries were determined by measuring the metal frames in an empty image without cows. The boundary in the

*z*direction was set to 1 m to separate the body of each cow from the ground. After cow body segmentation, all points within the ROI boundaries were saved as the cow's body surface.

#### Step 2. Image Noise Removal

#### Step 3. Transformation

*xy*plane, the 3-D image was rotated back by 3°. Moreover, the starting point of the

*z*-axis was converted from the center of the camera lens to the surface of the iron plate of the weighing scale. The

*z*-axis conversion made each point's

*z*coordinate the height above the plate (Figure 5c).

#### Step 4. Interpolation

*x*and

*y*directions. For each grid point, we assigned its value as the

*z*value of its nearest neighbor in the point cloud (Figure 5d). The mesh grid image was considered a matrix. The columns and rows of the matrix were represented by the mesh grid points in the

*x*and

*y*directions, and the elements of the matrix were the heights of the grid points in the

*z*direction.

#### Step 5. Anatomical Landmark Identification

*xy*plane to align the spine line perpendicular to the

*x*-axis and parallel to the

*y*-axis. After rotation, the spine was represented as a single column in the matrix.

*x*direction) by discarding the spine and its adjacent columns (n = 20) on both sides from the matrix. Second, both the left and right parts of the matrix were separated into the front and rear in the

*y*direction by discarding the middle rows (n = 11) from the matrix. Excluding the middle columns and rows will separate the matrix into 4 quadrants (Figure 5f), which ensured that only one protruding anatomical landmark (either a hip or pin bone) could be located in each quadrant. For each quadrant, the row with the greatest mean height was considered to cross the protruding bone. In this row, the farthest element from the spine, which was higher than the mean height of the quadrant, was identified as the center of the protruding bone (Figure 5f).

#### Step 6. Morphological Trait Quantification

*y*direction between the centers of the hip and pin bones from both sides of the body. Hip width was defined as the distance in the

*x*direction between the 2 hip bone centers.

### Body Weight Prediction Model

where β is a parameter vector, ε is an error term, ${\sigma}_{\varepsilon}^{2}$ is the error variance,

*i*denotes the

*i*th cow, and

*i.i.d*. indicates independent and identically distributed.

**RMSE**; Equation [2]) and mean absolute percentage error (

**MAPE**; Equation [3]):

where

*yi*is the referential BW, ${\stackrel{\u02c6}{y}}_{i}$ is the estimated BW from the prediction model,

*n*is the total number of cows (i.e.,

*n*= 30), and

*i*denotes the

*i*th cow. Of all 64 models, the one with the smallest RMSE was selected as our final (best) model to predict BW.

### Quantification of Variability in Morphological Trait Measurement

*x*,

*y*, or both directions in the image acquisition setup.

### Propagation of Morphological Trait Measurement Error into Body Weight Prediction

**β**

_{0}+

**β**

_{1}×

*X*

_{1}+

**β**

_{2}×

*X*

_{2}+ … +

**β**

*k*×

*Xk*+ ε,

where

**β**is a parameter vector, X is the input variable in the final model (including morphological traits and age-related information),

*k*is the number of input variables in the final model,

*ε*is an error term with a normal distribution, and ${\sigma}_{\varepsilon}^{2}$ is the error variance. All 3 data sets were used to compute and compare the BW predictive performances. Data set A represented a set of morphological traits in the final model without the influence of the measurement error; data set B represented the same set of morphological traits under the influence of automated measurement error; data set C represented the same set of morphological traits under the influence of manual measurement error.

*XA*}

_{1000}∼ $N\left(\overline{X},{\sigma}_{x}^{2}\right),$ where $\overline{X}$ is the mean of the trait in our 30-cow data set and ${\sigma}_{x}^{2}$ is the variance of the trait calculated based on

where

*Xi*is the input variable (not including age-related information) of the

*i*th cow,

*n*is the total number of cows (i.e,

*n*= 30), and

*i*denotes the

*i*th cow.

*εAM*stemming from the automated morphological trait measurement. This error was modeled as

*εAM*∼ $N\left(0,{\sigma}_{AM}^{2}\right),$ where ${\sigma}_{AM}^{2}$ is the squared value of the automated measurement variability calculated in the Quantification of Variability in Morphological Trait Measurement section. Effectively, the 1,000-sample collection of data set B was drawn from {

*XB*}

_{1000}∼ $N\left(\overline{X},{\sigma}_{X}^{2}+{\sigma}_{AM}^{2}\right).$

*εMM*∼ $N\left(0,{\sigma}_{MM}^{2}\right),$ where ${\sigma}_{MM}^{2}$ is the squared value of the manual measurement variability calculated in the Quantification of Variability in Morphological Trait Measurement section. Effectively, the 1,000-sample collection of data set C was drawn from {

*XC*}

_{1000}∼ $N\left(\overline{X},{\sigma}_{X}^{2}+{\sigma}_{MM}^{2}\right).$

*ε*was drawn from

*ε*∼ $N\left(0,{\sigma}_{\varepsilon}^{2}\right)i.i.d.,$ where ${\sigma}_{\varepsilon}^{2}$ is the error variance of our 30-cow data set testing on the final model based on

where SSE is the sum of squared error,

*n*is the number of samples (i.e., n = 30), and

*k*is the number of the input variables in the final model.

## RESULTS

*P*< 0.001).

Item | Minimum | Mean | Maximum | SD | PCC |
---|---|---|---|---|---|

BW (kg) | 485.5 | 597.4 | 767.5 | 81.0 | — |

Hip height (m) | 1.302 | 1.359 | 1.414 | 0.029 | −0.05 |

Rump length (m) | 0.368 | 0.432 | 0.475 | 0.027 | 0.33 |

Hip width (m) | 0.385 | 0.442 | 0.510 | 0.035 | 0.76 |

DIM (d) | 1 | 136 | 363 | 100 | 0.18 |

Age (yr) | 2.02 | 3.66 | 8.03 | 1.92 | 0.81 |

Parity (no.) | 1 | 3 | 7 | 2 | 0.81 |

*P*< 1

*P*< 0.10

*P*< 0.001.

Morphological trait | Automated | Manual |
---|---|---|

Hip height (m) | 0.003 | 0.001 |

Rump length (m) | 0.012 | 0.011 |

Hip width (m) | 0.006 | 0.009 |

Multiple linear regression model | RMSE (kg) | MAPE (%) |
---|---|---|

Full model | ||

BW = β_{0} + β_{1} × HipHeight + β_{2} × RumpLength + β_{3} × HipWidth + β_{4} × DIM + β_{5} × Age + β_{6} × Parity + ε | 45.2 | 5.5 |

2 examples of intermediate models | ||

BW=β_{0} + β_{1}× HipWidth + ε | 55.4 | 7.4 |

BW=β_{0} + β_{1}× DIM + β_{2} × Age + ε | 49.5 | 6.1 |

Final model | ||

BW=β_{0} + β_{1}× HipWidth + β_{2} × DIM + β_{3} × Parity + ε | 41.2 | 5.2 |

Data set | RMSE (kg) | MAPE (%) |
---|---|---|

A (without measurement error) | 38.6 | 5.1 |

B (with automated measurement error) | 39.1 | 5.2 |

C (with manual measurement error) | 39.5 | 5.3 |

## DISCUSSION

### Source 1

*x*) × 0.003 m (

*y*) × 0.001 m (

*z*) at a viewing distance of 1 m. This resolution enables consistent identification of anatomical landmarks on the surface of a cow's rump and precise quantification of the morphological traits. Moreover, the low variability in the manual measurement could be attributed to the predefined protocol (Appendix) followed by all the assessors. Although both types of measurement variabilities were low, the influence of measurement quality on BW prediction requires further investigation. First, the variability tests in our study were done on a life-size cow model in an experiment hall using automatic and manual approaches. Thus, we simplified the measuring conditions and ignored the influences (e.g., illumination and fur color difference) of measurements on real cows on a farm. Second, the measurements were repeated on the cow model, whereas measurements on the real cows were not repeated at the farm. Third, when identifying the anatomical landmarks of different cows, the precision of the identification may depend on the shape of a cow. Bones from fat cows protrude less than the ones from thin cows. Last, the manual measurement variability of the cow model was low. However, performing manual measurements on real cows at farms will lead to a larger variability. Thus, further study is required to test the variability and reliability of the measurements on real cows at different farms and to quantify the error propagation from these sources.

### Source 2

### Source 3

## CONCLUSIONS

## ACKNOWLEDGMENTS

## APPENDIX

### Protocol for a Morphological Trait Measurement in a Life-Size Model Cow

- 1.Stand behind the cow, in line with the top of the spine.
- 2.Visually find the contour of the left hip bone and estimate the highest point on the contour.
- 3.Point out the highest point with a finger and adjust the location on a closer inspection.
- 4.Label the point with a small sticker.
- 5.Repeat steps 1 to 4 for the right hip bone.
- 6.Stand to the left of the cow and face toward the left pin bone, in line with the tail-head.
- 7.Visually find the contour of the left pin bone and estimate the highest point on the contour.
- 8.Point out the highest point with a finger and adjust the location on a closer inspection.
- 9.Label the point with a small sticker.
- 10.Repeat steps 6 to 9 for the right pin bone.

- 11.Place the level horizontally to measure the distance between the left and right hip bone markers as the hip width.
- 12.Place the level horizontally to measure the distance between the left hip bone and pin-bone markers as the left rump length.
- 13.Place the level horizontally to measure the distance between the right hip bone and pin-bone markers as the right rump length.
- 14.Calculate the mean of the left and right rump lengths.

- 15.Place the ruler of the stadiometer vertically and next to the left hip bone; place the sliding headpiece horizontally on the marker to measure the left hip height.
- 16.Place the ruler of the stadiometer vertically and next to the right hip bone; place the sliding headpiece horizontally on the marker to measure the right hip height.
- 17.Calculate the mean of the left and right hip heights.

## REFERENCES

- Automatic recording of daily walkover liveweight of dairy cattle at pasture in the first 100 days in milk.
*J. Dairy Sci.*2011; 94 (21854916): 4431-4440 - Technical note: Prediction of liveweight from linear conformation traits in dairy cattle.
*J. Dairy Sci.*2012; 95 (22459862): 2170-2175 - Invited review: Changes in the dairy industry affecting dairy cattle health and welfare.
*J. Dairy Sci.*2015; 98 (26342982): 7426-7445 - Some effects of pregnancy on body weight and paunch girth.
*J. Dairy Sci.*1967; 50: 220-224 - Determination of live weight of pigs from dimensions measured using image analysis.
*Comput. Electron. Agric.*1996; 15: 57-72 - Relationships between energy balance and health traits of dairy cattle in early lactation.
*J. Dairy Sci.*2000; 83 (11104289): 2683-2690 - Melkproductieregistratie Statistiek–Rollend Jaargemiddelde Melkproductie Landelijk.(Accessed Nov. 7, 2016.)
- Determinants of consumer intention to purchase animal-friendly milk.
*J. Dairy Sci.*2016; 99 (27474987): 8304-8313 - Modeling of energy balance in early lactation and the effect of energy deficits in early lactation on first detected estrus postpartum in dairy cows.
*J. Dairy Sci.*1999; 82 (10509251): 1927-1934 - An automated walk-over weighing system as a tool for measuring liveweight change in lactating dairy cows.
*J. Dairy Sci.*2013; 96 (23684033): 4477-4486 - Estimation of body weight from body size measurements and body condition scores in dairy cows.
*J. Dairy Sci.*1997; 80 (9313139): 1988-1995 - Prediction of liveweight of cows from type traits and its relationship with production and fitness traits.
*J. Dairy Sci.*2014; 97 (24630649): 3173-3189 - Variability in Holstein heifer heart-girth measurements and comparison of prediction equations for live weight.
*Prev. Vet. Med.*2007; 78 (17157398): 333-338 - Predicting body weight and wither height in Holstein heifers using body measurements.
*J. Dairy Sci.*1992; 75 (1474218): 3576-3581 - Invited review: The impact of automatic milking systems on dairy cow management, behavior, health, and welfare.
*J. Dairy Sci.*2012; 95 (22541453): 2227-2247 - Responses in live weight change to net energy intake in dairy cows.
*Livest. Sci.*2015; 181: 163-170 - Three-dimensional shape measurement system for black cattle using KINECT sensor.
*Int. J. Circuits Syst. Signal Process.*2013; 7: 222-230 - Body weight, body condition score, and wither height of prepartum Holstein cows and birth weight and sex of calves by parity: A database and summary.
*J. Dairy Sci.*1997; 80: 525-529 - A preliminarily study for predicting body weight and milk properties in lactating Holstein cows using a three-dimensional camera system.
*Comput. Electron. Agric.*2015; 111: 186-193 - The number, size, and distribution of farms, smallholder farms, and family farms worldwide.
*World Dev.*2016; 87: 16-29 - The body weight of the dairy cow: III. Use for on-line management of individual cows.
*Livest. Prod. Sci.*1997; 48: 187-200 - Modeling of daily body weights and body weight changes of Nordic Red cows.
*J. Dairy Sci.*2015; 98 (26254522): 6992-7002 - Advances in structured light sensors applications in precision agriculture and livestock farming.
*Adv. Agron.*2015; 133: 71-112 - Invited review: Sensors to support health management on dairy farms.
*J. Dairy Sci.*2013; 96 (23462176): 1928-1952 - Extrinsic calibration of a multi-Kinect camera scanning passage for measuring functional traits in dairy cows.
*Biosyst. Eng.*2016; 151: 409-424 - Relationships between body measurements, body weight, and productivity in Holstein dairy cows.
*J. Dairy Sci.*1988; 71: 3437-3445 - Estimation of bull live weight through thermographically measured body dimensions.
*Comput. Electron. Agric.*2008; 61: 233-240 - Agriculture; Crops, Livestock and Land Use by General Farm Type, Region.(Accessed Nov. 7, 2016.)
- Determination of body measurements on the Holstein cows using digital image analysis and estimation of live weight with regression analysis.
*Comput. Electron. Agric.*2011; 76: 189-197 - On-farm estimation of energy balance in dairy cows using only frequent body weight measurements and body condition score.
*J. Dairy Sci.*2012; 95 (22459827): 1784-1793 - Time series analysis of live weight as health indicator.in: First North American Conference on Precision Dairy Management 2010, Toronto, Canada. Omnipress, Madison, WI2010: 230-231
- Short communication: Novel method to predict body weight of primiparous dairy cows throughout the lactation.
*J. Dairy Sci.*2015; 98 (25468694): 692-697 - Public and farmer perceptions of dairy cattle welfare in the United States.
*J. Dairy Sci.*2016; 99 (27179876): 5892-5903 - Prediction of body weight and empty body composition using body size measurements in lactating dairy cows.
*Livest. Sci.*2009; 124: 233-241