how can i detect sky

조회 수: 4 (최근 30일)
Eren Aslan
Eren Aslan 2022년 3월 29일
댓글: Adam Danz 2022년 3월 30일
Hello
I want to detect sky in a image and chang it colour to black.How can i do that?
For example this image:
  댓글 수: 4
Adam Danz
Adam Danz 2022년 3월 29일
편집: Adam Danz 2022년 3월 29일
@Eren Aslan for your simple image of a nearly uniform background, I would start with regionprops to segment the plane and then assume everything else is sky (including the ocean in my image above). However, it will not work with more complex backgrounds.
Sam Chak
Sam Chak 2022년 3월 29일
@Eren Aslan Are you trying to develop the MATLAB-based "Magic Wand"? Sound like an interesting project!

댓글을 달려면 로그인하십시오.

답변 (1개)

yanqi liu
yanqi liu 2022년 3월 30일
yes,sir,for more image,may be use DeepLearning to segment
but just for this image,we can use some simple method,such as
im = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/945114/image.jpeg');
jm = rgb2lab(im);
s = imcomplement(mat2gray(jm(:,:,3)));
bw = im2bw(s, graythresh(s));
im2 = im;
% make sky to black
r = im2(:,:,1);g = im2(:,:,2);b = im2(:,:,3);
r(bw) = 0; g(bw) = 0; b(bw) = 0;
im2 = cat(3,r,g,b);
figure;
subplot(2,2,1); imshow(im,[]);
subplot(2,2,2); imshow(s,[]);
subplot(2,2,3); imshow(bw,[]);
subplot(2,2,4); imshow(im2,[]);
  댓글 수: 1
Adam Danz
Adam Danz 2022년 3월 30일
Nice work!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by