Image Analysis with flow and gray scale
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Christine Nee
am 21 Feb. 2017
Kommentiert: Image Analyst
am 22 Feb. 2017
Hello. I am trying to calculate the percentage of the white foam for this image. I am struggling because I can either do a 8 bit binary black and white but it takes out some of the foam that is less dense and not completely white. The color of the foam varies. The second way I approached it was using a RBG analysis. I basically just analyzed the closest ranges for gray to white and black as the background.
Do any of you know how to separate the foam from the background more accurately?
Thanks
I = imread('test5.png') ;
figure;
imshow(I)
BW = im2bw(I,0.4);
figure; imshow(BW)
percentageBlack=(1-nnz(BW)/numel(BW))*100
%%%%another method
clear all
clc
filename = 'test5.png';
RGB = imread(filename);
grayscale = rgb2gray(RGB);
numTotalPixel = size(grayscale,1) * size(grayscale, 2);
numBlackPixel = sum(grayscale(:)<= 80);
numWhitePixel = sum(grayscale(:)>140);
numGrayPixel = sum(grayscale(:)>80)-numWhitePixel;
percentBlackPixel = numBlackPixel / numTotalPixel * 100
percentWhitePixel = numWhitePixel / numTotalPixel * 100
percentGrayPixel = numGrayPixel / numTotalPixel *100
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 22 Feb. 2017
I have done foam/suds/lather analysis. If a gray level (like 100) might be foam in one location, but background in another location, then you're going to have to come up with some descriptor of foam that depends on more than simply the gray scale. I don't know what that might be. Maybe you need to do some spatial processing first, like using adapthisteq() or something.
4 Kommentare
Image Analyst
am 22 Feb. 2017
I filled in the clear bubbles using imclose(). Then I thresholded, smoothed the boundaries a bit I think, and finally got area fractions from the histogram.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing and Computer Vision finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!