CN115396576B - Device and method for automatically measuring sheep body ruler from side view and overlook double-view images - Google Patents

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

Info

Publication number
CN115396576B
CN115396576B CN202211018538.6A CN202211018538A CN115396576B CN 115396576 B CN115396576 B CN 115396576B CN 202211018538 A CN202211018538 A CN 202211018538A CN 115396576 B CN115396576 B CN 115396576B
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.)
Active
Application number
CN202211018538.6A
Other languages
Chinese (zh)
Other versions
CN115396576A (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

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 sheep body scales from side-view and overlook double-view images, which mainly comprises a PLC controlled access control system, an image acquisition module provided with side-view and overlook cameras and an image acquisition chamber. One side of the image acquisition chamber is transparent glass, the other side of the image acquisition chamber is a movable baffle connected with an electric push rod, 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 measurement requirements of sheep body scales with different body conditions. Correcting the side-looking and overlooking images by utilizing the characteristics of minimum external rectangle of the foreground in the side-looking and overlooking images and the like, comprehensively utilizing the key point characteristics of the sheep body ruler in the side-looking and overlooking images to automatically position the key points of the body ruler, calculating the height, the chest depth, the chest width, the body oblique length and the pipe diameter by utilizing Euclidean distance, performing elliptical fitting by taking the chest depth and the chest width as long and short axis parameters to obtain the chest circumference, and obtaining the pipe circumference by utilizing pipe diameter fitting. The invention can automatically provide objective sheep body ruler parameters on the premise of reducing human and animal contact and labor cost.

Description

Device and method for automatically measuring sheep body ruler from side view and overlook double-view images
Technical Field
The invention belongs to the technical field of sheep raising, and particularly relates to a device and a method for automatically measuring sheep body ruler data by utilizing machine vision and an automatic control technology.
Background
The sheep body size data can reflect the growth and development condition of sheep and the relative development relation among all parts of the body, and can be used as a main index for measuring the growth and development of sheep. The sheep body ruler data can also be used for evaluating the growth and development characteristics and genetic characteristics of sheep, is one of important references for screening sheep germplasm resources, and can improve the production performance of sheep, compensate sheep weaknesses and improve the feed utilization rate and ketone body quality. The body size parameters of sheep that receive attention in the production of breeding mainly have: high, deep, wide, circumference, tube circumference, and oblique length.
At present, the traditional sheep body ruler measurement method mainly uses measurement tools such as a flexible ruler, a stick measuring instrument and the like to directly contact a sheep body for measurement, the measurement method is time-consuming and labor-consuming, the measurement method can only bring great stress response to the sheep, if the measurement object is pregnant female sheep, the abortion probability of the sheep can be increased, and the artificial measurement result is not objective enough due to the existence of artificial subjective influence factors. Meanwhile, the direct contact between the human and sheep increases the risk of zoonosis. In addition, there is also a measurement method for clamping sheep by using a mechanical device and obtaining sheep body ruler data through the distance between mechanical structures, and the method replaces manual direct contact with sheep, but the mechanical clamping can still damage the sheep body, and the stress response to sheep is larger.
Disclosure of Invention
The patent aims to overcome the problems and provide an automatic sheep body ruler measuring device and method based on machine vision and automatic control technology. The technical problems to be solved are as follows: an automatic acquisition device structure for a side view and a top view of a sheep body; an image processing method for automatically extracting sheep body ruler parameters from side view and overlook 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 sheep body ruler from side view and overlook double-view images, wherein the hardware part comprises the following steps: the system comprises an inlet channel, an inlet entrance guard, a sensor module, an image acquisition chamber, an image acquisition module, an outlet entrance guard, an outlet channel, a computer, a PLC (programmable logic controller) and an entrance guard switch control motor, wherein the image acquisition module consists of a overlook camera and a side view camera, and the sensor module comprises a photoelectric sensor and a limit switch.
Photoelectric sensors are respectively arranged at the entrance channel, the image acquisition chamber and the exit channel, the light path of the corresponding photoelectric sensor is shielded when the sheep is at a certain position, the output signals of the photoelectric sensors are connected to a PLC, the PLC determines the position of the sheep according to the signals of the photoelectric sensors, and the steering of the entrance guard and the exit guard motors is controlled based on the positions of the entrance guard and the exit guard so as to open or close the entrance guard and the exit guard.
The motor and the limit switch are used for controlling the automatic opening and closing of the entrance guard and the exit guard, the entrance guard and the exit guard are composed of two doors, each door is controlled by one motor and two limit switches together to realize opening and closing, and the PLC automatically controls the forward rotation and the reverse rotation of the motor 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 entrance guard, side transparent glass, movable baffle, export entrance guard, side view camera and overlook camera, and movable baffle is by electric putter control removal in order to adjust image acquisition room width for image acquisition room size is suitable for gathering the sheep body image of equidimension. A red calibration plate with the length of 20 cm and the width of 10 cm is attached to the upper left corner of the transparent glass on the side of the image acquisition chamber, 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 arranged in the image acquisition chamber, and the identity of the sheep in the image acquisition chamber is automatically recorded.
The software part of the device and the method for automatically measuring the sheep body ruler from the side view and overlook double-view images adopts an image processing method to automatically measure the body ruler parameters from the side view and overlook images of sheep, and the method comprises the following steps:
when no sheep exists in the image acquisition chamber, driving a side view and overlook camera to acquire a background image respectively, and recording the overlook background image as Tb and the side view background image as Sb;
when sheep exist in the image acquisition chamber, two cameras are simultaneously started and shoot the sheep, a top view is marked as Tf, a side view is marked as Sf, a background subtraction method is utilized to obtain foreground images of the sheep in side view and top view, and the foreground images are respectively marked as Sm and Tm, namely Sm=sf-Sb, and Tm=Tf-Tb;
sequentially carrying out 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;
fourth step: the body ruler measurement parameters of the sheep mainly comprise tube circumference, height, chest depth, body oblique length, chest width and chest circumference, the body ruler parameters of the sheep are automatically extracted by processing the binary images T and S, and the measurement modes of the specific parameters are as follows:
and (3) surrounding the pipe: in the side view S, the sheep head faces to the left, 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 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, and then the circumference of the tube is fitted according to the width of the cross section of the tube.
High: in the production practice, the vertical distance from the highest point of the first of the astragalus to the ground is defined as the height of the sheep, in the side view S, two front legs of the sheep body stand separately and naturally, the abscissa of the highest point of the first of the astragalus is positioned between two feet, the two front limbs are positioned based on the abscissa and ordinate characteristics of the contact points of the 4 feet and the ground, the coordinates of the two points of the two front limbs 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 perpendicular line is drawn based on the lower end point to the back point 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 first of astragalus 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 in manual measurement, in the side view S, the abdomen outline of the sheep body is extracted, the abdomen outline is positioned to the forefront point of the abdomen outline and is taken as the lower endpoint of the chest depth, the perpendicular line perpendicular to the ground is made on the basis of the lower endpoint and is intersected to one point of the back as the upper endpoint of the chest depth, and the Euclidean distance from the upper endpoint of the chest depth to 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 ischial tuberosity is taken as the oblique length of the sheep, on the basis that the upper end point of the chest depth is already determined, oblique lines with the slope of 1 are crossed to one point of the front chest through the upper end point of the chest depth to be taken as the front end point of the oblique length of the sheep, the tail root part of the sheep is taken as the rear end point of the oblique length of the sheep, and the Euclidean distance from the front end point of the oblique length of the sheep to the rear end point of the oblique length of the sheep is the oblique length of the sheep.
Chest width: in production practice, the straight line distance of the widest points at the rear edges of the shoulder blades at two sides of the sheep body is defined as the chest width of the sheep, in a top view T, the length of the sheep body is taken as an x axis, the sum of the points with the pixel values of 1 on the line perpendicular to the x axis and the coordinate points on the x axis is counted, a sheep body width change curve is drawn by taking the sum of the numbers as a y axis, and the maximum point corresponding to the chest width is determined based on curve function analysis, wherein the maximum point is the chest width of the sheep.
Chest circumference: in production practice, the chest circumference of the rear edge of the scapula is defined as the chest circumference of the sheep body, the chest depth is used as the major axis, the chest width is used as the minor axis for elliptical fitting on the basis of obtaining the chest depth and the chest width, and the elliptical circumference obtained by fitting is used as the chest circumference.
The Euclidean distance calculation formula between the pixel points is as follows: knowing the coordinates of points a and b as (x 1, y 1), (x 2, y 2), the Euclidean distance between the pixel points a and b is
Positioning the calibration plate in the side view image by using a template matching method, and extracting the length of the calibration plateThe pixel distance is l pixel Knowing the physical dimension of the calibration plate length as l, the conversion ratio between the physical dimension and the pixel distance can be obtained as p=l/l pixel The physical size of the sheep body ruler is d real =p×d pixel Wherein d is pixel The pixel distance of the sheep body ruler parameter.
The beneficial effects of the invention are that
The invention provides a non-contact type sheep body ruler parameter measuring device and method based on machine vision, which specifically comprise a set of hardware device and a set of body ruler automatic measuring algorithm, and can automatically and accurately acquire sheep body ruler parameters. The hardware of the invention is controlled by the PLC, the opening and closing of the entrance and exit entrance guard of the image acquisition chamber are automatically controlled according to the real-time position of the sheep, and the side view and overlook images of the sheep positioned in the image acquisition chamber are automatically acquired, so that the complicated manual operation is reduced; a set of practical image processing algorithm is provided, and the key points of the sheep body ruler are accurately positioned by combining side view and top view images of the sheep, so that the sheep body ruler parameters are obtained; by adjusting the width of the image acquisition chamber, the device can be suitable for measurement requirements of sheep body scales of different sizes and different ages in days, a scientific, accurate, objective and stress-free method is provided for automatic measurement of the sheep body scales, and development of intelligent animal husbandry is promoted.
Drawings
FIG. 1 is a schematic view of an image acquisition apparatus according to the present invention
Fig. 2 is a partial enlarged view of a motor and a limit switch
FIG. 3 is a flow chart of the image acquisition operation for the side view and the top view of the sheep body
FIG. 4 is a diagram showing the result of preprocessing a side view and a top view of a sheep body
FIG. 5 is a schematic diagram of an automatic high-parameter sheep body extraction method
FIG. 6 is a schematic diagram of an automatic extraction method of chest depth parameters of sheep
FIG. 7 is a schematic diagram of an automatic extraction method of sheep chest width parameters
FIG. 8 is a schematic diagram of an automatic extraction method for parameters of the left foreleg circumference of sheep
FIG. 9 is a schematic diagram of an automatic sheep body slant length parameter extraction method
Detailed Description
The invention is further illustrated below with reference to examples, but the scope of the invention is not limited thereto:
in order to make the above objects, features and advantages of the present invention more comprehensible, the following technical solutions are described in detail with reference to the accompanying drawings in the embodiments of the present invention. It will be apparent that the described embodiments are only some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
FIG. 1 is a schematic view of the structure of the device of the present invention, mainly comprising the mechanical structure and control components of the device, and FIGS. 1 (2) and (4) are entrance guard and entrance passage rail, respectively; (1) And (3) exit access and exit passage fences, respectively; (13) Is a glass baffle plate at the side of an image acquisition camera for side view of an image acquisition room; (14) The movable baffle is a movable baffle of the image acquisition chamber, and the movable baffle (14) can move in a direction close to the glass baffle (13) or far away from the glass baffle (13) to adjust the width of the image acquisition chamber, so that the requirements of sheep body image acquisition 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 to drive the movable baffle (14) to move so as to adjust the width of the image acquisition chamber; (5) is a top view camera mount; (7) a top view camera for photographing only a top view of sheep; (6) a side view camera mount; (8) The side view camera is used for shooting side view images of sheep bodies, and the height of the side view camera (8) is as high as the center point of the side view image acquisition side glass baffle (13); (9-3) an entrance photoelectric sensor, (9-2) an image acquisition chamber movable baffle photoelectric sensor, and (9-1) an exit photoelectric sensor, wherein the position where the corresponding photoelectric sensor is installed is indicated when the photoelectric sensor is shielded; (10) Is an RFID reader which is arranged on the inner side of a movable baffle (14) of the image acquisition room and is used for recording the identity information of sheep positioned in the image acquisition room. The installation heights of the entrance photoelectric sensor (9-3), the movable baffle photoelectric sensor (9-2) of the image acquisition chamber and the exit photoelectric sensor (9-1) are at the height of the abdomen of the sheep, the installation position of the movable baffle photoelectric sensor (9-2) of the image acquisition chamber is close to the exit gate inhibition (1), the entrance gate inhibition (2) closing signal is triggered after the sheep completely enters the image acquisition chamber, the exit photoelectric sensor (9-1) is installed at a position far away from the exit gate inhibition (1), and the closing signal of the exit gate inhibition (1) is triggered after the sheep completely leaves.
FIG. 2 is a partial enlarged view of a first outlet sub-door (1-1) of the outlet door (1) close to one side of a movable baffle (14), wherein (11) is a pulley sleeved with a sliding rail, the pulley is fixed on the movable baffle (14), and the pulley slides on the sliding rail to drive the movable baffle (14) to move; the PLC sends a stop command to the first motor (18) 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), so that the opening or closing action of the first outlet sub-door (1-1) is automatically stopped; the mechanism consisting of the first limit switch (16), the second limit switch (17) and the first motor (18) is respectively provided with a set of mechanism on the 4 corners of the image acquisition chamber, and the mechanism is respectively used for controlling the automatic opening and closing of the four doors of the entrance guard (2) and the exit guard (1).
As shown in fig. 3, the complete image acquisition workflow of the device for the side view and the top view of the sheep is as follows: the sheep approaches an entrance guard through an entrance passage fence, if the sheep shields a photoelectric sensor of the entrance passage fence, a PLC (programmable logic controller) receives a signal that the sheep is outside the entrance guard, and sends a command to an entrance guard control motor to drive the motor to rotate so as to open a first entrance sub-door and a second entrance sub-door, and after the first entrance sub-door and the second entrance sub-door are respectively pressed to a pressure lever of a corresponding limit switch, the PLC sends a control command for stopping rotation to the entrance guard control motor; the 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 guard control motor, the first entrance sub-door and the second entrance sub-door are closed and pressed to pressure rods of limit switches respectively, and then the PLC sends a rotation stopping command to the entrance gate control motor to finish closing of the entrance guard; the RFID reader is communicated with an RFID electronic ear tag worn by the sheep, and the identity of the sheep is identified; the PLC opens the overlook camera to collect the back image of the sheep, transmits the back image to the computer to process to obtain the width of the image collection chamber, and sends a telescopic command to the electric push rod to drive the movable baffle to move to a proper position; after the side view camera and the overlook camera start to collect images and continuously set time, the PLC closes the overlook camera and the side view camera, the PLC sends a rotary driving command to a control motor of the exit gate inhibition to open the first exit sub-gate and the second exit sub-gate, after the sheep leaves the channel, the PLC triggers a photoelectric sensor positioned outside the exit, the PLC sends the rotary driving command to the control motor of the exit gate inhibition to close the first exit sub-gate and the second exit sub-gate, and the signal relationship between the exit gate inhibition and a corresponding limit switch in the opening and closing processes of the exit gate inhibition is similar to that of the entrance gate inhibition.
As shown in fig. 4, the preprocessing workflow of the side view and top view images of the sheep body is as follows:
the first step: gray scale and binary operation are carried out on the side view and the top view of the sheep body;
and a second step of: obtaining the minimum circumscribing rectangle of the sheep body part in the top view, recording the length of the minimum circumscribing rectangle as Tr_len, obtaining the minimum circumscribing rectangle of the sheep body part in the side view, recording the length of the minimum circumscribing rectangle as Sr_len, carrying out affine transformation on the top view by taking Sr_len as a standard, recording the length of the sheep body circumscribing rectangle in the top view as Tr_len 'after affine transformation, so that Tr_len' and Sr_len are equal, and recording the top view and the side view after affine transformation as T and S respectively.
As shown in fig. 5, the method for extracting the sheep high parameter from the sheep body side view S comprises the following steps: in the side view S, the ordinate of the contact points of the two front hooves and the ground is extracted, the contact point with the larger ordinate is marked as K, the contact point with the smaller ordinate is marked as J, and the marked point K is marked as (x) K ,y K ) The coordinates of the J point are noted as (x J ,y J ) Taking the midpoint of the K, J connecting line as a high-low endpoint B, and recording the abscissa as x B Cross point (x) B 0) making a vertical line perpendicular to the upper edge of the side view S, takingThe intersection point of the vertical line and the back profile of the sheep body is taken as a high upper end point and is marked as A, and the Euclidean distance between the point A and the point B is calculated as the sheep body.
As shown in fig. 6, the method for extracting the chest depth parameter from the sheep body side view S comprises the following steps: taking the abscissa of the contact points of the two rear hooves and the ground in the side view S, marking the point with smaller abscissa as L, marking the point with larger abscissa as M, calculating the average value of the abscissa of the point K and the point L and marking the average value as x K_L Selecting the abscissa in the side view S to be [ x ] B ,x K_L ]Interval, ordinate is atThe region constituted by the pixel points of the section is also denoted as ROI-1, and points (x K_L 0) to point (x B 0) making a vertical line perpendicular to the upper edge of the side view S by each pixel point, counting the number of non-0 pixel value points in the ROI-l according to the direction from top to bottom for each vertical line, stopping counting the non-0 pixel value points on the current vertical line when the 0 pixel value points appear for the first time, drawing a non-0 pixel value point number change curve, taking the minimum value on the curve and recording the abscissa of the minimum value as x K_L_min In the side view S, the passing point (x K_L_min 0) drawing a perpendicular to the upper edge of the side view S, taking the intersection point of the perpendicular and the abdomen as a chest depth lower end point, which is marked as F, the intersection point of the perpendicular and the back contour as a chest depth upper end point, which is marked as E, and calculating the Euclidean distance between the points E, F as the chest depth, which is marked as depth-bre.
As shown in fig. 7, the method for extracting the sheep chest width parameter from the sheep top view T comprises the following steps: in the top view T, the main axis of the sheep body is extracted, a vertical line perpendicular to the main axis is drawn through each point of the main axis, the abscissa 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 The body width corresponding to the first maximum value point between the maximum value point and the second maximum value point is taken as the chest width of the sheep, if the maximum value point does not exist, the inflection point of the convex-concave is taken to correspond toThe body width of (a) is referred to as the chest width, which is denoted as width_ bre.
The chest circumference rule is fit using the formula 2pi×width_ bre +4 (depth_ bre-width_ bre).
As shown in FIG. 8, the side view S is selected as a point (0, y J )、(x K_L ,y J ) The line segment is marked as seg as an endpoint, and the left foreleg tube circumference size of the sheep is extracted from the side view S according to the following steps:
the first step: calculating the number of foreground areas of the side view S through which the seg passes, if the number of the foreground areas is 2, vertically moving the seg upwards by 1 pixel, circularly executing the first step until the number of the foreground areas through which the seg passes in the side view S is 1, and turning to the second step;
and a second step of: the seg is moved down by 1 pixel, 4 endpoints of two intersecting line segments of the seg and the side view S are extracted, the endpoint with the third largest abscissa is selected as the vertex of the included angle between the two forelimbs, which is marked as N, and the sitting mark is (x) N ,y N );
And a third step of: selecting a side view S with an abscissa of [2x ] K -x B ,x B ]Interval, ordinate is at [ y ] N ,y K ]The region formed by the pixel points of the section is also referred to as ROI-2, and the y-axis upper points (0, y N ) To the point (0, y) K ) Making a vertical line perpendicular to the y axis by making the pixel point between each pixel point, counting the number of non-0 pixel points on the vertical line, drawing a variable curve of the number of the non-0 pixel points, selecting the position of the minimum value point in the variable curve, locating the narrowest part of the tube circumference, extracting the width of the cross section of the position as the tube diameter, and marking the tube diameter as w g
Fourth step: using the formulaFitting to obtain the size of the tube periphery.
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 outline is marked as C, C is taken as the front end point of the oblique body length, and the oblique body length rear end point is positioned and the oblique body length is calculated by adopting the following steps:
the first step: selecting a sheep body width change curve C body_width Upper maximum point to the firstMinimum value between two maximum points, and record the value at 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 transverse axis and intersecting the curve C body_width The curve part on the right side of the point of the upper maximum value intersects with each other, and the intersection point is denoted as P1_C body_width
And a second step of: point-to-point P1_C body_width To sheep body width change curve C body_width Each point between the rightmost end points obtains the second derivative thereof, if the point with the second derivative of 0 exists, the point with the first second derivative of 0 is extracted and the abscissa of the point is marked as x_p_end, if the point with the second derivative of 0 does not exist, C is marked body_width The abscissa of the rightmost endpoint is x_p_end;
and a third step of: taking a region formed by 1/4 inner pixel points on the upper half section and the right side of the side view S as a target region, marking the region as an ROI-3, positioning the maximum point of the horizontal coordinate of a foreground region in the ROI-3, marking the vertical coordinate as y_end, and marking the point with the coordinates of (x_p_end and y_end) as the rear end point of the body oblique length, and marking the point as Q;
fourth step: in side view S, CQ is connected and the length of line segment CQ is taken as the sheep body diagonal length.
The specific embodiments described herein are offered by way of example only to illustrate the spirit of the invention. Those skilled in the art may make various modifications or additions to the described embodiments or substitutions thereof without departing from the spirit of the invention or exceeding the scope of the invention as defined in the accompanying claims.

