MATLAB Code for Vein Detection using IR Camera.

I am working on a mini project to find the matlab code to detect the veins using an IR Camera. I have referred a paper and applied all those techniques as mentioned in the algorithm attached as image.
The code I have written so far is as follows. May I get the code inorder to improve the precision and do it more effectively ?
Matlab Code:
clc
%Remove items from workspace, freeing up system memory
clear all
%Remove figures
close all
%read image
img=imread('C:\Users\Ananthu\Desktop\test.jpg');
%display image
figure,imshow(img);
%convert image to grayscale
I=rgb2gray(img);
figure,imshow(I),title('Grayscale image');
%applying median filter to remove noise
K = medfilt2(I);
figure,imshow(K), title('median filtering');
%applying CLAHE
J = adapthisteq(I,'clipLimit',0.05,'Distribution','rayleigh');
figure,imshow(J), title('CLAHE');
%median filtering to remove the noise
K1 = medfilt2(J);
figure,imshow(K1), title('median filtering2');
%blurring images for accuracy
%Adaptive thresholding
T = adaptthresh(K1, 0.7);
BW = imbinarize(K1,T);
figure, imshow(BW), title('Adaptive threshold')
%T1 = adaptthresh(K1,0.5,'ForegroundPolarity','dark');
%figure,imshow(T1), title('foreground');
%BW = imbinarize(K1,T1);
%figure,imshow(BW), title('new thresholding');
se1 = strel('line',11,90);
erodedBW = imdilate(BW,se1);
figure, imshow(erodedBW,[]), title('dilated image');
BW3 = bwperim(erodedBW);
figure, imshow(BW3,[]),title('perimeter extraction');
C = imfuse(img,BW3,'blend','Scaling','joint');
figure, imshow(C), title('fusing images');

6 Comments

Thanks for providing an idea about how to include the code in a question. I would like to know if there are any solutions available for the question I asked.
@ Image Analyst Do you have anything that would help me out with this question. I have processed an image with this code and am receiving an output as given :
I wanted to improve its accuracy, in most of the cases there are significant differences in getting the clear images of vein.
A real time image processed under this code shows an output as:
Kindly help me out in improving it. Thank You.
How can I do that? Those images mean nothing to me. I can't even see the original image, just the badly processed output image. About all I can suggest to to follow the lead of others who have successfully done it and published algorithms on how to do it. Look here: http://www.visionbib.com/bibliography/people945.html#Hand%20Structure,%20Vein%20Structure%20in%20Hands,%20Recognition,%20Systems
@Image Analyst I have added the image for your testing purpose.
I am a beginer in matlab and I have tried out direct algorithms in the papers read from the link. The algorithm which I followed is also attached in the question above. Please see to it and even I have added an image for the testing purpose.
My ultimate aim is to get an image as shown below:
Then process the final image using the algorithms in the paper. Is there a method atleast to do these procedures.
Thanks
Not at a high level - there is no vein extraction function. You'll have to build up the algorithm in the paper from lower level functions. It looks like you're doing that.

Sign in to comment.

Answers (3)

I applied this code and its really worked.
thank you so much
but when i convert to grayscale i want to keep one color which is green lets say
i mean i want to show only the vein in green color and others in grayscale
Anyone can help?
Mr Ananthu Jayan, can you please help me out how can you made the vein detector and can you please send me the matlab program which gives final successful output. Thank you

Asked:

on 12 Jan 2018

Answered:

on 18 Jan 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!