11
$\begingroup$

orange

This was the image obtained after Gabor filtering... Is there some way of removing the lines inside the image except the bright white rounded defect.

Did try another orientation of gabor filter go the following result:

enter image description here

After thresholding :Which is ok enough but not great

enter image description here

After Median filtering:

enter image description here

Thanks in advance

$\endgroup$

migrated from stackoverflow.com Jan 16 '12 at 23:50

This question came from our site for professional and enthusiast programmers.

  • 2
    $\begingroup$ Good job with the median filter. You're well on your way. $\endgroup$ – Rethunk Jan 15 '12 at 17:47
  • $\begingroup$ This seems like a good scenario for applying a diffusion filter. Also, try asking in:<br/> dsp.stackexchange.com/<br> photo.stackexchange.com/<br> $\endgroup$ – Danny Varod Jan 15 '12 at 18:37
  • $\begingroup$ Did you apply the median filter after the threshold? If so, try it without the threshold. $\endgroup$ – Danny Varod Jan 15 '12 at 18:43
  • $\begingroup$ Yes i tried it after the the thresholding and i got almost the same result when i did it before as well $\endgroup$ – vini Jan 16 '12 at 1:52
12
$\begingroup$

If the output of your Gábor-filter is reliable and the variation in your image-data is not so high that the outcome looks completely different, then you can use the following approach (parts of it where already mentioned):

  1. Binarize your second image with any automatic thresholding algorithm. The range of thresholds which will work is large as you will see.

  2. Use a component labeling algorithm to label each connected region of pixel with a unique value.

  3. Calculate for every component of your image a property which describes, how close your object is to a filled circle. For this, you can use for instance the compactness. I used below the fraction of pixels within the equivalent disk radius. This radius is the radius a disk with the same area as your object would have.

    1. Area is simply counting the number of pixels of your object
    2. Calculating the radius of a circle given its area should be manageable too
    3. For the pixel inside this radius, you need the center of each image object, but this is just the mean of all positions of the object-pixels. If you are a physicist then you know the center of mass of several point-masses. This is equivalent.
    4. Now you calculate for every pixel of each object the distance from its center and check whether or not it is smaller then the circle radius. Dividing the two numbers and you get the fraction of inside and outside pixel.
  4. Take the object with the highest fraction. Note: objects with only one pixel will get a value of 1. So you should set a size-threshold and take only objects larger, say 10 pixel.

To see, that an automatic binarization should work, here are the results for a very low and a very high threshold:

enter image description here enter image description here

Update Component Labeling

The choice of the component labeling is not critical for your application. I would suggest, if you have to implement it by yourself, to use a very simple method. The one pass version from the Wikipedia site is very easy. Basically you iterate through your binary image and when you meet a pixel which is white and is not already labeled you use a new label to for this object and start with this pixel.

The process of labeling this object with a label is basically similar to a flood fill. This is on the Wikipedia-site the inner steps 1-4 in the algorithm. You start with this labeled pixel and put all its neighbors on a stack (they used a vector). For a pixel on the stack you check whether it is foreground and not already labeled. If you have to label it, you put again all its neighbors on the stack. Do this until your stack is empty.

Then you continue your scan through the image. Unlike the description on the Wiki-site, you don't have to remove a pixel from your original image, you just skip when you have a value different from 0 in your label-image.

$\endgroup$
  • $\begingroup$ what compnent labelling algorithm ae you reffering to over here? $\endgroup$ – vini Jan 16 '12 at 14:31
  • 1
    $\begingroup$ @vini, I updated my post. Phonon, thanks. We use a lot of morphological measures and especially compactness was very useful a while ago. $\endgroup$ – halirutan Jan 16 '12 at 18:53
  • $\begingroup$ yup great got it :) $\endgroup$ – vini Jan 17 '12 at 1:49
6
$\begingroup$

A few ideas:

  1. Filter out edges based on density of edge strengths. Using an approximation of a circular kernel, find the mean edge strength (or some other measure). Pass through any edges at or above the threshold value, set to black any edges below the threshold.
  2. Use a morphological "close" operation (dilate followed by erosion) to clean up the image, then use a region labeling algorithm (a.k.a. connected component, blobs) to find all blobs. Filter the blob data according to size, ratio of major to minor axes, etc.
  3. Try Gaussian blur, find a binarization threshold to segment light from dark, and then filter blobs as described in step 2 above. (For a quick approximation of a Gaussian blur, squeeze your eyelids mostly shut and squint at the image.)
  4. Try a few filters in Photoshop or GIMP.

EDIT: after your median filtering step, you're most of the way there. Good job! Item 2 that I suggested above (close, then region labeling) is one technique to take you the rest of the way.

$\endgroup$
  • $\begingroup$ yup will try that will let u knw what happens $\endgroup$ – vini Jan 16 '12 at 13:58
1
$\begingroup$

You can try active contours. Although it maybe slow, it can handle complicate case like this.

Or you can use some prior knowledge to process this image. For example, you know that blob thing is 'big' and 'connected'. Thus when you count the number of each connected region, you can find it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.