Machine vision-based cattle body ruler measurement method

文档序号:1568328 发布日期:2020-01-24 浏览:14次 中文

阅读说明:本技术 基于机器视觉的牛体尺测量方法 (Machine vision-based cattle body ruler measurement method ) 是由 滕峰 张嘉森 王思嘉 杨晨 于 2019-12-19 设计创作,主要内容包括:本发明实施例公开了一种基于机器视觉的牛体尺测量方法,包括:步骤1:使用固定长度的标签贴于牛体侧身;步骤2:拍摄贴有标签的牛侧身图像,计算标签的像素长度,通过标签真实长度与像素比例,算出图像上单位像素对应的实际距离;步骤3:提取图像中的牛图像以及牛轮廓的数据;步骤4:对牛轮廓数据分析;步骤5:定位牛体的特征点;步骤6:根据特征点计算牛体尺。本发明使用机器视觉的方式,对牛的体尺信息进行测量,极大的减少了人工成本,且该方式属于无接触式,不会对牛造成任何应激反应,并具有较高的准确率;且无设备部署需求,只需利用随身携带的手机与标签纸,即可方便的完成对牛只的体尺测量。(The embodiment of the invention discloses a method for measuring a bovine body ruler based on machine vision, which comprises the following steps: step 1: the label with fixed length is attached to the side of the cow body; step 2: shooting a side body image of a cow with a label, calculating the pixel length of the label, and calculating the actual distance corresponding to a unit pixel on the image according to the ratio of the real length of the label to the pixel; and step 3: extracting data of a cattle image and a cattle outline in the image; and 4, step 4: analyzing the cattle contour data; and 5: positioning feature points of the cattle body; step 6: and calculating the body size of the cattle according to the characteristic points. The invention uses the machine vision mode to measure the body size information of the cattle, thereby greatly reducing the labor cost, and the mode belongs to non-contact type, does not cause any stress reaction to the cattle and has higher accuracy; and the device is not required to be deployed, and the body size of the cow can be conveniently measured only by using a portable mobile phone and label paper.)

1. A method for measuring a body size of a cow based on machine vision is characterized by comprising the following steps:

step 1: the label with fixed length is attached to the side of the cow body;

step 2: shooting a side body image of the cow with the label, matching the label on the cow body by using a matching algorithm, calculating the pixel length of the label, and calculating the actual distance corresponding to a unit pixel on the image according to the real length of the label and the pixel proportion, wherein the proportion is ruler;

and step 3: removing the parts of the image which are irrelevant to the cattle, and extracting the cattle image and the cattle outline data in the image;

and 4, step 4: analyzing the cattle contour data, and calculating to obtain section data and distance data from the cattle back to the cattle belly;

and 5: positioning the characteristic points of the cattle body according to the calculated data;

step 6: and calculating the body size of the cattle according to the characteristic points.

2. The machine vision-based bovine body ruler measuring method of claim 1 wherein said step 3 comprises:

and a substep of extracting the cattle image: extracting the cattle in the image by using a cattle extraction algorithm, and removing parts irrelevant to the cattle;

and a substep of acquiring the profile of the cow: using an edge detection algorithm to obtain a plurality of contour data in an image, sequencing the plurality of contour data from outside to inside, wherein the outmost layer of the contour is the contour data of the cattle to be obtained, and the contour data of the cattle comprises a plurality of coordinates;

and n is the total number of contour points.

3. The machine vision-based bovine body ruler measuring method of claim 2 wherein said step 4 comprises:

normalization profile data substep: scaling the numerical range of the profile data on the x-axis to

Figure 376762DEST_PATH_IMAGE002

Normalization formula:

Figure 306300DEST_PATH_IMAGE005

whereinAs a result of the original value of the value,

Figure 606011DEST_PATH_IMAGE007

calculating section data substep: scanning the contour data of the cattle from the left side to the right side of the x axis, and subtracting the coordinate y value of the lowest edge from the coordinate y value of the uppermost edge to obtain the section data of the contour coordinate of the x axis

Figure 430879DEST_PATH_IMAGE008

Figure 51216DEST_PATH_IMAGE009

Figure 986942DEST_PATH_IMAGE010

Positioning the bun shell: analyzing the normalized profile data of the chignon using a machine learning method

Figure 25437DEST_PATH_IMAGE004

Positioning the cattle nojiri substep: using machine learning method to analyze the obtained cattle nojiri in normalized profile data

Figure 128839DEST_PATH_IMAGE004

