CN115396576A - Device and method for automatically measuring sheep body size from side-view and overlook double-view-angle images - Google Patents

Device and method for automatically measuring sheep body size from side-view and overlook double-view-angle images Download PDF

Info

Publication number
CN115396576A
CN115396576A CN202211018538.6A CN202211018538A CN115396576A CN 115396576 A CN115396576 A CN 115396576A CN 202211018538 A CN202211018538 A CN 202211018538A CN 115396576 A CN115396576 A CN 115396576A
Authority
CN
China
Prior art keywords
point
sheep
view
width
image acquisition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202211018538.6A
Other languages
Chinese (zh)
Other versions
CN115396576B (en
Inventor
陆明洲
光二颖
王�锋
张国敏
陈子康
沈明霞
熊迎军
刘龙申
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Agricultural University
Original Assignee
Nanjing Agricultural University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Agricultural University filed Critical Nanjing Agricultural University
Priority to CN202211018538.6A priority Critical patent/CN115396576B/en
Publication of CN115396576A publication Critical patent/CN115396576A/en
Application granted granted Critical
Publication of CN115396576B publication Critical patent/CN115396576B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A01AGRICULTURE; FORESTRY; ANIMAL HUSBANDRY; HUNTING; TRAPPING; FISHING
    • A01KANIMAL HUSBANDRY; AVICULTURE; APICULTURE; PISCICULTURE; FISHING; REARING OR BREEDING ANIMALS, NOT OTHERWISE PROVIDED FOR; NEW BREEDS OF ANIMALS
    • A01K29/00Other apparatus for animal husbandry
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B11/00Measuring arrangements characterised by the use of optical techniques
    • G01B11/02Measuring arrangements characterised by the use of optical techniques for measuring length, width or thickness
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C9/00Individual registration on entry or exit
    • G07C9/10Movable barriers with registering means
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A40/00Adaptation technologies in agriculture, forestry, livestock or agroalimentary production
    • Y02A40/70Adaptation technologies in agriculture, forestry, livestock or agroalimentary production in livestock or poultry

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Theoretical Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Environmental Sciences (AREA)
  • Quality & Reliability (AREA)
  • Geometry (AREA)
  • Animal Husbandry (AREA)
  • Biodiversity & Conservation Biology (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a device for automatically measuring a sheep body ruler from side-view and overlook double-view images. Transparent glass is arranged on one side of the image acquisition chamber, a movable baffle connected with an electric push rod is arranged on the other side of the image acquisition chamber, and the width of the image acquisition chamber is automatically adjusted according to the size of the sheep obtained in the overlooking image so as to adapt to the requirements of sheep body size measurement under different body conditions. The method comprises the steps of correcting side-looking and overlooking images by utilizing the isometric characteristics of a minimum external rectangle of a foreground in the side-looking and overlooking images, comprehensively utilizing the characteristics of sheep body ruler key points in the side-looking and overlooking images to automatically position body ruler key points, calculating body height, chest depth, chest width, body oblique length and pipe diameter by utilizing Euclidean distance, obtaining chest circumference by carrying out ellipse fitting on the chest depth and the chest width as parameters of a long axis and a short axis, and obtaining pipe circumference by utilizing pipe diameter fitting. The invention can automatically provide objective parameters of the sheep body ruler on the premise of reducing human and animal contact and reducing labor cost.

Description

Device and method for automatically measuring sheep body ruler from side-view and overlook double-view-angle images
Technical Field
The invention belongs to the technical field of sheep breeding, and particularly relates to a device and a method for automatically measuring sheep body size data by using machine vision and automatic control technology.
Background
The body size data of the sheep can reflect the growth and development conditions of the sheep and the relative development relationship among all parts of the body, and can be used as a main index for measuring the growth and development of the sheep. The sheep body size data can also be used for evaluating the growth and development characteristics and the genetic characteristics of sheep, and is one of important references for screening sheep germplasm resources. The parameters of the body size of the concerned sheep in the breeding production mainly include: height, depth, width, circumference, and oblique length.
At present, the traditional sheep body size measuring method mainly utilizes measuring tools such as a flexible rule and a staff gauge to directly contact the sheep body for measurement, the measuring method is time-consuming and labor-consuming, a large stress response can be brought to the sheep during measurement, if the measured object is a pregnant ewe, the abortion probability of the sheep can be increased, and due to the existence of artificial subjective influence factors, the artificial measuring result is not objective enough. Meanwhile, the direct contact between human and sheep also increases the risk of zoonosis. In addition, a measuring method for clamping sheep by using a mechanical device and obtaining sheep body size data through the distance between mechanical structures is adopted, although manual direct contact of the sheep is replaced by the method, the sheep body can be damaged by mechanical clamping, and the stress response brought to the sheep is larger.
Disclosure of Invention
The patent aims to overcome the problems and provide a sheep body ruler automatic measuring device and method based on machine vision and automatic control technology. The technical problem to be solved is as follows: the sheep body side-view and overlook image automatic acquisition device structure; an image processing method for automatically extracting sheep body size parameters from side-view and top-view images.
The technical scheme is as follows:
in order to solve the problems, the invention provides a device and a method for automatically measuring a sheep body ruler from side-view and overlook double-view images, which comprise a hardware part and a software part.
The invention provides a device and a method for automatically measuring a sheep body size from side-view and top-view double-view images, wherein the hardware part comprises the following steps: entrance way, entry entrance guard, sensor module, image acquisition room, image acquisition module, export entrance guard, exit channel, computer, PLC controller, entrance guard on-off control motor, wherein, image acquisition module comprises overlooking the camera and looking sideways at the camera, and sensor module includes photoelectric sensor and limit switch.
Photoelectric sensor installs respectively in entrance way, image acquisition room and exit channel department, and the sheep can shelter from corresponding photoelectric sensor's light path when being in a certain position, and photoelectric sensor output signal is connected to PLC, and PLC confirms the position of sheep according to the photoelectric sensor signal to based on this control entry entrance guard, turning to of export entrance guard motor in order to open or close entry entrance guard and export entrance guard.
The motor and the limit switch are used for controlling automatic opening and closing of the entrance guard and the exit guard, the entrance guard and the exit guard are both composed of two doors, each door is controlled by one motor and two limit switches together to realize opening and closing, and the PLC controls the positive rotation and the reverse rotation of the motors according to the two limit switches and the photoelectric sensor signals, so that the opening and closing of the corresponding door are realized.
The image acquisition room comprises entry entrance guard, side transparent glass, movable baffle, export entrance guard, side looking camera and overlooking camera, and movable baffle is removed in order to adjust image acquisition room width by electric putter control for image acquisition room size is suitable for gathering the sheep body image of equidimension not. A red calibration plate with the length of 20 cm and the width of 10 cm is pasted on the upper left corner of the transparent glass on the image acquisition chamber side, the function of the red calibration plate is to determine the conversion relation between the actual size and the pixel distance, each sheep is provided with an RFID electronic ear tag, an RFID reader is installed in the image acquisition chamber, and the identification of the sheep in the image acquisition chamber is automatically recorded.
The invention provides a device and a method for automatically measuring sheep body size from side-view and top-view images, wherein a software part of the device and the method automatically measures body size parameters of sheep from the side-view and top-view images by adopting an image processing method, and the method comprises the following steps:
when no sheep exists in an image acquisition room, driving a side-view camera and a top-view camera to respectively acquire a background image, wherein the top-view background image is recorded as Tb, and the side-view background image is recorded as Sb;
when a sheep exists in the image acquisition room, simultaneously opening two cameras and shooting the sheep, recording the top view as Tf and the side view as Sf, and obtaining foreground images of the sheep under side view and top view angles by using a background subtraction method, wherein the foreground images are respectively recorded as Sm and Tm, namely Sm = Sf-Sb and Tm = Tf-Tb;
thirdly, performing morphological operation, binarization and connected domain analysis on the images Tm and Sm to obtain a top view binary image T and a side view binary image S of the sheep;
the fourth step: the body ruler measurement parameters of the sheep mainly comprise tube circumference, body height, chest depth, oblique body length, chest width and chest circumference, the body ruler parameters of the sheep are automatically extracted by processing binary images T and S, and the measurement mode of the specific parameters is as follows:
surrounding the pipe: in the side view S, the sheep head faces to the left, the two front legs of the sheep body stand separately and naturally, the left forelimb is positioned based on the characteristics of the abscissa and the ordinate of the contact points of the 4 feet and the ground, the height of the left forelimb is taken as the x axis, the width is taken as the y axis, a leg width curve is drawn, the minimum value on the curve is the width of the cross section of the tube periphery, and the length fitting of the tube periphery is carried out according to the width of the cross section of the tube periphery.
Body height: in the production practice, the vertical distance from the highest point of the astragalus membranaceus to the ground is determined as the height of the sheep, in a side view S, two forelegs of the sheep body stand naturally and separately, the abscissa of the highest point of the astragalus membranaceus is located between two feet, two forelimbs are positioned based on the abscissa and ordinate characteristics of contact points of the 4 feet and the ground, the coordinates of two points of the two forelimbs contacting the ground are extracted, the middle point of the connecting line of the two points is taken as the lower end point of the height, the lower end point is taken as a vertical line and is intersected to one point on the back to be taken as the upper end point of the height, the Euclidean distance between the upper end point and the lower end point of the height is calculated, and the distance is taken as the height of the sheep.
Chest depth: in the production practice, the straight line distance from the milk claw to the lower edge of the sternum is defined as the chest depth, the distance from the intersection point of the front leg and the abdomen to the intersection point of the back is taken as the chest depth during manual measurement, in the side view S, the abdomen contour line of the sheep body is extracted, the foremost point of the abdomen contour is positioned and taken as the lower endpoint of the chest depth, a perpendicular line vertical to the ground is made on the basis of the lower endpoint and is intersected with one point of the back to be taken as the upper endpoint of the chest depth, and the Euclidean distance between the upper endpoint of the chest depth and the lower endpoint of the chest depth is calculated to be the chest depth of the sheep.
Oblique length: in production practice, the distance from the front edge of the sternum to the rear edge of the ischiadic tuberosity is used as the body oblique length of the sheep, on the basis that the upper end point of the chest depth is determined, the upper end point of the chest depth is used as an oblique line with the slope of 1 and crossed to a point in the front chest to be used as the front end point of the body oblique length, the root of the sheep tail is selected to be used as the rear end point of the body oblique length, and the Euclidean distance from the front end point of the body oblique length to the rear end point of the body oblique length is the body oblique length of the sheep.
Chest width: in the production practice, the linear distance of the widest points of the rear edges of the scapulas on the two sides of the sheep body is determined as the chest width of the sheep, in a plan view T, the length of the sheep body is taken as an x axis, the sum of the number of points which pass through each coordinate point on the x axis and are in pixel value 1 on a line vertical to the x axis is counted, the sum of the number is taken as a y axis, a sheep body width change curve is drawn, a maximum value point corresponding to the chest width is determined based on curve function analysis, and the maximum value point is the chest width of the sheep.
Chest circumference: in the production practice, the chest circumference of the posterior margin of the scapula is determined as the chest circumference of the sheep body, on the basis of obtaining the chest depth and the chest width, the chest depth is used as a long axis, the chest width is used as a short axis for ellipse fitting, and the ellipse circumference obtained by fitting is used as the chest circumference.
The calculation formula of the Euclidean distance between the pixel points is as follows: knowing the coordinates of the points a and b as (x 1, y 1) and (x 2, y 2), respectively, the Euclidean distance between the points a and b is
Figure BDA0003813254100000031
Positioning a calibration plate in a side-looking image by using a template matching method, and extracting the long pixel distance of the calibration plate as l pixel Knowing that the physical dimension of the calibration plate length is l, the conversion ratio between the physical dimension and the pixel distance is p = l/l pixel The physical size of the sheep body ruler is d real =p×d pixel Wherein d is pixel Is the pixel distance of the sheep body ruler parameter.
The invention has the advantages of
The invention provides a non-contact sheep body size parameter measuring device and method based on machine vision, which specifically comprise a set of hardware device and a set of body size automatic measuring algorithm, and can automatically and accurately obtain sheep body size parameters. The hardware of the invention is controlled by a PLC, the opening and closing of entrance and exit access controls of the image acquisition room are automatically controlled according to the real-time position of the sheep, and side-view and top-view images of the sheep in the image acquisition room are automatically acquired, thus reducing the complicated manual operation; providing a set of specific and feasible image processing algorithm, combining side-view and overlook images of the sheep, accurately positioning key points of the sheep body ruler, and further acquiring parameters of the sheep body ruler; by adjusting the width of the image acquisition chamber, the device can meet the requirements of body ruler measurement of sheep with different sizes and different ages in days, a scientific, accurate, objective and stress-free method is provided for automatic measurement of the body ruler of the sheep, and development of the intelligent animal husbandry is promoted.
Drawings
FIG. 1 is a schematic view of the whole structure of the image capturing device of the present invention
FIG. 2 is a partial enlarged view of the motor and limit switch
FIG. 3 is a flow chart of the sheep's side view and top view image acquisition
FIG. 4 is a diagram of the result of preprocessing lateral and top images of sheep
FIG. 5 is a schematic diagram of the method for automatically extracting high parameters of sheep body
FIG. 6 is a schematic diagram of an automatic extraction method of sheep chest depth parameters
FIG. 7 is a schematic diagram of an automatic sheep breast width parameter extraction method
FIG. 8 is a schematic diagram of an automatic extraction method for parameters of left foreleg circumference of sheep
FIG. 9 is a schematic diagram of an automatic extraction method for sheep body slant length parameters
Detailed Description
The invention is further illustrated by the following examples, without limiting the scope of the invention:
in order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
FIG. 1 is a schematic view of the apparatus of the present invention, mainly including the mechanical structure and control components of the apparatus, and in FIG. 1, (2) and (4) are entrance guard and entrance way fence, respectively; (1) And (3) exit gate and exit channel fences, respectively; (13) The glass baffle is arranged at the side of the image acquisition camera for the side view of the image acquisition chamber; (14) The movable baffle plate is a movable baffle plate of the image acquisition chamber, and the movable baffle plate (14) can move in the direction close to the glass baffle plate (13) or far away from the glass baffle plate (13) to adjust the width of the image acquisition chamber, so that the requirements of acquisition of sheep body images with different sizes are met; (12) The telescopic end of the electric push rod is connected with the movable baffle (14), and the electric push rod (12) stretches and retracts to drive the movable baffle (14) to move so as to adjust the width of the image acquisition chamber; (5) looking down the camera mount; (7) the overlook camera is used for shooting the top view of the sheep; (6) is a side view camera stand; (8) The side-looking camera is used for shooting a side-looking image of a sheep body, and the height of the side-looking camera (8) is as high as the central point of a side-looking image acquisition side glass baffle plate (13); (9-3) an inlet photoelectric sensor, (9-2) a movable baffle photoelectric sensor of an image acquisition chamber, and (9-1) an outlet photoelectric sensor, wherein when the photoelectric sensor is shielded, the photoelectric sensor indicates that the sheep is positioned at the position where the corresponding photoelectric sensor is arranged; (10) The RFID reader is arranged on the inner side of a movable baffle (14) of the image acquisition room and used for recording the identity information of the sheep in the image acquisition room. The installation height of the entrance photoelectric sensor (9-3), the image acquisition room movable baffle photoelectric sensor (9-2) and the exit photoelectric sensor (9-1) is at the height of the abdomen of the sheep, the installation position of the image acquisition room movable baffle photoelectric sensor (9-2) is close to the exit entrance guard (1), the fact that the sheep completely enters the image acquisition room is guaranteed, a closing signal of the entrance guard (2) is triggered, the exit photoelectric sensor (9-1) is installed at a position far away from the exit entrance guard (1), and the fact that the sheep completely leaves the exit entrance guard (1) is guaranteed.
Fig. 2 is a partial enlarged view of a first outlet sub-door (1-1) on one side of an outlet door guard (1) close to a movable baffle (14), wherein (11) is that a pulley is sleeved with a slide rail, the pulley is fixed on the movable baffle (14), and the pulley slides on the slide rail to drive the movable baffle (14) to move; the automatic opening and closing device comprises a first motor (18), a first limit switch (16) and a second limit switch (17), wherein the first motor (18), the first limit switch (16) and the second limit switch (17) control the opening and closing of a first outlet sub door (1-1) of an outlet entrance guard (1), the first limit switch (16) is installed on an outlet channel fence (3), the second limit switch (17) is installed below an outlet cross beam (15), and when the first outlet sub door (1-1) is opened or closed to a preset angle and touches a limit rod of the first limit switch (16) or the second limit switch (17), a PLC sends a stop command to the first motor (18) to realize the automatic stop of the opening or closing action of the first outlet sub door (1-1); the mechanism composed of the first limit switch (16), the second limit switch (17) and the first motor (18) is respectively provided with one set at 4 corners of the image acquisition room and is respectively used for controlling the automatic opening and closing of four doors of the entrance guard (2) and the exit guard (1).
As shown in fig. 3, the one-time complete image acquisition workflow of the device for the side-view and top-view images of sheep is as follows: the sheep approaches the entrance guard through the entrance passage fence, if the sheep blocks the photoelectric sensor of the entrance passage fence, the PLC receives a signal that the sheep is outside the entrance guard, sends a command to the entrance guard control motor to drive the motor to rotate to open the first entrance sub-door and the second entrance sub-door, and when the first entrance sub-door and the second entrance sub-door are respectively pressed to the corresponding pressure rods of the limit switches, the PLC sends a control command to the entrance guard control motor to stop rotating; when a sheep enters an image acquisition room, a photoelectric sensor in the image acquisition room is shielded, a PLC sends a command for closing a first entrance sub-door and a second entrance sub-door to an entrance access control motor, and after the first entrance sub-door and the second entrance sub-door are closed and press pressure rods of respective limit switches, the PLC sends a rotation stop command to the entrance access control motor to complete the closing of an entrance access; the RFID reader is communicated with an RFID electronic ear tag worn by the sheep to identify the identity of the sheep; the PLC opens the overlook camera to acquire sheep back images, transmits the sheep back images to the computer for processing to obtain the required width of the image acquisition chamber, and sends a telescopic command to the electric push rod to drive the movable baffle plate to move to a proper position; look sideways at camera and look down the camera and begin to gather the image, after the time of continuous settlement, PLC closes the camera of looking down, look sideways at the camera, PLC sends the rotation driving order to the control motor of export entrance guard and opens first export sub-door, the sub-door of second export, the sheep leaves behind the passageway, trigger and be located the outer photoelectric sensor of export, PLC sends the rotation driving order to the control motor of export entrance guard and closes first export sub-door, the sub-door of second export, export entrance guard opens, close the in-process and similar with entry entrance guard with corresponding limit switch's signal relation.
As shown in fig. 4, the preprocessing workflow for the side-view and top-view images of the sheep body is as follows:
the first step is as follows: carrying out graying and binarization operation on the side view and the top view of the sheep body;
the second step is that: the minimum bounding rectangle of the sheep body part in the top view is obtained and recorded as the length Tr _ len, the minimum bounding rectangle of the sheep body part in the side view is obtained and recorded as the length Sr _ len, the Sr _ len is taken as a standard, the top view is subjected to affine transformation, the outside bounding rectangle of the sheep body part in the top view after transformation is recorded as the length Tr _ len ', the Tr _ len' and the Sr _ len are equal, and the top view and the side view after affine transformation are respectively recorded as T and S.
As shown in fig. 5, the method for extracting the sheep body height parameter from the sheep body side view S comprises the following steps: extracting the vertical coordinates of the contact points of the two forehooves and the ground in the side view S, recording the contact point with the larger vertical coordinate as K and the contact point with the smaller vertical coordinate as J, and recording the coordinate of the point K as (x) K ,y K ) And the coordinate of the J point is expressed as (x) J ,y J ) Taking the middle point of the connecting line of K and J as the lower end point B of body height, and recording the abscissa as x B Passing point (x) B And 0) making a vertical line perpendicular to the upper edge of the side view S, taking the intersection point of the vertical line and the contour of the back of the sheep body as an upper end point of the body height, marking as A, and calculating the Euclidean distance between the point A and the point B as the body height of the sheep.
As shown in fig. 6, the method for extracting the sheep chest depth parameter from the sheep body side view S comprises the following steps: taking the abscissa of the contact point between the two rear hooves and the ground in the side view S, recording the point with the smaller abscissa as L, the point with the larger abscissa as M, calculating the average value of the abscissas of the point K and the point L and recording the average value as x K_L The abscissa in the selected side view S is at [ x ] B ,x K_L ]Interval, ordinate at
Figure BDA0003813254100000061
The region formed by the pixel points of the interval is marked as ROI-1, and the point (x) on the upper edge of the side view S in the ROI-1 K_L 0) to point (x) B 0), making a vertical line perpendicular to the upper edge of the side view S and passing through each pixel point between 0), counting the number of non-0 pixel value points in ROI-l for each vertical line from top to bottom, stopping counting the non-0 pixel value points on the current vertical line when the 0 pixel value point appears for the first time, drawing a change curve of the number of the non-0 pixel value points, taking the minimum value on the curve and recording the abscissa as x K_L_min Passing a point (x) in the side view S K_L_min 0) drawing a vertical line perpendicular to the upper edge of the side view S, extracting the intersection point of the vertical line and the abdomen as the lower end point of the chest depth, and recordingAnd F, taking the intersection point of the vertical line and the back contour as an upper endpoint of the chest depth, and recording as E, and calculating the Euclidean distance between the points E and F as the chest depth, and recording as depth _ bre.
As shown in fig. 7, the method for extracting the sheep breast width parameter from the sheep body top view T comprises the following steps: in a top view T, a main axis of the sheep body is extracted, each point passing through the main axis is taken as a vertical line perpendicular to the main axis, each horizontal coordinate of each point on the main axis is taken as an independent variable, the number of non-0 pixel value points on the vertical line is taken as a dependent variable, a sheep body width change curve is drawn, and a smooth curve obtained by smoothing the curve is marked as C body_wid th, extracted from C body_width And taking the body width corresponding to the first maximum value point between the maximum value point and the second maximum value point as the chest width of the sheep, if the maximum value point does not exist, taking the body width corresponding to the inflection point of the convex-concave as the chest width, and recording the chest width as width _ bre.
Fitting by using a formula of 2 pi multiplied by width _ bre +4 (depth _ bre-width _ bre) to obtain the chest girth body ruler.
As shown in FIG. 8, the point (0, y) in the side view S is selected J )、(x K_L ,y J ) And (3) recording the line segment as seg as the line segment of the end point, and extracting the size of the left foreleg circumference of the sheep from the side view S according to the following steps:
the first step is as follows: calculating the number of foreground regions of the side view S through which the seg passes, if the number of the foreground regions is 2, vertically moving the seg by 1 pixel, circularly executing the first step until the number of the foreground regions through which the seg passes in the side view S is 1, and turning to the second step;
the second step: shifting seg by 1 pixel, extracting 4 endpoints of two intersecting line segments of seg and side view S, selecting the endpoint with the third largest abscissa as the vertex of the included angle between the two forelimbs, recording the endpoint as N, and recording the coordinate as (x) N ,y N );
The third step: choosing the side view S with the abscissa at [2 ×) K -x B ,x B ]Interval, ordinate at [ y N ,y K ]The region formed by the pixel points of the interval is marked as ROI-2, and points (0, y) on the y axis are aligned in the ROI-2 N ) To point (0, y) K ) Making each pixel point pass through the pixel point and vertical line perpendicular to y axis, counting number of non-0 pixel points on the vertical line and drawingMaking a variation curve of the number of non-0 pixels, selecting the minimum value point in the variation curve to position the thinnest part of the tube circumference, extracting the cross section width of the part as the tube diameter, and recording the tube diameter as w g
The fourth step: using the formula
Figure BDA0003813254100000071
And fitting to obtain the size of the pipe circumference.
As shown in fig. 9, the upper end point E of the chest depth is taken as a straight line with a slope of 1, the intersection point of the straight line and the anterior chest contour is denoted as C, and C is taken as the front end point of the body slope length, and the rear end point of the body slope length is located and the body slope length is calculated by the following steps:
the first step is as follows: selecting a sheep body width change curve C body_width The minimum value between the upper maximum value point and the second maximum value point is recorded as C body_width The point on the curve is min _ C body_width Passing point min _ C body_width Making a straight line parallel to the horizontal axis and intersecting the curve C body_width The curve part on the right side of the point where the upper maximum value is located intersects, and the intersection point is recorded as P1_ C body_width
The second step: to point P1_ C body_width Sheep body width change curve C body_width And (3) calculating the second derivative of each point between the extreme right side end points, if a point with the second derivative of 0 exists, extracting a point with the first second derivative of 0, recording the abscissa of the point as x _ p _ end, and if a point with the second derivative of 0 does not exist, recording C body_width The abscissa of the rightmost endpoint is x _ p _ end;
the third step: taking a region formed by pixel points in the upper half section and the 1/4 of the right side of the side view S as a target region, recording the region as ROI-3, positioning the maximum horizontal coordinate point of a foreground region in the ROI-3, recording the vertical coordinate of the maximum horizontal coordinate point as y _ end, and taking a point with the coordinates of (x _ p _ end and y _ end) as a rear end point of the body slant length and recording the point as Q;
the fourth step: in side view S, CQ is connected and the length of the line CQ is taken as the body slant length of the sheep.
The specific embodiments described herein are merely illustrative of the spirit of the invention. Various modifications or additions may be made to the described embodiments or alternatives may be employed by those skilled in the art without departing from the spirit or ambit of the invention as defined in the appended claims.

