|
"Sven " <sven.holcombe@gmail.deleteme.com> wrote in message
<fsq8e5$a8l$1@fred.mathworks.com>...
> "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.
>
Here's a starting point for you that illustrates *one*
approach. It worked for me on your first example image.
It's up to you to choose the best method, and adapt it to
suit all your input cases.
I = imread('your_first_image.bmp');
BW = I < 25; % Threshold
se = strel('disk',14); % A disc of 14 pixels, used to wipe
away unwanted pixels
BW_2 = bwmorph(BW,'erode',6); % Blobs that survived the
'disc wipe'
L = bwlabel(BW_2); % A matrix with all separate blobs labelled
stats= regionprops(L,'Area','Centroid'); % Get the area and
centroid of each blob
valid_indexes = [stats.Area] < 2000; % Indexes of blobs that
are less than 2000 pixels (as we expect the holes to be)
stats(valid_indexes).Centroid % The coordinate(s)of the
holes(s) in the image.
----
Note that in the above, there were many steps to 'improve'
the image so it was easier to detect black/white regions.
Pattern detection very rarely works on the original image.
Cheers,
Sven.
|