extracting avocado fruits from an image (band780).

1 次查看(过去 30 天)
I need to extract avocado fruits from an image (band780). besides avocado there are trees and leaves.
In the code now looks like this but the main problem is that i cannot mask out the background as it is not clear what exactly is a background here
%original image
x = imread('REF_024_11072018_084046937_780.TIF');
imshow(x)
title('Raw Image')
%color map
% figure
% imshow(x)
% colormap jet
% title('Jet color map')
%histogram stretch
h=histeq(x);
figure
imshow(h)
title('histogram')
%Negative Histogram
ng = max(h) - h;
figure
imshow(ng)
colormap jet
title ('Negative Histogram')
%invert
n = ng - x;
figure
imshow(n)
title Invert
%background estimation (non uniform illumination)
% bg = imopen(x,strel('disk',10));
% figure
% imshow(bg)
% colormap jet
% title Background
% %Negative Background
% ng = max(bg) - bg;
% figure
% imshow(ng)
% colormap jet
% title ('Negative Background')
%background removal (flatten background level)
% y = imsubtract(x,bg);
% figure
% imshow(y)
% title Flattened
%segment grains from background
bw = im2bw(n,graythresh(n));
figure
imshow(bw)
title GrayThreshed
%edge detection
%sobel
edgeS = edge(bw,'sobel');
% BW2 = edge(bw,'canny');
figure
imshow(edgeS)
title Edge
%label connected regions
Screen Shot 2019-01-30 at 9.23.15 AM.png

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by