# How to find depth map image by using a single image......?????

25 Ansichten (letzte 30 Tage)
priyanka kadam am 8 Apr. 2017
Beantwortet: Image Analyst am 23 Jan. 2024
We did till this ... but we are not getting how to produce depth map image ...
close all;
clear all;
clc;
a=imresize(a,[255 255])
a=double(a);
[row col dim]=size(a);
red=a(:,:,1);
[row col]=size(red);
green=a(:,:,2);
blue=a(:,:,3);
numer=0.5*((red-green)+(red-blue));
deno=sqrt((red-green).^2+(red-blue).*(green-blue));
theta=acos(numer./(deno+eps));
%for computing HUE
for x=1:1:row
for y=1:1:col
if green(x,y)<blue(x,y);
H(x,y)=(2*pi)-theta(x,y);
else
H(x,y)=theta(x,y);
end
end
end
%computing SATURATION & INTENSITY
numer=min(min(red,green),blue);
deno=red+green+blue;
deno(deno==0)=eps;
S=1-(3.*numer./deno);
I=(red+green+blue)/3;
z=edge(I,'canny');
y=imfill(z,'holes');
subplot(2,3,1);
imshow(uint8(a));
colormap(gray);
title('original image');
subplot(2,3,2);
imagesc(H);
colormap(gray);
title('HUE');
subplot(2,3,3);
imagesc(S);
colormap(gray);
title('SATURATION');
subplot(2,3,4);
imagesc(I)
colormap(gray);
title('INTENSITY');
subplot(2,3,5);
imshow(z);
title('edge detection');
subplot(2,3,6);
imshow(y);
title('HOLE FILLING');
figure;
imshow(z);
figure;
imshow(y);
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (3)

Image Analyst am 8 Apr. 2017
Bearbeitet: Image Analyst am 8 Apr. 2017
I don't think you can. Why do you think you can get a depth (range) image from a single color optical photo?
Attach your color cameraman.jpg photo. The standard one that ships with MATLAB is a tiff image and it's monochrome/grayscale, not color. I see no reason why doing edge detection and hole filling would/could get you the distance from the sensor to the subject unless you're somehow hoping that there will be some lateral chromatic aberration.
##### 2 KommentareKeine anzeigenKeine ausblenden
Mohammad Shafivulla am 12 Jan. 2020
sir, can you please give the code for this question.
Image Analyst am 13 Jan. 2020
Like I said, I don't think it can be done, so there is not code for it.

Melden Sie sich an, um zu kommentieren.

George Abrahams am 23 Jan. 2024
This task is called "monocular depth estimation" and it is a heavily researched field.
For a still image, the most common, traditional method would be shape from shading, but these days deep neural networks are most commonly used. There are many CNNs pretrained for different types of environment freely available.
The only code I can find for MATLAB is this repository on File Exchange for indoor environments.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Image Analyst am 23 Jan. 2024
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by