Webcam Version

A project log for Assistance System for Vein Detection

Using NIR (near infrared) Illumination and real-time image processing, we can make the veins more visible!

MyrijamMyrijam 08/13/2017 at 15:190 Comments

As an alternative to the ready-to-use Pi-Camera, we (re)used a webcam that already had been modified in a previous research project (Eye controlled wheelchair,

We had removed the infrared filter and replaced the two white LEDs with infrared LEDs. The following figure shows the webcam without housing, the converter chip without optics and the completely reconstructed camera with the two IR-LEDs (violet dots).

Figure 12: modified webcam from the project "Eye controls wheelchair"

A USB webcam offers several advantages: It can be connected to other computers than a Raspberry Pi or even smartphones (see “Whats next”) and is more flexible concerning the connection cable. Furthermore, this camera has a built-in autofocus and already supports illumination sufficient enough the range needed here (well, you have to exchange 2 white SMD LEDs for IR ones).

The disadvantage is that rebuilding this device will be more complicated since soldering SMD components is required along with removing the IR blocking filter (cut it off using a sharp blade). Additionally using a USB camera with the Raspberry Pi, you may loose a bit speed/performance because the CPU has to do the transfer over the USB2, while the Raspberry camera can be handled by the graphics processor with no additional load to the CPU.

We added a mounting option, consisting of a tripod base with 3d-printed fittings and 9mm plastic tubes:

Figure 13: Construction of the camera for the modified webcam The code is a bit different, since the camera does auto contrast and auto brightness along with autofocus. This second prototype can be build from scratch and you can of course modify it to use the Raspberry Pi Camera as well. For the moment the Raspberry is still without an enclosure attached to the back of the monitor for easy access – but still not comfortable enough for the intended users.

After Buildlog 3: “Testing the prototypes with Professionals”

Our vein-detection system can not only be used for intravenous medication but also for obtaining blood samples. Both the image acquisition and the calculation of image optimizations are carried out on the fly, meaning patient and doctor see directly where the vein to be punctured can be found.

Therefore we kindly asked two haemophilia specialists to have a look at our Vein detector and give us a feedback. In particular, we discussed our two prototypes with Dr. Klamroth, chief physician of the Center for Vascular Medicine at the Vivantes Clinic in Berlin. He confirmed that only veins near the surface are found with optical devices. Veins below 1mm depth should be localized by ultrasound. Furthermore, finding veins by cooling the skin and using thermography imaging is counterproductive, because veins contract if the skin is cold and are therefore even more difficult to puncture… Dr. Klamroth advised us to extend the results so far and, if necessary, to look for ways to additionally mark the veins in the video displayed as an orientational aid for the user.

A few weeks later, we were able to present and discuss our prototypes in the Competence Care Centre for Haemophilia in Duisburg ( Dr. Halimeh and Dr. Kappert tested both prototypes in comparism with their professional medical system for Vein illumination. The professional device uses IR light as well, but then projects the image back to the skin using red a laser. Of course the professional system is much easier to use, no bootup time and adjustments needed, but we can compete in terms of image quality!


The experiments we carried out as well as the research on scientific papers have shown that a universal can be realized with infrared lighting, independently of the skin pigmentation: Below 800nm, the skin dye melanin absorbs large parts of the irradiated light - above 1100nm, very much irradiated light is absorbed by the water in the tissue (see Figures 2 and 4). The combination of infrared and light-red lighting would be ideal for little pigmented skin, but our Venenfinder would not be suitable for more pigmented skin. At the wavelength used, we can distinguish veins from surrounding tissue - they are recognizable only as a pale glimmer. Adjusting the contrasts and the brightness distribution on the fly, we get a much clearer picture. A fully automatic adjustment provides first good results, but with the help of three parameters, the result can be significantly improved again.

Our development is based on the inexpensive camera systems a) modified webcam (approx. 50 €) or b) Raspberry Pi Cam (about 35 €), and can certainly compete with professional systems, which provide a much finer graduation of the grayscale and thus finer “shadows” (veins), while the technology available to us only returns a slightly differentiated gray image. The veins differ from the skin surface only by a minimal brightness deviation of about 5% of the total brightness distribution.

What’s next?

We came across another algorithm that is used for enhancing blood vessel pattern ins retinal images, e.g.: Frangi et al (named after their publication). Trying this with the auto-leveled images or the manual improved ones seems like a good plan 😉

Additionally, this approach could be ported to mobile phones. There is software out that captures from USB-Cameras attached to an Android phone already, so “all there is to do” is to implement the image adjustment filters for Android…