Thread Subject: Centroids of bead image

Subject: Centroids of bead image

From: Steffen

Date: 20 Nov, 2007 17:25:23

Message: 1 of 6

Hi there,

I´m trying to calculate the centroids of many beads as shown
in the following url:
http://img222.imageshack.us/my.php?image=beadste6.png

This however requires a proper detection of each bead.
Judging by eye one can easily distinguish the beads, but if
I do bwareaopen it always takes for example 3 close beads as
one object. I haven´t found a way to get a more precise
label of the single beads. I tried thresholding the image,
applying strel but nothing did work so far. Any idea is much
appreciated.

Many thanks in advance!

Steffen
 

Subject: Centroids of bead image

From: Screwdriver223

Date: 20 Nov, 2007 21:07:15

Message: 2 of 6

On Nov 20, 12:25 pm, "Steffen " <rile...@gmail.com> wrote:
 SNIP> trying to calculate the centroids of many beads

Have a look at this tutorial:

http://physics.georgetown.edu/matlab/tutorial.html

There is code linked to that page as well that should help you out.

Good luck!

Dave

Subject: Centroids of bead image

From: Matthew Whitaker

Date: 21 Nov, 2007 00:29:28

Message: 3 of 6

Hi Steffen,
The following might get you going to separate out the beads.

I = rgb2gray(imread('beadste6.png'));
I = I(2:end-1,2:end-1); %theres a band of 255 values on the
edges
fun = @(x) graythresh(x(:)); %create a nonlinear filter to
do adaptive threshold
gFilt = nlfilter(I,[5,5],fun);
gFilt = uint8(gFilt*255);
BW = false(size(I));
BW(I > gFilt) = true;
g = graythresh(I);
 
BW = im2bw(I,g) & BW; %clean out the low value garbage

figure, imshow(BW);

s = strel('disk',3);
bwOpen = imopen(BW,s); %open it up a bit

figure, imshow(bwOpen);

Hope this helps
Matt

Subject: Centroids of bead image

From: Steffen

Date: 21 Nov, 2007 16:11:13

Message: 4 of 6

Thanks for the advices!

Is my understand correct that input of the [m m] matrix for
nlfilter corresponds to the feature size in pixels?
I assume so, as the filtering works best when taking the
average radius of my beads into the matrix. However, when I
apply the strel, I´m wondering why this doesn´t work well
for the above found value. In my particular case its a [7 7]
matrix and a strel disc of 4. Why is it not identical and
thus where is my incorrect thougt?


Cheers,
Steffen

Subject: Centroids of bead image

From: Matthew Whitaker

Date: 21 Nov, 2007 19:13:57

Message: 5 of 6

"Steffen " <rileksn@gmail.com> wrote in message <fi1lb1
$ris$1@fred.mathworks.com>...
> Thanks for the advices!
>
> Is my understand correct that input of the [m m] matrix
for
> nlfilter corresponds to the feature size in pixels?
> I assume so, as the filtering works best when taking the
> average radius of my beads into the matrix. However, when
I
> apply the strel, I´m wondering why this doesn´t work well
> for the above found value. In my particular case its a [7
7]
> matrix and a strel disc of 4. Why is it not identical and
> thus where is my incorrect thougt?
>
>
> Cheers,
> Steffen

I often make the strcturing element smaller than the
features I am working with if I need to extract a range of
feature sizes. With a disk strel I usually start at about
1/2 the feature size. So for a radius of 7 a disk strel of
3 or 4 would work well. The problem of working with a
structuring element too close to the average feature size
when doing a morphological opening operation is that you
can end up having eroded completely away about half your
features leaving only your biggest features to be re-
dilated. It all depends on what you want to end up with.

Subject: Centroids of bead image

From: Steffen

Date: 22 Nov, 2007 12:54:14

Message: 6 of 6

Thanks for the info. Seems as though that I´ve to read some
more about it. But the eroding effect makes sense,
theoretically and proven in practive as well. ;)

Thanks!!

> I often make the strcturing element smaller than the
> features I am working with if I need to extract a range of
> feature sizes. With a disk strel I usually start at about
> 1/2 the feature size. So for a radius of 7 a disk strel of
> 3 or 4 would work well. The problem of working with a
> structuring element too close to the average feature size
> when doing a morphological opening operation is that you
> can end up having eroded completely away about half your
> features leaving only your biggest features to be re-
> dilated. It all depends on what you want to end up with.
>
>

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
im2bw Sven 29 Jan, 2008 01:11:23
morphology Matthew Whitaker 20 Nov, 2007 19:30:10
im2bw Steffen 20 Nov, 2007 12:30:20
bwareaopen Steffen 20 Nov, 2007 12:30:20
image Steffen 20 Nov, 2007 12:30:20
rssFeed for this Thread

Contact us at files@mathworks.com