Main Page | Report this Page
 
   
Science Forum Index  »  Image Processing Forum  »  Advise on object detection...
Page 1 of 2    Goto page 1, 2  Next
Author Message
stormogulen...
Posted: Tue May 20, 2008 10:35 pm
Guest
Hi all,

I have a bunch of pictures like this one:

(http://cid-1627b3c28e2dc281.spaces.live.com/photos/cns!
1627B3C28E2DC281!125 )

(A picture of rocks with soil between them)

I would like to detect and extract every single rock in the picture.
What would be the best way to do this? I have tried using Canny edge
detection to find each rock, but even though the contrast between rock
and soil is quite high, I don't get all the edges in the picture.

Also I would like to find the green box which is somewhere at the
center of the picture. How would you suggest that I do that?

Best regards,
Bjarne
aruzinsky...
Posted: Wed May 21, 2008 7:00 am
Guest
On May 21, 2:35 am, stormogulen <bjarn... at (no spam) gmail.com> wrote:
Quote:
Hi all,

I have a bunch of pictures like this one:

(http://cid-1627b3c28e2dc281.spaces.live.com/photos/cns!
1627B3C28E2DC281!125 )

(A picture of rocks with soil between them)

I would like to detect and extract every single rock in the picture.
What would be the best way to do this? I have tried using Canny edge
detection to find each rock, but even though the contrast between rock
and soil is quite high, I don't get all the edges in the picture.

Also I would like to find the green box which is somewhere at the
center of the picture. How would you suggest that I do that?

Best regards,
Bjarne

When I click the thumbnail, the new web page doesn't respond.
"waiting for" in status bar continues for minutes. You should use
PBase.

You should find the green box by color detection.
ImageAnalyst...
Posted: Wed May 21, 2008 5:48 pm
Guest
On May 21, 4:35 am, stormogulen <bjarn... at (no spam) gmail.com> wrote:
Quote:
Hi all,

I have a bunch of pictures like this one:

(http://cid-1627b3c28e2dc281.spaces.live.com/photos/cns!
1627B3C28E2DC281!125 )

(A picture of rocks with soil between them)

I would like to detect and extract every single rock in the picture.
What would be the best way to do this? I have tried using Canny edge
detection to find each rock, but even though the contrast between rock
and soil is quite high, I don't get all the edges in the picture.

Also I would like to find the green box which is somewhere at the
center of the picture. How would you suggest that I do that?

Best regards,
Bjarne
--------------------------------------------------------------------------------

Bjarne:
An edge detector depends on the window size so it will find large dirt
areas in addition to the dirt cracks between the rocks. You might try
just simple thresholding and then maybe a morphological opening to
make the dirt connect in the narrow spots. Or you could use the edge
detector but to have it not find the large dirt spots, you need to
check your areas against their average intensity and then thrown out
regions close to the dirt color. Doesn't really look too tough to do
a reasonably good job. Find the green box with a color classifier, for
example just convert the RGB image into HSI and threshold on the hue
channel.
Regards,
ImageAnalyst
Pixel.to.life...
Posted: Wed May 21, 2008 7:36 pm
Guest
On May 21, 8:48 pm, ImageAnalyst <imageanal... at (no spam) mailinator.com> wrote:
Quote:
On May 21, 4:35 am, stormogulen <bjarn... at (no spam) gmail.com> wrote:



Hi all,

I have a bunch of pictures like this one:

(http://cid-1627b3c28e2dc281.spaces.live.com/photos/cns!
1627B3C28E2DC281!125 )

(A picture of rocks with soil between them)

I would like to detect and extract every single rock in the picture.
What would be the best way to do this? I have tried using Canny edge
detection to find each rock, but even though the contrast between rock
and soil is quite high, I don't get all the edges in the picture.

Also I would like to find the green box which is somewhere at the
center of the picture. How would you suggest that I do that?

Best regards,
Bjarne

---------------------------------------------------------------------------­-----
Bjarne:
An edge detector depends on the window size so it will find large dirt
areas in addition to the dirt cracks between the rocks.  You might try
just simple thresholding and then maybe a morphological opening to
make the dirt connect in the narrow spots.  Or you could use the edge
detector but to have it not find the large dirt spots, you need to
check your areas against their average intensity and then thrown out
regions close to the dirt color.   Doesn't really look too tough to do
a reasonably good job. Find the green box with a color classifier, for
example just convert the RGB image into HSI and threshold on the hue
channel.
Regards,
ImageAnalyst- Hide quoted text -

- Show quoted text -

I agree with ImageAnalyst.

