1 Introduction

Body dimensions and weight of the livestock not only reflect their body outlines, structures and physical conditions, but also embody their physiological status, productivity, disease resistance and adaptation to external living environment [1]. Moreover, they have been also extensively applied in evaluation, reproduction and sales areas. In recent decades, the measurement technology of body size and body weight for livestock plays a key role in improving the production of animal husbandry [2]. In addition to directly revealing production traits of the livestock, the accurate estimation for their body dimensions and weight is even a key basis for making breeding plans for domestic animals.

Globally, animal size has been widely investigated and various analytical methods have been adopted to appraise animal morphology and traits. They provide guidance for animal breed selection and animal production [3,4,5]. However, traditional measuring methods require high workload and raise stricter requirements for standing postures of animal. Besides, according to the requirements of these methods, the direct contact will cause great harm to animals, which may further lead to the decline of animal productivity, increase in disease and even death. All these severely affect growth and development of individual animals and the herd on one hand; it is also much more likely to spread zoonotic diseases on the other hand.

In this regard, it is urgent to propose easy-to-handle, lightweight methods to precisely estimate the weight of the livestock. Thankfully, this is made to be true with the proliferation of mobile and edge computing [6,7,8]. With these infrastructures and techniques, it is feasible to collect and process a huge amount of data and accomplish complex tasks of various kinds (e.g., manufacturing production management [9], information/event prediction [10, 11], paper recordation [12] and social networking analysis [13]). Similar techniques can also be applied in livelihoods areas. For example, a method that was proposed based on optical and acoustic devices (ultrasonic waves) by John can identify skeletal structure characteristics of animals [14], and X-ray imaging was utilized by Cloete to determine bone sizes [15]. Nevertheless, ultrasonic imaging is still incapable of realizing non-contact measurement, and the X-ray imaging has defects of cytoclasis and raising more rigorous requirements for environment. For this reason, body measurement for animals is fulfilled by Doschlwilson et al. depending on principles of optics [16]; by virtue of a machine-vision-based method, Zwertvaeg-her et al. succeeded in measuring lengths of different body parts of a swine [17], and Wang et al. used a Xtion sensor to analyze and measure swine morphology [18]. For the past few years, computer-assisted image acquisition and processing have been extensively applied in animal husbandry to obtain body measurement parameters of animals. Subsequently, such parameters are utilized to estimate their weight. This has become one of the most popular methods in this field. A stereo binocular visual system is established by Paolo et al. to estimate sizes and weight of live goats [19]. On the basis of an image processing technique, Khojasteh-key evaluates body sizes of newborn lambs and figures out influence of body sizes on their genetic characters [20]. With the development of deep learning, it is possible to deal with various image problems by deep learning. Jin Liu [21] outlines the MRI image processing and analysis methods based on deep learning, but it is difficult to collect yak’s data, which leads to the inability to obtain a large number of yak pictures. Therefore, this paper uses the traditional algorithm to calculate yak’s weight. With the rapid development of economic progress in Western China, yak breeding industry is gradually developed from a situation where plot-based culture and a free-ranging pattern coexist to large-scale breeding. In this context, differences in breeds, ages, fetal times and lactation stages among the individuals should be taken into account for the latter. With the increase in the cost of artificial, feed and fecal treatment and the increasingly prominent problem of dairy safety, large-scale breeding has put forward more stringent requirements for the feeding and management mode. Hence, precision breeding supported by information technology is inevitable in the process of modern farming development [22]. Furthermore, information perception and analysis for individual animals is the key to precision breeding. By accurately obtaining information (e.g., respiratory conditions, postures and movement) of individual animals in a real-time manner, their growth, health status and gestation can be objectively evaluated. In this way, relevant prevention and treatment measures such as human intervention can be taken timely, so that potential losses may be minimized.

Growth of the yak is basic biological characteristics of this breed and serves as an important embodiment to their economic values [23]. Considering that the yak production is completed in a highland ecosystem with poor stability, their growth is featured with distinct spatial and temporal heterogeneity. Relevant investigations assist us in minimizing errors of body measurement parameters that are obtained and enhancing sensitivity to weight parameter acquisition, so as to make it convenient for us to diagnose and prevent health problems during livestock breeding.

