Sciencemadness Discussion Board

Need machine vision camera

Quince - 1-2-2006 at 22:59

I need a machine vision camera (digital) that can output raw (unprocessed and uncompressed), 10 bits or better, monochrome is OK (non-demosaiced Bayer if color), at least VGA resolution. Sensor quality and ADC linearity are my main concerns, as well as reasonable light sensitivity, so I can minimize the exposure times for dim sources (I plan to be photographing a scintillation screen to capture X-ray projections). Obviously, an SDK should be available so I can use the camera in my software. I prefer a used camera due to the price issue. I missed one such camera on eBay that auctioned for $170 US a couple of months ago; I'm willing to spend up to $250 depending on the specs.

Polverone - 1-2-2006 at 23:47

Canon digital cameras have SDKs available for free; you just need to sign up through a short online form IIRC. You should be able to get a RAW file that has the unprocessed sensor information at 10+ bits depending on the camera model. I'd suggest signing up for the SDK first and then picking a camera, as I seem to recall that SDK-available capabilities varied between cameras (read the docs). I'm sure you can find a used Canon digital camera for under $250, and of course the resolution will be much higher than VGA.

I don't know how ADC linearity and sensor quality are. You won't be able to acquire multiple images in a very short timespan. If you don't think that consumer digital cameras are up to it, you might want to post to sci.image.processing on Usenet as I'm sure there are many more machine vision people there than here.

[Edited on 2-3-2006 by Polverone]

Marvin - 2-2-2006 at 11:25

Good points. If the pixel depth is too low and the object is stationary then multiple images can be integrated to get 10 or 12 bits from 8.

For a lower cost option, something to try that may work, remove the lamp from a scanner, and put the X ray imaging sheet directly on the glass. As the screen is viewed via several mirrors the sensor can easily be protected with a metal foil. Some more foil around the electronics and just scan the images in witht he software they provide...

Quince - 2-2-2006 at 16:45

The scanner won't work as it's a pusled X-ray; I can't run the setup continuously from mere house wiring.
Since I need many projections for tomography, taking multiple exposures would mean a couple of hours to capture a full dataset, during which I'd have to stay out of my room...

Marvin - 6-2-2006 at 11:57

You only need a few watts actual X ray power for a decent image. Depending on the area illuminated. Carl Willis at the fusor.net forums has done a few things with a portable unit you might want to look at.

Running an unprotected X ray device as a CT scanner is a moron solution, build a wooden box, line the inside with lead foil. If you use <30kev rays this will be good sheilding. Test it for leaks.

Quince - 6-2-2006 at 16:25

30 kV is pretty dangerous, as almost all of these get absorbed in a few cm of flesh, not to mention if it hits the eye. That's why medical X-ray tubes often have aluminum plate windows to block low energy photons. A 30 kV leak is more dangerous than the 60-120 kV range I'm interested in.

I don't have enough lead foil, but combining it with thick steel plates, and staying out of the room should be sufficient.

I'm curious what portion of the beam is absorbed by the scintillation screen.