Do you have MATLAB with image processing toolbox? It has a
demonstration project called 'Marker-Controlled Watershed
Segmentation'. That could be one way of achieving what you want to do
with the rocks. All the steps invole either morphological operations
or thresholding.

For the box, a color classifier makes sense. You may also use a hough
transform for lines.

Again, there can be multiple ways of doing this. You have to choose
based on your requirements.
serg271...
Posted: Wed May 21, 2008 7:59 pm
Guest
On May 21, 11:35 am, stormogulen <bjarn... at (no spam) gmail.com> wrote:
Quote:
Hi all,

I have a bunch of pictures like this one:

(http://cid-1627b3c28e2dc281.spaces.live.com/photos/cns!
1627B3C28E2DC281!125 )

(A picture of rocks with soil between them)

I would like to detect and extract every single rock in the picture.
What would be the best way to do this? I have tried using Canny edge
detection to find each rock, but even though the contrast between rock
and soil is quite high, I don't get all the edges in the picture.

Also I would like to find the green box which is somewhere at the
center of the picture. How would you suggest that I do that?

Best regards,
Bjarne

Adaptive thresholding should do the trick, using intensity histogram
for example. The rocks considerably lighter then ground, and there is
no lightning gradient so single histogram could be enough. Binarize
the image and after that count white connected components.
Green box you can probably find making adaptive thresholding on hue
and saturation.
aruzinsky...
Posted: Thu May 22, 2008 5:14 am
Guest
On May 21, 9:48 pm, ImageAnalyst <imageanal... at (no spam) mailinator.com> wrote:
Quote:
Find the green box with a color classifier, for
example just convert the RGB image into HSI and threshold on the hue
channel.

In my experience, that won't work because there will be numerous
unwanted green (or any) hue regions with S slightly greater than
zero. In other word, these unwanted regions look white or grey but
have green (or any) hue. Hue and saturation must be both examined to
properly detect an object by color.
serg271...
Posted: Thu May 22, 2008 6:11 am
Guest
On May 22, 6:14 pm, aruzinsky <aruzin... at (no spam) general-cathexis.com> wrote:
Quote:
On May 21, 9:48 pm, ImageAnalyst <imageanal... at (no spam) mailinator.com> wrote:

Find the green box with a color classifier, for
example just convert the RGB image into HSI and threshold on the hue
channel.

In my experience, that won't work because there will be numerous
unwanted green (or any) hue regions with S slightly greater than
zero. In other word, these unwanted regions look white or grey but
have green (or any) hue. Hue and saturation must be both examined to
properly detect an object by color.

I found helpful in my project (on low-en cellphone camera) use YUV
based "saturation" and "hue". That is saturation=sqrt(U*U+V*V),
hue=atan(U,V). For some reason it works a lot better for low end
camera than HSV, probably because in HSV hue almost pure R , G and B
take most of the range, and YUV have more place for "transitional"
colors.
aruzinsky...
Posted: Thu May 22, 2008 6:15 am
Guest
On May 21, 2:35 am, stormogulen <bjarn... at (no spam) gmail.com> wrote:
Quote:
Hi all,

I have a bunch of pictures like this one:

(http://cid-1627b3c28e2dc281.spaces.live.com/photos/cns!
1627B3C28E2DC281!125 )

(A picture of rocks with soil between them)

I would like to detect and extract every single rock in the picture.
What would be the best way to do this? I have tried using Canny edge
detection to find each rock, but even though the contrast between rock
and soil is quite high, I don't get all the edges in the picture.

Also I would like to find the green box which is somewhere at the
center of the picture. How would you suggest that I do that?

Best regards,
Bjarne

First, I removed texture with bilateral filter,
http://www.general-cathexis.com/images/bilateral.jpg

Then I generated mask by color detection and applied to original,
coloring outside region red, http://www.general-cathexis.com/images/segmented.jpg

Why is your file name so long? It fosters Murphy's law.
stormogulen...
Posted: Thu May 22, 2008 10:24 pm
Guest
On 22 Maj, 18:15, aruzinsky <aruzin... at (no spam) general-cathexis.com> wrote:
Quote:
On May 21, 2:35 am, stormogulen <bjarn... at (no spam) gmail.com> wrote:





Hi all,

I have a bunch of pictures like this one:

(http://cid-1627b3c28e2dc281.spaces.live.com/photos/cns!
1627B3C28E2DC281!125 )

(A picture of rocks with soil between them)

I would like to detect and extract every single rock in the picture.
What would be the best way to do this? I have tried using Canny edge
detection to find each rock, but even though the contrast between rock
and soil is quite high, I don't get all the edges in the picture.

Also I would like to find the green box which is somewhere at the
center of the picture. How would you suggest that I do that?