As mammals living at the highest elevation in the world, yaks are mainly distributed along the Himalayas and on the Qinghai-Tibet Plateau that is the alpine region at an altitude ranging from 3000 to 5000 m. Under the circumstance that yaks are rather wild and free-ranging in most cases, it is very difficult to obtain their body measurement parameters and weight by common methods. Due to the above reasons, it is too difficult to estimate the body weight of yak using traditional body weight measurement methods or three-dimensional modeling. Fortunately, with the rapid development of portable mobile devices in recent years, their capabilities of computing processing are getting higher and higher. We can use mobile devices to take photographs for yaks at a distance, combining with edge computing mode. It is extremely convenient for herders to breed yak, the above problems can be solved as well. In a word, such an algorithm can be effectively applied in an actual breeding environment to gain body dimensions and weight of yaks in conditions of reducing human interventions and less contact with them.

2 Materials and methods

2.1 Body dimension and weight measuring methods for yaks

Regarding animal husbandry research and production, certain characteristics of the research object are frequently described by an index [24]. The health and genetic characteristics are evaluated by measuring weight and body of yaks. Body dimension of a yak is commonly divided into six aspects, including standing height, body length, chest depth, chest circumference and hipcross height. For details, please see Table 1 and Fig. 1d Images with Measuring Points Labeled .

Table 1 Common morphological parameters of yaks
Fig. 1
figure 1

Yak images

Before body measurement parameters are evaluated, feeding should be ceased 12 h earlier to ensure that the yaks are in a fasting state. For each yak, the parameters should be measured for three times and an average value was worked out and used as its parameter. In this way, errors in body dimensions and weight can be prevented [25]. Moreover, a Biltmore stick was selected to measure standing height, body length, chest depth and hipcross height of the yaks, and they were weighed by an electronic scale manufactured in Shanghai Yaohua. As for the scale with 1.5 m \(\times\) 2 m in its size, it has a weighing range of 0–3 t and a weighing error of \(\pm 500\) g (Table 2).

Table 2 Common morphological parameters of yaks

2.2 Data acquisition

Chindu County in Yushu Tibetan Autonomous Prefecture, Qinghai Province, is selected as the research area. Located in the hinterland of Qinghai-Tibet Plateau, Yushu is in southwestern Qinghai, nowadays, its grassland is as large as \(0.14 \times 10^{8}\,{\hbox {hm}}^{2}\), including \(0.11 \times 108\,{\hbox { hm}}^{2}\) of those available [26].

As highly sociable animals, individual yaks that are familiar with each other yearn for forming groups [27]. Among all 25 tested yaks randomly selected, 9 are 1.5 years old (3 males weighed to be \(92 \pm 7\) kg and 6 females \(95 \pm 6\) kg). Besides, there are also eight 2.5-year-old yaks that are all male and weighed to be \(160 \pm 50\) kg. As for another 8 adult yaks, they are all female with weight at \(195 \pm 30\) kg. A herdsman who was familiar with the corresponding yak was asked to stabilize it by holding its horns, so that another people had the chance to photograph it 2–3 m away from it. During photographing, the yak should be in a posture vertical to the center line of the camera to the greatest extent; moreover, the camera was placed in a position that is 2/3 of the yak’s standing height. (For each yak, at least 3 photographs containing the stances shown in Table 3 must be taken.) With regard to photographic pictures, they are presented in Fig. 1b Photographic Images. In the course of photographing, extreme cases were encountered among 3 yaks who behaved badly, including a 2.5-year-old male yak (body arching) and two 1.5-year-old female yaks who leaned backward and formed a rather large included angle with the plane where the camera was placed. In a word, 25 yaks at different age groups were randomly selected from a yak herd to acquire their images by above mentioned means. Then, their weight and body dimensions were measured manually and noted down as well. After the completion of the above experiment, data of weight and body dimensions were further collected for 300 yaks in various age groups by means of manual measurement.

Table 3 Definitions of yaks’ 3 stances

According to the existing public literature, important indexes that reflect growth characters, productivity and genetic characters of yaks consist of their standing height, body length, chest depth, hipcross height and weight. In this study, a person took the responsibility to hold yak horns and ensure correct postures of the yak, while another person measured and recorded relevant parameters. Each parameter was measured three times to give an average value. Subsequently, the yak was pulled onto an electronic scale for weighing. After that, it was pulled again in a photographing area where its image was obtained in a condition of normal stance. In the end, relevant images were processed by a foreground extraction algorithm, a contour extraction algorithm and a measuring point identification algorithm to acquire their body dimensions and weight data.

