METHOD AND APPARATUS FOR GENERATING IMAGE INFORMATION WHEN CARRYING OUT ANIMAL RELATED OPERATIONS
Technical Field of Invention
The present invention relates to methods and apparatuses for generating image information when carrying out operations related to an animal's udder .
Technical Background and Prior Art
For the sake of clarity, the invention will be disclosed in the environment of a milking station and specifically with respect to operations related to the udder and the teats of a cow. It should be understood, however, that the invention is as well applicable for different animals and in different environments. The operations may include positioning of teat cups as well as positioning of operation means for cleaning and dis- infection of teats and udder.
There are several reasons for using automated milking, one being the possibility to decrease personnel costs and eliminate unergonomic manual work, another being the fact that milking may be done more frequently with arbitrary milking hours, thereby increasing the milk production.
Milking stations of this type are primarily intended for free-range cattle, searching the station on their own initiative possibly enticed thereto. The cow enters a stall or a box provided with a gate or a corresponding means which is closed behind the cow. In order to avoid damages it is necessary to create a situation which is as calm as possible by performing every step smoothly, accurately and as rapid as possible, including the arrange- ment of teat cups and the milking procedure. Even so, the cow will not be standing still and, furthermore, different cows will behave differently, thereby complicating automatic positioning and attachment of the teat cups.
Preferably, the teat cups, are handled one at a time by using a robot arm and a gripping tool thereof for picking up teat cups from a carrier and positioning the same one at a time on a respective teat based upon teat position information derived from said image. Alternatively, the teat cups may be arranged as a cluster which may be positioned on all four teats in one single step. Also, the four teat cups may be moved to a position just below the udder and teats in a first step and then the teat cups may be applied one at a time starting from this more closely arranged position.
Prior art includes the use of IR-sensors for sensing the position of teats and udder at a distance combined with a set of close-range IR-sensors for adjusting the position of a teat cup more accurately when moved towards a respective teat. Also, ultrasonic sensors have been used in prior art.
The use of images and processing of image information is known from GB-A-2 272 971, disclosing the use of two video cameras, and DE 37 44 867 C2, disclosing the use of video cameras and identification of teats by a comparison between obtained contours and reference data.
Use of optical sensors including a camera is known from EP 0 300 115 Al, disclosing among other things iden- tification of teats by the use of directed illumination of the teats in order to create characteristic shadows thereof on the udder. Further, according to this document, the height position of teats may be established by focusing a point of a teat, either by adjusting the camera lens or by moving the camera.
Summary of the invention
The object of invention is to provide a solution which eliminates shortcomings of prior art and allows for a rapid and accurate generation and analysis of image information when performing animal related operations.
This object is achieved by methods and apparatuses as claimed in the accompanying claims.
According to a first aspect of the invention, there is provided a method of the kind mentioned in the introduction, comprising the steps of illuminating at least one teat of an animal's udder; and collecting an image relating to said at least one teat of the udder; wherein said illuminating and image collecting steps are performed so as to obtain a substantially shadow-free image of said at least one teat of the udder to enable correct identification of said teat for controlling said animal related operations.
According to a second aspect of the invention, there is provided a corresponding apparatus of the kind mentio- ned in the introduction, comprising: light source means for illuminating at least one teat of the animal's udder; viewing means for obtaining an image relating to said at least one teat the udder; control means for controlling said animal related operation based upon an evaluation of said image provided by said viewing means, wherein said light source means and said viewing means are mutually arranged for providing a substantially shadow-free image of said at least one teat of the udder to enable correct identification of said teat by said viewing means. Hence, according to the first and second aspect of the invention, the arrangement of said light source means and said viewing means for obtaining a substantially shadow-free illumination of a protrusion on a surface of the animal to be imaged, i.e. of a teat protruding from the udder, makes it possible to accurately analyse and evaluate said image in order to control for example positioning of a teat cup when carrying out the animal related operation, e.g. the application of a teat cup.
Preferably, the illuminating of said at least one teat of the udder is performed from essentially below thereof, and, consequently, said image is obtained as viewed essentially from below said teat and/or, thereby
to provide the desired shadow-free illumination. The positioning of said viewing means below said teat and/or udder also provides a preferred substantially clear view of the teat/teats and the udder without interference from the animal's leg, tail or the like.
The positioning of said viewing and light source means below said udder may, of course, tend to increase the risk of the operation of said viewing and light source means being affected by dirt or the like. This may however be avoided for example by arranging said means in transparent, strong, water tight housings or the like which, when needed, may be washed clean using streams or jets of water.
Preferably, the luminous intensity of said light source means or illumination may be controlled to facilitate the desired image quality.
According to a preferred arrangement, said light source means is arranged essentially surrounding said viewing means. This arrangement ensures that the image obtained by said viewing means always shows a substantially shadow-free image.
If for example said light source means is provided on a robot grip, said illumination essentially surrounding the camera may be accomplished by the robot gripping the camera, the camera lens then being encompassed by said gripping members and consequently said lamps mounted thereto, the invention of course not being limited thereto.
According to a third aspect of the invention, there is provided a method of the kind mentioned in the introduction, comprising the steps of: collecting images relating to at least one teat of the animal's udder; varying the depth of field in connection with collecting said images; and deriving image information relating to the position of said at least one teat based upon a depth of field evaluation of said images having different depths
of field, said image information then being used to control of said operations.
According to a fourth aspect of the invention, there is provided a corresponding apparatus of the kind mentio- ned in the introduction, comprising: viewing means for collecting images relating to at least one teat of an animal's udder; means for varying the depth of field in connection with collecting said images; and means for deriving image information relating to the position of said at least one teat based upon a depth of field evaluation of collected images having different depths of field, said image information then being used to control of said operations.
Hence, the invention is also based upon the recog- nition that position or identifying information relating to an animal's teats and udder used in controlling an animal related operation, such as applying a teat cup on a teat when for example milking a cow, may be derived by evaluating images of said teat and/or udder having dif- ferent depths of field. As a result of the different depths of field of said images, such images comprise different image areas having different image sharpness, said sharpness differences appearing as a result of the spatial relation between parts of said udder and teats momentarily being at different distances from said viewing means .
Since parts of the animal are closer to the lens than other parts, all parts cannot be shown simultaneously as sharp on the image with a small depth of field. Accordingly, full sharpness can in such a situation only be obtained in some parts within the image. While the teats of an udder form protrudingly shaped elements with respect to said udder, these may be identified by analysing the depth of field features of said image, prefer- ably by using information from more than one image having different depths of field. As the depth of field is varied, the different objects appearing within the image
will successively fall in or out of focus, depending on the distances thereof to the viewing means, thus enabling identification of teats.
Hence, according to these aspects of the invention, such evaluation of the depth of field may be used in order to obtain an efficient discrimination of non-relevant image information, thereby speeding up the image evaluation and identification of significant image parts. Hereby, the invention makes it possible to determine which parts of an animal's udder and/or teats that are positioned closer to or further away from said viewing means than other parts of said udder and/or teats in order to detect a teat and, based thereupon, for example apply a teat cup to said teat. If the viewing means are positioned as to view the udder from essentially below thereof, the teats will be detected as being positioned closer to said viewing means than the bottom of the udder. If the viewing means instead are positioned as to provide a more horizontal view the udder, some teats will be detected as being positioned closer to said viewing means than other teats.
Which part, i.e. the closest or the more distant, of the image that will be presented as being sharp, depends on the present focusing setting. The focus setting may be held constant or may be varied during operation. Hence, according to an embodiment of the invention, there is provided means for varying the focal setting when collecting said images.
Therefore, in a broad aspect, the apparatus accor- ding to these aspects of the invention collects images relating to at least one teat of the animal's udder and varies the depth of field in connection with collecting said images. The images are then evaluated with respect to said depth of field information for deriving image information relating to the position of said at least one teat. Said animal related operation may then be controlled based upon said information.
As is clear for a person skilled in the art, the depth of field analysis according to the third and fourth aspects of the invention may thus be used and implemented by conventional image processing technology for obtaining a simplified evaluation of an image and the spatial relationships between the different objects, namely the teat or teats and the udder of an animal, appearing on said image, thus providing identification thereof, using the different images having different depths of field for a discrimination of image information.
Such image processing may for example include filtering of an image pixel light intensity signal for deriving parts of the signal showing distinct fluctuations in signal amplitude, i.e. corresponding to image areas showing relatively high degree of contrast. The image processing may also include line and edge analysis for determining whether lines and edges present in the image appears as relatively distinct or non-distinct, corresponding to sharp or unsharp areas, i.e. areas lying inside or outside the present depth of field.
The apparatus may accordingly further comprise means for controlling said animal related operation based upon an evaluation of said images provided by said viewing means. The varying depth of field may for example be accomplished by varying the size of an aperture associated with a lens of said viewing means or by varying the focal length of such a lens .
Thus, according to an embodiment, said means for varying the depth of field of said images comprises aperture forming means, the aperture of which being arranged to be varied for enabling a variable amount of light to enter said aperture forming means so as to provide said varying depth of field. The varying means may also comprise two separate aperture forming means, being associated with two respective image forming lenses, having different aperture settings and thereby providing different depths of field images.
According to another embodiment, said viewing means is provided with a first lens having one focal length and a second lens having a different focal length, thereby forming said means for varying the depth of field of said images .
Of course, said varying aperture size and and/or the varying of focal length may be accomplished by using two apertures associated with two respective lenses, each aperture-lens-pair providing an image having a different depth of field, thus enabling varying depth of field analysis .
Preferably, said light source means is provided for illuminating said at least one teat of an animal's udder. The luminous intensity of said light source means or illumination may then be controlled to facilitate said aperture size or focal length control, corresponding to a desired depth of field, with maintained image quality. It is further desired that said light source means and said viewing means then are mutually arranged for providing a substantially shadow-free image of said at least one teat of the udder to enable correct identification of said teat by said viewing means.
More preferably the viewing of said at least one teat of the udder is performed from essentially below thereof. This enables the preferred depth of field image variation to be viewed as seen essentially in the protruding direction of said teats with respect to said udder. The positioning of said viewing means below said teat and/or udder also provides a preferred substantially clear view of the teat/teats and the udder without interference from the animal's leg, tail or the like.
The positioning of said viewing means below said udder may, of course, tend to increase the risk of the operation of said viewing and light source means being affected by dirt or the like. This may however be avoided for example by arranging said means in transparent, water
tight housings or the like which, when needed, may be washed clean using streams or jets of water.
According to a fifth aspect of the invention, there is provided a method of the kind mentioned in the intro- duction, comprising the steps of: collecting a first and a second image relating to the animal's udder and/or teats, said first and second image being collected using image collecting lenses having different focal lengths; and evaluating said first and second images collected using different focal lengths for deriving image information used in carrying out said operations related to the animal's udder.
According to a sixth aspect of the invention, there is provided a corresponding apparatus of the kind mentio- ned in the introduction, comprising: viewing means including at least one lens of a first focal length and at least one lens of a second focal length for collecting respectively a first and a second image relating to an animal's udder and/or teats, said second focal length being different than said first focal length; and means for evaluating said first and second images for deriving image information used in carrying out said operations related to the animal's udder.
Hence, according to the fifth and sixth aspects of the invention, the collecting of images using lenses having different focal length makes it possible to provide closer and more distant views of said udder and/or teats, thus enabling a wider range of possibilities when collecting, monitoring or analysing images thereof. For example, in one image, corresponding to the use of a lens having a small focal length, the udder may be viewed as a whole and as viewed from a comparatively large distance, thus making it possible to determine the overall position of the udder and, based upon this first image analysis, to direct the camera attention to a specific teat and/or to start moving a robot arm or gripping means closer to the udder in order to apply a teat cup, for example.
Simultaneously or subsequently, in a second image, corresponding to the use of a lens having a larger focal length, the udder or for example a single teat may be viewed in more detail and, consequently, as viewed from a closer distance, thus for example making it possible to more precisely determine the position one of the teats of said udder in order to control a milking robot to apply a teat cup to said teat.
Advantageously, the invention makes it possible to view the udder as a whole from a relatively distant position, thus also to bring a tool of a milking robot towards the animal from a relatively large distance, and yet have the possibility of viewing for example a specific teat of the udder at a closer view, even during poor lighting conditions, which is not always possible with e.g. a zoom lens, as such lenses require good light conditions .
Thus, according to a preferred aspect of the invention, there is provided a method for generating image information when applying a teat cup to a teat of an animal's udder, comprising the steps of: collecting a first image of the animal's udder using a first focal length to provide an overall view of the udder; evaluating said first image to determine the overall position of the udder and thereby the general position of one teat of the teats of said udder; collecting a second image of said one teat using a second focal length, said second focal length being larger than the first focal length for providing a more detailed view of the one teat; evalua- ting said second image to determine the specific position of said one teat; and applying said teat cup to said one teat based upon the determined position of said one teat.
Hence, according to a preferred embodiment, for providing a general view of the animal' s udder as a whole, said first image is collected using a smaller focal length than the focal length used when collecting
the second image, said second image thus providing a closer view of at least one of the teats of said udder.
The images obtained by the use of such different focal lengths may preferably be evaluated using image processing techniques for determining the position of a teat to be provided with for example a teat cup. Thus, the image information obtained is preferably used for controlling said operations relating to the animal's udder. According to anther embodiment, such image analysis may be facilitated if said images that are collected using different focal lengths are also collected using different depths of field according to the third and fourth aspects of the invention. Said varying of the depth of field is preferably performed by using said lenses having different focal lengths in combination with a relatively large aperture setting for allowing such variation of the depth of field. According to a seventh aspect of the invention, there is provided a method of the kind mentioned in the introduction, comprising the steps of: collecting first and second images of at least one teat of the animal' s udder at different viewing angles for providing stereo vision imaging of said at least one teat; and deriving three dimensional image data relating to the position of said at least one teat based upon evaluation of said stereo vision imaging provided by said first and second images . According to an eight aspect of the invention, there is provided a corresponding apparatus of the kind mentioned in the introduction, comprising: viewing means for collecting images relating to an at least one teat of the animal's udder, said images representing different view- ing angles with respect to said at least one teat for providing stereo vision imaging thereof; and processing means for deriving three dimensional image data relating
to the position of said at least one teat based upon evaluation of said stereo vision imaging provided by said images .
Hereby, the seventh and eigth aspect of the inven- tion make it possible to determine which parts of an animal' s udder and/or teats that are positioned closer to or further away from said viewing means than other parts of said udder and/or teats in order to detect a teat and, based thereupon, for example apply a teat cup to said teat. If the viewing means are positioned as to view the udder from essentially below thereof, the teats will be detected as being positioned closer to said viewing means than the bottom of the udder. If the viewing means instead are positioned as to provide a more horizontal view the udder, some teats will be detected as being positioned closer to said viewing means than other teats.
Hence, the seventh and eighth aspects of the invention are based on the use of stereo vision imaging techniques for obtaining three dimensional spatial informa- tion relating to the position of the teat or teats of the animal's udder. This three dimensional spatial information may then for example be used for the positioning of operation means, such as a teat cup or a teat cleaning device, when performing an operation related to the animal's udder, such as the operation of milking a cow. In this context, as is understood by those skilled in the art of image processing and analysis, the term stereo vision imaging refers to image matching technique used for deriving three dimensional information about the animal's udder and/or teats by comparing images taken from two different viewpoints or viewing angles.
Hence, the invention makes use of the so called parallax appearing in images collected at different viewing angles, i.e. the apparent differences in the relative positions of the teat(s) and/or udder that occur as a result of the difference in viewpoints, for deter-
mining the position of the teat or teats of the animal' s udder.
The kind of image processing methods, software and components used for this type of image analysis is well known to those skilled in the art of image processing. A survey of different techniques used in stereo vision imaging processing is disclosed in "Competitive Stereo Correspondence Framework", El-Konyaly, E., et . al., SPIE, Vol. 2588, 519-527, and in "Localization of Significant 3D Objects in 2D Images For Generic Vision Task", Marielle Mokhatari et . al., SPIE, Vol 2588, 676- 687.
According to an embodiment, said collecting of said images of different viewing angles are performed essenti- ally simultaneously. This is preferably achieved by said viewing means comprising two separately arranged image collecting lenses. Such two separately arranged image collecting lenses may be associated with two respective image receiving elements, such as CCD-elements, forming two separate cameras.
Alternatively, such two separately arranged image collecting lenses may be associated with one common image receiving element, for example by the use of a light guiding mirror and lens system, said common image recei- ving element then being arranged to receive images via the two image collecting lenses alternately.
However, said images of different viewing angles can also be obtained by the use of one single image collecting lens or unit which is moved from a first viewing angle or position to a second viewing angle or position for collecting said first and second images.
In order to obtain a true stereo vision imaging, the distance between the two lenses, or rather the difference in viewing angle, generally has to be small compared to the distance from said viewing means, i.e. the lenses, to the udder.
Of course, it is understood that the distance between the lenses and the udder may vary during operation, for example when said viewing means or cameras are provi¬ ded on a movable robot arm which controls the position of the cameras with respect to the udder. However, in a general sense, a desired stereo vision effect is achieved when the difference in viewing angle is less than 60°, preferably less than 40°, alternatively when the image collecting lenses are arranged mutually separated a distance which is essentially smaller than a distance from said lenses to said at least one teat, these condi¬ tions being accommodated at least during an initial udder and/or teat finding viewing operation for example for detecting the overall position of said udder. In this context, as is described in greater detail with reference to the drawings, the separate image collecting lenses or cameras may be arranged either fixed or movable, preferably pivotable, with respect to each other. Hence, according to another embodiment, at least one of the image collecting lenses or cameras is pivotally arranged with respect to the other, thereby to enable variation of the direction of the optical axis of one of said two image collecting lenses with respect to the direction of the optical axis of the other of said two image collecting lenses. An arrangement of this kind allows for control of the mutual arrangement of said image collecting lenses, preferably based upon evaluated image information, in order to keep said at least one teat within a respective desired area of said images.
The angle between the optical axes of the two lenses may then be varied as the robot arm is brought towards the udder, the angle between the axes being dependent on the distance between the lenses and the teat of the udder.
Alternatively, as stated above, the image collecting lenses or cameras may be arranged in a fixed arrangement
with respect to each other. This arrangement allows for simplified robot control but may require more image processing capacity. There is also the risk of the udder "falling out of sight" when moving the cameras with respect to the udder.
According to another embodiment, a light pattern is provided upon said at least one teat and/or udder. The image processing may then be based upon analysis of differences in the appearance of said light pattern as collected in said images of different viewing angles.
As the teats and udder of an animal, such as a cow, in many cases only shows, from an image processing point of view, relatively small distinctive features, such as sharp differences in colour or the like, the provision of a light pattern upon the animal's udder and teats may be of great use in providing distinctive image features for the stereo vision imaging processing to be based upon. Preferably, said light pattern comprises a raster line pattern, the appearing distance between the lines on the image then giving information on the angle of the viewed surface in relation to the respective camera or lens. Also, the light pattern is preferably provided by the use of a light projecting means, for example arranged on a robot arm. This kind of structured light may be provided by the use of a laser, an IR light source, a halogen lamp or the like.
In this context, the technique of using light patterns in stereo vision imaging is disclosed in "Three Dimensional Reconstruction of Trunk Surface Using Structured Light" by Lui, R. , et . al . , IEEE International Conference on Systems, Man and Cybernetics, Vol. 2, 1085- 1090, October, 1995.
According to another preferred embodiment, said viewing means is provided in the centre of an operation means carrying four different teat cups, one for each teat, being arranged to be applied to the respective teats of a cows udder all in a single step. Preferably,
said operation means then comprises four positioning units for performing small adjustments of said teat cups positions with respect to said operation means for accommodating the different mutual distances between the teats of the udder. The light source means may then for example be provided as an annular lamp surrounding said camera, as four annular lamps surrounding each teat cup or as one or more separate conventional lamps provided on said operation means and/or said actuating means, e.g. a robot arm or grip, for providing said shadow-free image. The light source means may also for example be provided as the light emitting ends of one or more optical cables or fibres.
As discussed above, the viewing of said at least one teat of the udder is performed from essentially below thereof, and, consequently, said images are obtained as viewed essentially from below said teat and/or udder, i.e. essentially in the protruding direction of said teats with respect to said udder. The positioning of said viewing means below said teat and/or udder also provides a preferred substantially clear view of the teat/teats and the udder without interference from the animal's leg, tail or the like.
The positioning of said viewing and light source means below said udder may, of course, tend to increase the risk of the operation of said viewing and light source means being affected by dirt or the like. This may however be avoided for example by arranging said means in transparent, strong, water tight housings or the like which, when needed, may be washed clean using streams or jets of water.
According to the invention, the image information is preferably used for controlling the operation of an actuation means, such as a robot arm, for positioning an operation means, such as a teat cup, in relation to an animal's udder and/or teat or teats.
Said actuation means may then comprise an actuation arm and gripping means jointly engaged therewith for gripping and holding said operation means, e.g. the teat cup. According to one embodiment, said gripping members is generally arcuate in shape and connected to each other at said joint. Preferably said gripping members are arranged as to provide a gap at the respective other ends thereof for introduction of for example a teat cup. In such a case, said light source means may comprises a single annular or arcuate elongated lamp having essentially the shape of said gripping members, the respective ends thereof preferably being arranged in close proximity of said gap. According to an alternative embodiment, said gripping members constitute gripping levers being movably connected to each other and arranged to provide a gap at the respective other ends thereof for introduction of said operation means. The light source means then preferably comprises two generally arcuate elongated lamps mounted on the respective lever, the respective ends thereof preferably being arranged in close proximity of said gap and said joint.
Hence, said light source means may in a preferable manner be provided on the actuating means itself, such as on a robot arm or grip. Of course, the light source may just as well be provided on for example said operating means, e.g. in connection with said teat cup, or may be provided as a separate unit.
Said viewing means, such as a camera, may also preferably be provided on said actuating means or in connection with said operating means, for example as a separate operating means which is held by one robot arm, the actual teat cup application then being performed by a second robot arm. The camera may also be provided as a separate unit. Of course, as is understood by a person skilled in the art, the image processing according to the invention may be combined with other types of conventional image
processing functions such as colour analysis, stereo vision imaging analysis or the like. Also, the images could just as well be used for monitoring purposes, thus being provided on a monitor to be viewed by operator personnel.
Further aspects, features and objects of the invention are disclosed in the following detailed description of exemplifying embodiments and in the following claims.
Brief description of the drawings
Exemplifying embodiments of the invention will now be described with reference to the accompanying drawings, in which:
Fig la schematically illustrates a robot having a robot arm carrying an animal related operation means in form of a teat cup to be positioned on a teat of a schematically illustrated animal udder;
Fig lb - le schematically illustrates the robot arm of Fig la carrying a video camera, a teat cleaning means, a spray device and a deep bowl, respectively;
Fig 2 schematically illustrates an arrangement identical with the one shown in Fig la, but with the robot arm carrying a cluster of teat cups;
Fig 3a schematically illustrates a first embodiment of the light source and viewing means provided on the robot arm gripping means;
Fig 3b schematically illustrates a second embodiment of the arrangement in Fig 3a;
Fig 4a-4e schematically illustrates a respectively different depth of field view from below of a cow' s udder and teats;
Fig 5 illustrates a block diagram showing an image processing system according to an embodiment of the invention; Fig 6 illustrates a flow chart showing the different functions performed according an embodiment of the invention;
Fig 7 illustrates a flow chart showing the different functions performed according to yet another embodiment of the invention;
Fig 8a-8c schematically illustrates images from below of a cows udder together with schematically illustrated use of a corresponding aperture and a corresponding lens, i.e. focal length;
Fig 9a-9c schematically illustrates images from below of a cows udder together with schematically illustrated use of a corresponding aperture and a corresponding lens, i.e. focal length;
Fig 10 illustrates a block diagram showing an image processing system according to an embodiment of the invention; Fig 11 illustrates a flow chart showing an example of functions performed by the system in Fig 10;
Fig 12 schematically illustrates a milking robot according to another embodiment of the invention;
Fig 13a schematically illustrates a first stereo vision imaging arrangement according to the invention;
Fig 13b schematically illustrates images collected by the stereo vision imaging arrangement shown in Fig 3a;
Fig 14a schematically illustrates a second stereo vision imaging arrangement according to the invention; Fig 14b schematically illustrates images collected by the stereo vision imaging arrangement shown in Fig 4a;
Fig 15 schematically illustrates a milking robot according to yet another embodiment of the invention; and
Fig 16 schematically illustrates a view from above of a cow accommodated in a schematically illustrated milking box or stall.
Detailed description of preferred embodiments
In the different drawings, similar details, blocks, and components having corresponding or similar function or form is denoted using the same numerals.
Fig la schematically illustrates an udder 2 and four teats 1 thereof of an animal, which may be a cow, and an apparatus 4 according to an embodiment of the invention. The apparatus comprises an animal related robot 4 having an actuation means in the form of a robot arm 5 and a gripping means 6 provided on said robot arm. The robot is arranged for automatically performing activities related to the animal's udder by using operation means 7, which has been illustrated in the form of a teat cup 7a. The robot, and in this case specifically the gripping means 6 thereof, comprises one or more viewing devices 8a, such as one or more cameras, or camera lenses in optical communication with respective cameras, or the like, for obtaining one or more images of said teats 1 and udder 2 essentially from below thereof. Examples of images obtained by the viewing device 8a are disclosed in Fig 4a-4e, 8a-8c, and 9a-9c. The viewing device 8a is connected to a control unit 10, which is arranged for controlling the operation of the robot 4 based on an evaluation of the image information supplied by said viewing device 8a. Hence, in this case the robot is arranged to apply the teat cup 7a to one of the teats 1 based upon positioning information obtained and provided by said control unit 10 by an evaluation of the image provided by said viewing device 8a.
As schematically illustrated in Fig lb-le, said animal operation means 7 need not necessarily be a teat cup 7a, but instead any useful means for performing a preferred operation related to the animal's udder and/or teats. Accordingly, Fig lb shows an animal operation means 7 in the form of a video camera 7b carried by said gripping means 6; Fig lc shows an animal operation means 7 in the form of a teat cleaning means 7c having two cylindrical brushes arranged to counter-rotate in the directions of the arrows as shown, and between which a teat 1 is to be inserted for cleaning; Fig Id shows a spray device 7d having a spray nozzle which may be
directed towards the teats and the udder; and, finally, Fig le discloses an animal operation means in the form of a dip bowl 7e, said spray device 7d and said dip bowl 7e being suitable for applying a cleaning liquid such as water or iodine powder. The dip bowl in Fig le may have a size which is fitted for applying powder or liquid to one teat at a time or all teats simultaneously.
Fig 2 shows an arrangement identical with the one shown in Fig la, but instead of a single teat cup, the gripping means 6 is shown carrying an operation means 7f having a cluster of four teat cups 7a, one for each teat 1, being arranged as to be applied to the respective teats of the cows teats all in a single step. The operation means 7f also comprises four positioning units (not shown) , one for each teat cup 7a, for performing small adjustments of said teat cups positions with respect to each other for accommodating the different mutual distances between the teats of the udder. The operation means 7f also comprises a viewing device, illustrated by a video camera 8b, arranged centrally with respect to said four teat cups 7a. Since the camera 8b in this arrangement is provided on the operation means 7f itself, there is basically no need for any viewing device (8a) also to be provided on said gripping means 6, as is the case in Fig la.
In Fig 2, according to a preferred aspect, the camera 8b may be arranged to be vertically movable with respect to the operation means 7f itself, so that the camera lens may be elevated above the top of the teat cups to enable a clear view of the udder, when viewing the same, and lowered below the top of the teat cups, when these are applied to the teats, in order to prevent the camera from being pressed against the udder during operation. The operation means 7f further comprises a light source (not shown in this figure but the function of which more fully described below, for example with respect to Fig 3a and 3b) essentially surrounding the
camera lens and directing light upwards against the udder and teats to provide a substantially shadow-free image with respect to the camera, said image being provided by the camera 8b for further processing by the control unit 10. Said light source means may hence comprise a single annular light source surrounding the lens or, for example, four annular light sources surrounding a respec¬ tive teat cup, or any kind of light source arrangement providing the desired shadow free image. Fig 3a illustrates an embodiment of the invention disclosing a robot arm 5 and a gripping means 6, which for example may be the robot arm and gripping means in Fig la or 2. A joint 12, shown arranged inside a rubber bellows, provides engagement between the robot arm 5 and the gripping means 6 for allowing a relative movement between the arm 5 and the gripping means 6. The gripping means 6 is essentially annularly or arcuately shaped and provides a carrier for a likewise essentially annularly or arcuately shaped light source means 11. The light source means 11 and the gripping means 6 both provides a gap or space S at the front end, i.e. the end opposite said joint 12, of the gripping means 6, said gap or space S allowing introduction of an animal operation means, like a teat cup 7, into the area encompassed by the gripping means 6, the respective ends of said gripping means together forming a pair of gripping members. The robot arm 5 is furthermore provided with a viewing device 8a positioned at the location of said joint 12 and comprising a circular single lens. The viewing device 8a is connected to the control unit 10 by means of an optical or electrical transmission path (not shown) .
Fig 3b illustrates another embodiment of the invention, disclosing the robot arm 5 and the gripping means 6 being provided with a similar joint 6a. However, the joint 6a in Fig 3b interconnects and allows for relative movements of two essentially semicircular or arcuate levers 6b, 6c forming the gripping members of said
gripping means. The levers 6b, 6c provide carriers for likewise essentially semicircular or arcuate light source lamps 11a, lib. The shape of levers 6b, 6c and light source parts 11a, lib is interrupted by a gap or space S in accordance with Fig 2a.
In Fig 3b the viewing device is provided in the form of two circular lenses 8a' , 8a' ' spaced apart from each other for obtaining two differently inclined images from the inspected area of the animal. According to one aspect of the invention, the lenses 8a' and 8a' ' may have different focal lengths, or may for example be arranged in association with corresponding apertures (not shown) having different aperture sizes in order to provide two images having different depth of field. In Fig 3a and 3b, the fact that the light source means 11, 11a, lib is arranged in close proximity of the viewing means, as compared to the mutual distances between the teats 1, provides for a substantially shadow- free image being obtained by the viewing means, even though the light source means may not actually surround the viewing device as discussed above.
It is understood that the viewing means 8a, 8a' , 8a' ' may be omitted for example in the arrangements shown in Fig 3a and 3b if a viewing device instead is provided in some other way separate from the robot arm and gripping means, for example as part of an operation means, as in Fig lb and 2.
Fig 4a-4e illustrate schematically images from below of a cow' s udder which are obtained by positioning the viewing and light source means, for example as disclosed in Fig la or 2, underneath the udder 2 in a mutual arrangement for providing a substantially shadow free image, along with the corresponding settings of an aperture 13 provided in connection with said viewing means. Fig 4a and 4b illustrate the images obtained when the circumstances are such that a relatively small depth of field of the image is obtained, i.e. in this case by
using a relatively large aperture of an aperture forming means 13, such as a diaphragm. Accordingly, in Fig 4a, only the tip of the teats 1 are presented as sharp and the udder 2 as blurry. Fig 4b discloses the opposite outcome obtained when using a different focal setting but the same small depth of field, i.e. the udder 2 is represented as sharp and a comparatively larger part of the length of the teats 2 is represented as unsharp due to the small depth of field. The effects illustrated in Fig 4a and 4b are achieved by providing the lens of the viewing means with an aperture forming means 13 set to a relatively large aperture, since with a corresponding small depth of field, such parts of the animal that are closer to the lens than other parts cannot be shown simultaneously as sharp on the image. Accordingly, full sharpness can in such a situation only be obtained in parts of the image. Which part, i.e. the closest or the more distant, of the image that will be presented as being sharp, depends on the present focus setting.
Fig 4c illustrates the circumstances when using a relatively small aperture of the aperture forming means 13, resulting in an image having a large depth of field. As a result of the relatively large depth of field, the whole image, i.e. both the. teats 1 and the udder 2, is represented as sharp in Fig 4c. If the illumination is not sufficient for obtaining an image of a desired quality, the light means described above may be used to increase the illumination of the part or parts of the animal to be viewed.
Fig 4d and 4e illustrate images obtained when using an intermediate aperture of the aperture forming means 13, resulting in an image having an intermediate depth of field As a result of the intermediate depth of field, and as a comparison to Fig 4a, a larger part of the length of the teats 1, and not only the tip thereof as in Fig 4a, are presented as sharp and the udder 2 as blurry in Fig
4d. Fig 4e discloses the opposite outcome obtained when using a different focal setting but the same intermediate depth of field, i.e. the whole udder 2 is represented as sharp and only the tip of the teats 2 are represented as unsharp due to the intermediate depth of field.
As is clear for a person skilled in the art, such a variation of the image depth of field as is obtained by the aperture settings in Fig 4a-4e may be used and imple¬ mented by conventional image processing technology for obtaining a simplified evaluation of an image and the spatial relationships between the udder and teats appearing on said image, using the different depths of field settings for a discrimination of image information.
Fig 5 schematically illustrates a block diagram of an exemplifying arrangement for image processing according to the invention. The design and functions performed by the different blocks in Fig 5 may be realised using conventional image processing technology, as is clear for a person skilled in the art of image processing. In Fig 5, an image processing system 100 comprises a viewing and image forming means 110 including an image collecting lens 120, an image aperture 130 and an image receiver 140, which for example may be a CCD imaging array. The viewing and image forming means 110 is arran- ged to provide an image of at least one teat of an animal's udder. The depth of field of the image collected by said image receiver 140 may in this case be varied by using different aperture settings of the aperture 130. Of course, as is understood by one skilled in the art, depth of field variation can be accomplished in many other ways. For example, the arrangement may comprise more than one viewing and image forming means, each providing an image having a different depth of field. However, the use of a variable aperture 130 as in Fig 5 constitutes a currently preferred way of achieving depth of field variation.
The image collected by the image receiver 140, which for example may be one of the images shown in Fig 4a-4e, such as the one shown in Fig 4c (corresponding to a relatively small aperture) , is converted to a digital signal by said image receiver and is then provided to an image processing unit 150 which is arranged to evaluate said image in order to determine which part or parts (or areas) of said image having a desired sharpness as compared to other relatively non-sharp parts of said image. The kind of processing performed in the image processing unit 150, which is needed for establishing which parts of the image being sharp or unsharp, is well known to a person skilled in the art of image processing.
The result of the image processing is provided as an output signal from the image processing unit 150 to a control unit 160. The control unit 160 is arranged to determine whether or not the image information provided by said image processing unit 150 is sufficient to identify and, in doing so, establish the spatial position of one or more teats of the animal's udder. If not, then the control unit is arranged to vary the size of the aperture 130 in order to set a new depth of field and then to instruct the image processor 150 to evaluate the new image having the new depth of field. The control unit may also then be arranged to vary the light intensity provided by a light source 170 illuminating said at least one teat of the udder for providing a substantially shadow free image thereof.
However, if the control unit 160 determines that the image information derived from one or more images having a varying depth of field evaluated and provided by the image processing unit 150 is sufficient to establish the position of one or more teats of the animal's udder, then the control unit controls the operation of actuation and operation means 190 of a milking robot to apply one or more teat cups to the respective teat, the position of
which being established by said image processing, based upon the derived position data.
In evaluating the image information provided by the image processing unit, the control unit may store and then make use of image information provided by the preceding image or images, said image information then being stored in a read and write memory RAM 180. The control unit may also for example, but of course not necessarily, make use of other kinds of animal historical data or the like, preferably stored in advance in a read only memory ROM 185, when evaluating said image information.
Of course, as is understood by a person skilled in the art, the different means and functions provided by for example the image processing unit 140, the control unit 160, RAM 180 and ROM 185 may be provided in one or more function units or may be provided as separate function units as in Fig 5. The overall operation performed by the arrangement shown in Fig 5 can be accomplished in many other ways and the invention is not limited to the specific exemplifying arrangement described herein.
An example of the operation performed according to the invention will now be described with reference to the block diagram shown in Fig 6. The operation described in Fig 6 may for example be controlled by said control unit 160 in Fig 5.
At the start of the operation, an animal is enticed to move to a stall or box of a kind which is specifically adapted to the kind of animal and the kind of operation to be performed, for example a box for milking a cow, as will be described below with reference to Fig 16.
In step SI, it is determined whether or not a cow is present and correctly positioned in the milking box. If not, then this step is repeated, for example including providing alarm signals in case of incorrect positioning, until it is decided that a cow is present and correctly positioned. The operation then proceeds to step S2.
In step S2, the depth of field of the image collec¬ ted or to be collected by for example said image viewing means 110 in Fig 5 is set initially, for example by the control unit 160 in Fig 5 setting the aperture 130 to a relatively small size.
An image of the kind illustrated in Fig 4a-4e, spe¬ cifically Fig 4c in the case of a small aperture, is then obtained by the image receiving unit 140, said image having the current depth of field, in step S3. The image obtained is then evaluated by said image processing unit 150 in step S4 for finding image areas having a certain image sharpness. During this image processing, the depth of field of the image, such as one or more of the images in Fig 4a-4e, may be optimised by dis- crimination of non-relevant pixels of the image, based upon an evaluation of the sharpness of the image in different image areas.
The derived image information is then provided to said control unit 160, which in step S5 determines whether or not the provided and/or accumulated image data is sufficient for identifying the teat and determining the spatial teat position with a desired accuracy.
If the obtained depth of field image data is determined not to be sufficient, the operation proceeds to step S6, whereby the depth of field is changed or varied, for example by the control unit 160 in Fig 5 varying the size of the aperture 130 in the viewing and image forming means 140, for example changing the aperture 130 to the relatively larger aperture 13 shown in Fig 4b, giving rise to the corresponding image shown in that figure. The operation then returns to step S3 for collecting a new image, to step S4 for finding the sharp areas of the new image, as a result of the new image depth of field, and to step S5 for once again determining whether the new depth of field information, preferably together with the depth of field information provided by the foregoing
image or images, is sufficient for determining teat position, and so on.
When the obtained depth of field image data is determined to be sufficient m step S5, the operation then proceeds to step S7 for activating the robot actua¬ tion and operation means 190 (such as the robot arm 5 and the operation means 7a in Fig la) in order to apply a teat cup on the identified teat based on the position data derived by said control unit 160 based upon the image data provided by the image processing unit 150. The teat finding and teat cup applying routine is then completed and the system operation may go on to a milking routine or the like.
As is understood by a person skilled in the art, the operations described with reference to Fig 6 may be varied m many different ways. For example, image data from more than one image, corresponding to different depths of field, may be obtained before the actual evaluation of the varying depth of field images or image information is performed. Also, the actuating of the different robot means may be performed in successive steps separated by intermediate further or renewed collecting of image information, rather than one single actuation step. The routine shown m Fig 6 may be provi- ded as a subroutine of for example an overall milking procedure, wherein other subroutines provides the actual milking operation and the following teat cup removal operations .
Another example of a preferred operation performed according to the invention will now be described with reference to Fig 7.
After having determined in step Sll that a cow is present m the milking box, focus is set to a point lying at a level just below or at an expected level for the tip of the udder's teats in step S12.
Then, m step S13, a first image is collected using a relatively large aperture setting resulting in an image
having a relatively small depth of field, for example providing an image of the kind shown in Fig 4a wherein the tip of the teats 1 appears as sharp and the udder 2 itself appears as unsharp. Subsequently, in step S14, a second image is collected using a relatively small or intermediate aperture resulting in an image having a large depth of field, for example providing an image of the kind shown in Fig 4c wherein both the teats 1 and the udder 2 appears as sharp. After having collected these first and second images, the process proceeds to step S15, wherein focus is set to a point lying at an expected general level of the udder, i.e. at a level somewhere above the level of the teats. Then, in step S16, a third image is collected using a relatively large aperture setting resulting in an image having a relatively small depth of field, for example providing an image of the kind shown in Fig 4b wherein the tip of the teats 1 appears as unsharp and the udder 2 itself appears as sharp. Subsequently, in step S17, a fourth image is collected using a relatively small or intermediate aperture resulting in an image having a large depth of field, for example providing an image of the kind shown in Fig 4c wherein both the teats 1 and the udder 2 appears as sharp.
After having collected all four images, the process proceeds to step S18, wherein the four images are analysed in order to detect said sharp and unsharp areas appearing in the four images. Then, in step S19, the position of a specific teat 1 is determined based upon the arrangement of and relations between the detected sharp and unsharp areas in step S18.
The milking robot is then actuated in step S20 to apply a teat cup to said teat based upon the derived teat position data. The teat finding and teat cup applying routine is then completed and the system operation may go on to a milking routine or the like.
Fig 8a-8c and 9a-9c schematically illustrate images from below of a cows udder, which are obtained when positioning a viewing means, for example the camera lenses as disclosed in Fig la, 2, 3a, or 3b, underneath the udder 2. The images are shown together with schematically shown corresponding settings of an aperture 35 provided in connection with said viewing means and with the corresponding lens, i.e. the corresponding choice of focal length. In Fig 8a-8c, viewing means in the form of an image collecting unit or camera 30 is set to have a corresponding relatively small aperture of an aperture forming means 35, giving rise to a relatively large depth of field in the collected images. As a result, all parts of the udder and teats appear as being essentially sharp in all three corresponding images.
In Fig 8a, the viewing means, i.e. the camera 30, is associated with a lens 31a having a relatively small focal length. As a result, in the corresponding image, the udder 2 appears as a whole and as viewed from a comparatively large distance. This viewing mode makes it possible to determine the overall position of the udder and subsequently direct the camera attention to a specific teat 1 and/or to start moving a robot arm or gripping means closer to the udder in order to apply a teat cup, for example.
In Fig 8b, the camera 30 is associated with a lens 31b having an intermediate focal length. As a result only a portion of the udder 2 appears within the corresponding image. Consequently, the udder appears as being viewed from an intermediate distance i.e. the image provides a closer view of the udder 2. This viewing mode makes it possible to more precisely determine the position one of the teats 1 of said udder, for example to direct the camera thereto and/or to further move said gripping means closer to the udder 2.
In Fig 8c, the camera 30 is associated with a lens 31c having a relatively large focal length. As a result only a specific teat 1 of the udder 2 appears within the corresponding image. Hence, the teat 1 appears as viewed from a very close distance. This viewing mode makes it possible to more specifically determine the position of the teat 1, and, based upon such image evaluation, to complete the process of applying a teat cup to the teat 1 of the udder 2. Fig 9a-9c schematically illustrate viewing modes corresponding to those shown in Fig 8a-8c, but with the use of a relatively large aperture or the aperture forming means 35 instead of a smaller one as in Fig 8a-8c. Hence, in Fig 9a-9c, the viewing means, in the form of the camera 30, is set to have a corresponding relatively large aperture setting of the aperture forming means 35, giving rise to a relatively small depth of field. As a result, not all parts of the udder and teats appear as being essentially sharp in all three corresponding images.
With a small depth of field, parts of the animal that are positioned at different distances to the lens cannot be shown simultaneously as sharp on the image. Accordingly, full sharpness can in such a situation only be obtained in some parts of the image. Which parts, i.e. the closer or the more distant, of the image that will be presented as being sharp, depends on the present focusing setting.
In Fig 9a, corresponding to Fig 8a, the camera 30 is associated with a lens 31a having a relatively small focal length. As a result, in the corresponding image, the udder appears as a whole and as viewed from a comparatively large distance. Even though the use of a large aperture of the aperture forming means 35 give rise to a relatively small depth of field, the small focal length in combination with the distance between the viewing means 30 and the udder results in that the whole udder
and teats appear as being essentially sharp in the image. As described with reference to Fig 8a, this viewing mode makes it possible to determine the overall position of the udder and to direct the camera to a specific teat and/or, if desired, to start moving a robot arm or gripping means closer to the udder in order to apply a teat cup, for example.
In Fig 9b, corresponding to Fig 8b, the camera 30 is associated with the lens 31b having an intermediate focal length. As a result only a portion or the udder appears in the corresponding image. Hence, the udder appears as viewed from an intermediate distance i.e. the image provides a closer view of the udder.
Further, in Fig 9b, as a result of the use of a large aperture setting, the image has a smaller depth of field than in Fig 5a, hence the teats 1 are presented as sharp and the udder 2 as blurry due to the larger focal length.
As is clear for a person skilled in the art, such a variation of the image depth of field as is shown in Fig 9a and 9b (and 9c below) may be used and implemented by conventional image processing technology for obtaining a simplified evaluation of an image and the spatial relationships between the udder and teats appearing on said image, i.e. to decide which parts of the udder and/or teats that are currently positioned closer to or further away from the viewing means, using the different depths of field for a discrimination of image information in identifying teats of the udder. Hence, the viewing mode in Fig 9b makes it possible to more precisely determine the position one of the teats 1 of said udder 2 to direct the camera thereto and/or to further move said gripping means closer to the udder.
In Fig 9c, corresponding to Fig 8c, the camera 30 is associated with a lens 31c having a relatively large focal length. As a result, only one specific teat of the
udder appears within the image. Also, the teat appears enlarged as viewed from a very close distance.
Further, in Fig 9c, as a result of the use of a large aperture of the aperture forming means 35 in combination with a large focal length, giving a small depth of field, only the tip of the teat 1 is presented as sharp. This further enhances the possibility to determine the position of the teat and to control the animal related operation correspondingly. Hence, the viewing mode in Fig 9c makes it possible to determine the specific position of the teat 1, more specifically the tip of the teat 1, and, based upon such image evaluation, to complete the process of applying a teat cup to the teat of the udder. As is understood, when evaluating the images according to Fig 4a-4e, 8a-8c and 9a-9c, characteristic shadows of the teats appearing on the udder might have been a disturbing factor during evaluation because the shadows of the teats may then appear within the depth of field and be confused with the teats themselves. This illustrates the importance of the shadow-free illumination according to the invention.
Fig 10 schematically illustrates a block diagram of an exemplifying arrangement for image processing accor- ding to another embodiment of the invention. The design and functions performed by the different blocks in Fig 10 may be realised using conventional image processing technology, as is clear for a person skilled in the art of image processing. In Fig 6, an image processing system 101 according to an embodiment of the invention comprises two image collecting units 110 and 110' , which for example may illustrate the image collecting cameras or lenses described with reference to Fig 3b. In Fig 10, each of the image collecting units 110, 110' comprise an image collecting lens 120, 120', an aperture 130, 130' and an image receiver 140, 140' , which for example may be a CCD
imaging array. The image collecting units 110, 110' are arranged to provide stereo vision images of at least one teat of an animal's udder.
As is understood, the system need not involve two separate image collecting systems. In a similar arrange¬ ment, only one image collecting unit could be used in association with two different lenses. Preferably, a light guiding and/or hindering system or a lens selecting system could then be used to control which of said two lenses being associated with the image collecting unit at a certain point. Alternatively, the lenses may be provided on a revolver magazine or a shift magazine, each of the lenses then being movable to a common axis when in use . According to the invention, the image collecting lens 120 is arranged as to have a relatively small focal length and the image collecting lens 120' is arranged as to have a relatively large focal length, thus providing two different images of the animal's udder and/or teats. The desired depth of field of the images collected by said image receivers 140, 140' may in this case also be controlled by the setting of the apertures 130, 130' . The images collected by the image receivers 140 and 140', which for example may be images of the kind shown in Fig 8a and 8c or 9a and 9c, are converted into digital signal form by said image receivers and are as such provided to an image processing unit 150, which is arranged to evaluate the images in order to derive information relating to the position of said udder and/or teat of the animal. The kind of processing performed in the image processing unit 150, for example for detecting certain colours or for establishing which parts of the image being sharp or unsharp, is well known to a person skilled in the art of image processing. The result of the image processing, for example teat position data, is provided as an output signal from the image processing unit 150 to a control unit 160. The
control unit 160 is arranged to control the operation of actuation and operation means 190 of a milking robot to apply one or more teat cups to the respective teat based upon the derived position data. In evaluating the image information, the image processing unit 150 and/or the control unit 160 may be arranged to store and then make use of image information obtained from preceding images, said image information then being stored in a read and write memory RAM 180. The units 150, 160 may also for example make use of other kinds of animal historical data or the like, preferably stored in advance in a read only memory ROM 185, when evaluating said image information.
The arrangement further comprises a light source 170, which may by a conventional light source for illuminating the teat and/or udder. In Fig 10, the operations of the light source 170 and the image collecting units 110, 110' are also controlled by the control unit 160. Of course, as is understood by a person skilled in the art, the different means and functions provided by for example the image processing unit 140, the control unit 160, RAM 180 and ROM 185, may be provided in one or more function units or may be provided as separate function units as in Fig 10. The overall operation performed by the arrangement shown in Fig 10 can be accomplished in many other ways and the invention is not limited to the specific exemplifying arrangement described herein.
Another example of the operation performed according to the invention will now be described with reference to the block diagram shown in Fig 11. The operation described in Fig 11 may for example be controlled by said control unit 160 in Fig 10.
At the start of the operation, an animal is enticed to move to a stall or box of a kind which is specifically adapted to the kind of animal and the kind of operation to be performed, for example a cow for milking as illustrated in Fig 16.
In step S21, it is determined whether or not a cow is present and correctly positioned in the milking box. If not, then this step is repeated, for example including providing alarm signals in case of incorrect positioning, until it is decided that a cow is present and correctly positioned. The operation then proceeds to step S22.
In step S22, the image collecting unit 110 in Fig 10, having a lens 120 of a small focal length, is used for collecting an image displaying a general overview of the udder as a whole, for example as shown in Fig 8a or 9a.
Then, in step S23, the image collected in step S22 is analysed using image processing techniques to determine the general position of the udder. In this processing, the control or processing units 150, 160 in Fig 10 may use historical or previously stored data in RAM 180 or ROM 185.
Based upon the result of the processing performed in step S3, the control unit 160 in Fig 10 directs the camera or processing attention towards an expected or determined position of a specific teat in step S24. If desired, this step may also involve moving a robot arm or gripping means closer to the udder in order to subsequently apply a teat cup, for example. Then, in step S25, the image collecting unit 110' in Fig 10, having a lens 120' of a large focal length, is used for collecting an image displaying a closer view of the specific teat of the udder, for example as shown in Fig 8c or 9c. In step S26, the processing and control units 150,
160 determines which parts of the udder and/or teats that are currently positioned closer to or further away from the viewing means, preferably using the differences in sharpness of different areas within said image. This processing is performed in order to more precisely determine the position of one of the teats of said udder.
Then, in step S27, the control unit uses the result of the processing in step S26, and optionally step S23, to activate the robot actuation and operation means 190 (such as the robot arm 5 and the gripping means 6 in Fig 3b) in order to apply a teat cup (7a in Fig 1) on the identified teat. The teat finding and teat cup applying routine is then completed and the system operation may go on to a milking routine or the like.
If for example the obtained depth of field image data is determined not to be sufficient to correctly determine the position of a teat, the operation may repeated comprising a further step in which the aperture setting corresponding to the different lenses is varied for obtaining desired depth of field differences in said images.
Fig 12 schematically illustrates a milking robot according to another embodiment of the invention. In Fig 12, the milking robot 4 comprises a robot arm 5 and an operation device 6 provided on the robot arm 5. The milking robot 4 is arranged to automatically perform activities related to an animal's udder 2, more specifically to apply a teat cup 7 on a teat 1 of the udder 2.
The milking robot 4 is arranged to operate based on stereo vision image information obtained by the use of two separate cameras 3a and 3b provided on the milking robot 4, more specifically on the operation device 6. Hence, the cameras 3a and 3b are arranged for collecting stereo vision images of the udder 2 and/or the teat 1. The viewing angles of the cameras 3a, 3b may be control- led in order to keep the optical axes 3a' and 3b' of the cameras 3a and 3b, directed towards a teat 1 at all times as the operation device 6 is moved with respect to the udder 2.
The stereo vision cameras 3a and 3b are connected to a processing and control unit 10, which is arranged for controlling the operation of the milking robot 4 based
upon an evaluation of the stereo vision image information supplied by said cameras.
Hence, in Fig 12, the robot 4 is arranged to apply the teat cup 7 to one of the teats 1 based upon positio- ning information obtained and provided by the control and processing unit 10 by an evaluation of the stereo vision images provided by the cameras 3a and 3b.
The evaluation of the image may be carried out by means of commercially available software packages for image processing well known to the man skilled in the art. Preferably the image processing software is implemented within the processing capacity of the computer hardware of the robot control unit 10.
It is understood that the robot 4 need not be used for milking purposes, but may instead be provided with any useful means for performing a preferred operation related to the animal's udder and/or teats, for example a teat cleaning device such as a spray device or a dip bowl for applying a cleaning liquid or powder, such as water or iodine, to the animal's teats.
Fig 13a schematically illustrates a stereo vision imaging arrangement 20 according to the invention, showing the mutual arrangement of two cameras 21 and 22 on a robot operation device 26 as positioned at two different distances from the position of an animal's udder or teats, said position of the animal's udder being schematically indicated by the dotted line 27. The cameras 21, 22 and the robot operation device 26 may for example illustrate the cameras 3a, 3b and the operation device 6 shown in Fig 12.
As shown in Fig 13a, the cameras 21, 22 are mutually separated a distance which is generally smaller than the distance from said cameras 21, 22 to the position 27 of the udder. In Fig 13a, the two cameras 21 and 22 are pivotally arranged with respect to each other on the operation device 26. Hence, each of the cameras 21 and 22 may be
rotated or tilted with respect to a respective axis 21a and 22a, thereby to vary the direction of the optical axis 21b of the camera 21 with respect to the direction of the optical axis 22b of the camera 22 as the operation device 26 and the cameras 21, 22 are moved closer to or further away from the position of the udder 27.
The variation of the mutual arrangement of the cameras 21, 22 as these are brought closer to or further away from the position 27 of the udder causes a change in the image parallax θi, θ2, i.e. a change in the viewing angles, as viewed by the two cameras.
Hence, the mutual arrangement of the cameras 21, 22 is controlled, based upon evaluated image information, in order to keep the appearance of for example a teat within a respective desired area of the images obtained by the cameras, preferably at the centre of each image as is shown in Fig 13b. This kind of image tracking is schematically illustrated in Fig 13a by the optical axes 21b, 22b of the cameras 21, 22 intersecting at a point located at the position 27 of the animal's udder.
As is understood in Fig 13a, the axes 21a and 22a are parallel, which is a preferred arrangement.
Fig 13b schematically illustrates exemplifying images as collected by the cameras 21 and 22 at one of the two operation device locations in Fig 3a, the image 21c showing the udder 2 as viewed from the camera 21 and the image 22c showing the udder 2 as viewed from the camera 22. As is shown in Fig 13b, by control of the mutual rotational arrangement of the cameras 21, 22 in accordance with the parallax, the appearances of the udder are kept essentially at the centre of each image. Based upon the stereo vision images 21c and 22c, using conventional stereo vision image processing techniques, the milking robot may determine the three dimensional position of the teat or teats of the udder and then, based upon this positional information, apply one or more teat cups on the respective teats.
The image processing may for example be based upon analysing the overall parallax θi or θ2 when trying to bring the images 21c and 22a to coincide, or for example based upon the analysing of different parallaxes associa- ted with different specific parts of the udder appearing within each of the images 21c and 22c, such as the respective parallax associated with distinctive parts of a teat or the like.
Hence, the parallax features in Fig 13a and 13b are used to determine which parts of the animal's udder and/or teats that are positioned closer to or further away from said cameras than other parts of said udder and/or teats
Although the cameras 21 and 22 in Fig 13a have been described as being able to rotate in one single plane, it is understood that cameras 21, 22 and the operation device 26 may as well be arranged to allow for directing the cameras 21 and 22 in other desired directions, which for example may be desired if the camera arrangement are to be moved towards, or about, the udder from different angles with respect to said udder.
Fig 14a schematically illustrates a second stereo vision imaging arrangement 40 according to the invention, showing the arrangement of two cameras 41 and 42 on a robot operation device 46 as positioned at two different distances from the position of an animal's udder or teats, said position of the animal's udder being schematically indicated by the dotted line 47. The cameras 41, 42 and the robot operation device 46 may for example illustrate the cameras 3a, 3b and the operation device 6 in Fig 12 or the image collecting lenses 8a, 8b and the gripping device 6' in Fig 3b.
As shown in Fig 14a, the cameras 41, 42 are mutually separated a distance which is generally smaller than the distance from the cameras 41, 42 to the position 47 of the udder.
In Fig 14a, the two cameras 41 and 42 are arranged on the operation device 46 in a fixed arrangement with respect to each other. Hence, the optical axes 41b, 42b of the cameras 41 and 42 are directed in fixed directions with respect to each other. In Fig 14a, the optical axes 41b and 41c are parallel. However, the optical axes 41a and 41b could just as well be arranged diverging, converging or the like.
Fig 14b schematically illustrates exemplifying images as collected by the cameras 41 and 42 at one of the two operation device locations in Fig 14a, the image 41c showing the udder 2 as viewed from the camera 41 and the image 42c showing the udder 2 as viewed from the camera 42. As is shown in Fig 14b, and as a result of the fact that the cameras 41, 42 are fixed with respect to each other, the appearances of the udder 2 on the images 41c, 42c will be gradually shifted towards the right and left side of the images 41c and 42c, respectively, as the operation device 46, along with the cameras 41 and 42, is moved towards the animal's udder, thereby creating a change in the image parallax or the image viewing angles with respect to the object of interest, i.e. the teat of the udder. Similarly, the appearances of the udder 2 on the images 41c, 42c will gradually shift towards the centre of the images 41c, 42c as the operation device 46, along with the cameras 41 and 42, is moved away from the animal's udder.
The parallax in Fig 14a and 14b is used to determine which parts of the animal's udder and/or teats that are positioned closer to or further away from said cameras than other parts of said udder and/or teats
Hence, Based upon the stereo vision images 41c and 42c, using conventional stereo vision image processing techniques, the milking robot may determine the three dimensional position of the teat or teats of the udder and then, based upon this positional information, apply one or more teat cups on the respective teats.
Although the images 21c, 22c, 41c, 42c collected by the cameras 21 and 22 and shown in 13b, 14b are schematically shown as providing a view of the udder and/or teats from the side thereof, the stereo vision system according to the invention may in fact preferably be arranged to provide a view of the udder and/or teats from essentially below thereof, as is schematically shown for example in Fig 1, 2 and 12.
The processing blocks and components used for the stereo vision image processing according to the invention may be realised using conventional stereo vision image processing technology, as is clear for a person skilled in the art, and may for example be similar to the processing arrangement described with reference to Fig 10. As the udder of the animal in many cases may lack distinctive image features, such as sharp differences in colour or the like, it may be difficult for the image processing unit to detect and separate different areas of the udder in the collected images. In order to enhance the surface recognition capabilities of the stereo vision imaging system, the milking robot in Fig 15 therefore comprises a light pattern projecting device 9 which is arranged to project a raster light pattern 9' on the animal's udder 2. By evaluating differences in the appearances of this light pattern 9' as viewed by the cameras 3a and 3b, the stereo vision image processing may be simplified and more accurately performed. The light pattern projector 9 may the be used as a sole light source or in combination with for example the light sources 8a, 8b in Fig 3b.
Finally, Fig 16 illustrates the box or stall of a milking station as seen from above. A box space 19 is formed by three walls or bars 20, 21, 22 and two doors 23, 24 hinged about a joint 25. A cow resides in the space 19 after having entered the box through the door 23. After milking has been finished, the cow leaves the box through the door 24. A robot is positioned in rela-
tion to said space 19 such that it only needs to survey a minor part of the cow in order to find the desirable part of the body, being the udder in case of milking. Alternatively, the robot may be provided on a rail (not shown) running alongside the space 19 in order to allow a survey of all parts of the cow body in case other desirable actions than milking shall be carried out. For example, it would be possible for the robot to survey the head of the cow in order to kill it in case of slaughtering, alternatively to survey the fleece of the animal for finding dirty parts of the body that need to be cleaned.
In operation, an animal is enticed to move to a stall or box of a kind which is specifically adapted to the kind of animal and the kind of operation to be per- formed, for example a cow for milking. The cow is allowed to enter the box through the open door 23, which means that the head of the cow will always be directed towards the wall 20 and the rear of the cow towards the wall 22. In consequence, in the milking situation when the robot is used to find the udder of the cow, it is now sufficient for the robot to survey a limited area.
Although the description above has been directed specifically relating to cows, it is understood that the invention may just as well be used in relation to sheep, goats, horses, buffaloes and other milking animals.
As is understood by those skilled in the art, although the invention has been disclosed by means of specific embodiments thereof, it is understood the invention is not limited thereto and that many different alterations and modification, along with combinations of the different features described with reference to different figures, may be performed without departing from the scope of the invention, which is defined by the following claims. Accordingly, even though it has been shown in the figures that the positions of the teats are determined preferably by viewing the udder from underneath, it is of course possible to start the teat finding operation by
viewing solely from the side of the udder, or to initiate the teat finding by viewing from the side, in order to find a suitable position for the robot arm and camera underneath the udder. Also, the actuating of the diffe- rent robot means may be performed in successive steps separated by intermediate further or renewed collecting of image information, rather than one single actuation step. Furthermore, the exemplifying routines described with reference to Fig 6, 7, and 11 may be provided as subroutines of for example an overall milking procedure, wherein other subroutines provides the actual milking operation and the following teat cup removal operations. Also, lenses may be arranged in a revolver magazine or a shift magazine, preferably being movable to a common optical axis when in use.
Furthermore, the image processing need not involve a depth of field analysis, stereo vision imaging, and/or focal length analasys, but may also or instead involve colour analysis or the like, or a combination thereof. Alternatively, the images may for example only be supplied to a monitor for ocular inspection of the udder by an operator.