|
-
Sep 8th, 2011, 07:00 AM
#1
Fitting an almost rectangular block to get the width
Hi,
I have a number of scanning electron microscope (SEM) images of nanowires that we've grown, and I need to measure their thickness. The nanowires are visible as a bright line on a dark background, see below, so we had the idea to scan the brightness of the image (across the wire) and plot it as a graph, which would result in a kind of bell-shape or rectangular block, low brightness at the sides and high brightness in the middle. The width of this block (in pixels) would then be a good indication of the width of the nanowire. I can convert from pixels to nanometers or something easily by using the (known) width of the total image.
Here's an example of a SEM image (scaled down):

Using C# I get the brightness of each pixel in a 'cross section' of the image (so at a certain height or y value), and plotting this produces this:

So, the question is simple... How do I fit a curve through this that I can deduce the width of the wire from? The most important thing is that this width is consistent across different images, so I really like to use a standard non-linear fit, instead of actually fitting a rectangular block. For example I could loop through the pixels (x values) until I find a brightness that is sufficiently higher than the previous brightness and call that the start of the wire, but that is quite arbitrary and might work for some images, but not very well for others. When I got a good fit I will apply the fit across the whole image (imagine scanning the image top to bottom and calculating the width for every height, then averaging them) so this consitency is key.
Anyway, the most obvious choice would be a Gaussian curve fit. This works quite well, and it fits all curves in the same way, but the problem is that I am finding it hard to extract the width from the fit. The FWHM would be the most obvious choice, but it seems it is not very accurate for the actual width. In the image I showed, the FWHM comes to about 101 pixels, whereas the line seems to be about 120-130 pixels when measured using various other manual techniques. This difference (20-30 pixels) is relatively large and will make the widths come out much smaller than the actually are, which of course is not good.
I tried looking for similar curves, but none seem to fit very well. They all have the same problem as the Gaussian fit; they assume the data is bell-shaped, whereas the actual data is more like a rectangle then a real bell shape...
Another thought I had is to manipulate the image to make the contrast between wire and background a lot more pronounced. Probably I could even get the contrast to be 100% (pure black for the background and pure white for the wire) which would make the brightness plots actual rectangles and make it easy to find the width. However, after experiencing some in Photoshop (playing with the Levels of the image) I've found that the width of the resulting wire can change quite a lot depending on how you change the contrast exactly. I managed to take various routes to form a completely black/white image but in all of the routes the widths came out different. So again this is very arbitrary and I'd like to use a more mathematically correct solution...
Any ideas how I can fit this rectangle the best and retrieve the width of the wire from it?
Thanks!
Note: I am not necessarily looking for a way to fit the data in .NET (C#), I can use various maths tools (Origin, Matlab, etc) to do it, but if you know a solution in C# that would be even better
Last edited by NickThissen; Sep 8th, 2011 at 07:05 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|