Claims (7)

1. The utility model provides a follow device that looks sideways at, overlook two visual angle images automatic measure sheep body chi which characterized in that it includes:
an exit entrance guard (1) arranged at the exit of the image acquisition room, an exit passage fence (3) outside the exit, and an exit photoelectric sensor (9-1) arranged at the inner side of the exit passage fence (3); an entrance gate (2) arranged at the entrance of the image acquisition room and an entrance passage fence (4) outside the entrance, wherein the inner side of the entrance passage fence (4) is provided with an entrance photoelectric sensor (9-3);
the side-looking camera (8) is arranged on one side of the image acquisition room based on the side-looking camera bracket (6) and is used for shooting a side-looking image of the sheep body; the overlooking camera (7) is arranged at the top of the image acquisition room based on the overlooking camera bracket (5) and is used for shooting a top view of the sheep;
a glass baffle (13) is arranged on the side of a side-view camera (8) of the image acquisition chamber, a movable baffle (14) is arranged on the opposite side of the glass baffle (13), and the telescopic end of an electric push rod (12) is connected with the movable baffle (14); the movable baffle (14) moves in the direction close to the glass baffle (13) or far away from the glass baffle (13) under the action of the electric push rod (12) to adjust the width of the image acquisition chamber, so that the requirements of acquisition of sheep body images with different sizes are met; a movable baffle photoelectric sensor (9-2) is arranged on the inner side of the movable baffle (14); an RFID reader (10) is arranged on the inner side of the movable baffle (14) and is used for recording the identity information of the sheep in the image acquisition room;
the processor automatically calculates and obtains sheep body size data based on the image information acquired by the image acquisition room.
2. Device according to claim 1, characterized in that the height of the side view camera (8) is the same as the center point of the side view image capturing side glass barrier (13).
3. The device according to claim 1, characterized in that the inlet photosensor (9-3), the image acquisition chamber movable baffle photosensor (9-2) and the outlet photosensor (9-1) are mounted at the height of the abdomen of the sheep.
4. The device according to claim 1, characterized in that the image acquisition chamber movable barrier photoelectric sensor (9-2) is installed close to the exit door (1) to ensure that the sheep completely enters the image acquisition chamber and then triggers the entrance door (2) to close; the exit photoelectric sensor (9-1) is arranged at a position far away from the exit entrance guard (1) to ensure that the sheep completely leaves and then triggers a closing signal of the exit entrance guard (1).
5. The device of claim 1, wherein the entrance door and the exit door are identical in structure and are both of two-door structure, and the two doors slide 90 degrees from the middle to the outside of the image acquisition room to open, so that four sub-doors with identical structures are recorded; the first outlet sub-door (1-1) is provided with a first motor (18), a first limit switch (16) and a second limit switch (17) in a matching way; the first limit switch (16) is installed on the outlet channel rail (3), the second limit switch (17) is installed below the outlet cross beam (15), and when the first outlet sub door (1-1) is opened or closed to a preset angle and touches a limit rod of the first limit switch (16) or the second limit switch (17), the PLC sends a stop command to the first motor (18), so that the automatic stop of the opening or closing action of the first outlet sub door (1-1) is realized.
6. A method for automatically measuring a sheep body ruler from a side-view and top-view double-view image, which is based on the device of any one of claims 1-5, and is characterized by comprising the following steps:
s1: the entrance photoelectric sensor (9-3) is shielded, the movable baffle photoelectric sensor (9-2) of the image acquisition chamber is not shielded, and the entrance door control (2) is opened;
s2: a movable baffle photoelectric sensor (9-2) of the image acquisition chamber is shielded, an entrance door control (2) is closed, a overlooking camera (7) is opened and driven to shoot a top view of the sheep, the body width information of the sheep is automatically extracted, and the position of a movable baffle (14) of the image acquisition chamber is adjusted according to the body width of the sheep, so that the side surface of the sheep is close to transparent glass (13) on the image acquisition chamber side;
s3: opening the side-view camera (8), and simultaneously driving the top-view camera (7) and the side-view camera (8) to shoot side-view and top-view images of the sheep and storing the side-view and top-view images in a computer;
s4: and opening the exit access control (1), if the exit photoelectric sensor (9-1) is shielded, closing the exit access control (1), and restoring the movable baffle (14) of the image acquisition chamber to the initial position.
7. The method according to claim 6, wherein the sheep body size information is automatically extracted using steps S5 to S12:
s5: carrying out graying and binaryzation operations on the sheep side view and the top view acquired in the step S3;
s6: acquiring a minimum circumscribed rectangle of the sheep body part in a top view, recording the length of the minimum circumscribed rectangle as Tr _ len, acquiring a minimum circumscribed rectangle of the sheep body part in a side view, recording the length of the minimum circumscribed rectangle as Sr _ len, performing affine transformation on the top view by taking Sr _ len as a standard, recording the length of the sheep body external circumscribed rectangle in the top view after the affine transformation as Tr _ len ', enabling the Tr _ len' and the Sr _ len to be equal, and respectively recording image areas in the sheep circumscribed rectangles in the top view and the side view after the affine transformation as T and S;
s7: extracting the vertical coordinates of the contact points of the two forehooves and the ground in the side view S, recording the contact point with the larger vertical coordinate as K and the contact point with the smaller vertical coordinate as J, and recording the coordinate of the point K as (x) K ,y K ) And the coordinate of the J point is expressed as (x) J ,y J ) Taking the middle point of the connecting line of K and J as the lower end point B of body height, and recording the abscissa as x B Passing point (x) B 0) making a vertical line perpendicular to the upper edge of the side view S, taking the intersection point of the vertical line and the contour of the back of the sheep body as an upper end point of the body height, marking the intersection point as A, and calculating the Euclidean distance between the point A and the point B as the body height of the sheep;
s8: taking the abscissa of the contact point between the two rear hooves and the ground in side view S, recording the point with the smaller abscissa as L, the point with the larger abscissa as M, calculating the average of the abscissas of point K and point L and recording as x K_L Choosing the abscissa in the side view S to be [ x ] B ,x K_L ]Interval, longitudinal sittingIs marked at
Figure FDA0003813254090000031
The region formed by the pixel points of the interval is marked as ROI-1, and the point (x) on the upper edge of the side view S in the ROI-1 K_L 0) to point (x) B 0), making a vertical line perpendicular to the upper edge of the side view S and passing through each pixel point between 0), counting the number of non-0 pixel value points in ROI-1 for each vertical line from top to bottom, stopping counting the non-0 pixel value points on the current vertical line when the 0 pixel value point appears for the first time, drawing a change curve of the number of the non-0 pixel value points, taking the minimum value on the curve and recording the abscissa as x K_L_min Passing point (x) in side view S K_L_min 0) making a vertical line perpendicular to the upper edge of the side view S, extracting an intersection point of the vertical line and the abdomen to be a lower end point of the chest depth and marking as F, taking an intersection point of the vertical line and the back contour as an upper end point of the chest depth and marking as E, and calculating the Euclidean distance between the points E and F to be the chest depth and marking as depth _ bre;
s9: in a top view T, a main axis of the sheep body is extracted, each point passing through the main axis is taken as a vertical line perpendicular to the main axis, each horizontal coordinate of each point on the main axis is taken as an independent variable, the number of non-0 pixel value points on the vertical line is taken as a dependent variable, a sheep body width change curve is drawn, and a smooth curve obtained by smoothing the curve is marked as C body_width Extracted from C body_width Taking the body width corresponding to a first maximum value point between the maximum value point and a second maximum value point as the chest width of the sheep, if the maximum value point does not exist, taking the body width corresponding to the inflection point of the convex-concave as the chest width, and recording the chest width as width _ bre;
s10: fitting by using a formula of 2 pi multiplied by width _ bre +4 (depth _ bre-width _ bre) to obtain a chest girth body ruler;
s11: the point (0, y) in the side view S is selected J )、(x K_L ,y J ) And (3) taking the line segment as an end point as seg, and extracting the size of the left foreleg circumference of the sheep from the side view S according to the following steps S11a to S11d:
s11a: calculating the number of foreground areas of the side view S passed by the seg, if the number is 2, vertically moving the seg by 1 pixel, circularly executing the step S11a until the number of the foreground areas passed by the seg in the side view S is 1, and turning to the step S11b;
s11b: shifting seg by 1 pixel, extracting 4 endpoints of two intersecting line segments of seg and side view S, selecting the endpoint with the third largest abscissa as the vertex of the included angle between the two forelimbs, recording the endpoint as N, and recording the coordinate as (x) N ,y N );
S11c: choosing the side view S with the abscissa at [2 ×) K -x B ,x B ]Interval, ordinate at [ y N ,y K ]The region formed by the pixel points of the interval is marked as ROI-2, and points (0, y) on the y axis are aligned in the ROI-2 N ) To point (0, y) K ) Making a vertical line perpendicular to the y axis and passing through each pixel point, counting the number of non-0 pixel points on the vertical line, drawing a variation curve of the number of non-0 pixel points, selecting the minimum point in the variation curve to position the thinnest part of the tube circumference, extracting the cross section width of the part as the tube diameter, and recording the tube diameter as w g
S11d: using the formula
Figure FDA0003813254090000032
Fitting to obtain the size of the pipe circumference;
s12: taking the upper end point E of the chest depth as a straight line with the slope of 1, recording the intersection point of the straight line and the anterior chest contour as C, taking C as the front end point of the body slope length, positioning the rear end point of the body slope length by adopting the steps S12a to S12d and calculating the body slope length:
s12a: selecting a sheep body width change curve C body_width The minimum value between the upper maximum value point and the second maximum value point is recorded as C body_width The point on the curve is min _ C body_width Passing point min _ C body_width Making a straight line parallel to the horizontal axis and intersecting the curve C body_width The curve part on the right side of the point where the upper maximum value is located intersects, and the intersection point is recorded as P1_ C body_width
S12b: to point P1_ C body_width Sheep body width change curve C body_width And (3) calculating the second derivative of each point between the extreme right side end points, if a point with the second derivative of 0 exists, extracting the point with the first second derivative of 0 and recording the abscissa of the point as x _ p _ end, and if the point does not exist with the second derivative of 0The point where the derivative is 0 is recorded as C body_width The abscissa of the rightmost endpoint is x _ p _ end;
s12c: taking a region formed by pixel points in the upper half section and the 1/4 of the right side of the side view S as a target region, recording the region as ROI-3, positioning the maximum horizontal coordinate point of a foreground region in the ROI-3, recording the vertical coordinate of the maximum horizontal coordinate point as y _ end, and taking a point with the coordinates of (x _ p _ end and y _ end) as a rear end point of the body slant length and recording the point as Q;
s12d: in side view S, CQ is connected and the length of the line CQ is taken as the body slant length of the sheep.
CN202211018538.6A 2022-08-24 2022-08-24 Device and method for automatically measuring sheep body ruler from side view and overlook double-view images Active CN115396576B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211018538.6A CN115396576B (en) 2022-08-24 2022-08-24 Device and method for automatically measuring sheep body ruler from side view and overlook double-view images

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211018538.6A CN115396576B (en) 2022-08-24 2022-08-24 Device and method for automatically measuring sheep body ruler from side view and overlook double-view images

