Message Boards Message Boards

4
|
7010 Views
|
6 Replies
|
10 Total Likes
View groups...
Share
Share this post:

How to remove dark ring from microscopic image

Posted 11 years ago
I am analyzing images of insects taken through a microscope. The dark ring around the edges certainly complicates the work; so I'd like to begin by removiing it. But, in these images the lighting is uneven and the intensity of the specimen is surprsingly close to that of the dark background I want to eliminate. I'm sure many others have solved this problem before, and I would appreciate your help. I'm attaching one sample  to provide some context for the problem.

Thanks In advance,
Ed 

POSTED BY: Ed Komp
6 Replies
You can remove that dark edge by using ImageApply and a mask:
bug = Import["bug.png"];

ImageApply[1 &, bug, Masking -> Graphics[Disk[]]]
POSTED BY: Arnoud Buzing
Another approach to get a mask that is better aligned with the region-of-interest, and works even if the disk-of-interest is not exactly in the center of the image is to do a region growing segmentation from the four corners of the image.

corners = {{0, 0}, {0, 300}, {300, 0}, {300, 300}};

mask = RegionBinarize[bug, corners, .15]

ImageApply[1 &, bug, Masking -> mask]





Notice that in comparison, all the bug is still present in the masked image. You may apply a small dilation to the mask to get less of the black background:




Hope this helps,

  -- Shadi
POSTED BY: Shadi Ashnai
Hi Ed,
My first post here. I have processed images similar to yours, albeit with cells using a technique called interference reflection rather than with insects. My challenge was to increase the perceived contrast within the cells. My approach then (in 2008) was to apply a 3x3 low pass filter with a 41x41 high pass filter. This generated good contrast, removed uneven illumination and removed the dark space due to the aperture. You do, however, generate a thin line along the edge of that space. I'm away from Mathematica atm, but I reckon you should get some mileage from the LaplacianGaussianFilter. You are effectively generating a bandpass filter and the size of the low and high pass kernels define the band pass.

HTH,

Mark
POSTED BY: Mark Holt
Posted 11 years ago
Arnoud,

Thanks so much !
Your solution is as effective as it is short and clear.
I am glad that I asked.

Have a great day.

Ed
POSTED BY: Ed Komp
Posted 11 years ago
Mark,

Thanks for your post.
Arnoud's solution that follows directly answered my specific question.

But, your post will be most helpful as I proceed -- trying to handle uneven illumination.

Ed
POSTED BY: Ed Komp
Hi Ed,
Arnoud's solution is a nice trick I wasn't aware of and whilst I didn't think my answer would be exactly what you were looking for I'm fairly certain you'll be stunned at the level of detail in your image that can be extracted using my suggestion. You might want to combine both approaches in order to remove the artefact that mine generates.

All the best and good luck!

Mark
POSTED BY: Mark Holt
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract