How to calculate the mean and standard deviation of a ROI(Region of interest) excluding the black background
13 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Elias Unk
il 24 Apr 2017
Modificato: Elias Unk
il 24 Giu 2017
I need to calculate numerous color and texture features of a region of interest in an image excluding the black background,the current built in matlab functions like mean2 and std2 for mean and standard deviation respectively won't do it.I also calculated variance,skew,kurtosis and entropy for the entire input image and i want them EXCLUSIVELY for the lesion area not the entire picture,to test my theory i increased the background size in that same exact first image while keeping the lesion size intact and the mean dropped from 16.6398 to 13.6976 for the green grayscale layer.Kindly find 2 images attached one with more black background then the other and again,i only want to calculate the color features of the lesion area.
0 Commenti
Risposta accettata
Image Analyst
il 24 Apr 2017
Use the function on each channel
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
meanR = mean(redChannel(mask));
meanG = mean(greenChannel(mask));
meanB = mean(blueChannel(mask));
stdR = std(redChannel(mask));
stdG = std(greenChannel(mask));
stdB = std(blueChannel(mask));
and so on for skewness, kurtosis, etc.
redChannel(mask) will give a 1-D vector of pixel values that are only inside your mask region. So taking the mean of that 1-D vector will give you the mean of pixels inside the mask.
2 Commenti
Image Analyst
il 24 Apr 2017
So? Just make it double like it asked for:
stdR = std(double(redChannel(J)));
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!