Publications (2)

Publication Number Publication Date
CN115396576A true CN115396576A (en) 2022-11-25
CN115396576B CN115396576B (en) 2023-08-08

Family

ID=84120244

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211018538.6A Active CN115396576B (en) 2022-08-24 2022-08-24 Device and method for automatically measuring sheep body ruler from side view and overlook double-view images

Country Status (1)

Country Link
CN (1) CN115396576B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116447982A (en) * 2023-06-19 2023-07-18 深圳市看飞鸡生态农业有限公司 System for evaluating size of free-range chicken flock

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017084204A1 (en) * 2015-11-19 2017-05-26 广州新节奏智能科技有限公司 Method and system for tracking human body skeleton point in two-dimensional video stream
CN107464249A (en) * 2017-06-13 2017-12-12 内蒙古农业大学 A kind of sheep only contactless body measurement method
CN107481243A (en) * 2017-06-13 2017-12-15 内蒙古农业大学 Sheep body chi detection method based on sheep top view
CN210374994U (en) * 2019-07-03 2020-04-21 西北农林科技大学 Device for collecting body ruler parameters of cattle and sheep
CN113344960A (en) * 2021-05-10 2021-09-03 河南省农业科学院畜牧兽医研究所 Live cattle body ruler weight measuring method based on machine vision
CN114241031A (en) * 2021-12-22 2022-03-25 华南农业大学 Fish body ruler measurement and weight prediction method and device based on double-view fusion

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017084204A1 (en) * 2015-11-19 2017-05-26 广州新节奏智能科技有限公司 Method and system for tracking human body skeleton point in two-dimensional video stream
CN107464249A (en) * 2017-06-13 2017-12-12 内蒙古农业大学 A kind of sheep only contactless body measurement method
CN107481243A (en) * 2017-06-13 2017-12-15 内蒙古农业大学 Sheep body chi detection method based on sheep top view
CN210374994U (en) * 2019-07-03 2020-04-21 西北农林科技大学 Device for collecting body ruler parameters of cattle and sheep
CN113344960A (en) * 2021-05-10 2021-09-03 河南省农业科学院畜牧兽医研究所 Live cattle body ruler weight measuring method based on machine vision
CN114241031A (en) * 2021-12-22 2022-03-25 华南农业大学 Fish body ruler measurement and weight prediction method and device based on double-view fusion

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张丽娜;武佩;乌云塔娜;宣传忠;马彦华;陈鹏宇;: "基于图像的肉羊生长参数实时无接触监测方法", 农业工程学报, no. 24, pages 1 - 44 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116447982A (en) * 2023-06-19 2023-07-18 深圳市看飞鸡生态农业有限公司 System for evaluating size of free-range chicken flock
CN116447982B (en) * 2023-06-19 2023-09-05 深圳市看飞鸡生态农业有限公司 System for evaluating size of free-range chicken flock

