I have been working on this project for quite some time and am now seeking some outside opinions. I must create a script that will identify each of the small particles. I have looked at multiple threshold techniques and not many seem to be working. For example, I tried turning it into a binary image and getting rid of noise using the function bwareaopen, but there is still a lot of noise and the imfindcircles function is being thrown off. Any fresh ideas to identify these beads would be very helpful. Accuracy is a must in this project! The small beads are the ones I'm identifying, they are the ones that have the most consistent size in the image.

답변 (1개)

Image Analyst
Image Analyst 2017년 5월 15일

0 개 추천

Have you tried a Bottom Hat Filter, imbothat()?
rgbImage = imread('StackOverflow#1.JPG');
subplot(2,2,1);
grayImage = rgb2gray(rgbImage);
imshow(grayImage, []);
axis on;
subplot(2,2,2);
se = strel('disk', 4, 0);
filteredImage = imbothat(grayImage, se);
imshow(filteredImage, []);
axis on;
% Histogram
subplot(2,2,3);
histogram(filteredImage, 256);
grid on;
xticks(0:16:255);
% Threshold
binaryImage = filteredImage > 40;
subplot(2,2,4);
imshow(binaryImage);

댓글 수: 8

Isaiah Stefan Engle
Isaiah Stefan Engle 2017년 5월 15일
편집: Image Analyst 2017년 5월 16일
Yes, I tried that but when I run it through the imfindcircles() function, it still does not register the beads. It seems to just go around them.
Image Analyst
Image Analyst 2017년 5월 16일
Yeah, so? So just don't do that. No need to use findcircles() because the blobs are found using a different segmentation algorithm (bottom hat filter and thresholding). Why would you want to run findcircles()? You'll notice I did not use it and there is a reason for that.
Isaiah Stefan Engle
Isaiah Stefan Engle 2017년 5월 16일
The goal of the project is to count the circles and return the value of how many bonded circles there are
Image Analyst
Image Analyst 2017년 5월 16일
And my code doesn't do that? Sure it does. Apparently much better than find circles does. Of course if the dots are too close together, like you showed, it will count it as one blob instead of 2. If you want to throw out blobs bigger than the size of one dot, you can do that, or you can count it as two dots instead of 1. Maybe the area fraction of dots would be a better metric than the count of the dots. They would be perfectly correlated if all dots were isolated but if they're touching then the count can be wrong but the area would be right. So I'd encourage you to consider area fraction instead of count as a useful metric.
Isaiah Stefan Engle
Isaiah Stefan Engle 2017년 5월 16일
I really appreciate you taking the time to help me with this, though I am still a little bit confused with the output and your code. This is what I get when I run the program
Here is what I get with this code:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
format longg;
format compact;
fontSize = 20;
rgbImage = imread('StackOverflow#1.JPG');
subplot(2,2,1);
grayImage = rgb2gray(rgbImage);
imshow(grayImage, []);
axis on;
title('Original Gray Scale Image', 'FontSize', fontSize);
subplot(2,2,2);
se = strel('disk', 4, 0);
filteredImage = imbothat(grayImage, se);
imshow(filteredImage, []);
axis on;
title('Bottom Hat Filtered Image', 'FontSize', fontSize);
% Histogram
subplot(2,2,3);
histogram(filteredImage, 256);
grid on;
xticks(0:16:255);
title('Histogram of Gray Levels', 'FontSize', fontSize);
xlabel('Gray Level', 'FontSize', fontSize);
ylabel('Pixel Count', 'FontSize', fontSize);
% Threshold
binaryImage = filteredImage > 40;
subplot(2,2,4);
imshow(binaryImage);
title('Binary Image', 'FontSize', fontSize);
% Label the image
labeledImage = bwlabel(binaryImage);
% Measure the areas
props = regionprops(labeledImage, 'Area');
allAreas = [props.Area];
% Show histogram of blob areas:
figure;
histogram(allAreas);
grid on;
title('Histogram of Blob Areas', 'FontSize', fontSize);
xlabel('Area', 'FontSize', fontSize);
ylabel('Blob Count', 'FontSize', fontSize);
You can see the distribution of blob areas. What is a "bonded circles"? Can it be identified as a certain area? Like if the area is more than 10 pixels, it's 2 blobs connected together instead of one single blob? What are "bonded circles"?
Isaiah Stefan Engle
Isaiah Stefan Engle 2017년 5월 17일
I also tried this approach earlier. The problem is that there are also dust particles that have around the same area of pixels. For example, the first image displays two separate dimers and 5 single beads. The second image displays a dust particle that has the same area of pixels as the bonded beads. The method you are suggesting is unfortunately unable to distinguish the two.
Indrajit Nandi
Indrajit Nandi 2021년 3월 31일
Were you able to solve the problem?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2017년 5월 15일

댓글:

2021년 3월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by