how do i select only a certain area of an image and then use it to get the mean pixel value?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
How can i select only the central red area of the star and then get the mean pixel value of the red channel?
0 Kommentare
Antworten (1)
KALYAN ACHARJYA
am 7 Mär. 2021
Bearbeitet: KALYAN ACHARJYA
am 7 Mär. 2021
This is all about how you can correctly segregate ROI, what the red fields refer to, as there is no clear boundary in the area of interest items, the easiest way-
red_channel=rgbImage(:,:,1);
bwimage=imbinarize(rgbImage(:,:,1),0.3);
% Get the largest blob only
bwimage=bwareafilt(bwimage,1);
% Get data for mean
sum_pix=sum(bwimage(:));
mask=uint8(cat(3,bwimage,bwimage,bwimage)); % Just for display purpose
% Mask operation on Red Channel
red_seg=red_channel(bwimage);
fprintf('The Mean is: %f',sum(red_seg)/sum_pix);
imshow([rgbImage,mask.*rgbImage;])
7 Kommentare
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox 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!