3 Data processing and testing on mobile

3.1 Foreground extraction for images

A vast majority of yaks have black hairs. However, the movement areas of a farm are usually covered with soil. Consequently, it is much likely to see their hair color similar to that of the background. In this consideration, yaks should be herded to a place where its ground color is greatly different from their hair color. Hairs of a yak are coarse, look like petals and are divided into strands [28], which result in irregular and fuzzy boundaries found during gray analysis on images. To preserve image boundaries better and minimize the complexity of further processing, this article obtains the foreground images of yak by combining simple linear iterative clustering (SLIC, as shown in Fig. 2) with a Sobel edge detection.

Before using the Sobel operator and SLIC algorithm to obtain the foreground image of yak, the image preprocessing should be performed at first. We changed the Yak’s head orientation to the unified left, so as to identify the measurement points of the body and size. In order to improve the speed of image processing, the image can be compressed, and then histogram homogenization [29] and average filtering [30] make the contrast of the image more balanced, which is more conducive to the extraction of yak’s preprocessing image. The image initialization algorithm of yak is shown in Algorithm 1.

Fig. 2
figure 2

SLIC flowchart

figure a
$$\begin{aligned} D= & {} \sqrt{\left( \frac{d_{c}}{N_{c}} \right) ^2+\left( \frac{d_{s}}{N_{s}} \right) ^2} \end{aligned}$$
(1)
$$\begin{aligned} d_{c}= & {} \sqrt{\left( L_{j}-L_{i}\right) ^2+\left( A_{j}-A_{i} \right) ^2+\left( B_{j}-B_{i} \right) ^2} \end{aligned}$$
(2)
$$\begin{aligned} d_{s}= & {} \sqrt{\left( x_{j}-x_{i}\right) ^2+\left( y_{j}-y_{i} \right) ^2} \end{aligned}$$
(3)

In Eq. (1), dc stands for color distance, ds for space distance and Ns for maximum intra-class space distance. As for Nc that denotes the maximum color distance, it may be substituted by a constant m ranging between 1 and 40 (equal to 10 generally).

As a typical region segmentation algorithm, superpixel segmentation makes use of clustering methods to fulfill image segmentation based on brightness, colors and texture correlation among pixels. In line with the SLIC algorithm, images are converted from RGB space into LAB color space, and local clustering of pixels is executed in 5-D space which is defined by L, A and B values in the LAB color space together with x and y pixel coordinates [31]. In this way, it can effectively produce dense and almost uniform super mixture. Thanks to its advantages such as high processing speed, high memory efficiency and uniformity with the original image boundary, it has attracted more and more attention from researchers [32]. As one of the most important operators in pixelated image edge detection [33], the Sobel edge detection operator consists of two groups of \(3 \times 3\) matrices, one horizontal and the other vertical. By planar convolution dependent on such matrices, approximate values of brightness differences in horizontal and vertical directions are obtained, respectively. In addition, steps of image foreground acquisition based on SLIC and the Sobel edge detection operator are as follows.

  1. (1)

    The Sobel operator was used to carry out plane convolution for the original image in Fig. 1, and the average brightness of the image obtained was calculated as the threshold value. Pixels larger than the threshold value can be considered as edge pixels, while those smaller than the threshold value can be considered as non-edge pixels.

  2. (2)

    The boundary point in the Sobel image was obtained by traversing; moreover, the number of total pixels corresponding to all points that were connected to each boundary point was acquired; for connected pixels less than \(1\%\) of the total boundary point pixel value, they were eliminated.

  3. (3)

    SLIC-based segmentation was carried out for images that have undergone preliminary processing; in this process, distance of seed points was set at five pixels (\(N_{c} = 10\)) to solve the SLIC segmentation boundary.

  4. (4)

    Specific to images obtained in Steps 3 and 2, the Sobel edge detection images were generated eventually.

  5. (5)

    The SLIC-based image segmentation algorithm was utilized again and distance of clustering centers was defined as 30 pixels (\(N_{c} = 40\)); in this way, the SLIC segmentation boundary was acquired.

  6. (6)

    Regarding images detected in Step 4, if it intersects with the SLIC segmentation boundary obtained in Step 5, then the SLIC boundary of the corresponding clustering center should be supplemented; in addition, a pixel point, which is closest to an image center, of the supplemented boundary should be figured out. Subsequently, extension was conducted based on this point and did not stop until the Sobel image obtained in Step 4 was acquired. As for the final image thus generated, please refer to Fig. 1c Supplemented Sobel Edge Images.

  7. (7)

    In this case, the generated yak boundary image was closed and its central point was set as the starting point to allow filling by feat of a flooding algorithm [34]. Since the yak standing area can be removed from the image obtained in step 6, the color space distance between the image edge point obtained based on the flooding algorithm and the surrounding pixels is detected. The extension should be iteratively conducted if the space distance is less than the threshold before the acquired foreground pixels remain unchanged.

  8. (8)

    The obtained image was subjected to expansion and corrosion so that it may become smooth. Eventually, the yak image images turn out to be those presented in Fig. 1d Images with Measuring Points Labeled. Regarding operational processes of extracting the yaks’ foreground images, it is given in Fig. 3.

