How to find depth map image by using a single image......?????
13 次查看(过去 30 天)
显示 更早的评论
We did till this ... but we are not getting how to produce depth map image ...
close all;
clear all;
clc;
a=imread('cameraman.jpg');
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 个评论
回答(3 个)
Image Analyst
2017-4-8
编辑:Image Analyst
2017-4-8
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 个评论
George Abrahams
2024-1-23
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!