Fitting a cattle back equation substep: intercepting

Figure 998805DEST_PATH_IMAGE011

Figure 319825DEST_PATH_IMAGE012

fitting the data by using a least square method to obtain a cattle back fitting linear equation

Figure 316600DEST_PATH_IMAGE013

yback= kx + b, wherein

Calculating the distance from the cow back to the cow belly sub-step: calculating the average value of the integral section data

Figure 752708DEST_PATH_IMAGE015

Figure 382535DEST_PATH_IMAGE018

Figure 104634DEST_PATH_IMAGE019

4. The machine vision-based bovine body ruler measuring method of claim 3 wherein said step 5 comprises:

chignon positioning substep:

Figure 767697DEST_PATH_IMAGE011

A back positioning sub-step: intercepting

Figure 998269DEST_PATH_IMAGE011

A cattle nojiri localizer step:

Figure 428693DEST_PATH_IMAGE011

Positioning the scapula front end: on the basis of the chignon coordinates, the y value is positively deviated from the length from the cattle back to the cattle belly, namely the coordinates (x) of the front end of the shoulder bladeThe front end of the scapula is provided with a shoulder blade,yanterior end of scapula);

An abdomen positioning sub-step: offset in longitudinal axis coordinate on back

Figure 956975DEST_PATH_IMAGE022

A front hoof positioning sub-step: find the maximum coordinate of the slice in the left chignon part, defined as front hoof (x)The front hoof is a common hoof,yfront hoof)。

5. The machine vision-based bovine body size measuring method according to claim 4, wherein in said step 6,

the length of the body is the distance from the chignon to the cattle nojiri:

Figure 971067DEST_PATH_IMAGE023

the oblique length of the body is the distance from the cattle nojiri to the front end of the scapula:

Figure 787845DEST_PATH_IMAGE024

the abdominal depth is the distance from the back to the abdomen:

Figure 714343DEST_PATH_IMAGE025

the height of the body is the distance from the chignon to the forehoof:

Figure 233049DEST_PATH_IMAGE026

Technical Field

The invention relates to the technical field of body ruler measurement, in particular to a body ruler measurement method based on machine vision.

Background

According to the traditional method for measuring the body size of the cattle, a worker needs to use measuring tools such as a flexible rule and a tape measure to measure multiple indexes such as the body height, the body slant length and the body straight length of the cattle, and the manual measuring mode has certain measuring difficulty, high cost and low speed and can cause stress reaction of the cattle.

Disclosure of Invention

The technical problem to be solved by the embodiment of the invention is to provide a method for measuring the body size of a cow based on machine vision, so that the measurement difficulty is reduced.

In order to solve the technical problem, an embodiment of the present invention provides a method for measuring a bovine body size based on machine vision, including:

step 1: the label with fixed length is attached to the side of the cow body;

step 2: shooting a side body image of the cow with the label, matching the label on the cow body by using a matching algorithm, calculating the pixel length of the label, and calculating the actual distance corresponding to a unit pixel on the image according to the real length of the label and the pixel proportion, wherein the proportion is ruler;

and step 3: removing the parts of the image which are irrelevant to the cattle, and extracting the cattle image and the cattle outline data in the image;

and 4, step 4: analyzing the cattle contour data, and calculating to obtain section data and distance data from the cattle back to the cattle belly;

and 5: positioning the characteristic points of the cattle body according to the calculated data;

step 6: and calculating the body size of the cattle according to the characteristic points.

Further, the step 3 comprises:

and a substep of extracting the cattle image: extracting the cattle in the image by using a cattle extraction algorithm, and removing parts irrelevant to the cattle;

and a substep of acquiring the profile of the cow: using an edge detection algorithm to obtain a plurality of contour data in an image, sequencing the plurality of contour data from outside to inside, wherein the outmost layer of the contour is the contour data of the cattle to be obtained, and the contour data of the cattle comprises a plurality of coordinates;

and n is the total number of contour points.

Further, the step 4 comprises:

normalization profile data substep: scaling the value range of the profile data on the upper x-axis to

Figure 613169DEST_PATH_IMAGE002

In the above-mentioned manner,

Figure 241727DEST_PATH_IMAGE003

for hyper-parameters, the normalized profile data is recorded as

Figure 998462DEST_PATH_IMAGE004

Normalization formula:

wherein

Figure 880147DEST_PATH_IMAGE006

As a result of the original value of the value,

Figure 414028DEST_PATH_IMAGE007

for scaled values, R is a set containing several real numbers;

