4

I have a need to take an image of a series of glass test tubes, and automatically give an indication of either the level fo liquid in the tubes or the point at which the liquid reaches the bottom of the tubes. The image would probably be gathered by a webcam and processed on a standard PC. I have no restrictions on language or method, but I'll have to learn whatever it is.

I've found these more general questions on Vision on SO;

Does anyone know of any similar projects that are well documented that I could review, or other ideas / comments.

Community
  • 1
  • 1
PaulHurleyuk
  • 8,009
  • 15
  • 54
  • 78
  • Are there more obvious ways of doing this like monitoring weight, resistance etc or is this a way to play with computer vision? If so make sure that you have good contrast between the liquid and the background so that you should be able to segment the image easily. – pjp Sep 23 '09 at 12:30
  • There might be other ways, but my restrictions are that I will have multiple tubes (around 12-24), the liquid will be clear and needs to stay contamination free (one current solution it to sense the liquid level using a resistance probe that moves, but it's slow and causes contamination headaches...) – PaulHurleyuk Sep 23 '09 at 12:32
  • 2
    The first thing I thought when reading your question was that I'd like to see that for the coffee machine, sending an alert to me when there's only one or two cups left... – OregonGhost Sep 23 '09 at 12:39
  • @OregonGhost: we use interns for that. – MusiGenesis Sep 23 '09 at 13:01

4 Answers4

9

If you do it with image analysis, the first thing is to get the best possible image quality. Webcam will probably do, but in addition you'll need some illumination. You want your image's background brightness to be equal everywhere and get rid of shadows, to help segmenting the image correctly. Possibly illuminating the tubes from the back could make sense.

It could be tricky - since your liquids and tubes are clear, the surface of the liquid might not be too well visible. You could also consider using ultrasound-based approach (measure the time of echo from the surface of the liquid).

Edit: one more idea: If the tubes are open from the top, why don't blow air over them, measure the pitch, and calculate the liquid level from that :-)

Joonas Pulakka
  • 36,252
  • 29
  • 106
  • 169
  • 1
    +! Good point on image and lighting. My first rule of vision is 'you can write a lot of software with light'. – kenny Sep 23 '09 at 13:56
  • 1
    I would also maybe try using lighting outside the visible band (IR or UV). Depending on the type of liquid and container that could make it really easy to get find the liquid. – Hannes Ovrén Oct 01 '09 at 11:03
  • Good idea! Just make sure the camera is able to see the wavelength you're using. It's more likely up to the lens/glass than the sensor. – Joonas Pulakka Oct 01 '09 at 11:15
  • a simple diffuse backlight would be fine to find the level of liquid. there are a lot of resaler for those kind of material. however, industrial grade hardware is expensive (but come in whatever shape, color, lightness, etc. you want) – Adrien Plisson Oct 31 '09 at 18:29
  • @kigurai: some (many) chemical liquids do not like IR or UV lightning... i would stay safe and keep with a standard light. – Adrien Plisson Oct 31 '09 at 18:35
  • @Joonas Pulakka: seeing a wavelength is up to the sensor. a standard CMOS or CCD sensor is generally sensitive to the near infra red (provided you remove the IR filter that generally comes bundled in front of the sensor), camera sensitive to other wavelength needs special sensors and tend to be more expensive. beware that an optical system is generally designed for visible light, and behaves differently with IR or UV lights (achromatism is particularly sensitive to the wavelength...) – Adrien Plisson Oct 31 '09 at 18:35
  • Sure, there's a limit to what wavelengths a sensor can see. I meant that typical (even cheap) cameras *do* see somewhat more than the visible spectrum, so it could be least worth trying. Of course it's a dirty hack even if it works, but... :-) – Joonas Pulakka Nov 01 '09 at 08:26
  • not a dirty hack at all, it is even pretty common to remove the IR filter to take advantage of this fact (also mounting a specific IR bandpass filter is common). but the additional bandwidth is almost always located on the IR side of the spectrum, and is quite limited: you would not implement a night-vision like system by taking advantage of this. in the case of the OP, the liquid will certainly not show much in the IR band that can't be seen in the visible band. but as always, it is only a question of lightning... – Adrien Plisson Nov 01 '09 at 19:48
5

Chesnokov-Yuriy wrote series of articles explaining image analysis in codeproject. He covers vast range of topics in all his articles. You should check this . he is really exceptional.

some of his articles, you can find useful

RameshVel
  • 64,778
  • 30
  • 169
  • 213
3

If you are looking for a free and open source too. OpenCV is a good choice and I would suggest C# as an easier thing to learn that C and this port which worked well for me. There are other ports for other languages as well.

There are good pay packages as well that may be easier for instance I've used MvTec's Halcon.

kenny
  • 21,522
  • 8
  • 49
  • 87
  • -1: Just having OpenCV in front of you won't help much unless you have an idea about what you want to do with it. Just because someone gives me a toolbox for professional mechanics does not mean that I can fix the engine in my car. – Hannes Ovrén Oct 01 '09 at 11:05
  • +1: for Halcon link! Incredible tool and great documentation. IHMO, the documentation is usefull for general understanding of CV, not necesserily for HALCON. (However, bear in mind, the demo license is granted only for HALCON evaluation, not for general learning :-) – Valentin H Nov 19 '12 at 15:09
2

if the project is funded by a company (that is, it has an allocated budget), you should consider buying a "real" image processing library: matrox, cognex, halcon, national instruments... there are a lot of library provider. the advantage is that many tools already exists, especially concerning image registration and dimensional measurements. many even have kind of an IDE for prototyping the processing.

also consider buying a "real" camera: one with a decent CMOS or CD sensor. here again, there are dozens of providers. the difference between this and a webcam is the quality of the image. keep in mind that the resolution of the camera has a big impact on the resolution of the result. also, an good camera does not come with a lens, but you will find very good quality lenses (cosmicar/pentax are the best quality/price compromise), whereas a webcam is generally equipped with a very poor one-piece lens... lens type affect the distortion of the image, thus it affects the quality of the result.

any diffuse white-backlight should be perfect for lightning this product.

then, you can find a training in computer vision, or just find a mentor which knows how vision works and will guide you through the project.

Adrien Plisson
  • 22,486
  • 6
  • 42
  • 73
  • Actually, If the project had been slightly higher priority I would have done this, probably using National Instruments hardware and their Lab View GUI to prototype the software, in the edn I just winged it.... – PaulHurleyuk Oct 31 '09 at 21:09