Also Published As

Publication number Publication date
CN115396576B (en) 2023-08-08

Similar Documents

Publication Publication Date Title
Zion et al. Real-time underwater sorting of edible fish species
CN109785337A (en) Mammal counting method in a kind of column of Case-based Reasoning partitioning algorithm
CN108961330B (en) Pig body length measuring and calculating method and system based on image
TWI687159B (en) Fry counting system and fry counting method
CN101499129B (en) Distant range iris recognition system and method
CN105184787B (en) A kind of license camera and method for portrait scratch figure automatically
US20110279650A1 (en) Arrangement and method for determining a body condition score of an animal
CN101853399B (en) Method for realizing blind road and pedestrian crossing real-time detection by utilizing computer vision technology
CN115396576A (en) Device and method for automatically measuring sheep body size from side-view and overlook double-view-angle images
CN107992797A (en) Face identification method and relevant apparatus
CN105260750B (en) A kind of milk cow recognition methods and system
WO2015096345A1 (en) Forage detection system and method based on machine vision
Zhang et al. Development and validation of a visual image analysis for monitoring the body size of sheep
CN106483130B (en) A kind of detection method and its automatic detection device of rice disease
CN109570051B (en) Chinese chestnut wormhole detection device based on machine vision, laser and acoustics
CN109687382B (en) Relay protection pressing plate switching state identification method based on color template matching
CN106846462B (en) insect recognition device and method based on three-dimensional simulation
CN112418124A (en) Intelligent fish monitoring method based on video images
CN109492535B (en) Computer vision sow lactation behavior identification method
CN103824057A (en) Pig respiratory rate detection method based on area feature operator
CN110741964A (en) Automatic sheep identification and sheep body determination device under computer assistance
CN107374641B (en) 3D scanning system for dynamically identifying cow body shape
CN110097540A (en) The visible detection method and device of polygon workpeace
CN113920138A (en) Cow body size detection device based on RGB-D camera and detection method thereof
CN113808156A (en) Outdoor cattle body ruler detection method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant