How to measure the size of the red blots in the image?
1 view (last 30 days)
Show older comments
I was trying to use imfindcircle() and detect the cirlces in the image below, however was unable to find them through adjusting sensitivity. I just want to find the size of each blot so maybe it is a better approach to filter the image then detect certain colors, but I'm not exactly familiar with how to do this. Any guidance would be great, thanks!
0 Comments
Accepted Answer
yanqi liu
on 3 Nov 2021
clc; clear all; close all;
img = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/787390/image.jpeg');
V = rgb2gray(img);
R = img(:,:,1);
G = img(:,:,2);
Y = 255-img(:,:,3);
xz_red = imsubtract(R,V);
xz_red = imadjust(xz_red,stretchlim(xz_red),[]);
bw = im2bw(xz_red); bw = bwareaopen(bw, 100);
[L,num] = bwlabel(bw);
stats = regionprops(L);
figure; imshow(img,[]);
for i = 1 : num
hold on; rectangle('position', stats(i).BoundingBox, 'EdgeColor', 'g', 'LineWidth', 2)
end
0 Comments
More Answers (1)
Sulaymon Eshkabilov
on 2 Nov 2021
In your exercise, starting with the image pixel values impixel() and employining logical indexing would be a good solution. Then computing the area from the number of pixels in red.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!