How to find depth map image by using a single image......?????
조회 수: 12 (최근 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!