Fig. 3
figure 3

Operational processes of extracting the yaks’ foreground images

Fig. 4
figure 4

Comprehensive display system for yak’s estimation

3.2 Measuring point recognition algorithms

3.2.1 Recognition algorithm for standing height measuring points of yaks

Standing height of a yak refers to distance from its point of withers to the ground. In the case of identifying such a point, its head should be neglected in the first place for the purpose of preventing horns on the head from affecting acquisition of this point. In Fig. 1d Images with Measuring Points Labeled, heads that have been ignored are indicated in yellow. Afterward, their profile curves of the left upper part to the center were encoded by \(24-neighborhood\) chain codes, and curvature of each point was calculated [35]. In this case, a point with the maximum curvature represents the point of withers of the corresponding yak. During curvature calculations, a triangle may be determined by a contour point in a region where the point of withers is identified and another two points adjacent to it. After lengths of three sides as well as its perimeter P have been acquired for the triangle, the Heron’s formula was selected to work out its area denoted as S and the curvature K. When a normal line of measurement is identified, traversing of the lowest points in the left lower part to the center and other lowest points in the right lower part to the center can be performed provided that the yak is standing ordinarily. On this basis, the normal line can be identified. Moreover, such a normal line of measurement may be deemed as the ground, as Line S in black shown in

figure b

Figure 1d Images with Measuring Points Labeled. Furthermore, the perpendicular distance from the point of withers to the normal line is the yak’s standing height. Regarding lines of standing height, they have been shown by red segments A in Fig. 1d Images with Measuring Points Labeled. The recognition algorithm of the measurement points of body height is shown in Algorithm 2.

figure c

3.2.2 Recognition algorithm for hipcross height measuring points of yaks

Hipcross height of a yak refers to vertical height from its hipcross to the ground. Here, the hipcross point can be identified by recognizing a lower boundary point of its hipcross. The center of the yak was recalculated after its head and feet were eliminated, so that a lower boundary point of its hipcross was determined to be on the right of the above described center. Likewise, a search algorithm was utilized to locate the highest point within a range from the lower boundary of the center to the lowest point of its rear hoof. Again, the highest point is identified as its lower boundary point. Similarly, a perpendicular between this point and the normal line is drawn, so that an intersection of this perpendicular and the upper half of the yak is the upper boundary point of its hipcross. As shown in purple segments D in Fig. 1d Images with Measuring Points Labeled, the recognition algorithm of cross height measurement point is similar to that of chest depth measurement point. It can refer to the recognition algorithm of chest depth measurement point, which is not described too much here.

3.2.3 Recognition algorithm for body length measuring points of yaks