calculating section data substep: scanning the contour data of the cattle from the left side to the right side of the x axis, and subtracting the coordinate y value of the lowest edge from the coordinate y value of the uppermost edge to obtain the section data of the contour coordinate of the x axis

Figure 658059DEST_PATH_IMAGE008

Figure 197941DEST_PATH_IMAGE010

Positioning the bun shell: analyzing the normalized profile data of the chignon using a machine learning method

Figure 914442DEST_PATH_IMAGE004

The position of the chignon is obtained

Figure 645769DEST_PATH_IMAGE011

Chignon nail

Positioning the cattle nojiri substep: using machine learning method to analyze the obtained cattle nojiri in normalized profile data

Figure 343467DEST_PATH_IMAGE004

The x-axis position of the nojiri is obtained

Figure 109428DEST_PATH_IMAGE011

Nijiri (a kind of cattle)

Fitting a cattle back equation substep: intercepting

Figure 985112DEST_PATH_IMAGE012

Chignon nailAnd

Figure 938155DEST_PATH_IMAGE012

nijiri (a kind of cattle)Normalized profile data of (a) between

Figure 705123DEST_PATH_IMAGE004

And only the profile data of the uppermost edge is taken, and the fitting data satisfies the following relation:

Figure 60012DEST_PATH_IMAGE013

fitting the data by using a least square method to obtain a cattle back fitting linear equation

Figure 106597DEST_PATH_IMAGE014

back

yback= kx + b, wherein,;

Calculating the distance from the cow back to the cow belly sub-step: calculating the average value of the integral section data

Figure 320857DEST_PATH_IMAGE016

The abdomen of the cattle is located

Figure 795832DEST_PATH_IMAGE017

And

Figure 13318DEST_PATH_IMAGE018

between the vertical lines, cutting the section data between the vertical lines, and averaging the section data

Figure 924642DEST_PATH_IMAGE019

secCalculating the average value of the section data within the threshold value sigma to obtain the distance from the back of the cow to the belly of the cow

Figure 252986DEST_PATH_IMAGE020

abdominal

Figure 220122DEST_PATH_IMAGE022

Further, the step 5 comprises:

chignon positioning substep: chignon nailEquation of straight line fitting between X-axis line and cattle back

Figure 750778DEST_PATH_IMAGE023

The intersection point is the chignonThe nail obtains the coordinates (x) of the chignonThe head of the user can be chignon,ychignon nail);

A back positioning sub-step: intercepting

Figure 934766DEST_PATH_IMAGE012

Chignon nailAnd

Figure 494054DEST_PATH_IMAGE012

nijiri (a kind of cattle)Section data between

Figure 114391DEST_PATH_IMAGE024

Finding the coordinate of the maximum value in the intercepted tangent plane data

Figure 50117DEST_PATH_IMAGE025

Will be

Figure 76893DEST_PATH_IMAGE011

maxSubstituted cattle back fitting linear equation backObtaining the back coordinates (x)The back part of the chair is provided with a back part,yback part);

A cattle nojiri localizer step: x is the number ofNijiri (a kind of cattle)The intersection point of the x-axis line and the y-axis line is the cattle nojiri to obtain the cattle nojiri coordinate (x)The feed additive of the beef nojiri,ynijiri (a kind of cattle));

Positioning the scapula front end: on the basis of the chignon coordinates, the y value is positively deviated from the length from the cattle back to the cattle belly, namely the coordinates (x) of the front end of the shoulder bladeThe front end of the scapula is provided with a shoulder blade,yanterior end of scapula);

An abdomen positioning sub-step: offset in longitudinal axis coordinate on backGet the abdomen (x)The abdomen part of the patient is provided with a plurality of abdominal muscles,yabdomen part);

A front hoof positioning sub-step: find the maximum coordinate of the slice in the left chignon part, defined as front hoof (x)The front hoof is a common hoof,yfront hoof)。

Further, in the step 6,

the length of the body is the distance from the chignon to the cattle nojiri:

Figure 919712DEST_PATH_IMAGE027

the oblique length of the body is the distance from the cattle nojiri to the front end of the scapula:

the abdominal depth is the distance from the back to the abdomen:

Figure 494230DEST_PATH_IMAGE029

the height of the body is the distance from the chignon to the forehoof:

Figure 839892DEST_PATH_IMAGE030

