Extract color with in region

2 views (last 30 days)
Noor us Saba
Noor us Saba on 19 Apr 2019
Commented: Noor us Saba on 22 Apr 2019
I want to extract the color of tablets from the strips. i segmented the tablets using bwboundaries. kindly help me to extract the color of each region
Here is my code
[TotalSampleObjNo,L] = bwboundaries(Noise_FreeImg,'noholes'); % Search only for object
imshow(label2rgb(L,@jet,[.5 .5 .5]))
hold on
%disp (length (TotalSampleObjNo));
for k = 2:length(TotalSampleObjNo) % Starts with 1 for all boundries
boundary = TotalSampleObjNo{k};
plot(boundary(:,2),boundary(:,1),'w','LineWidth',2)
end

Answers (1)

Image Analyst
Image Analyst on 19 Apr 2019
% Extract your color channels
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Extract mean color in the binary image mask
redMean = redChannel(Noise_FreeImg)
greenMean = greenChannel(Noise_FreeImg)
blueMean = blueChannel(Noise_FreeImg)
  1 Comment
Noor us Saba
Noor us Saba on 22 Apr 2019
i didnt get how to use these mean value to detect the color of sample tablet.
regionprops give the binary image how we used to extract the color information from the binary image

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!