Body length of a yak refers to the distance from its punctum ischiacum to its shoulder point. During punctum ischiacum acquisition, contour lines of the yak in the upper right part to the center may be encoded by 8-neighborhood chain codes and curvature of each point should be calculated. In this case, the point with the least curvature is the punctum ischiacum of the corresponding yak. As for shoulder point acquisition, head and feet of the yak should be first ignored to avoid their influence on shoulder point recognition. Regarding contour lines of yaks with heads and feet removed, they are shown in white in Fig. 1d Images with Measuring Points Labeled. By traversing images of the left lower part to the center, a curve point at the most upper left end was found within the range. Then, such a curve point was used as the starting point to fulfill searching. Furthermore, traversing of all retrieved points was conducted to locate a point that is the closest to its center, the punctum ischiacum. With regard to the body lengths of yaks, they are denoted by orange segments B in Fig. 1d Images with Measuring Points Labeled, the recognition algorithm of the measuring point for the length of body oblique is shown in Algorithm 3.

figure d
Table 4 Univariate regression model-based prediction
Table 5 Multivariate regression model-based prediction
Fig. 5
figure 5

Data transfer between nodes and cloud

3.2.4 Recognition algorithm for chest depth measuring points of yaks

Chest depth of a yak refers to the height, around its chest, starting from the rear of its scapula. In this paper, chest circumference measuring points of a yak may be gained by identifying lower boundary points of its chest. After the center of the remaining body part with heads and feet eliminated, their lower boundary points were determined to be on the left of its center. Subsequently, a search algorithm was adopted to search the highest point within a range from the lower boundary of this center to the lowest point of its forehoof. Thus, the highest point can be recognized as a lower boundary point of its chest. Furthermore, an intersection between a perpendicular formed by this point and the normal line is the upper boundary point of its chest. As for chest depth recognized by this algorithm, it is represented by pink segments C in Fig. 1d Images with Measuring Points Labeled. The recognition algorithm of measuring points of chest depth is shown in Algorithm 4.

Hipcross height of a yak refers to vertical height from its hipcross to the ground. Here, the hipcross point can be identified by recognizing a lower boundary point of its hipcross. The center of the yak was recalculated after its head and feet were eliminated, so that a lower boundary point of its hipcross was determined to be on the right of the above-described center. Likewise, a search algorithm was utilized to locate the highest point within a range from the lower boundary of the center to the lowest point of its rear hoof. Again, the highest point is identified as its lower boundary point. Similarly, a perpendicular between this point and the normal line is drawn, so that an intersection of this perpendicular and the upper half of the yak is the upper boundary point of its hipcross. As shown in purple segments D in Fig. 1d Images with Measuring Points Labeled, the recognition algorithm of cross height measurement point is similar to that of chest depth measurement point. It can refer to the recognition algorithm of chest depth measurement point, which is not described too much here.

3.3 Calculations of yak weight

Data fitting was carried out for the collected data based on weka to produce a computational formula (see Eq. 4) for yak weight. In this equation, w stands for weight, h for standing height, s for body length, d for chest depth and t for hipcross height. According to the data acquired, ratios of standing height to body length, standing height to chest depth, standing height to hipcross height, body length to chest depth, body length to hipcross height and chest depth to hipcross height were worked out and used as the essential data. By comparing the advantages and disadvantages of K-means, KNN, Bayes, a priori and other data mining algorithms [36] , this paper decided to adopt KNN algorithm to proportions of standing height to body length, standing height to chest depth, standing height to hipcross height, body length to chest depth, body length to hipcross height and chest depth to hipcross height were calculated. Respectively, these ratios are compared with the perceptual data one by one to find out the related errors and define k data with the minimum error. In this paper, K was equal to 5. (If the value of the k too small, the final measurement result will easily affected by noise points, and the error may increase; if too large, it may contain too many other yak-type points, and the error may also increase.) Thus, body measurement data of five yaks were generated and averaged. After that, data obtained through calculations were substituted into Eq. (4) to work out their weight.

Fig. 6
figure 6

Recognition images of measuring points of yak in different standing positions

Fig. 7
figure 7

Body measurement data analysis for yaks in different age groups

$$\begin{aligned} w= 1.0621\times h+0.7202\times s+4.6187\times d+1.0350\times t-398.6303 \end{aligned}$$
(4)

4 The establishment for a comprehensive display system for yak estimation

Through the development and application of the yak body size and weight estimation algorithm in 3 on the mobile terminal, the herdsmen can obtain the yak body size and weight data easily and quickly when using mobile phones, which will bring positive benefits to yak’s healthy breeding, welfare breeding and precision breeding.

