Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a 2D image as shown here and need to extract the spatial information about the curves in between each cell division. I have been able to analyze the image and output $\;(x,y)\;$ coordinates where the brightest values (1.0) are located in the grid of pixels.

How might I be able to process the image to remove noise (inside the cells) leaving only the lines describing the cell outlines?

enter image description here

share|improve this question

2 Answers 2

up vote 10 down vote accepted

There are a number of nonlinear filters that are possible. One that might help is the RidgeFilter

img=Import["http://i.stack.imgur.com/IyUPZ.jpg"];
ImageAdjust[RidgeFilter[img, 5]]

enter image description here

Let's now clean it up a bit:

Pruning[Thinning[SelectComponents[Binarize[ImageAdjust[RidgeFilter[img, 5]], 0.094], 
        "Count", # > 800 &]]]

enter image description here

The above binarizes the output of the ridge filter. This leaves the desired edges plus some junk in the middle. SelectComponents then removes all the small components, leaving just the desired edges. The result contains the edges but they have become fat; the Thinning function trims them down. The final pruning (as suggested by halirutan) removes a couple of dangling edges.

share|improve this answer
    
Thank you for the assistance. This is exactly the push I needed! –  rjd Nov 26 '13 at 14:38

Common functions you should look at are EdgeDetect, Thinning and Pruning. With the already mentioned RidgeFilter this gives

img = Import["http://i.stack.imgur.com/IyUPZ.jpg"];
border = Pruning[Thinning@Closing[EdgeDetect[
  ImageAdjust@RidgeFilter[img, 7], 1], 5], 500];
ColorCombine[{img, img, border}]

Mathematica graphics

share|improve this answer
    
What about doing an initial TotalVariationFiltering with Method->"Poisson"? –  UDB Nov 20 '13 at 11:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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