Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 20th, 2008, 09:30 AM
Registered User
 
Join Date: Jul 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Comparing two images in C# (without HASH)

Hi:

The objective is to compare two bitmap images and declaring them as equal if they are 95% similar. Hashing function cannot be used in this case. This requires comparing images or part of images against a threshold value. I am weak in C# programming so if someone can explain this to me with source code then it will be really helpful.

Hoping for replies. thanks

 
Old July 20th, 2008, 12:49 PM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You can use Bitmap.GetPixel to get the colour of any particular pixel.

http://msdn.microsoft.com/en-us/libr....getpixel.aspx

The you can compare them to see if they are 'similar'.

/- Sam Judson : Wrox Technical Editor -/
 
Old July 21st, 2008, 05:58 PM
Registered User
 
Join Date: Jul 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Thanks for the help. I was finally able to figure that out but now I am stuck with a bigger problem. I want to do text detection in an image using C# but do not know where to start from. A little help will be appreciated.

aakash

 
Old July 22nd, 2008, 02:49 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

I honestly wouldn't know where to start I'm afraid.

/- Sam Judson : Wrox Technical Editor -/
 
Old July 22nd, 2008, 08:23 AM
Authorized User
 
Join Date: Nov 2006
Posts: 93
Thanks: 0
Thanked 1 Time in 1 Post
Default

I'd go back to looking at pixels. Your bitmap is in a row/column matrix. If you scanned along the rows and then the columns looking for a significant change in the color number ie the series 0x00 0x00 0x00 0xFF 0xFF 0xFF 0xFF would indicate an "edge" pixel. If you store these along with their row and column. You would then have to analyze your edges looking for patterns. Some ideas might be to look for multiple "edges" in the same row or column. You might be able to match patterns of letters by creating letter patterns in similar row/column collections. You might want to allow the user to vary the difference in color number that constitutes "significant". Of course, the sloppier the lettering, the harder it will be to match.

It sounds like an exciting, challenging project. Good luck.

What you don't know can hurt you!
 
Old August 15th, 2008, 02:28 PM
Registered User
 
Join Date: Aug 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey aakash can u send me the program please in which u have compared two pictures ? This will really help me in my project ... Help me out !! Reply

Regards !

 
Old June 9th, 2009, 11:29 AM
Registered User
 
Join Date: Jun 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to compare two images, check two image are same or not

You can compare two images content using imagemagick. It is very easy.
You can download imagemagick from here Version must be greater than 6.0.


compare -metric AE 5001.MAIN.jpg 5002.MAIN.jpg difference.jpg

if it returns value 0 means both images are same.

This post might help you.

Thanks,
Binod Suman
http://binodsuman.blogspot.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
purpose of hash in CSS style crmpicco CSS Cascading Style Sheets 4 January 27th, 2018 08:34 AM
Dynamic load of hash table jcwest Visual Basic 2005 Basics 0 October 29th, 2007 11:03 PM
Abt Hash Code.. pandian Java Basics 3 January 18th, 2006 06:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.