Determining depth maps from images
A method generates a depth map from an image. In the method, a first depth data is generated that represents a first measure proportional to depth for pixels in the image using a first selected colour channel of the image, where the first depth data is calculated based on a minimum in intensity of the first selected colour channel of the image. A second depth data is generated that represents a second measure proportional to depth for pixels in the image, where the second depth data is calculated based on a maximum attenuation of a second selected colour channel of the image. The second depth data is filtered using the first depth data as a filtering guide to generate the depth map.
1 . A method for generating a depth map from an image, the method comprising:
generating first depth data representing a first measure proportional to depth for pixels in the image using a first selected colour channel of the image, wherein the first depth data is calculated based on a minimum intensity of the first selected colour channel of the image, wherein the first depth data is generated based on a modified dark channel prior process, the modified dark channel prior process comprising:
determining a most attenuated colour channel for the image by, for each colour channel in the image, determining a variance map using a moving variance with a fixed window size and a preselected variance threshold, wherein the first selected colour channel is the most attenuated colour channel;
generating second depth data representing a second measure proportional to depth for pixels in the image, wherein the second depth data is calculated based on a maximum attenuation of a second selected colour channel of the image; and
filtering the second depth data using the first depth data as a filtering guide to generate the depth map.
2 . The method as claimed in claim 1 , wherein the depth map is generated from a single image.
3 . The method as claimed in claim 1 , wherein at least one of the first and the second selected colour channels of the image is a colour channel of the image with a largest amount of attenuation.
4 . The method as claimed in claim 1 , wherein at least one of the first and the second selected colour channels of the image is determined based on an image characteristic.
5 . The method as claimed in claim 4 , wherein the image characteristic comprises at least one of a dominant image colour, hue, or tone.
6 . The method as claimed in claim 1 , wherein determining the first depth data further comprises:
determining a minimum intensity for each pixel in the image in the first selected colour channel to generate an intermediate image representation; and
filtering the intermediate image representation using a selected filtering kernel to generate the first depth data.
7 . The method as claimed in claim 6 , wherein the selected filtering kernel comprises a windowed morphological filter or a rank filter.
8 . The method as claimed in claim 1 , wherein determining the second depth data further comprises:
calculating a value representing a difference between a most intense value in the second selected colour channel of the image and a secondary value in a further selected colour channel of the image.
9 . The method as claimed in claim 8 , wherein the secondary value comprises a most intense value in the further selected colour channel of the image.
10 . The method as claimed in claim 8 , wherein the value is calculated over a set of colour channels of the image.
11 . The method as claimed in claim 1 , wherein the second depth data is generated based on a modified maximum intensity prior comprising a channel intensity, D′(x), that represents a transmission map for the image and is provided by:
D
′
(
x
)
=
max
y
∈
Ω
(
x
)
W
c
′
(
y
)
-
max
y
∈
Ω
(
x
)
,
c
≠
c
′
W
c
(
y
)
,
wherein an estimated {circumflex over (t)} M-MIP (x), is:
t
^
M
-
MIP
(
x
)
=
D
′
(
x
)
+
(
1
-
max
x
D
′
(
x
)
)
,
wherein {circumflex over (t)} M-MIP (x) is another estimate of a depth of the image.
12 . The method as claimed in claim 1 , wherein at least one of the first and the second selected colour channels of the image is determined using a colour sensor.
13 . A non-transitory machine-readable storage medium encoded with instructions for generating a depth map for an image, the instructions executable by a processor of a machine whereby to cause the machine to execute the method of claim 1 .
14 . A user equipment comprising an image sensor configured to generate image data representing an image, the user equipment further comprising a processor, and a memory to store instructions, executable by the processor, whereby to cause the user equipment to:
determine, based on the image data, a colour channel representing a most attenuated colour channel of the image;
generate a first and a second depth map data for the image using the colour channel, wherein the first depth map data is defined by a minimum intensity of the colour channel, wherein the second depth map is defined by a difference in attenuation between different colour channels of the image, and wherein at least one of the different colour channels comprises the colour channel representing the most attenuated colour channel of the image; and
filter the second depth data using the first depth data as a guide to generate a depth map for the image, wherein the first depth map data is generated based on a modified dark channel prior process, the modified dark channel prior process comprising:
determining the most attenuated colour channel for the image by, for each colour channel in the image, determining a variance map using a moving variance with a fixed window size and a preselected variance threshold.
15 . An apparatus for generating a depth map from an image, the apparatus being configured to:
generate first depth data representing a first measure proportional to depth for pixels in the image using a first selected colour channel of the image, wherein the first depth data is calculated based on a minimum intensity of the first selected colour channel of the image, wherein the first depth data is generated based on a modified dark channel prior process, the modified dark channel prior process comprising:
determining a most attenuated colour channel for the image by, for each colour channel in the image, determining a variance map using a moving variance with a fixed window size and a preselected variance threshold, wherein the first selected colour channel is the most attenuated colour channel;
generate second depth data representing a second measure proportional to depth for pixels in the image, wherein the second depth data is calculated based on a maximum attenuation of a second selected colour channel of the image; and
filter the second depth data using the first depth data as a filtering guide to generate the depth map.
16 . The apparatus as claimed in claim 15 , wherein the depth map is generated from a single image.
17 . The apparatus as claimed in claim 15 , further comprising:
an imaging module to generate image data representing the image.
18 . The apparatus as claimed in claim 15 , wherein the apparatus is further configured to:
determine at least one of the first and the second selected colour channels of the image based on an image characteristic, such as at least one of a dominant image colour, hue or tone.
19 . The apparatus as claimed in claim 15 , wherein the apparatus is further configured to:
determine a minimum intensity for each pixel in the image in the first selected colour channel to generate an intermediate image representation; and
filter the intermediate image representation using a selected filtering kernel to generate the first depth data.
20 . The method as claimed in claim 1 , wherein the modified dark channel prior process further comprises calculating a weight map based on the variance map and the preselected variance threshold to obtain a transmission for the image that provides an estimate of a depth of the image.