The amount of data collected determines the accuracy of the method of estimating the body size and weight of yak in this paper. (The more information about body size and weight of different yaks in the database, the higher the accuracy of body size and weight estimation in practical application.) However, it is very difficult to collect information on the body size and weight of yaks in reality. It usually requires several strong labors, and the body size and weight data of dozens of yaks can be obtained by weighing in one day. If the majority of herdsmen use the yak body size and weight estimation software based on mobile, timely feedback the specific body size and weight data of the estimated yak, which will have a positive impact on the accurate estimation of yak body size and weight information. Therefore, a comprehensive display system for yak estimation is developed [37] (as shown in Fig. 4).

The estimation and display system of yak includes estimate average error module, history record module, best and worst estimate result module [38, 39] and the use record of mobile module. When herdsmen estimate the body size and weight of yaks by the mobile terminal, they can choose the measure accuracy of the body size and weight of the yaks. They can also use the mobile terminal to estimate the body size and weight of yaks and then measure body size and weight in actual. Subsequently, the data are transmitted to the cloud server through the network for storage [40, 41] (as shown in Fig.  5). By updating and fitting the body size and weight data of yaks regularly  [42] , the error between the body size and weight of the estimated yaks can be minimized. More than 100 yak body size and weight data were collected in one month after the system was put into operation. Through updating and fitting the body size and weight data, the results showed that the average error of yak body weight estimation is reduced by \(0.8\%\) compared with the previous one, and the body height, oblique length, chest depth and cross height are reduced compared with the previous one.

Table 6 Data of randomly selected ten yaks
Table 7 Data validation results of 25 yaks in different age groups

5 Results and discussions

5.1 Algorithm stability analysis

Three stances have been defined for yaks, as given in Table 3

In order to detect the adaptability of the algorithm, the measurement points of the same yak at different positions are extracted. These extracted measuring points on body sizes of yaks in diverse stances are revealed in Fig. 6. To be specific, measuring points of the yak in Stance 1 are presented in Fig. 6 Stance 1, while Fig. 6 Stance 2 and Fig. 6 Stance 3, respectively, indicate measuring points obtained in Stances 2 and 3. It has been proven by the relevant results that this algorithm has the potential to accurately recognize measuring points on bodies of yaks. As signified by testing totally 103 yak pictures collected, foregrounds can be extracted from 98 yak pictures by virtue of such an algorithm, generating a recognition accuracy of \(95.15\%\). Regarding 95 images with foregrounds identified, measuring points can be accurately labeled; in this case, the recognition accuracy turns out to be \(92.23\%\). It has been found from the experimental results that such an algorithm is preferably adaptable and performs accurately and robustly in extracting measuring points in various stances.

Table 8 Mean error detection results based on data of 25 yaks

5.2 Analysis on body measurement detection accuracy and results

Body measurement data of ten male or female yaks in diverse age groups (see Table 6) were selected to generate the measurement results by virtue of the above algorithm. These results are given in Fig. 7.

In conformity with data analysis, mean errors between the calculated values and the measured values of standing height, body length, chest depth and hipcross height are, respectively, \(0.37\%\), \(1.428\%\), \(2.009\%\) and \(2.774\%\) as far as Stance 1 is concerned. The reason why such errors for chest depth and hipcross height are rather large is that both chest depth and hairs in the lower part of the hipcross are exclusive during calculations of them by a Biltmore stick, and although preliminary image processing has been performed by the proposed method, it fails to utterly remove hairs below the chest and on the lower part of the hipcross. In terms of Stance 2, mean errors between the calculated value and the measured value of standing height, body length, chest depth and hipcross height are \(0.534\%\), \(2.264\%\), \(2.68\%\) and \(3.255\%\), respectively. In addition, all relevant data are reduced. The reason for large errors found in body length, chest depth and hipcross height is that center line of the yak’s back forms a rather great included angle with the center line of the camera. Due to this included angle, impressions of the body length, the chest depth and the hipcross height are cut down in their images. As regards Stance 3, a mean error of \(0.742\%\), is generated by the calculated value and the measured value of standing height; however, all calculated and measured values are comparatively small, because heads of the yaks tilt during photographing, which leads to a slight decline of their points of withers. For mean errors between the calculated values and the measured values of body length, chest depth and hipcross height, they turn out to be \(3.32\%\), \(3.531\%\) and \(3.957\%\), respectively. Again, all such data decrease. The reason why mean errors of body length, chest depth and hipcross height are rather high is similar to that for Stance 2. As demonstrated by the measurement results of the same yak in three different stances, the calculated value of standing height is slightly deviated from its measured value in an extreme stance, while data of its body length, chest depth and hipcross height decline to an extent greater than that of their measured values. By averaging data obtained by repeated measurements, better results can be generated.

