protected Matrix fingerprintEnhance(Matrix image) { Matrix result; const int filterRadius = 8; const float filterVariance = 4.0f; // std deviation squared // const int filterRadius = 6; // const float filterVariance = 4.0f; // std deviation squared result = filterGaussian(image, filterVariance, filterRadius); result = ImageUtils.Convolve(result, Laplacian); // We leave a few levels of grey. ImageUtils.BoundImage(result, -4.0f, -1.0f); ImageUtils.AutoScaleLevels(result); clearBorder(result, filterRadius + 1, 255); // Uncomment the following three lines to get a pure b&w image. ImageUtils.InvertImage(result); ImageUtils.ThresholdImage(result, 1); ImageUtils.InvertImage(result); return(result); }
private Matrix inRelief(Matrix image) { Matrix hDiff = new float[, ] { { -1, 1, 0 } }; Matrix vDiff = hDiff.Transpose; Matrix gradH = new float[, ] { { 0, -2, 0 }, { 0, 0, 0 }, { 0, 2, 0 } }; Matrix gradV = gradH.Transpose; Matrix gX = ImageUtils.Convolve(image, -hDiff); Matrix gY = ImageUtils.Convolve(image, -vDiff); Matrix r = (gX + gY) / 2; // ImageUtils.BoundImage(r, 0, 255); ImageUtils.AutoScaleLevels(r); // ImageUtils.PutImage("gx.png", r); return(r); }
protected Matrix autoScaleLevels(Matrix image) { Matrix r = image.Clone(); ImageUtils.AutoScaleLevels(r); return(r); }