the invention has the beneficial effects that: the invention uses the machine vision mode to measure the body size information of the cattle, thereby greatly reducing the labor cost, and the mode belongs to non-contact type, does not cause any stress reaction to the cattle and has higher accuracy; and the device is not required to be deployed, and the body size of the cow can be conveniently measured only by using a portable mobile phone and label paper.

Drawings

FIG. 1 is a flow chart of a method for measuring a body size of a cow based on machine vision according to an embodiment of the present invention.

Fig. 2 is a schematic diagram of an extracted bovine image according to an embodiment of the present invention.

FIG. 3 is a schematic representation of a bovine profile according to an embodiment of the present invention.

FIG. 4 is a schematic diagram of the measurement of the key points and body size of cattle according to the embodiment of the present invention.

Description of the reference numerals

Chignon 1

Back 2

Nijiri 3

Scapular front end 4

Abdomen 5

And a front hoof 6.

Detailed Description

It should be noted that the embodiments and features of the embodiments in the present application can be combined with each other without conflict, and the present invention is further described in detail with reference to the drawings and specific embodiments.

If directional indications (such as up, down, left, right, front, and rear … …) are provided in the embodiment of the present invention, the directional indications are only used to explain the relative position relationship between the components, the movement, etc. in a specific posture (as shown in the drawing), and if the specific posture is changed, the directional indications are changed accordingly.

In addition, the descriptions related to "first", "second", etc. in the present invention are only used for descriptive purposes and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature.

Referring to fig. 1, the method for measuring a bovine body size based on machine vision according to the embodiment of the present invention includes steps 1 to 6.

Step 1: arranging a reference object, and attaching a label with a fixed length to the side of the cow body. For example, 8cm blue border labels are applied to the sides of the cattle.

Step 2: shooting a side body image of the cow with the label, matching the label on the cow body by using a matching algorithm, calculating the pixel length of the label, and calculating the actual distance corresponding to a unit pixel on the image according to the real length of the label and the pixel proportion, wherein the proportion is ruler.

And step 3: the cattle irrelevant part in the image is removed, and a cattle image (shown in figure 2) and the data of the cattle outline (shown in figure 3) in the image are extracted.

And 4, step 4: and analyzing the cattle contour data, and calculating to obtain section data and distance data from the cattle back to the cattle belly.

And 5: and positioning the characteristic points of the cattle body according to the calculated data. The bovine keypoints were located as shown in figure 4.

Step 6: and calculating the body size of the cattle according to the characteristic points.

As an embodiment, assume that the face of the cow is facing to the left, i.e., the head of the cow is to the left of the tail of the cow. For the case where the face of the cow is facing the right side, the image is flipped over so that the face of the cow is facing the left side. The step 3 comprises the following steps:

and a substep of extracting the cattle image: extracting the cattle in the image by using a cattle extraction algorithm, and removing parts irrelevant to the cattle, as shown in FIG. 2;

and a substep of acquiring the profile of the cow: using an edge detection algorithm to obtain a plurality of contour data in an image, sequencing the plurality of contour data from outside to inside, wherein the outmost layer of the contour is the contour data of the cattle required to be obtained, and the contour data contourr comprises a plurality of coordinates, as shown in fig. 3 and shown in the following formula;

Figure 117421DEST_PATH_IMAGE031

and n is the total number of contour points.

As an embodiment, the step 4 includes:

normalization profile data substep: scaling the numerical range of the profile data on the x-axis to

Figure 114196DEST_PATH_IMAGE032

In the above-mentioned manner,

Figure 717346DEST_PATH_IMAGE033

for hyper-parameters, the normalized profile data is recorded as

Normalization formula:

Figure 615212DEST_PATH_IMAGE035

whereinAs a result of the original value of the value,for scaled values, R is a set containing several real numbers;

calculating section data substep: the contour data of a cow is scanned from the left side to the right side of the x-axis, and the coordinates of the uppermost edge are used as the contour coordinates of the x-axis

Figure 295220DEST_PATH_IMAGE038

Value minus the coordinates of the lowest edgeValue, obtaining section data

Figure 636651DEST_PATH_IMAGE024

Figure 565293DEST_PATH_IMAGE039

Figure 372843DEST_PATH_IMAGE040

Positioning the bun shell: analyzing the normalized profile data of the chignon using a machine learning method

Figure 795865DEST_PATH_IMAGE034

The position of the chignon is obtained

Figure 887318DEST_PATH_IMAGE012

Chignon nail

Positioning the cattle nojiri substep: using machine learning method to analyze the obtained cattle nojiri in normalized profile data

Figure 206435DEST_PATH_IMAGE034

