[ Close ]
Username
Password


Forgotten your password?
 
Custom Search
Computer/IT Projects
 Projects Q A, Guidance for your projects Ľ†Projects Forum Ľ†Computer/IT Projects
Message Icon Topic: Face Detection and Recognition in dot net Post Reply Post New Topic
Found this useful? Give a +1   Add to Facebook: Add to Facebook
Free Project Downloads
CS / IT Project Downloads
.Net Project Downloads
JAVA Project Downloads
PHP Project Downloads
Networking Proj Downloads
Project Topics
Computer(CS/IT) Projects
Software Mini Project Topics
Android Project Topics
Networking Project Ideas
Dot Net Project Topics
Latest IEEE Projects List
IEEE JAVA Project Topics
Project Presentation Tips
How to choose Project Topic
Tips for Final Year Project
Steps for FYP, Mini Project
Preparing a Project Report
Problems faced in Projects
 
Get Free Software CS / IT Project Downloads:

Enter your email address:  

Author Message
sris269
Newbie
Newbie


Joined: 26-Mar-2012
Online Status: Offline
Posts: 0
Quote sris269 Replybullet Topic: Face Detection and Recognition in dot net
    Posted: 26-Mar-2012 at 7:34pm
Can you please help me i'm stuck in my project. I'm doing Secure Online Examination Using Cryptography. In that when a student registers for an exam through online with his details even a snap of him/her must be taken and stored into sql server and then while the student logs in a picture must be taken and it shoul be compared with the earlier picture for authentication. Please help me out soon. I'm using VS2010 asp.net. SQL 2008

 
IP IP Logged
Roopa
Newbie
Newbie


Joined: 09-Apr-2009
Online Status: Offline
Posts: 0
Quote Roopa Replybullet Posted: 29-Mar-2012 at 5:33pm
You might have to do an image comparison in asp.net I suppose

 
IP IP Logged
Krishna_Sridhar
Senior Member
Senior Member


Joined: 21-Sep-2008
Online Status: Offline
Posts: 0
Quote Krishna_Sridhar Replybullet Posted: 29-Mar-2012 at 5:38pm
Hey sris, this might help you out....

Comparing Two Images In Asp.Net

Introduction:
               This article explain how you can compare two images are same or not. You can compare the images from database also. DataBases not support the binary data comparision.
               For comparing two images Iím taking both of images from outside but you can replace that with database also. Itís take lots of conversion process like byte array to image and image to bitmap. In this article Iím comparing each pixel of bitmap.
               Image comparison is not possible in any Database because the binary data may not be same. You can try it with Data length also but it will not give exact result.


Using Code:
               Firstly we have convert our uploaded images into byte array for converting this byte array into images again and then this byte array are again converted into bitmap for comparison.
    byte[] _barray1;
    byte[] _barray2;
      Next we have to read the bytes of uploaded images into our byte arrays like bellow.Here only you can go for database field also means here we can read the database binary data into our byte array. Here instead of reading bytes from Upload control you can read it from database.
//Reading Bytes From Uploaded Images
           
            if (FileUpload1.HasFile && FileUpload2.HasFile)
            {
               using(BinaryReader reader1=new BinaryReader(FileUpload1.PostedFile.InputStream))
               {
                   using (BinaryReader reader2=new BinaryReader(FileUpload2.PostedFile.InputStream))
                   {
                      _barray1 = reader1.ReadBytes(FileUpload1.PostedFile.ContentLength);
                      _barray2 = reader2.ReadBytes(FileUpload2.PostedFile.ContentLength);
                   }
               }
            }
      Passing this two byte array to our compare method is not possible for that we have to convert this byte array to images and then this images to Bitmap and pass this two bitmap to our compare method and showing results.
//Converting Byte Array To Image And Then Into Bitmap
            ImageConverter ic = new ImageConverter();
            Image img = (Image)ic.ConvertFrom(_barray1);
            Bitmap bmp1 = new Bitmap(img);
            Image img1 = (Image)ic.ConvertFrom(_barray2);
            Bitmap bmp2 = new Bitmap(img1);
            //Calling Compare Function
            if (Class1.Compare(bmp1,bmp2)==Class1.CompareResult.ciCompareOk)
            {
               Label1.Visible = true;
               Label1.Text = "Images Are Same";
            }
            else if (Class1.Compare(bmp1,bmp2)==Class1.CompareResult.ciPixelMismatch)
            {
               Label1.Visible = true;
               Label1.Text = "Pixel not Matching";
            }
            else if (Class1.Compare(bmp1,bmp2)==Class1.CompareResult.ciSizeMismatch)
            {
               Label1.Visible = true;
               Label1.Text = "Size Is Not Same";
            }


The Compare Method:
      This method will perform the actuall task of image comparision. This method compare each and every pixel using SHA256Managed.And stored the result in enum.
public enum CompareResult
    {
        ciCompareOk,
        ciPixelMismatch,
        ciSizeMismatch
    };

    public static CompareResult Compare(Bitmap bmp1, Bitmap bmp2)
    {
        CompareResult cr = CompareResult.ciCompareOk;

        //Test to see if we have the same size of image
        if (bmp1.Size != bmp2.Size)
        {
            cr = CompareResult.ciSizeMismatch;
        }
        else
        {
            //Convert each image to a byte array
            System.Drawing.ImageConverter ic = new System.Drawing.ImageConverter();
            byte[] btImage1 = new byte[1];
            btImage1 = (byte[])ic.ConvertTo(bmp1, btImage1.GetType());
            byte[] btImage2 = new byte[1];
            btImage2 = (byte[])ic.ConvertTo(bmp2, btImage2.GetType());

            //Compute a hash for each image
            SHA256Managed shaM = new SHA256Managed();
            byte[] hash1 = shaM.ComputeHash(btImage1);
            byte[] hash2 = shaM.ComputeHash(btImage2);

            //Compare the hash values
            for (int i = 0; i < hash1.Length && i < hash2.Length && cr == CompareResult.ciCompareOk; i++)
            {
               if (hash1 != hash2)
                    cr = CompareResult.ciPixelMismatch;
            }
            shaM.Clear();
        }

        return cr;
    }


Conclusion:
               This compare the two images either from uploaded images or database binary data.
IP IP Logged
TnagarSharath
Groupie
Groupie


Joined: 21-Sep-2008
Online Status: Offline
Posts: 0
Quote TnagarSharath Replybullet Posted: 29-Mar-2012 at 5:44pm
Its better you save the image in binary format as the image datatype will be removed from SQL Server.
IP IP Logged
sris269
Newbie
Newbie


Joined: 26-Mar-2012
Online Status: Offline
Posts: 0
Quote sris269 Replybullet Posted: 29-Mar-2012 at 6:36pm
Thank you :)
IP IP Logged

 
Post Reply Post New Topic

Free Programming Courses in JAVA, .Net and PHP (Register Now!)

Java Free Online Course

.Net Free Online Course

PHP Free Online Course


 
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.
© ProjectsQA.com   |   Privacy policy