Claims (1)

1. A method for automatically measuring sheep body ruler from side view and overlook double-view images, based on a device for automatically measuring sheep body ruler from side view and overlook double-view images, the device comprises:
an outlet entrance guard (1) arranged at the outlet of the image acquisition chamber and an outlet channel fence (3) outside the outlet, wherein an outlet photoelectric sensor (9-1) is arranged at the inner side of the outlet channel fence (3); an entrance guard (2) arranged at the entrance of the image acquisition room and an entrance passage fence (4) outside the entrance, wherein an entrance photoelectric sensor (9-3) is arranged at the inner side of the entrance passage fence (4);
the side view camera (8) is arranged on one side of the image acquisition chamber based on the side view camera bracket (6) and is used for shooting side view images of sheep bodies; the overlook camera (7) is arranged at the top of the image acquisition room based on the overlook camera bracket (5) and is used for shooting only the top view of sheep;
a glass baffle (13) is arranged on the side view camera (8) side 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 the electric push rod (12) is connected with the movable baffle (14); the movable baffle (14) moves in a direction close to the glass baffle (13) or far away from the glass baffle (13) under the action of the electric push rod (12) so as to adjust the width of the image acquisition chamber, thereby adapting to the image acquisition requirements of sheep bodies with different sizes; 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 sheep positioned in the image acquisition room;
the processor automatically calculates and obtains sheep body ruler data based on the image information acquired by the image acquisition room, and the method is characterized by comprising the following steps of:
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 guard (2) is opened;
s2: the movable baffle plate photoelectric sensor (9-2) of the image acquisition chamber is shielded, the entrance guard (2) is closed, the top view camera (7) is opened and driven to shoot the top view of the sheep, the body width information of the sheep is automatically extracted, and the position of the movable baffle plate (14) of the image acquisition chamber is adjusted according to the body width of the sheep, so that the side surface of the sheep body is close to the transparent glass (13) on the side of the image acquisition chamber;
s3: opening a side view camera (8), driving a overlook camera (7) and the side view camera (8) to shoot side view and overlook images of the sheep, and storing the side view and overlook images into a computer;
s4: opening the exit gate inhibition (1), closing the exit gate inhibition (1) if the exit photoelectric sensor (9-1) is blocked, and recovering the movable baffle (14) of the image acquisition chamber to the initial position;
the sheep body ruler information is automatically extracted by adopting the steps S5 to S12:
s5: carrying out grey-scale and binarization operation on the sheep side view and the top view acquired in the step S3;
s6: obtaining the minimum circumscribed rectangle of the sheep body part in the top view, recording the length of the minimum circumscribed rectangle as Tr_len, obtaining the minimum circumscribed rectangle of the sheep body part in the side view, recording the length as Sr_len, carrying out affine transformation on the top view by taking Sr_len as a standard, recording the length of the circumscribed rectangle of the sheep body in the top view as Tr_len 'after affine transformation, so that Tr_len' and Sr_len are equal, and recording the image areas in the circumscribed rectangle of the sheep in the top view and the side view after affine transformation as T and S respectively;
s7: in the side view S, the ordinate of the contact points of the two front hooves and the ground is extracted, the contact point with the larger ordinate is marked as K, the contact point with the smaller ordinate is marked as J, and the marked point K is marked as (x) K ,y K ) The coordinates of the J point are noted as (x J ,y J ) Taking the midpoint of the K, J connecting line as a high-low endpoint B, and recording the abscissa as x B Cross 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 back profile of the sheep body as a high upper end point, marking as A, and calculating the Euclidean distance between the point A and the point B as the sheep body;
s8: taking the abscissa of the contact points of the two rear hooves and the ground in the side view S, marking the point with smaller abscissa as L, marking the point with larger abscissa as M, calculating the average value of the abscissa of the point K and the point L and marking the average value as x K_L Selecting the abscissa in the side view S to be [ x ] B ,x K_L ]Interval, ordinate is atThe region constituted by the pixel points of the section is also denoted as ROI-1, and points (x K_L 0) to point (x B 0) making a vertical line perpendicular to the upper edge of the side view S by each pixel point, counting the number of non-0 pixel value points in the ROI-1 according to the direction from top to bottom for each vertical line, stopping counting the non-0 pixel value points on the current vertical line when the 0 pixel value points appear for the first time, drawing a non-0 pixel value point number change curve, taking the minimum value on the curve and recording the abscissa of the minimum value as x K_L_min On the side ofView S passing points (x K_L_min 0) drawing a vertical line perpendicular to the upper edge of the side view S, extracting an intersection point of the vertical line and the abdomen as a chest depth lower end point, marking as F, an intersection point of the vertical line and the back contour as a chest depth upper end point, marking as E, and calculating Euclidean distance between the points E, F as chest depth, marking as depth_ bre;
s9: in the top view T, the main axis of the sheep body is extracted, a vertical line perpendicular to the main axis is drawn through each point of the main axis, the abscissa 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 The body width corresponding to the first maximum value point between the maximum value point and the second maximum value point is taken as the chest width of the sheep, if the maximum value point does not exist, the body width corresponding to the inflection point of the convex-concave is taken as the chest width, and the chest width is recorded as width_ bre;
s10: fitting by using a formula 2pi×width_ bre +4 (depth_ bre-width_ bre) to obtain a chest circumference ruler;
s11: the side view S is selected to be at points (0, y J )、(x K_L ,y J ) The line segment is marked as seg as an endpoint, and the left foreleg circumference size of the sheep is extracted 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 through which the seg passes, if the number of foreground areas is 2, vertically moving the seg upwards by 1 pixel, circularly executing the step S11a until the number of foreground areas through which the seg passes in the side view S is 1, and turning to the step S11b;
s11b: the seg is moved down by 1 pixel, 4 endpoints of two intersecting line segments of the seg and the side view S are extracted, the endpoint with the third largest abscissa is selected as the vertex of the included angle between the two forelimbs, which is marked as N, and the sitting mark is (x) N ,y N );
S11c: selecting a side view S with an abscissa of [2x ] K -x B ,x B ]Interval, ordinate is at [ y ] N ,y K ]The region formed by the pixel points of the section is also referred to as ROI-2, and the y-axis upper points (0, y N ) To the point (0, y) K ) Counting the vertical lines perpendicular to the y-axis and passing through each pixelDrawing a variable curve of the number of non-0 pixel points, selecting the minimum value point in the variable curve to locate the position where the tube circumference is the finest, extracting the width of the cross section of the position as the tube diameter, and recording the tube diameter as w g
S11d: using the formulaFitting to obtain the size of the tube periphery;
s12: 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 contour of the chest is marked as C, the C is taken as the front end point of the oblique length of the body, and the rear end point of the oblique length of the body is positioned and the oblique length of the body is calculated by adopting the steps S12a to S12d:
s12a: selecting a sheep body width change curve C body_width A minimum value between the upper maximum point and the second maximum 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 transverse axis and intersecting the curve C body_width The curve part on the right side of the point of the upper maximum value intersects with each other, and the intersection point is denoted as P1_C body_width
S12b: point-to-point P1_C body_width To sheep body width change curve C body_width Each point between the rightmost end points obtains the second derivative thereof, if the point with the second derivative of 0 exists, the point with the first second derivative of 0 is extracted and the abscissa of the point is marked as x_p_end, if the point with the second derivative of 0 does not exist, C is marked body_width The abscissa of the rightmost endpoint is x_p_end;
s12c: taking a region formed by 1/4 inner pixel points on the upper half section and the right side of the side view S as a target region, marking the region as an ROI-3, positioning the maximum point of the horizontal coordinate of a foreground region in the ROI-3, marking the vertical coordinate as y_end, and marking the point with the coordinates of (x_p_end and y_end) as the rear end point of the body oblique length, and marking the point as Q;
s12d: in side view S, CQ is connected and the length of line segment CQ is taken as the sheep body diagonal length.
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 CN115396576A (en) 2022-11-25
CN115396576B true 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116447982B (en) * 2023-06-19 2023-09-05 深圳市看飞鸡生态农业有限公司 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
基于图像的肉羊生长参数实时无接触监测方法;张丽娜;武佩;乌云塔娜;宣传忠;马彦华;陈鹏宇;;农业工程学报(第24期);正文第1-44节 *