Best regards,
Bjarne

First, I removed texture with bilateral filter,http://www.general-cathexis..com/images/bilateral.jpg

Then I generated mask by color detection and applied to original,
coloring outside region red,http://www.general-cathexis.com/images/segmented.jpg

Why is your file name so long?  It fosters Murphy's law.- Skjul tekst i anførselstegn -

- Vis tekst i anførselstegn -

Wow! That looks brilliant! Much better than what I have come up with.
Thank you for the input, I will surely look at the method you all have
described.

Regarding the filename: dunno, that just the way Microsoft wants it to
be...Smile
aruzinsky...
Posted: Fri May 23, 2008 6:47 am
Guest
On May 22, 10:11 am, serg271 <serg... at (no spam) gmail.com> wrote:
Quote:
On May 22, 6:14 pm, aruzinsky <aruzin... at (no spam) general-cathexis.com> wrote:

On May 21, 9:48 pm, ImageAnalyst <imageanal... at (no spam) mailinator.com> wrote:

Find the green box with a color classifier, for
example just convert the RGB image into HSI and threshold on the hue
channel.

In my experience, that won't work because there will be numerous
unwanted green (or any) hue regions with S slightly greater than
zero.  In other word, these unwanted regions look white or grey but
have green (or any) hue.  Hue and saturation must be both examined to
properly detect an object by color.

I found helpful in my project (on low-en cellphone camera) use YUV
based "saturation" and "hue". That is saturation=sqrt(U*U+V*V),
hue=atan(U,V). For some reason it works a lot better for low end
camera than HSV, probably because in HSV hue almost pure R , G and B
take most of the  range, and YUV  have more place for "transitional"
colors.

Why don't you combine and compare hue and saturation thusly?:

[ (U - U0)*(U - U0) + (V - V0)*(V - V0) ] < threshhold

where Y0 U0 V0 is the reference color.
Pixel.to.life...
Posted: Fri May 23, 2008 10:48 am
Guest
On May 23, 9:47 am, aruzinsky <aruzin... at (no spam) general-cathexis.com> wrote:
Quote:
On May 22, 10:11 am, serg271 <serg... at (no spam) gmail.com> wrote:





On May 22, 6:14 pm, aruzinsky <aruzin... at (no spam) general-cathexis.com> wrote:

On May 21, 9:48 pm, ImageAnalyst <imageanal... at (no spam) mailinator.com> wrote:

Find the green box with a color classifier, for
example just convert the RGB image into HSI and threshold on the hue
channel.

In my experience, that won't work because there will be numerous
unwanted green (or any) hue regions with S slightly greater than
zero.  In other word, these unwanted regions look white or grey but
have green (or any) hue.  Hue and saturation must be both examined to
properly detect an object by color.

I found helpful in my project (on low-en cellphone camera) use YUV
based "saturation" and "hue". That is saturation=sqrt(U*U+V*V),
hue=atan(U,V). For some reason it works a lot better for low end
camera than HSV, probably because in HSV hue almost pure R , G and B
take most of the  range, and YUV  have more place for "transitional"
colors.

Why don't you combine and compare hue and saturation thusly?:

[ (U - U0)*(U - U0)  + (V - V0)*(V - V0) ]  <  threshhold

where Y0 U0 V0 is the reference color.- Hide quoted text -

- Show quoted text -

The idea to use a bilateral filter is very good. Sound advice!!!
serg271...
Posted: Fri May 23, 2008 10:13 pm
Guest
On May 23, 7:47 pm, aruzinsky <aruzin... at (no spam) general-cathexis.com> wrote:
Quote:
On May 22, 10:11 am, serg271 <serg... at (no spam) gmail.com> wrote:



On May 22, 6:14 pm, aruzinsky <aruzin... at (no spam) general-cathexis.com> wrote:

On May 21, 9:48 pm, ImageAnalyst <imageanal... at (no spam) mailinator.com> wrote:

Find the green box with a color classifier, for
example just convert the RGB image into HSI and threshold on the hue
channel.

In my experience, that won't work because there will be numerous
unwanted green (or any) hue regions with S slightly greater than
zero. In other word, these unwanted regions look white or grey but
have green (or any) hue. Hue and saturation must be both examined to
properly detect an object by color.

I found helpful in my project (on low-en cellphone camera) use YUV
based "saturation" and "hue". That is saturation=sqrt(U*U+V*V),
hue=atan(U,V). For some reason it works a lot better for low end
camera than HSV, probably because in HSV hue almost pure R , G and B
take most of the range, and YUV have more place for "transitional"
colors.