But this project will take a while. The best camera quote I've gotten this far is $1000, including one lens, for a new camera (I didn't find a source for a used one) :(

[Edited on 7-2-2006 by Quince]

Twospoons - 6-2-2006 at 22:16

How big does your scintillation screen *need* to be? I ask because there are x-ray cameras already available from companies like Hamamatsu. These are basically a CMOS image sensor coated directly with the scintillator. Used in modern dental x-ray machines because they're about 100x more sensitve than film.
No idea what price though ...

Quince - 6-2-2006 at 22:51

I don't see how anything larger than the sensor can be imaged. That's a severe limitation. My scintillation screen is about 17 cm by 40 cm.

Quince - 21-2-2006 at 05:17

Well, I've found nothing under $500 this far (only new cameras). In sci.image.processing I got no replies, the bastards.

Marvin - 23-2-2006 at 18:07

"A 30 kV leak is more dangerous than the 60-120 kV range I'm interested in."

This makes no sense. For 20 - 30kev region you can get away with a couple of layers of lead flashing for roofs. The point is to stop it, not gawp while you get sunburn.

100kev region will require several centimeters of lead for reasonable sheilding. Steel will not be useful, iron has a low Z and thus has no absorbtion bands for high energy X rays. It is inefficiant, even for an equivalent mass. You need lead, or bismuth or depleted uranium.....

Quince - 23-2-2006 at 23:27

100 keV has less absorption in the body. Much of it will go through.

Marvin - 24-2-2006 at 10:16

You are guessing.

100kev will be about half absorbed in the first 4cm of flesh, half the remaining in the next 4cm. By moving to 100kev you save less than half, but you cripple your ability to sheild easily.

Worse than that, this assumes you put the same total energy into the X rays. For a given picture you need the same number of impact photons to get the image, so the total dose is a factor of three higher, canceling out any gain due to poorer absobption in the body. Oh! But whats this? The sheet you are detecting with will also have poorer performance , so you need more photons being produced in order to have the same number of hits.

The reduction in absorbtion by human tissue is more than canceled out by other factors, but the move to 100kev ish does make it very very hard to sheild. The materials your house is made of will be of no help at all.

Quince - 28-2-2006 at 01:06

You better correct this Wikipedia article then, as it says up to 200 kV penetrates tissue no more than 5 mm: http://en.wikipedia.org/w/index.php?title=Superficial_X-rays

And then from http://www.sprawls.org/ppmi2/RADPEN/
Quote:
photons with energies less than approximately 40 keV. These are the photons with a low probability of penetrating a typical patient and contributing to image formation. They do, however, contribute to patient exposure.


And from http://www.utoronto.ca/safety/RadTraining/Module10.htm
Quote:
Diagnostic rays are designated for tissue penetration and are carefully filtered to avoid X-ray damage to the skin caused by the longer, more readily absorbed wavelengths.
<-- 1 to 3 mm Aluminum filter depending on kV

So the fact is that to image well a thick piece of flesh, you need higher kV. A collimator minimizes the amount of shielding needed.

ALSO, MODERATOR, WHY DOES IT STILL SAY I'M ON PROBATION???

[Edited on 28-2-2006 by Quince]

Marvin - 2-3-2006 at 22:00

Well, we could believe a wikipedia article that was changed to add that faulty data just 3 days before your post. Or we could look at something reliable.

"The Australian Radiation Protection and Nuclear Safety Agency " website on X ray safety.

http://www.arpansa.gov.au/basics/xrays.htm

Which backs up virtually everything Ive said. It does seem to indicate half a centimeter or so of lead sheild might be ok for 100kev, I'm uncertain if they are talking about impacted photons with reduced energy or total removal. Either way, lead is slightly better than I expected, concrete is a lot worse. Lead Foil is not good enough unless it can be layered to similar thickness.

"A collimator minimizes the amount of shielding needed."

Wrong again, as stated on that website about 1/3rd of the X rays bounce off the object typically and your beamstop will glow in the X ray region with a significant fraction of the power in the beam even if your target doesn't. The sheilding you need is not significantly reduced.

Quince - 2-3-2006 at 22:03

A significant fraction? 1/3 is a small fraction. Squared-falloff with distance is an even bigger attenuator (for small target, which I'm assuming).
The wikipedia articles have logged history of edits.
I also put more weight on the second article I quoted. Maybe you should address that.

By the way, your own reference defeats you:
Table 2
Dianostic X-rays, CT: Accelerating potential 80 - 140 kV giving average photon energy 60 keV


[Edit:] Rudeness removed.

[Edited on 3-3-2006 by Quince]

Marvin - 2-3-2006 at 23:13

I see, Your the one part way through building a machine that will give your whole family lukaemia on the unchecked assumption that 100kev photons will pass right through people without doing any damage and *I'm* the idiot?

On my 'self defeating reference', sure. You want to build a whole body CT, you'll need 60kev X rays and sheilding right round the room to match. Thats what it says on the page, thats what you'll need.

Of course if you don't want to CT a whole person....

"I also put more weight on the second article I quoted. Maybe you should address that."

Yes, and the quote is out of context unless, again, you are taking an image of a large living animal. In those circumstances its absorbed dose for a given quality of image. If you are X raying something inanimate everything on that page supports what Ive said allready and it contains data that contradict all your assumptions about sheilding, though most of the graphs do end before the 100kev energy you wanted to use. I guess you'll crayon those in after printing them out right?

"A significant fraction? 1/3 is a small fraction. "

Do the math. If you can reduce the dose to 1/3rd that saves less than 0.2mm on your sheilding. Will you even be making your sheild to an accuracy better than that? Factor of 3 lower dose is useful in certain ranges, but the sheilding you need is not significantly reduced, exactly as I said.

"for small target, which I'm assuming"

Oh right, the small target you won't need 100kev for, or even the full 60kev sort of energy they use in whole body CT machines? That small target. I guess you could use lower energies that are sheilded more easily with lead foil, or did I suggest that allready?

The funny thing is, I think you won't get as far as producing a 3D image with this setup even if it works. I think you'll hit the problem with multi angle fan projections applied to fourier slice theorum and give up. I think at best you'll end up using the 90 degree fan projection the medical CT scanners use and your image would be best captured with a linear rather than area sensor, say for example a home desktop scanner! Now wouldn't that be ironic if I hadn't actually thought that far ahead at the time I suggested it. Another pearl cast.

Oh, incidentally the X ray beam will also be scattered by the air, the term for this is 'Sky shine'.

Quince - 3-3-2006 at 00:04

Who's using Fourier slice? I'm using SART reconstruction for cone beams per Mueller's paper. I need only as many projections as about 2/3 the horizontal voxelgrid resolution, and it's quite tolerant of noise and such. He also gets rid of the non-uniform sampling artifacts of a cone beam by stretching the Kaiser-Bessel filter based on ray density. I already have the software implemented and optimized because I had to do it for an optical project (glass object geometry acquisition immersed in colored fluid with matched refractive index; since it's in a cylinder that refraction is known and so are the raypaths).

I'd never have even considered the X-ray project if I had to do scanline based. Instead, I can just use a turntable with stepmotor and just take projections from a bunch of angles.

I am sorry I called you an idiot, though, that was unreasonable.

As for target, I don't want to limit to flesh. I want to image such things as defects in soldering, and cracks in materials.

Air scattering? Sure, but the scattering attenutates even more because it increases the mean path length of the photon.

[Edit:] Here are Mueller's papers: http://www.cs.sunysb.edu/~mueller/research/ct.html
The one I was referring to is http://www.cs.sunysb.edu/%7Emueller/papers/ieeeCone.pdf
In another paper he implements it on GPU, but I didn't bother as it limits flexibility in my optical project to consider cases of some refraction mismatch. Also, you can't use the high quality filter, and multithreading it on my dual core Xeon made it fast enough anyway. I get a few hrs for 512^3 grid and 360 images, 3 iterations over all images. 256^3 is a matter of minutes. Not nearly as fast as Fourier methods, but you can work with sparse and crappy data.

[Edited on 3-3-2006 by Quince]

Marvin - 3-3-2006 at 20:24

I have to admit the cone based reconstruction does look very feasable with the hardware you are planning on. I'm really not a fan of the whole guess, calculate error, modify guess, convergent method, it does solve the problem.

I do not think the resolution will be enough to see small cracks, I also think for solder defects a simple X ray will do fine, pushing this into CT will make your X ray and sheilding requirements insane. If you were to stick with imaging household electrical items and the odd frozen fish this would potentially be a much safer project.

Quince - 3-3-2006 at 20:33

Frozen fish? I was going to say the cat, but...

Algebraic methods are more general than Fourier slice ones. I've seen a paper where they get amazing results of tomography of binary densities (metal defects) with only 7 projections. It is very easy to add a priori information to the error function you're minimizing. Check out this paper:
http://www.iop.org/EJ/abstract/0022-3727/32/19/306

BTW, I still haven't found any source of camera. I can't seem to find a quote for a digital machine vision camera even with just monochrome VGA that's under $500.

[Edited on 4-3-2006 by Quince]

Quince - 6-3-2006 at 19:32

Is it very hard to convert a microscope camera for such a use? Or is something like aligning a different lens too much trouble?

[Edited on 7-3-2006 by Quince]

Polverone - 6-3-2006 at 19:48

Quote:
Originally posted by Quince
BTW, I still haven't found any source of camera. I can't seem to find a quote for a digital machine vision camera even with just monochrome VGA that's under $500.

Did you look at the Canon consumer cameras? Were they unusable for some reason? It doesn't seem like you need industrial ruggedness or video frame rates.

Quince - 6-3-2006 at 20:30

I'm asking about the microscope camera as I found a nice one for $200.

I'm wary of consumer cameras due to my concern for very high quality ADC and optics.

[Edited:] Corrected DAC to ADC as Polverone pointed out.

[Edited on 7-3-2006 by Quince]

Polverone - 7-3-2006 at 03:36

High-quality ADC, you mean? I think you gave up on that route too easily. You're more interested in quantitative image information than most users, but consumer-level cameras can be pretty impressive nowadays. I would bet that there's a consumer camera with adequate sensor/ADC quality out there, and as for the optics, the alternatives are so much more expensive and/or difficult that you should just try the consumer stuff first. I would imagine that some optical flaws are worse than others here; an image that shows vignetting will be more troublesome than one that is uniformly a bit soft. Some flaws might be corrected in software if they can be characterized from test images (which seems right up your alley). Really, I think you must try before you buy, and that will be easier with consumer cameras than anything else. Don't you know anyone who owns a digicam? Does your university have a media department or equipment center that will loan cameras out to students?

Quince - 10-3-2006 at 01:01

How would I choose among the Canon cameras? I can't find any listings on the details I'm interested in, such as what camera has how many bit ADC, or the response curves, or how good the exposure control is.

And for these cameras, is the aperture adjustable? It is insufficient for me if I can only change exposure time.

BTW, I just got to the SDK downloads, and there are a bunch of SDKs, some of them listing the same cameras, and I can't figure out which one I'm supposed to use WTF

[Edited on 10-3-2006 by Quince]

Polverone - 10-3-2006 at 18:29

According to this maker of RAW conversion software, the Canon G3, G5, G6, S45, S50, S60, D30, D60, 10D and 300D have 12 bit RAW and the G2, S30 and S40 have 10 bit RAW. The aperture is adjustable on all these cameras. I suggest you go to dpreview.net and reading reviews of the cameras. There will be a lot of information you don't care about, and not everything you do care about, but they often discuss image quality issues like noise, low-light performance, chromatic aberration, sharpness, and vignetting in at least a qualitative fashion (and with visual examples). When I did some more reading, I found that Canon cameras apparently already come with software that allows you to control the camera and take pictures via a PC tether cable, so you probably don't need to touch the SDKs at all.

I'd suggest an older camera with 12 bit RAW, since you probably don't need super-high resolution and there will be a larger used market with better prices. The G3, for example, has 12 bit RAW, very favorable reviews, and an ebay "buy it now" price as low as $225. I couldn't find a response curve for it online with a couple minutes of searching, but once you've found a camera that looks acceptable in every other way, you can determine that yourself.

Quince - 10-3-2006 at 22:22

Yes, I can just use hdrshop to get the response curve from multiple exposures. Thanks for your help.
By the way, by RAW you do mean the non-demosaiced Bayer filter pattern image, right?

The one remaining problem is transfer speed. These cameras are USB1.1, so that means quite a few seconds to transfer just one RAW image. It seems only very new cameras use USB2, and only very high end ones use Firewire.

[Edited on 11-3-2006 by Quince]

Polverone - 11-3-2006 at 01:41

Quote:
Originally posted by Quince
Yes, I can just use hdrshop to get the response curve from multiple exposures. Thanks for your help.
By the way, by RAW you do mean the non-demosaiced Bayer filter pattern image, right?

Yes, that's what I mean by RAW. The RAW file produced by each camera or family of cameras is closely tied to the hardware, and its format is often not completely documented in an open fashion by the camera manufacturer. That's part of why there are so many different programs, supporting different kinds of cameras, to convert RAW to something more standard like 16 bit TIFF. Existing converters offer quite a bit of flexibility so I would think they can do everything you need.

Edit: It looks like there is already free code that will handle quite a few RAW image types, including those from the G3, if you insist on tinkering with the nuts and bolts.

Quote:
The one remaining problem is transfer speed. These cameras are USB1.1, so that means quite a few seconds to transfer just one RAW image. It seems only very new cameras use USB2, and only very high end ones use Firewire.

That is a drawback. Apparently G3 RAW files are about 3.5 MB, so that's not too long if the camera can sustain near-maximum USB 1.1 transfer rates. It also might be possible to shoot faster by storing images to flash memory and retrieving them only after you have finished the series.

[Edited on 3-11-2006 by Polverone]

Quince - 21-3-2006 at 02:57

The problem is I can't use the camera's internal downsampling method as it's far from optimal plus I doubt it can output RAW (unless it has some per-channel binning mode).
How long would it take to transfer one such image? A couple of seconds is OK, more is not.

This sucks, as I'll probably end up waiting till I have a job and spending the thousand bucks for a Prosilica camera.

[Edited on 21-3-2006 by Quince]

Polverone - 21-3-2006 at 12:52

Quote:
Originally posted by Quince
The problem is I can't use the camera's internal downsampling method as it's far from optimal plus I doubt it can output RAW (unless it has some per-channel binning mode).

I don't understand what you're saying. The G3 and those other Canons I've listed do output RAW. Downsampling or other transformations of the raw information will take place on your PC.

Quote:
How long would it take to transfer one such image? A couple of seconds is OK, more is not.

This sucks, as I'll probably end up waiting till I have a job and spending the thousand bucks for a Prosilica camera.

A 3.5 MB image would probably take more like 4 seconds to transfer. That's why I suggested the memory card alternative. Put a flash memory card in the camera and remotely trigger it to take pictures saved to the memory card, so you don't have to face the USB bottleneck. When you're done with an item and time is no longer crucial, retrieve the saved images off of the memory card.

Or if you think it's simpler, just wait until you can spend a lot more on a camera you're more confident in, as it seems you may do.

Quince - 21-3-2006 at 14:56

Quote:
I don't understand what you're saying.

What I meant was transferring a lower resolution image (= faster). Some machine vision cameras have binning modes where they bin several pixels into one, sort of emulating a lower resolution but more light sensitive sensor.

Twospoons - 22-3-2006 at 16:16

USB 1.1 runs at 12MB/s in full speed mode. So 3.5 MB should only take around 1/3 second as a bulk transfer.

Quince - 22-3-2006 at 17:26

That doesn't sound right. It's 12 Mb/s not MB/s, so you're off by a factor of 8. That would make it just over 2 s, but again at full speed. But calculation is one thing, and I'm wondering if it approaches that.

[Edited on 23-3-2006 by Quince]

Twospoons - 22-3-2006 at 21:22

That'll teach me to listen to my workmate and not look it up. If your camera is on a root hub, with nothing else attached, you should be able to achieve close to that speed. Going though multiple hubs will impact on speed.

Quince - 17-5-2006 at 08:08

While I was in the hospital, the radiologist said for the chest X-rays they used 115 kV. But is that accelerating potential or actual photon energy? And does anyone know how to approximate one from the other for any value? I realize it would vary for different tubes, but I'm wondering if they are similar.

Marvin - 17-5-2006 at 20:22

Accelerating voltage. Peak spectral line is probably around the 60kev region. There is no corralation for voltage, only that accelerating potential must be greater. Everything else is mainly intensity and some bremsstrahlung.

Quince - 17-5-2006 at 23:22

The tube I have has a 1 mm aluminum plate as filter. That's very inefficient. Anyone know anything about pulse shaping, so I can have as uniform as possible accelerating potential to monochromatize the emitted spectrum? I've seen designs for pulsed supplies that use large lengths of coaxial cable as blumlein lines for pulse shaping, but I have no clue how to calculate line length and so on. As for doing the actual switching, I have taken out of an X-ray machine (not by me) a pair of high power heatsinked triacs potted in ceramic (AEG T130 N 1200 BOC-17X2, I found no data on these). Anyone have an idea how to drive them?

Marvin, the bremsstrahlung depends on the accelerating potential, and most of the transmitted energy (area under the curve) I see in graphs is under that, rather than characteristic emission, because the characteristics peaks are fairly narrow. So if accelerating potential is increased, I understand the characteristic peaks will remain at the same photon energy and their intensity increase, but the bremsstrahlung should produce higher photon energy. With the right filter applied to the output, all the characteristic peaks could be blocked and only bremsstrahlung can get through. I mean how else to make very hard X-rays, or do they just use different anode materials?

Is there any information somewhere on how emission is proportioned between bremsstrahlung and characteristic peaks depending on configuration?

Without a fairly monochromatic output, tomography is impossible due to differential absorption of various photon energies, and the resulting image will not properly represent densities (unless the sensor is responsive only to a narrow band of X-rays, but I just have a plain scintillation screen).

[Edited on 18-5-2006 by Quince]

Twospoons - 18-5-2006 at 18:19

The velocity factor for co-ax is typically around 1ns per foot, so you need roughly 1 foot of coax per ns of pulse width.
The transmission line approach can be mimicked by an array of L-C networks, if you don't wish to use 100's of feet of coax. You might also look at "magnetic pulse compression" using saturable inductors for pulse forming.

Are you sure those devices are triacs? I'd have thought thyratrons would be more likely.

Edit: couldn't resist trying a simulation of the L-C network - results in attached pdf :D

[Edited on 19-5-2006 by Twospoons]

Attachment: PULSE FORMING.pdf (203kB)
This file has been downloaded 616 times


Quince - 18-5-2006 at 20:27

One thing is that I have to have the pulse on the primary side of the transformer, simply because the transformer I have is rated for pulse use only and cannot handle continuous mains voltage (regardless of whether there is a load on the secondary). I'm wondering how to compensate for the distortion the transformer makes.

Another concerin is the HV rectifiers. I have ancient GE Kenotrons, though in good condition, I've not yet found what the cathode voltage/current is, so I can build filament transformers for them. Someone suggested to use mechanical synchronous rotary rectifier, but that sounds pretty difficult to build (check this out http://home.freeuk.net/dunckx/wireless/bridge/bridge.html).

Twospoons - 18-5-2006 at 21:31

Would you mind posting a schematic of what you want to build? It would make providing suggestions easier.

What voltage do you need to rectify?

The pulse forming network should work fine on the primary side of your tranny. I would not expect much distortion, so long as the transformer isn't driven into saturation.

Quince - 18-5-2006 at 21:39

There.

tomo.png - 4kB

Twospoons - 18-5-2006 at 23:13

Sorry, I wasn't clear - I meant a schematic of your x-ray power supply.

Quince - 19-5-2006 at 00:17

Well I haven't built it, that's why I'm asking here.

Quince - 20-5-2006 at 05:16

Anyone know where I can get a used anti-scatter grid (that's placed between object and shield to remove photons scattered by the object)? Cheapest new grids I found are above $100.

doomedMacalla - 13-6-2006 at 11:01

And *this* is why you're not allowed to use the new microwave.

Quote:
Originally posted by Quince
100 keV has less absorption in the body. Much of it will go through.

vulture - 13-6-2006 at 13:16

How long can you wait?

Digital SLRs with decent RAW output and USB 2.0 under $500 (body only though, do you need a lense?) might very well be reality after photokina (september) this year.

Sony stepped into the market which is going to put the prices under pressure.

[Edited on 13-6-2006 by vulture]

Quince - 5-7-2006 at 04:37

Hey guys, I took off the grid from an old computer monitor's picture tube. Is this suitable as an anti-scatter grid, or is the pitch too fine or the depth insufficient?

Nixie - 18-5-2007 at 08:12

Hey guys, what determines the resolution of the X-ray system? On the tube I have it says foci 0.8 mm and 1.8 mm. So would that be the size of the smallest feature that can be resolved? I understand that the projected focal spot is smaller than the actual focal spot, but would the numbers on the tube represent the actual or the projected one?
http://compepid.tuskegee.edu/syllabi/clinical/small/radiolog...

[Edited on 18-5-2007 by Nixie]