Skip

How to: make a microscope from a webcam
August 9, 2013 8:58 PM   Subscribe

Create a high-powered microscope from a cheap webcam by following Mark's simple step-by-step instructions. Because your microscope is connected to your computer, you can save and share your images easily.
posted by nickyskye (26 comments total) 52 users marked this as a favorite

 
cooooooooooooooooooooooooooooool
posted by blue t-shirt at 9:18 PM on August 9, 2013 [1 favorite]


on second thought, this may be more neat-o than cool
posted by blue t-shirt at 9:19 PM on August 9, 2013 [2 favorites]


This should make Chatroulette more fun.
posted by goethean at 9:19 PM on August 9, 2013 [4 favorites]


This should make Chatroulette more fun.

Now that is some seriously low self-esteem.
posted by srboisvert at 9:25 PM on August 9, 2013 [22 favorites]


Figured this would be the ol' "lens flip trick," which is a well known technique in photography for doing macro closeups. The wider the angle of view is normally, the more magnified it will be upon flipping. Webcams, being extremely wide angle, would make a good candidate, although it's clear that the cheap plastic lenses are quite prone to chromatic aberration (color bleeding at the edges of objects.)
posted by ShutterBun at 9:43 PM on August 9, 2013 [4 favorites]


I always do a double take when I read or hear "torch". I’m not sure I want to get involved in a project that requires a torch.
posted by bongo_x at 10:15 PM on August 9, 2013


1) Would you get better results from a higher resolution camera? Or is it due to the low resolution that makes it that much better? Or is resolution irrelevant?

2) Speaking of chromatic aberration, are there some sort of filters one could apply to filter that noise out? That's the thing that bothered me the most - I mean, of course, you're not gonna get massively awesome results from a cheap webcam, but I bet you should be able to get better results than mere hardware hacking.

3) What about some sort of lens to pre-filter instead of post-processing? Probably not, but maybe?
posted by symbioid at 10:37 PM on August 9, 2013


Would you get better results from a higher resolution camera?
At some point the resolution of the lens is the limiting factor. Webcams seem to be getting better and better lenses, so you would have to do some experiments to find out. If you don't already have a webcam, I'd look for something cheap and old on eBay to start with.
Speaking of chromatic aberration, are there some sort of filters one could apply to filter that noise out?
Yes, that is pretty much how Hubble was fixed. It isn't necessarily something you would be able to do in Photoshop, but if you are reasonably handy with a modern programming language, you should be able to write a filter that fixes images for your camera. Some calibration will be required.
What about some sort of lens to pre-filter instead of post-processing?
Cheaper lenses have fewer elements. More expensive lenses have more elements. The extra elements aren't there to drive up price, they are there to correct the image under various failure modes of the simpler version of the lens. The out-of-production Nikon Noct and the insanely expensive Leica Noctilux are extreme examples of this. Those two lenses were designed for low-light photography, so they let in more light and are more tolerant of point light sources. The Leicas are as expensive as they are because they degrade the image quality in a way that is visually pleasing.
posted by b1tr0t at 10:49 PM on August 9, 2013 [2 favorites]


Here's a dude who made a DIY Scanning Electron Microscope :)
posted by symbioid at 10:57 PM on August 9, 2013 [1 favorite]


Here's a dude who made a DIY Scanning Electron Microscope yt :)

That is totally awesome. But looks like more work than turning a lens around in a webcam.
posted by aubilenon at 12:18 AM on August 10, 2013


What ShutterBun said.

One of the really extra cool parts of the massive emergence of digital imaging technology is how nice it sometimes works with very old glass.

A guy I work with bought a couple of lenses deemed to be made to an absurdely high spec in East Germany during the Cold War. Yeah, I'm pretty sure it was hooey, but the one lens just works. It's tiny, but it puts out gold.

I've seen pictures taken from a lens from a salvaged brownie camera hot glued to a much less older, yet still technically old iphone that looked spectacular, they shouldn't be to hard to google.

