Filter löschen
Filter löschen

extracting avocado fruits from an image (band780).

1 Ansicht (letzte 30 Tage)
elena bogdanova
elena bogdanova am 30 Jan. 2019
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

Antworten (0)

Kategorien

Mehr zu Colormaps 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