The position of the upper part of the Chinese medicinal herb is obtainedAt the x-axis position Nijiri (a kind of cattle)

Fitting a cattle back equation substep: intercepting

Figure 242841DEST_PATH_IMAGE012

Chignon nailAnd

Figure 951252DEST_PATH_IMAGE012

nijiri (a kind of cattle)Normalized profile data of (a) between

Figure 706849DEST_PATH_IMAGE034

And only the profile data of the uppermost edge is taken, and the fitting data satisfies the following relation:

Figure 551308DEST_PATH_IMAGE041

fitting the data by using a least square method to obtain a cattle back fitting linear equation

Figure 112871DEST_PATH_IMAGE042

Figure 664069DEST_PATH_IMAGE043

Wherein, in the step (A),

Figure 105415DEST_PATH_IMAGE044

calculating the distance from the cow back to the cow belly sub-step: calculating the average value of the integral section data

Figure 109274DEST_PATH_IMAGE016

The abdomen of the cattle is located Chignon nailAnd nijiri (a kind of cattle)Between the vertical lines, cutting the section data between the vertical lines, and averaging the section dataCalculating the average value of section data within the threshold value sigma to obtain the distance d from the back of the cow to the belly of the cowabdominal

Figure 186897DEST_PATH_IMAGE046

Figure 559103DEST_PATH_IMAGE047

As an embodiment, the step 5 includes:

chignon 1 positioning substep:

Figure 334161DEST_PATH_IMAGE012

chignon nailEquation of straight line fitting between X-axis line and cattle back

Figure 133621DEST_PATH_IMAGE023

The point of intersection is chignon 1, and obtains the chignon 1 coordinate (x)The head of the user can be chignon,ychignon nail);

Back 2 positioning sub-step: intercepting

Figure 908810DEST_PATH_IMAGE012

Chignon nailAnd

Figure 84708DEST_PATH_IMAGE012

nijiri (a kind of cattle)Section data between

Figure 465005DEST_PATH_IMAGE024

Finding the coordinate of the maximum value in the intercepted tangent plane data

Figure 684633DEST_PATH_IMAGE048

Will be

Figure 884802DEST_PATH_IMAGE011

maxSubstituted cattle back fitting linear equation

Figure 333232DEST_PATH_IMAGE023

Obtaining the Back 2 coordinate (x)The back part of the chair is provided with a back part,yback part);

Nojiri 3 positioning substep: x is the number ofNijiri (a kind of cattle)The intersection point of the x-axis line and the y-axis line is cattle nojii 3 to obtain the coordinate of cattle nojii 3 (xThe feed additive of the beef nojiri,ynijiri (a kind of cattle));

The shoulder blade front end 4 positioning sub-step: on the basis of the 1 coordinate of the chignon, the y value is positively deviated from the length from the cattle back to the cattle belly, namely the 4 coordinate (x) of the front end of the shoulder bladeThe front end of the scapula is provided with a shoulder blade,yanterior end of scapula);

Abdomen 5 positioning substep: offset by d on the ordinate of the longitudinal axis on the back 2abdominalObtain the abdomen 5 coordinate (x)The abdomen part of the patient is provided with a plurality of abdominal muscles,yabdomen part);

Front shoe 6 positioning sub-step: find the maximum coordinate of the slice in the left chignon 1, defined as hoof 6 (x)The front hoof is a common hoof,yfront hoof)。

As an implementation mode, the relation between the body ruler and the key points is visually shown in the figure 4. In the step 6, the process is carried out,

the length of the body is the distance from chignon 1 to nojiri 3:

Figure 82882DEST_PATH_IMAGE049

the oblique length of the body is the distance from the cattle nojiri 3 to the front end of the shoulder blade 4:

Figure 946846DEST_PATH_IMAGE050

the depth of the abdomen is the distance from the back 2 to the abdomen 5:

Figure 634311DEST_PATH_IMAGE051

height is the distance from chignon 1 to forehoof 6:

Figure 135699DEST_PATH_IMAGE052

the invention uses the machine vision mode to measure the body size information of the cattle, greatly reduces the labor cost, and the mode belongs to non-contact type, does not cause any stress reaction to the cattle and has higher accuracy. The method has no equipment deployment requirement, can be used in systems of intelligent equipment such as mobile phones and the like, and can conveniently and quickly finish the body size measurement of the cattle only by using the mobile phone and the label paper which are carried about.

Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于双目视觉技术的刀闸智能识别系统及方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!