This particular technological convergence is going to be really fun to see/experience firsthand.
posted by Sphinx at 12:55 AM on August 10, 2013 [1 favorite]


I really can't wait to be done travelling for the summer so I can start playing with the Raspberry Pi camera board....
posted by kaibutsu at 1:11 AM on August 10, 2013


As observed, this is very reliant on lens quality for real definitions of "high powered". A few years ago I priced a 100x, 0.7 NA, apo microscope lens for the Nikon 'scope I was using at the time, and you weren't going to get change out of $6k. I decided to just stick with the 40x, 0.4 NA lens I had been using up to that point since my experience is that beyond about 40x people inflate their resolution figures to justify the high prices while working distance and focal depth suffer just as much as you'd expect. Only exception I've encountered was a confocal, and I shudder to think what they paid for the optics.
posted by memetoclast at 5:45 AM on August 10, 2013


I always do a double take when I read or hear "torch". I’m not sure I want to get involved in a project that requires a torch. - posted by bongo_x at 1:15 AM

(s'OK - the article is from the BBC, they mean the BRITISH "torch", what we call a "flashlight". Perfectly safe.)
posted by AsYouKnow Bob at 7:41 AM on August 10, 2013 [1 favorite]


I know it's not as much fun, but why wouldn't you go out and buy a usb microscope? So far the image quality of the ones I've looked at wasn't great, but the one made from a webcam isn't great either.
posted by sneebler at 8:07 AM on August 10, 2013 [1 favorite]


I know it's not as much fun, but why wouldn't you go out and buy a usb microscope? So far the image quality of the ones I've looked at wasn't great, but the one made from a webcam isn't great either.

I think the narrator starts his video off talking about the fun of making stuff, hacking, recycling. It might also be useful to know in places where there might be old webcams but no money to buy a cool USB microscope?
posted by nickyskye at 10:00 AM on August 10, 2013


memetoclast - I'm surprised a 100x / 0.7 objective would be $6k. Nowadays, I can get a 100x/1.4 Plan Apo for around $5k, I think.

For everyone else: a primer on microscope objectives:

In addition to the magnification of the objective, the other critical specification is the numerical aperture (NA) - that number after the slash above. The numerical aperture measures the light gathering power of the objective (strictly speaking, it's the sine of the largest angle the objective can collect, times the refractive index of the sample) and it's related to the f-number of a lens. The NA is important because it controls how much light you can collect, so how bright your image will be, but more importantly it controls the resolution of the objective. A low NA objective has a low resolution so even with high magnification, your images will be blurry. A high NA lens allows you to capture sharp images of small objects.

The focal depth shrinking with increasing NA can be good or bad. What's good about it is that it allows you to resolve objects at different heights in your sample, so you can get Z-resolution and generate 3D images of objects. The shrinking working distance at high NA is a direct consequence of capturing these large angle rays. To do so far away from the sample would require an objective with a large front lens, which would make it even more expensive. For example, we work with a Nikon 40x / 1.15 NA water objective that has 600 microns of working distance. It's about $15k. By comparison, a 40x/1.3 oil lens with 100-200 micron working distance is ~$5k.

For more info, see these pages at MicroscopyU.
posted by pombe at 11:46 AM on August 10, 2013 [3 favorites]


If you have a phone with actual push-buttons on it, don't look at the buttons under magnification. Trust me on this.
posted by StickyCarpet at 7:13 PM on August 10, 2013


Neat.
posted by homunculus at 10:51 PM on August 10, 2013


Thanks for this, very cool. It'll be a nice little project to try.
posted by abecedarium radiolarium at 12:13 PM on August 11, 2013


b1tr0t: Speaking of chromatic aberration, are there some sort of filters one could apply to filter that noise out?

Yes, that is pretty much how Hubble was fixed. It isn't necessarily something you would be able to do in Photoshop, but if you are reasonably handy with a modern programming language, you should be able to write a filter that fixes images for your camera. Some calibration will be required.
That's not correct. Chromatic aberration means that the red, yellow, green, blue, and indigo portions of the image cannot all be in focus at the same time, and may even be slightly offset from each other (at least, that's a reasonable layman's explanation). No filter can fix this.

Hubble's problem was not chromatic aberration, but an incorrect shape of one of the mirrors (which caused spherical aberration, an achromatic error). Because of this, it could never be focused as well as it was designed for. To correct it, two new lens elements were added to the entire assembly that corrected the light rays back to where they should have been - but it wasn't a mere filter; it was incredibly high-tech lenses (or possibly mirrors - I'm not sure).
b1tr0t: More expensive lenses have more elements. The extra elements aren't there to drive up price, they are there to correct the image under various failure modes of the simpler version of the lens.
Also incorrect. They don't correct failure modes; they keep the image in good focus over a wider range of inputs: sharper at the corners, or when fully opened up (such as at f/2.0 or less), or with lower aberrations that degrade sharpness in more complex ways.

Optical engineer here (although now I work in software).
posted by IAmBroom at 12:19 PM on August 11, 2013 [2 favorites]


I suppose you could sorta correct for chromatic aberration by using a deep red filter, and treating it as a monochromatic system, which would at least somewhat reduce the effect.
posted by ShutterBun at 2:56 PM on August 11, 2013 [1 favorite]


Also incorrect. They don't correct failure modes; they keep the image in good focus over a wider range of inputs: sharper at the corners, or when fully opened up (such as at f/2.0 or less), or with lower aberrations that degrade sharpness in more complex ways.

Wouldn't "reduced sharpness at the corners" be a failure mode which a compound lens is intended to correct?
posted by ShutterBun at 2:57 PM on August 11, 2013


Chromatic aberration means that the red, yellow, green, blue, and indigo portions of the image cannot all be in focus at the same time, and may even be slightly offset from each other (at least, that's a reasonable layman's explanation). No filter can fix this.
Chromatic aberration is just another way of saying that the focus problem is frequency dependent. It is very easy to transform a signal into the frequency domain and apply frequency-specific filtering digitally. So I don't buy your claim that "no filter can fix this."
They don't correct failure modes; they keep the image in good focus over a wider range of inputs: sharper at the corners, or when fully opened up (such as at f/2.0 or less), or with lower aberrations that degrade sharpness in more complex ways.
This is another strange objection. Poor focus across the image field is one possible failure mode, but so are chromatic aberration and spherical aberration. The two lenses I cited are famously out of focus except at the center of the image. Unlike typical lenses, they were designed to avoid chromatic aberration from point sources of light at night, and degrade focus smoothly away from the center. So I stand by my claim that additional lenses are used to correct for various failure modes. Focus is one of those modes, but not all applications place focus at the top of the priority list.

My recourse to authority is that I'm a talking turtle.
posted by b1tr0t at 5:08 PM on August 11, 2013


b1tr0t: Chromatic aberration is just another way of saying that the focus problem is frequency dependent. It is very easy to transform a signal into the frequency domain and apply frequency-specific filtering digitally.
Red light, the lowest frequency of visible light, is at 5e14 Hz.

You provide the "very easy" digital filter that's going to work at petahertz and we'll talk. Check Radio Shack; IIRC they have a sale on subatomic transistors...

As for your other defenses, it sounds like you're using a different definition of "failure mode" than I am. Optical aberrations aren't failures in and of themselves; they contribute to error budgets, and rarely act alone (I guarantee you Hubble had more aberrations than simply "spherical aberration", but that may have predominated - and has a handy name, which Z14 does not).
posted by IAmBroom at 10:38 AM on August 13, 2013


IAmBroom: Well, doing things like shrinking the blue channel and enlarging the red one is basically what b1tr0t is describing. It's not perfect but you can get pretty far without doing anything real complicated.
posted by aubilenon at 11:38 AM on August 13, 2013


« Older "MI5 trained a specially bred group of gerbils to...   |   Man creates own credit card... Newer »


This thread has been archived and is closed to new comments



Post