Why don't you combine and compare hue and saturation thusly?:

[ (U - U0)*(U - U0) + (V - V0)*(V - V0) ] < threshhold

where Y0 U0 V0 is the reference color.

I don't have any reference color. I'm doing color classification - how
similar colors of different objects, and use both hue and saturation
for kind of hashing.
aruzinsky...
Posted: Sat May 24, 2008 5:45 am
Guest
On May 24, 2:13 am, serg271 <serg... at (no spam) gmail.com> wrote:
Quote:
On May 23, 7:47 pm, aruzinsky <aruzin... at (no spam) general-cathexis.com> wrote:





On May 22, 10:11 am, serg271 <serg... at (no spam) gmail.com> wrote:

On May 22, 6:14 pm, aruzinsky <aruzin... at (no spam) general-cathexis.com> wrote:

On May 21, 9:48 pm, ImageAnalyst <imageanal... at (no spam) mailinator.com> wrote:

Find the green box with a color classifier, for
example just convert the RGB image into HSI and threshold on the hue
channel.

In my experience, that won't work because there will be numerous
unwanted green (or any) hue regions with S slightly greater than
zero.  In other word, these unwanted regions look white or grey but
have green (or any) hue.  Hue and saturation must be both examined to
properly detect an object by color.

I found helpful in my project (on low-en cellphone camera) use YUV
based "saturation" and "hue". That is saturation=sqrt(U*U+V*V),
hue=atan(U,V). For some reason it works a lot better for low end
camera than HSV, probably because in HSV hue almost pure R , G and B
take most of the  range, and YUV  have more place for "transitional"
colors.

Why don't you combine and compare hue and saturation thusly?:

[ (U - U0)*(U - U0)  + (V - V0)*(V - V0) ]  <  threshhold

where Y0 U0 V0 is the reference color.

I don't have any reference color. I'm doing color classification - how
similar colors of different objects, and use both hue and saturation
for kind of hashing.- Hide quoted text -

- Show quoted text -

Okay, but the OP does.

It just occurred to me that YUV is asymmetric:

Y = 0.2990*R + 0.5870*G + 0.1140*B;
U = -0.14713*R - 0.28886*G + 0.436*B;
V = 0.615*R - 0.51499*G - 0.10001*B;

As I recall, these coefficients (or was it YCbCr?) are determined by
the characteristics of CRT phosphors which changed from the 1950s.
Anyway, I bet the rationale for these coefficients is far fetched.

It would be better to use a symmetric version:

Y' = (R + G + B)/3.0;
U' = (2.0*B - R - G)/3.0;
V' = (2.0*R - G - B)/3.0;


R = Y' + V';
G = Y' - U' - V';
B = Y' + U';

In my experience, this works just fine.
serg271...
Posted: Sat May 24, 2008 6:54 am
Guest
aruzinsky wrote:

Quote:
It just occurred to me that YUV is asymmetric:

Y = 0.2990*R + 0.5870*G + 0.1140*B;
U = -0.14713*R - 0.28886*G + 0.436*B;
V = 0.615*R - 0.51499*G - 0.10001*B;

As I recall, these coefficients (or was it YCbCr?) are determined by
the characteristics of CRT phosphors which changed from the 1950s.
Anyway, I bet the rationale for these coefficients is far fetched.

It would be better to use a symmetric version:

Y' = (R + G + B)/3.0;
U' = (2.0*B - R - G)/3.0;
V' = (2.0*R - G - B)/3.0;


R = Y' + V';
G = Y' - U' - V';
B = Y' + U';

In my experience, this works just fine.

I suspect internal camera format is YUV, before it converted to RGB
later by driver - it seems it's either yuv or jpeg. So working with
asymmetrical YUV could be preferable.
ImageAnalyst...
Posted: Sat May 24, 2008 6:22 pm
Guest
On May 24, 12:54 pm, serg271 <serg... at (no spam) gmail.com> wrote:
Quote:

I suspect internal camera format is YUV, before it converted to RGB
later by driver - it seems it's either yuv or jpeg. So working  with
asymmetrical YUV could be preferable.- Hide quoted text -


----------------------------------
Why do you say that? Nearly all CCD's I see are natively RGB, and
most (all?) CMOS sensors are CMY or CMYG. Those are the filters that
are actually over the photosites. (Exceptions being the Foveon sensor
(sort of), and the Fuji SuperCCD SR and the new Kodak sensor with
additional "clear" pixels.)
Regards,
ImageAnalyst
 
Page 1 of 2    Goto page 1, 2  Next   All times are GMT - 5 Hours
The time now is Thu Dec 04, 2008 9:39 pm