Borrar filtros
Borrar filtros

Image Analysis with flow and gray scale

2 visualizaciones (últimos 30 días)
Christine Nee
Christine Nee el 21 de Feb. de 2017
Comentada: Image Analyst el 22 de Feb. de 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

Respuesta aceptada

Image Analyst
Image Analyst el 22 de Feb. de 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 comentarios
Christine Nee
Christine Nee el 22 de Feb. de 2017
Then you would go back and do a pixel analysis on it?
Image Analyst
Image Analyst el 22 de Feb. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by