Path: news.mathworks.com!not-for-mail
From: "Sven " <sven.holcombe@gmail.deleteme.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: image processing
Date: Mon, 31 Mar 2008 08:47:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 93
Message-ID: <fsq8e5$a8l$1@fred.mathworks.com>
References: <fsns6q$ke7$1@fred.mathworks.com> <fspubm$iep$1@fred.mathworks.com> <fsq5i9$b92$1@fred.mathworks.com>
Reply-To: "Sven " <sven.holcombe@gmail.deleteme.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1206953221 10517 172.30.248.37 (31 Mar 2008 08:47:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 31 Mar 2008 08:47:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1326470
Xref: news.mathworks.com comp.soft-sys.matlab:460018


"misty m." <donotspam@smth.be> wrote in message
<fsq5i9$b92$1@fred.mathworks.com>...
> ImageAnalyst:
> 
> edges must be find automaticly. these pictures are CT scans 
> of a bone with drilled holes. images from 'the beginning' 
> and from 'the end' of hole aren't so bad, they do not have 
> so many cracks and i've got an algorithm that find edges in 
> them.
> 
> problem starts with images from 'the middle' of the bone - 
> they have a lot of cracks. i tried some filter but as i 
> posted before nothing helps.
> i put few more pictures: http://test-bone.pl.tl/
> 
> what do You think of them?
> 
> 
> Vihang Patil:
> 
> shame to say but i do not know how :| as i look at  matlab 
> help it is written for example:
> I  = imread('circuit.tif');
>        rotI = imrotate(I,33,'crop');
>        BW = edge(rotI,'canny');
>        [H,T,R] = hough(BW);
> 
> so at first i need to 'edge' image.. 
> but maybe i should read it more carefuly
> 
> 

Hi Vihang,

What is the output that you are looking for?  For example,
it seems that all of your holes are always (very close to)
the same diameter, and always (very close to) perfectly
circular.  Therefore, is your desired output is simply a
[row column] coordinate pair per hole?  This coordinate
gives you the centre of your hole, and from this you already
know the hole radius, such that you don't *necessarily* need
to find the hole edges.

The following blog gives a few very useful examples of how
you can find round objects in an image:
http://basic-eng.blogspot.com/2005/10/detecting-objects-shapei-round-object.html

There are other topics as well that you will find useful.

I think that one common point that people are making for you
is this:
It is very difficult to simply find the circle *directly*
from the raw images that you have posted to web.  However,
there are quite a few processing steps you can take to make
it much easier to find the circular holes.  Here are a few
of my suggestions:

1. Use the results you get at the 'ends' to help predict
where the holes will be in 'the middle' slices. Perhaps the
holes should not move more than a certain distance from one
slice to the next?  Using this, you can narrow your search area.

2. Theshold.  It may just be a trick of the light, but it
seems that the holes themselves are *slightly* blacker than
the soft parts of the bones. Maybe if you threshold
(newImage = oldImage<threshold_value) very close to this
'black', you will be able to reduce the input to just a few
blobs.

3. bwmorph.  If the above thresholding can't produce perfect
circles, I bet its result can be improved by the following:
- You know the hole radius (maybe, say, 8 pixels)
- If you first threshold for the black regions, and then run
an "erode" morph of, say, 5 pixels, you will clear away any
of the non-hole black areas.

4. Filters.  As some other posters have mentioned, some
averaging filters can transform your raw image into another
image that is easier to run detection algorithms.  You say
above that you've tried filtering and "nothing helps".  It
is true that there is no such thing as a "black circle in an
image with other black cells" filter, but many of the
filters *will* help to transform you image, step by step,
into one that becomes easier and easier to work with.

Hope this helps.

Cheers,
Sven.