Abstract:
A method for generating a depth map of at least one selected region ( 210 ) of a capturing region ( 200 ) of a camera ( 100 ), wherein the camera ( 100 ) is aimed at a plurality of mutually different partial regions ( 220, 221, 222 ) of the at least one selected region ( 210 ), wherein for each of the partial regions ( 220, 221, 222 ) a depth information item is ascertained from the respective partial region ( 220, 221, 222 ) by varying a focus setting of the camera ( 100 ), and wherein the depth map ( 400 ) is generated taking into account the depth information of the partial regions ( 220, 221, 222 ), and to such a camera ( 100 ).

Description:
BACKGROUND OF THE INVENTION 
       [0001]    The present invention relates to a method for generating a depth map of at least one selected region of a capturing region of a camera, and to a camera, a computing unit and a computer program for performing it. 
         [0002]    Monitoring cameras are used for detecting suspicious objects or people, for counting people or for automatic monitoring of a specific region within the capturing region of the camera. In particular, sterile zones such as for example fences, external areas of buildings and the like are monitored. The field of use of such monitoring cameras, however, increasingly extends to public access regions, such as for example supermarkets, train stations, airports and the like. 
         [0003]    In order to ensure robust tracking of objects in such scenes, the monitoring cameras can be calibrated. Typically suitable here is a calibration which calculates a relationship between 2-D image points and 3-D image points, the positions of which are located in the associated base plane. This information can be used to estimate real speeds and object sizes, for example in order to be able to calculate more stable object tracking in the camera image. 
         [0004]    Depth information which extends beyond this, such as for example of objects located in the scene (for example obstacles, ramps, stairs, cabinets, objects placed on the ground, and the like), generally cannot be extracted easily with what is known as a single-camera system, i.e. a fixedly mounted monocular camera, as is typical for the field of video monitoring. However, this information is additionally useful in order to be able to develop further improvement and thus more robust systems with video content analysis (VCA). 
         [0005]    In addition to static cameras, what are known as PTZ cameras can also be used in video monitoring, with PTZ being an acronym for pan, tilt and zoom. Such cameras may be fitted at one location so as to be stationary, while their camera system (optical system with an image sensor) is movable. This permits observation of different regions of a monitoring scene and thus gives a more flexible video monitoring option of the scene to be monitored. 
         [0006]    DE 10 2013 223 995 A1 discloses for example a monitoring camera with which a depth map, i.e. a map with depth information (i.e. distance of an image point from a reference point, in particular from the camera), of a capturing region of the camera can be ascertained. Here, the camera is moved in space in order to be able to capture the capturing region from various observation angles, from which the depth map is then generated. 
       SUMMARY OF THE INVENTION 
       [0007]    A method according to the invention serves for generating a depth map of at least one selected region of a capturing region of a camera. The capturing region can here be a maximum region which is capturable or can be seen by the camera, maybe by panning the camera or the like, or the scene to be monitored. The at least one selected region may indeed be the entire capturing region, but it is practical to select only specific regions for which monitoring is desired from the entire capturing region. It may for example be practical to select only one such region in which people can actually move. In the proposed method, the camera is now aimed at a plurality of mutually different partial regions of the at least one selected region. Aiming at a partial region is here understood to mean limiting the current region of the camera which is within the field of view of the camera to a specific partial region to be captured. Aiming at specific partial regions can be effected for example by using the opening angle and current observation angle of the camera which are known for a used camera generally as part of controlling it. The partial regions are also frequently referred to in image processing as what are known as tiles. For each of the partial regions, a depth information item is ascertained from the respective partial region by varying a focus setting of the camera, wherein the depth map is then generated taking into account the depth information for the partial regions. 
         [0008]    It is now possible with the method proposed to generate a very accurate depth map, i.e. a map having depth information of the capturing region of the camera or at least of a selected region thereof. The proposed method here uses the fact that ascertaining a depth information item by varying the focus settings of the camera works significantly better for small sections of a capturing region than for the entire capturing region, since in a small section, as opposed to the entire capturing region, generally objects with different distances are not seen. In the lenses of such cameras, as are used for monitoring purposes, generally very many regions of the capturing region or of the scene are set to be sharp, since in video monitoring, the largest possible region of a scene should be detected. While no depth information can be gathered from the capturing region by way of varying the focus settings, this is possible with the proposed method. 
         [0009]    Using the method proposed, it is furthermore increasingly possible in new applications of automatic video monitoring to use 3-D information of a scene to be monitored, for example in order to be able to detect and develop more robust VCA systems. Extraction and provision of such depth information would be very complicated and costly using other methods, in particular if for example the scene would have to be scanned by a camera in order to extract 3-D information (what is known as “structure from motion”) in this way, or a use of 3-D sensors (for example Kinect, time-of-flight cameras, stereo cameras). 
         [0010]    The proposed method can run in the background for example during normal operation, or if the camera is for example not being put to a different use. 
         [0011]    The proposed method can also be used merely in a point-wise fashion in the scene in order to validate possible disturbance variables for the object tracking. Tracks, i.e. instances of tracking objects, can frequently be repeatedly interrupted or disappear in specific locations in the scene. With the proposed method, these regions can be measured in a targeted fashion for example to confirm obscuring edges, i.e. edges of objects behind which a person may be hidden. 
         [0012]    By way of extracting such depth information, additional functions can be provided in the field of security technology, for example it is possible to answer the question whether objects are located in front of emergency exits or along paths leading to emergency exits. In addition, the question whether free view of the camera onto the scene is blocked by nearby obstacles can be answered. 
         [0013]    The proposed method is additionally applicable to already installed cameras. For example, it may be offered as an additional service and thus provide added value for existing camera installations. 
         [0014]    The partial regions on which the aim is directed are preferably selected taking into account image gradients in an image which corresponds to the at least one selected region. Such image gradients are understood to be for example gradients of brightness values of neighboring pixels. Since such gradients are particularly great especially for edges of objects which in turn also represent depth jumps, it is possible by taking into account image gradients to differentiate particularly well between objects, such that the partial regions can be selected in a targeted fashion so as to detect depth jumps. 
         [0015]    The partial regions on which the aim is directed are preferably selected taking into account object tracking in at least one selected region. Here, it is possible to use for example video content analysis of the capturing region or of the at least one selected region, in which objects or, for example, persons can be tracked. The partial regions on which the aim is directed can in this way be limited to such regions in which people can actually be located, and therefore particularly good depth information is necessary for improved object tracking. Other regions which are not relevant for monitoring can thus be excluded very easily, as a result of which the depth map can be generated more quickly. 
         [0016]    It is advantageous if the partial regions on which the aim is directed are selected such that neighboring partial regions at least partially overlap or join one another exactly, or as exactly as possible. In this way, easier stitching together of the individual depth images obtained from the respective partial regions is possible. 
         [0017]    When generating the depth map, preferably individual depth images which correspond to the partial regions are stitched together, wherein depth information for regions of the at least one selected region for which no depth information was ascertained using the camera are estimated at least partially taking into account the depth information of the partial regions. In this way, depth information must be ascertained not for all the partial regions located in the relevant monitoring region, which is also frequently possible only with difficulty. In particular in the case of homogeneous surfaces, such as for example surfaces of objects, depth information can hardly be obtained through a variation of focus settings. These missing regions can then very easily be estimated for example by interpolation between depths which correspond to edges of an object. 
         [0018]    Advantageously, by varying the focus setting of the camera, the depth information is ascertained from the respective partial region by recording images for different focus levels and by ascertaining from image gradients of the individual images a focus setting which corresponds to the maximum image gradient. Such image gradients can be understood to mean for example gradients of the brightness values of neighboring pixels. To this end, it is possible for example for in each case one image of the respective partial region to be recorded for different predetermined focus settings, as a result of which a series of images, which is known as an image stack, is obtained. Since the image gradient is greatest in the image which has the best focus setting, i.e. the image which is imaged the sharpest, it is possible by ascertaining the maximum image gradient to find the focus setting which corresponds to the distance of the object and which images the object sharply. It is possible to ascertain the distance of objects, i.e. the depth information, from the thus ascertained focus setting, for example using comparison values or a function as a result of which a focus setting is assigned a distance. This procedure, which is known per se, is also referred to as “depth from focus”. Such comparison values or functions which are fitted to such comparison values can be ascertained for example by test recordings. 
         [0019]    The accuracy of the depth information ascertained by varying the focus setting of the camera can for example be increased by using a suitable model of the focus, as is known for example from “Asada, N., Fujiwara, H. &amp; Matsuyama, T. (1998). Edge and depth from focus. International Journal of Computer Vision, 26 (2), 153-163.” 
         [0020]    It is advantageous if the camera is aimed at the plurality of mutually different partial regions by panning and/or tilting and/or zooming the camera. To this end, a locationally fixed camera, in particular a PTZ camera, is expediently used as the camera. Panning, tilting and zooming are options for selecting different regions from the capturing region in the case of a locationally fixed camera. While different regions can be selected by panning in the horizontal direction, it is possible to select different regions in the vertical direction by way of tilting. Care must be taken that when changing the tilt angle, the capturable region changes in the horizontal extent. To this extent, it may be necessary for the aim to be directed to a different number of partial regions at different tilt angles in order to achieve the same resolution. Furthermore, it is possible to select a different image section by way of zooming. It may be practical here, in particular in the case of regions of the capturing region which are located far away, to use a high zoom level. 
         [0021]    The depth map is preferably used for improving and/or checking a video content analysis for the at least one selected region. The depth map or the obtained depth information can be made available to a system for video content analysis (VCA system). Now for example improved or more robust object tracking, validation of erroneous detection by object detectors or for example generating a 3-D environment of the monitoring scene is now possible for visualization purposes. It is likewise conceivable to effect a calibration of the scene from the calculated depths, for example taking into account base planes and a height of the camera above these base planes. It is possible using the depth map to estimate extrinsic parameters of the camera, such as for example heights at which the camera is located and viewing angles onto the base plane. 
         [0022]    A camera according to the invention, for example a PTZ camera, is in program-technological terms adapted to perform a method according to the invention. 
         [0023]    A computing unit according to the invention, for example a control or evaluation unit for a camera, is, in particular in program-technological terms, adapted to perform the method according to the invention. 
         [0024]    The implementation of the method in the form of a computer program is also advantageous, since it incurs particularly low costs, in particular if an executing controller is used for other tasks and is therefore already present. Suitable data carriers for providing the computer program are in particular magnetic, optical and electric memories, such as for example hard disks, flash memory, EEPROMs, DVDs and the like. Downloading a program by a computer network (Internet, intranet etc.) is also possible. 
         [0025]    Further advantages and embodiments of the invention can be gathered from the description and the attached drawing. 
         [0026]    The invention is schematically illustrated in the drawing on the basis of an exemplary embodiment and will be described below with reference to the drawing. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0027]      FIG. 1  schematically shows a camera, as can be used for a method according to the invention in a preferred embodiment, having an associated capturing region. 
           [0028]      FIG. 2 a    schematically shows a partial region of the capturing region of  FIG. 1 . 
           [0029]      FIG. 2 b    schematically shows a gradient stack image for different focus settings of a camera for the partial region from  FIG. 2   a.    
           [0030]      FIG. 3  shows a relationship between focus settings of a camera and distances of an object from the camera. 
           [0031]      FIG. 4  schematically shows a depth map for the capturing region from  FIG. 1 . 
       
    
    
     DETAILED DESCRIPTION 
       [0032]      FIG. 1  schematically shows a camera  100 , as can be used for a method according to the invention in a preferred embodiment. The camera  100  in the present case is what is known as a PTZ camera, i.e. a camera which, although mounted in a locationally fixed manner, can be panned and tilted and has zoom capability. 
         [0033]    The associated movements are designated in the figure using the reference signs  110  for panning in the horizontal direction (i.e. rotation about the vertical axis),  120  for tilting in the vertical direction (i.e. rotation about a horizontal axis), and  130  for the zoom capability. While the camera  110  is rotated when panning and tilting are performed, the camera itself is not moved as part of the zoom function, but the setting of its lens is changed. In all three described possibilities, however, the region which is currently being captured by the camera can be changed. 
         [0034]    A capturing region  200 , in this case for example in an office space, is furthermore shown. The capturing region  200  here designates the maximum region of an environment that is capturable by the camera, i.e. by maximum panning, tilting and zooming. It is thus possible to effect monitoring in the capturing region  200 . 
         [0035]    In the capturing region  200 , a region  210  is selected which comprises various objects located within the capturing region  200 . In particular, the selected region  210  thus comprises regions in which for example people may be located or move. Regions in which people cannot be located, for example a ceiling region, are here not in the selected region  210 . 
         [0036]    In this case, three partial regions  220 ,  221  and  222  are shown by way of example in the selected region  210 , which partial regions the camera  100  can be aimed at by suitable panning and/or tilting and/or zooming. Located in the partial region  220  is, for example, a high table, in the partial region  221  a desk, and in the partial region  222  a presentation board. 
         [0037]    The partial regions can preferably be extracted along image gradients, since these represent possible depth jumps and covering edges represent an important variable in the video content analysis. Such image gradients are located in the example shown for example in the partial region  221  with the edges of the desk plate. Homogeneous surfaces in the image, for example the surface of the desk plate, can also be filled by way of post-processing, as a result of which the entire process for generating a depth map is accelerated. 
         [0038]    It is likewise possible to determine on the basis of tracking results whether objects, such as for example people, move in the scene. In the example shown, it is also possible for the illustrated region  210  to be selected in this way, since people move for example in front of said objects. 
         [0039]    This information can be used to estimate the depth of base planes at these locations, for example planes on which objects or people are located or move. Subsequently, the obtained values can be used to estimate a base plane, which in turn can be used as an input for tracking. 
         [0040]    Panning the camera moves the image points of a captured image along circular paths, wherein the radius is dependent on the tilt angle of the camera. The greater the portion of the circular path that is visible in the image, the higher the number of recordings that should be made from this tilt angle in order to fill the total section, since the camera can be rotated only about two axes. 
         [0041]    A simplified case is possible for example for a small tilt angle. In this case, the circular paths approximate straight lines, and the angle of the visible section corresponds approximately to the horizontal opening angle of the camera. It is then possible to effect a fixed division of the image into horizontal and vertical regions using the zoom factor and the opening angle. 
         [0042]      FIG. 2 a    schematically illustrates in a more detailed fashion the partial region  220  of the capturing region  200  from  FIG. 1 . By way of example, it shows a board with a chessboard pattern. 
         [0043]      FIG. 2 b    now schematically shows a gradient stack image  250  for different focus settings (on the y-axis) of the camera  100  along a line  230  in the partial region  220  from  FIG. 2 a   . The gradient stack image is produced from a multiplicity of images of the partial region  220  which were recorded using the camera  100  with respectively different focus settings of the camera  100 . 
         [0044]    For each of these images, the gradients can now be calculated, for example gradients in one neighborhood can be combined, if appropriate, or accumulation may be effected over a plurality of images to suppress noise. This is expedient in particular in dark image regions. 
         [0045]    Each focus setting is assigned a y-value. For each focus setting, the brightness gradient is determined as the image gradient along a line  230  for each image point and for example plotted as a color or gray value. It should be pointed out that no gray levels can be depicted in  FIG. 2 b   , and therefore illustratively black is shown for gray levels above a threshold, and white is shown for gray levels below the threshold. The actually brighter, longer lines of the “hourglass” are therefore also shown in black. 
         [0046]    As can be seen from the image stack  250 , the gradients are largest at the line which is marked on the left and right hand sides by way of an arrow, i.e. in this case the gradient is at a maximum. The focus setting corresponding to this image thus presents the partial region  210  as sharply as possible and can be used to ascertain the distance of the object, in this case the board having the chessboard pattern, from the camera. 
         [0047]      FIG. 3  shows in a diagram a relationship between the focus setting F of the camera and a distance E of an object from the camera. The distance E is given in meters, the focus setting F in an arbitrary unit. 
         [0048]    The individual measurement points in the diagram (here illustrated as circles) can then be ascertained for example as part of test recordings. To this end, it is possible for example for an object to be positioned at various distances from the camera or its lens, and it is possible to select that focus setting with which the object is imaged as sharply as possible. 
         [0049]    These individual measurement points can subsequently be fitted for example using a function f. In this way, it is possible very simply, using a method explained according to  FIGS. 2 a  and 2 b   , for a distance to be assigned to an object. Such a method is also, as already mentioned, referred to as “depth from focus.” 
         [0050]    In this way, it is thus possible to assign a depth to the section illustrated in the partial region  220 . In the same way, it is also possible for the remaining shown partial regions  221  and  222  to be assigned a depth. 
         [0051]      FIG. 4  now schematically illustrates a depth map  400  for the capturing region  200  from  FIG. 1 . Here, the depth image  420  corresponds to the partial region  220 , the depth image  421  to the partial region  221 , and the depth image  422  to the partial region  222 . 
         [0052]    In the case shown here, objects having a smaller distance are illustrated with thicker lines, and objects having a greater distance with thinner lines. Objects having smaller distances can for example be illustrated in a gray level image as being brighter, and objects having a greater distance as being darker. 
         [0053]    As can be seen in  FIG. 4 , it is sufficient for example to ascertain only the depths of edges of objects by varying the focus settings. Homogeneous surfaces, that is to say for example the plate of the high table in the partial region  221  or in the depth image  421 , can be ascertained for example by interpolation of the depth of the edges that limit this surface. 
         [0054]    Surfaces perpendicular to the camera normal have the same depth along circular paths, which is why it is practical to propagate values for the depth along circular paths. It is also possible in this way to ascertain the depth for specific surfaces or regions. 
         [0055]    Stitching together individual partial regions or depth images should here be ensured so as to be able to extract a depth map of the entire scene or of the selected region of the scene. It is to be understood that to this effect, not only the three shown partial regions can be used, but as many partial regions as necessary to cover the entire selected region of the scene. As already mentioned, it may be practical here for neighboring partial regions to overlap. 
         [0056]    Calculation of a concrete section of the depth map can be effected by perspective projection of all visible recordings in space onto the new image plane of the section, similar to what is done for example when rendering a computer graphic. 
         [0057]    Also conceivable here is another measurement of potentially defective regions in the depth map. Likewise conceivable is that the scene is validated from time to time to check whether the 3-D structure has changed. 
         [0058]    An existing functionality of the VCA system can then be improved with the proposed method, for example what is known as the function “idle object detection” can be plausibilized. Here, a PTZ camera would be aimed at the location of the relevant object and attempt to identify depth differences in this region and thus to plausibilize whether this is an object or whether a shadow can be seen, for example, which has triggered for example a wrong warning. 
         [0059]    Then depth maps can be obtained for example by regions of unknown depth, which are for example a result of a low signal-to-noise ratio in this region and for which the “depth from focus” method has failed, being filled by post-processing.