these are example of my image

enter image description here

enter image description here

enter image description here

enter image description here

i have a 245 images similar to it ,i obtained these b/w images after preprocessing stage , i want to use them for recognition persons(not verification) in matlab. can i performe matching algorithm on these image after division into 2 group(one for training and the second for testing) without implementing feature extraction algorithm such as PCA,ICA,.....?

if it is possible , which are the suitable matching algorithms that are preferable for this purpose , especially i need to use matlab ?

any help please?really i need your opinions and consultations.

thanks in advance

  • $\begingroup$ PCA and ICA are not feature extraction algorithms, they're dimensionality reduction techniques. Feature extraction methods are useful because they make the recognition task much more robust - instead of using the image pixels, you transform/extract the pixels to another (much simpler) feature space. $\endgroup$ Feb 13, 2012 at 17:40
  • $\begingroup$ thanks for your good illustration.can you give me example on suitable feature extraction algorithm that you prefer for my image? $\endgroup$
    – ruaa
    Feb 13, 2012 at 19:22
  • $\begingroup$ What you need to define is - which images you seem close enough which you think should be discarded. So post another image (with some variation which should also pass) and another one which should not be taken up. Also, let us know - the domain. For example are you only restricted to such Black background / white line images? or are these edge detection images? Or you may also want to have general real life images? $\endgroup$ Feb 14, 2012 at 12:56
  • $\begingroup$ @Dipan.similar and different images to the original one were added.also i am only restricted to images similar to these black background / white line images .thank you in advance. $\endgroup$
    – ruaa
    Feb 14, 2012 at 13:21

1 Answer 1


Yes, it is possible!

For example, you can take pixel by pixel comparison and apply MSE (mean square error). If the error is close to zero, it is the same picture.

However, you will be able to recognize only those images which are picture perfect matching. For example, you won't be able to account for brightness variations, scale variations, minor transformations, compression loss (e.g. JPEG) etc. So while human being might just see them as SAME image - they are not on every pixel basis. Depending on how much strict or tolerant your application needs to be, do we really need to then look for advanced algorithms that are smart enough to be invariant to these factors.


After your clarification, it does sound like you have more of a special case of matching rather than general purpose recognition problem.

Given the following assumptions:

  1. A gray scale (or color) images are first converted to binary through some thresholding process.

  2. Mostly these images are lines (thick or thin) and the key differentiation is how far these edges are from others.

  3. Edges could be of arbitrary shapes and contours -no geometrical assumptions.

  4. Given the edge detection limitations (in the presence of noise) and thresholding algorithms, edges might be disjoint

Here is what i would suggest to apply:

  1. Edge following algorithms - to make continuous edges where applicable.
    Ref #1. http://www.slideshare.net/kiara1011000/edge-following-algorithm-chiara-galdi

  2. Apply Housdourf distances and similar shape/contour matching
    Ref #1. Haudorff Distance by Normad
    Ref #2. CV Online: The Hausdorff Distance
    Ref #3. Hausorff based Matching

Basic idea is that if all edges are more or less at the same locations and of same length, then the images are same.

Given that large portion of region which contains Black and implies no information- MSE would be an extremely BAD idea.

I am only giving you some basic direction toward formulating your problem. As you dig deeper you can put more specific questions. I would be keen to know what works for you finally.

EDIT 2: Adding one specific solution

One simple possible metric i can think of is:

Say, Ref[i][j] is the reference image and Test[i][j] is the test image.

pixel_similarity = 0; 
For each pixel in Ref[i][j]  
  if ( Ref[i][j] == Edge_pixel )   
     (k,l) <- find_nearest_edge_pixel(Ref, Test, i, j, window_size)  
     pixel_similarity += weighted_similarity (i, j, k, l)   

image_similarity_metric = error / (total_edge_pixels_in_ref);   

Please Note that this algorithm will be quite limited for heavy scaling and rotation. This is first step. Notify me for any typo or lack of clarity!


  1. If you keep two identical images (pixel by pixel)- you will find that (k,l) will be same as (i,j) and weighted error should be = 1.

  2. By dividing the number of edge pixels by total edge population, you will get similarity metric = 1.0 for perfectly matching images.

  3. When edges are almost similar, but slightly misaligned score will decline gradually. The weighted_similarity function should be chosen smartly to deal with what you consider as reasonably aligned edge vs. one that should be discarded.

  4. Other extreme is that if total number of edge pixels in Ref is zero - there is no way to compare it with any other one (since we are considering background pixels having no information related to match).

Try to work this out and see what results you get.

Happy to help you!

  • $\begingroup$ thanks in advance Dipan . i need the least error rate and i will try to find the good algorithm. $\endgroup$
    – ruaa
    Feb 13, 2012 at 16:11
  • $\begingroup$ @Dipan.i ask God to protect you.i will try to apply your suggestions and inform you about what i can obtain.thankssssss $\endgroup$
    – ruaa
    Feb 15, 2012 at 3:57
  • $\begingroup$ .I failed to apply the edge following algorithm . now , it was requested from me to apply reigid registration algorithm on this images to compare my results with another results.so , i need first to try connecting or linking the disconnecting edges , then i try the rigid registration algorithm after that i will ensure that my preprocessing steps is good then i return to apply a dimensionality reduction algorithm with matching algorithm that may be Hausdroff.please help me, i am confounded and i can't start . $\endgroup$
    – ruaa
    Feb 15, 2012 at 9:35
  • $\begingroup$ edge following algorithm can be added later to improve the results. Can you simply try and compute some distance between images - such as hausdorff or any other distance metric between edge pixels? Select one image and try to plot such metric (error) and see if there is a clear difference in that quantity that distinguish matching vs. non matching images. If there is significant meat in the feature vector (and comparison metric) only then there is a point in optimizing it. $\endgroup$ Feb 15, 2012 at 13:48
  • $\begingroup$ your comment about the edge following algorithm is very clear and good. $\endgroup$
    – ruaa
    Feb 15, 2012 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.