Home > Software design >  How to compare an image with certain part of another image in ASP.NET Core MVC
How to compare an image with certain part of another image in ASP.NET Core MVC

Time:07-12

I'm trying to compare an uploaded image with the image stored in my project's root file. I found many related work which is useful to compare images. This link (https://www.c-sharpcorner.com/uploadfile/krishnasarala/compare-two-images-in-Asp-Net/) describe how to compare images.

I just want to compare with specific part. For example, I have an image in my root directory, the image is about government authorization stamp and signature and I want to check whether the uploaded image has same signature and stamp portion or not.

I value the help.

CodePudding user response:

Mohammad.

You can use Bitmap to crop an image to your preferences. If you cannot access Bitmap with using System.Drawing dependency, follow this answer from another StackOverflow post.

Then you can crop using this algorithm:

int cropWidth, cropHeight;
Bitmap croppedImage = new Bitmap(Image.FromFile("uploaded.jpg"), cropWidth, cropHeight);

Note that crop will not scale the image in any way.

After this, you can use several comparison algorithms that are good, depending on what you find better for your application. I found this post interesting:

Algorithm to compare two images in C#

CodePudding user response:

I suggest you follow this tutorial which uses opencv library to match the shapes. This will help you to find the solution for your requirement. https://www.youtube.com/watch?v=tNMDWRXwHjo

  • Related