5.3 Weight detection accuracy and result analysis

Specific to 300 items of yak-related data that are manually acquired, univariate and multivariate regressions are performed to predict the weight by means of linear regression, Gaussian process, neural network and support vector machine. Relevant model prediction details are given in Tables 4 and 5. According to the corresponding results, high correlation coefficients are generated if their weight is obtained by image processing. This signifies that parameters gained through image processing can be used for modeling. During univariate analysis, chest depth exerts a more significant influence on weight; in the course of multivariate analysis, the linear regression method with comparatively high correlation coefficients and low errors produced features, as for model validation, the least standard deviation (9.2779 kg) and the least mean error (\(6.24\%\)). In the end, data validation results for 25 yaks that are divided into different age groups are acquired and presented in Tables 7 and 8.

5.4 Discussions

In this section, performance and applications of body measurement algorithms for yaks are assessed. In terms of such algorithms, a method proposed by Lina Zhang [5] specific to small-tailed han sheep is featured with being simple, convenient and independent of any particularly established construction. In comparison with another method raised by Tillett [3], that is to acquire morphological data of swine from 3-D images, the former can be much simpler. However, errors are incurred in this paper because of the failure in recognizing sufficiently accurate measuring points. If compared with the method developed by Larios [43], the proposed approach here does not require sensors and can be also embedded in portable devices such as a mobile phone. Yaks which are huge and wild cannot be treated like ordinary domestic animals. In this context, 3-D measurement or sensor-based measurement may be applied. The results of research show that it is feasible to use the edge calculation method to estimate the weight of yak. First, the estimated data and the actual body weight of the yak are transferred to the cloud server, and then the data is regularly updated and fitted to reduce the data deviation. Compared with other methods, this method can conveniently obtain the yak body size and weight data, reduce the manual labor of the herdsmen and improve the management efficiency of the herd.

6 Conclusions

In this paper, the edge calculation method is used to take photographs of the yak through the mobile and portable device, and the SLIC+Sobel operator is used to obtain the foreground image of the yak, and then, the image of the measurement point of the yak is identified. Then, the proportion of each yak’s body size data is transmitted to the cloud server, and the actual body size data of the yak is estimated through a data mining algorithm, and then, the actual weight of the yak is calculated using a linear regression formula and the result is fed back to the user. Compared with other methods, the method proposed in this paper is convenient, fast, low-risk and practical. This is very beneficial for the herdsmen in the Sanjiangyuan region to raise yak. At the same time, the weight information of the animal reflects the animal’s physical health, and the method in this paper also prevents and diagnoses health problems caused by yak eating, which can improve the production efficiency of large yak farms and save labor costs.

Specific tests through experiments show that:

  1. (1)

    Regarding images collected in a scene, the proposed algorithm is capable of generating split images with preferable edge information and effectively extracting contour information of yaks. In experiments of extracting measuring points on images of yaks that are in diverse stance, the proposed algorithm is demonstrated to be preferably adaptable.

  2. (2)

    The testing results indicate that averaging the values that are obtained through repeated measurements may enhance accuracy of the measurement system.

  3. (3)

    Errors may be reduced to the greatest extent by holding the camera horizontally and making the plane where the camera is placed parallel to that where the yak is standing.

  4. (4)

    In accordance with the yak weight prediction results, parameters generated by image processing can be used to monitor growth situations of yaks.

  5. (5)

    Yak estimation integrated display system, which can obtain the yak body size data in time and effectively, and evaluate the method proposed in this article.

  6. (6)

    The more actual yak body size and weight data is obtained, the more accurate the yak body size and weight estimation will be.

The experimental results show that the edge calculation method proposed in this paper can effectively measure the body size and weight parameters of yaks and avoid direct contact with yaks. Therefore, under the management mode of welfare agriculture, it provides guidance for yak evaluation and breeding based on body size.