Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am using SourceAFIS for fingerprint verification in .net framework. When i take an image form my desktop, it works fine. But when i use the same image form my localhost server, i cannot load the image and the following error is shown inside 'Enroll' function:
An unhandled exception of type 'System.ApplicationException' occurred in SourceAFIS.dll Additional information: Fingerprint image is too small.


here is my code:
C#
MyFingerprint fp = new MyFingerprint();
       fp.Filename = filename;
       // Load image from the file
       //Console.WriteLine(" Image size = {0} x {1} (width x height)", fp.Image.GetLength(1), fp.Image.GetLength(0));
       Console.WriteLine(" Loading image from {0}...", filename);
       BitmapImage image = new BitmapImage(new Uri(filename, UriKind.RelativeOrAbsolute));
       //Console.WriteLine(" Image size = {0} x {1} (width x height)", fp.Image.GetLength(1), fp.Image.GetLength(0));
       fp.AsBitmapSource = image;
       // Above update of fp.AsBitmapSource initialized also raw image in fp.Image
       // Check raw image dimensions, Y axis is first, X axis is second
       Console.WriteLine(" Image size = {0} x {1} (width x height)", fp.Image.GetLength(1), fp.Image.GetLength(0));

       // Initialize empty person object and set its properties
       MyPerson person = new MyPerson();
       person.Name = name;
       // Add fingerprint to the person
       person.Fingerprints.Add(fp);

       // Execute extraction in order to initialize fp.Template
       Console.WriteLine(" Extracting template...");
       Afis.Extract(person);
       // Check template size
       Console.WriteLine(" Template size = {0} bytes", fp.Template.Length);

       return person;
   }

   static void Main(string[] args)
   {
       // Initialize SourceAFIS
       Afis = new AfisEngine();
       // Enroll some people
       List<MyPerson> database = new List<MyPerson>();
       database.Add(Enroll("http://localhost:6060/PhpProject2/img/img2.jpg", "Second"));
    }


Would you please tell me how to solve the issue?

What I have tried:

Trying to upload image from my localhost server.
Posted
Updated 17-Apr-16 2:49am

1 solution

Uhhh....I would say that the image that you're using is too small. Go figure.

The first problem I see is that you're using a JPG as an enroll image. DON'T. JPG's use lossy compression and introduce artifacts that can screw up the image to the point of being unusable.

The second problem is probably because the image isn't of a high enough resolution. (Too small, like the error says.)

I have no idea what you're using and am not familiar with the library you're using. Contact the people who made it for it's limitations and requirements.
 
Share this answer
 
Comments
Member 11345334 18-Apr-16 0:29am    
Thanks for your response but my problem is, the same image is giving correct output when it is loaded form my desktop but giving the error that i mentioned above when i am using it from my server. In fact i cannot load it from my server.
Dave Kreskowiak 18-Apr-16 12:20pm    
Then you're going to have to get a hold of the people that wrote the library you're using. I have no idea why it's giving you that error.

The only thing that's suspicious is that you've got a hard-coded path to a file at "localhost:6060/PhpProject2/img/img2.jpg". Unless the server running this code has the EXACT same path to get to it or you didn't deploy the file to that path.

You really shouldn't be using a "localhost" path to get to content. You should be using relative paths that start with "~" and Server.MapPath to get a filepath to content on the server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900