Also Published As

Publication number Publication date
CN115396576A (en) 2022-11-25

Similar Documents

Publication Publication Date Title
CN115396576B (en) Device and method for automatically measuring sheep body ruler from side view and overlook double-view images
CN109785337A (en) Mammal counting method in a kind of column of Case-based Reasoning partitioning algorithm
Zion et al. Real-time underwater sorting of edible fish species
CA2744146C (en) Arrangement and method for determining a body condition score of an animal
CN102831606B (en) Method for acquiring vocal organ profile in medical image
CN109570051B (en) Chinese chestnut wormhole detection device based on machine vision, laser and acoustics
CN201600330U (en) System for recognizing and locating mature pineapples
CN106570892B (en) A kind of moving target active tracking method based on edge enhancing template matching
CN109766838B (en) Gait cycle detection method based on convolutional neural network
TW202005522A (en) Fry counting system and fry counting method
CN103824057A (en) Pig respiratory rate detection method based on area feature operator
CN108830856B (en) GA automatic segmentation method based on time series SD-OCT retina image
CN112418124A (en) Intelligent fish monitoring method based on video images
CN109492535B (en) Computer vision sow lactation behavior identification method
CN109380146A (en) Live pig self-operated measuring unit and method
CN107957245A (en) Engine link dimension measuring device and its measuring method based on machine vision
CN113808156A (en) Outdoor cattle body ruler detection method and device
CN112085142A (en) Rapid counting device and counting method for large-batch fish fries
CN113920138A (en) Cow body size detection device based on RGB-D camera and detection method thereof
CN110097540A (en) The visible detection method and device of polygon workpeace
CN104715459B (en) Blood-vessel image Enhancement Method
CN104809688B (en) Sheep body body measurement method and system based on affine transformation registration Algorithm
CN114120354A (en) Human body detection and positioning method and device applied to air conditioner and intelligent sensing system
CN111369497B (en) Walking type tree fruit continuous counting method and device
CN116686545B (en) Litchi picking robot shade removing method based on machine vision control

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