Fingerprint recognition system using gabor filter with opencv and MS VC++

asked 2015-06-17 19:42:02 -0500

I'm trying to implement fingerprint recognition system. now i'm on step to extract minutiae but the extraction don't work i'm obtaining a black windows. here is my code:

Fingerprint.cpp

      #include "Fingerprint.h"
      #include <iostream>
      #include <stdio.h>
      #include <stdlib.h>
      #include <string.h>
      #include <math.h>
      #include <fstream>
      #include <stdarg.h>

      using namespace std;
      using namespace cv;

    // d├ęclaration des variables
      Mat src, src_gray;
     //IplImage* img;
   // Ridge extraction  variables
    int edgeThresh = 100;
    Mat edge, cedge;
  //minutiae variables
   unsigned pc;
  //int v_idx = 0;
 //int pixel = 0;
 double cn;
 FILE *fpo;
   //IplImage* result;// , *image = 0;
//cvZero(result);
IplImage *result;
//CvScalar s;
//s.val[0] = 255;
//void thinning(cv::Mat& im)
/*
void OrientationField(Mat& orien_map){
Mat clone_map;

//threshold(orien_map, orien_map, 128, 255, cv::THRESH_BINARY);
clone_map = orien_map.clone();
Mat gx, gy, ang, mag;
Sobel(clone_map, gx, CV_32FC1, 1, 0);
Sobel(clone_map, gy, CV_32FC1, 0, 1);
phase(gx, gy, ang, false);
magnitude(gx, gy, mag);

normalize(mag, mag, 0, 1, cv::NORM_MINMAX);

Mat angRes = Mat::zeros(orien_map.rows, orien_map.cols, CV_8UC1);

for (int i = 0; i< orien_map.rows; i += 2)
{
    for (int j = 0; j< orien_map.cols; j += 2)
    {
        int x = j ;
        int y = i;

        float r = 5;
        float m = r*(mag.at<float>(i, j));
        float dx = m*r*cos(ang.at<float>(i, j));
        float dy = m*r*sin(ang.at<float>(i, j));

        cv::line(angRes, cv::Point(x, y), cv::Point(x + dx, y + dy), Scalar::all(255), 1, CV_AA);//all white
    }
}
imshow("O E", angRes);

    }*/
      static void onTrackbar(int, void*)
     {
      blur(src_gray, edge, Size(3, 3));

// Run the edge detector on grayscale
Canny(edge, edge, edgeThresh, edgeThresh *3 , 3);
cedge = Scalar::all(255);

src.copyTo(cedge, edge);
//thinning(cedge);
imshow("Edge map", cedge);
//cvSaveImage("EdgeImage.bmp", &cedge);
       }

     void filters(IplImage* image, int i, int j, double *cn)
     {
//int x, y;
unsigned char c1, c2, c3, c4, c5, c6, c7, c8;
if (j<0 || j> image->height) { ; }
else if (i<0 || i> image->width) { ; }
else {
    c1 = (image->imageData[j*image->width + i]);
    c2 = (image->imageData[(j + 1)*image->width + i]);
    c3 = (image->imageData[(j + 2)*image->width + i]);
    c4 = (image->imageData[(j + 2)*image->width + (i + 1)]);
    c5 = (image->imageData[(j + 2)*image->width + (i + 2)]);
    c6 = (image->imageData[j*image->width + (i + 2)]);
    c7 = (image->imageData[j*image->width + (i + 2)]);
    c8 = (image->imageData[j*image->width + (i + 1)]);
    pc = (image->imageData[(j + 1)*image->width + (i + 1)]);
    c1 = abs(image->imageData[(j + 1)*image->width + i] - image->imageData[j*image->width + i]);;
    c2 = abs(image->imageData[(j + 2)*image->width + i] - image->imageData[(j + 1)*image->width + i]);
    c3 = abs(image->imageData[(j + 2)*image->width + (i + 1)] - image->imageData[(j + 2)*image->width         + i]);//255;
            c4 = abs(image->imageData[(j + 2)*image->width + (i + 2)] - image->imageData[(j + 2)*image->width + (i + 1)]);//255;
           c5 = abs(image->imageData[(j + 1)*image->width + (i + 2)] - image->imageData[(j + 2)*image->width + (i + 2)]);//255;
    c6 = abs(image->imageData[j*image->width + (i + 2)] - image->imageData ...
(more)
edit retag flag offensive close merge delete

Comments

so, you're throwing ~2000 lines of ill-formatted code at us, your diagnosis is:"it does not work", and you want us to help ?

lol, no, sorry, it does not work this way here.

can you ty to read the faq and improve your question ?

berak gravatar imageberak ( 2015-06-18 00:43:50 -0500 )edit

Use some propper dilate/erode, extract skeletons and search for your minutia (bifurcations, endpoints, etc) with an propper 2D Filter (1,2,4,128,256,8,64,32,16) and convolution (http://www.christoph-busch.de/files/H... Page 94-97)

bhornde gravatar imagebhornde ( 2017-05-24 07:09:18 -0500 )edit