# what is the possible solution for the Intra-class variations poblems?

my poblem is that i have a database for human dorsal hand veins ,but with intra-class variations , so this problem have a large effect on my results when i need to do matching between my samples for recognition purpose(testing phase after finishing trainning phase ) .

therefore , i need to know what are the possible solutions that may be suitable here. are there any function in matlab can overcome this problem?

examples of my images(5 images for the same person):

class 1:

class 2:

class 3:

and the code that i wrote to obtain the above images was as below:

    in_dir = 'E:\master_matlab\HandVein_DataSet';
out_dir = 'E:\master_matlab\final resultant images';
for px = 1 : 50,
for hx = 1 : 5,
fname = sprintf('%04dhv%d.bmp', px, hx);

% do processing

level=graythresh(current_image);
x=im2bw(current_image,level);
% figure,imshow(x);
nnew=current_image.*cast(x,class(current_image));
medimage=medfilt2(nnew,[5 5]);%median Filtering image
% figure,imshow(medimage);
% figure,imshow(z);
H = fspecial('unsharp');
y=imfilter(z,H);
% figure,imshow(y);
mIm=imfilter(y,fspecial('average',15),'symmetric');%%%%%%here mask is 15*15 and method is symmetric(not replicate)
sIm=y-mIm;
bw=im2bw(sIm,0);                          % Convert to binary image
ALT_img=imcomplement(bw);                 % Complement binary image
% figure,imshow(ALT_img);
%%%%%% morphological on binary images.

open_img =bwmorph(ALT_img,'open'  ,Inf);
% figure,imshow(open_img);title('open_img');
major_img =bwmorph(open_img,'majority' ,Inf);
ske_img = bwmorph(major_img,'skel',100);

%removal outer boundary
without_border=ske_img.*x;
% figure,imshow(without_border);

%%%%spurs removal can be added  or removed
spur_img=bwmorph(without_border,'spur',1);%8 spurs
% figure,imshow(spur_img);

% centering the resultant spur_image
measurements = regionprops(im2double(spur_img), 'Centroid');
[rows columns] = size(spur_img);
rowsToShift = round(rows/2- measurements.Centroid(2));
columnsToShift = round(columns/2 - measurements.Centroid(1));
shiftedImage = circshift(spur_img, [rowsToShift columnsToShift]);

%%%%%cropping to remove the below white lines

rect=[26 ,37 ,255 ,138];
ssdc=imcrop(shiftedImage, rect);
q12=imresize((ssdc),1.25);
% figure,imshow(q12);
%
% save output
imwrite(q12, fullfile(out_dir, fname));
end
end


regards for all

• why all these views without any comment? it is a very difficult problem , or it cann't be solved. – ruaa Mar 29 '12 at 13:54
• I believe that it is very hard to understand your question. For example, we have to look at a file name in your code to infer that the images corresponds to veins. – Alceu Costa Apr 4 '12 at 2:50
• i mean that the 5 image which are for the same person are not very similar to each other, about the veins there is no problem about the images for what part , it is not affect the understanding of the question. – ruaa Apr 4 '12 at 8:09

It boils down to the features. You have shown some images of the same class. You also need to look at images of the other class(s), and find a set of features that maximize inter-class variance and minimize intra-class variance. What features those might be depends on your data. You need to look at the types of variation that exists within each class, and try to find features, transformations, or distance measures that account for it. It is very hard to tell you anything more specific based on the information you have provided.

Edit: One thing you can do is post some images of a different class.

Also, are the images aligned? Maybe before you compute the features you should translate all your images so that the white pixels coincide as much as possible. Then you can define a distance measure between two images as the percentage of white pixels that co-locate, and then use a k-nearest-neighbor classifier.

Some other random thoughts: Shape context features may be suitable for your problem.

You also might want to search the literature on recognizing hand-written characters.

• i considered that the x and y locations of white pixels as a vector and made them as a colunm vector to put it in the trainning set , according what can i select the features that minimize intra class variations and maximize intra class , i mean how can i select the suitable features that do this, also what are the additional details that i can add to get more clarification from you if you can.thanks alot – ruaa Mar 29 '12 at 18:37
• @ruaa, please see the edit. – Dima Mar 29 '12 at 19:45
• dima thanks alot for your edition and details.please you can see my edition , i added more images and i added also the code that i wrote to obtain b/w images from grayscale images ,you can take a look on it .i also read about hand written recognition. – ruaa Mar 31 '12 at 9:24
• Dima what your opinion in using zoing technique for feature extraction in my images? but if it is suitable how can i select the suitable size for matrix that i will use for partition of regions.thanks alot. – ruaa Mar 31 '12 at 11:41
• Sorry, I don't know anything about zoing. – Dima Apr 3 '12 at 15:28