Click here to Skip to main content
15,892,005 members
Home / Discussions / C#
   

C#

 
AnswerRe: serial port in c# Pin
Luc Pattyn8-Aug-07 1:17
sitebuilderLuc Pattyn8-Aug-07 1:17 
QuestionDropDownList(c# window forms)-control the The Repetetions Pin
Vik Kommineni8-Aug-07 0:25
Vik Kommineni8-Aug-07 0:25 
AnswerRe: DropDownList(c# window forms)-control the The Repetetions Pin
Sgg2458-Aug-07 0:39
Sgg2458-Aug-07 0:39 
AnswerRe: DropDownList(c# window forms)-control the The Repetetions Pin
kabeervh8-Aug-07 0:45
kabeervh8-Aug-07 0:45 
QuestionGetting Bitmap file size,,, Pin
tmp08-Aug-07 0:04
tmp08-Aug-07 0:04 
AnswerRe: Getting Bitmap file size,,, Pin
Luc Pattyn8-Aug-07 0:22
sitebuilderLuc Pattyn8-Aug-07 0:22 
GeneralRe: Getting Bitmap file size,,, Pin
tmp08-Aug-07 0:30
tmp08-Aug-07 0:30 
GeneralRe: Getting Bitmap file size,,, Pin
Luc Pattyn8-Aug-07 1:16
sitebuilderLuc Pattyn8-Aug-07 1:16 
Hi,

BMP files are uncompressed, that's why their sizes directly relate to image dimensions.
GIF files are LZW-compressed, hence you can't predict the file size.

If you don't want to save to disk, you can also save to a (memory) stream.
However it remains an expensive operation.

Now you are asking a completely different matter: image comparison.

When do you consider two images identical? is it you have two Bitmap instances,
and their dimensions, and all pixel values are identical ?
or is it they both show the Liberty Statue ?
or something in the middle ?

If you want to check for identical pixel content, this is what I would do assuming
a large number of images:

- create a dictionary (or Hashtable)
- now iterate over all your images, one by one.
for each image, create your own hash code; I suggest a function of
image width W, image height H, ARGB value of pixel (10,10) and pixel (W/2, H/2) and
pixel (W-10,H-10).
ARGB value is the result of Color.ToArgb()
That was 5 values; you could do hash=(hash<<1)^newNumber for each of them,
starting with zero (^ is exor operator)
- check dictionary for presence of hash code; if not, create a new List (or ArrayList),
add (hash, list) to dictionary, and add image to the new list
if hash already existed, you found a possible match and you now must compare the image
with all images in the list checking all pixels.
To do that, use lockbits and pointers (look it up in MSDN
and read CodeProject articles on image processing by Christian Graus).

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]


this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google


QuestionProblem with EnvDTE.ExecuteCommand and Source Control (C#) Pin
jedibald8-Aug-07 0:01
jedibald8-Aug-07 0:01 
QuestionHow to LogOff Locked Computer Pin
Muhammad Hafeez Ullah7-Aug-07 23:48
Muhammad Hafeez Ullah7-Aug-07 23:48 
QuestionUsing CAPSLOCK status in StatusBarPanel Pin
Sgg2457-Aug-07 23:19
Sgg2457-Aug-07 23:19 
AnswerRe: Using CAPSLOCK status in StatusBarPanel Pin
Luc Pattyn8-Aug-07 0:26
sitebuilderLuc Pattyn8-Aug-07 0:26 
GeneralRe: Using CAPSLOCK status in StatusBarPanel Pin
Sgg2458-Aug-07 1:20
Sgg2458-Aug-07 1:20 
GeneralRe: Using CAPSLOCK status in StatusBarPanel Pin
Luc Pattyn8-Aug-07 1:37
sitebuilderLuc Pattyn8-Aug-07 1:37 
GeneralRe: Using CAPSLOCK status in StatusBarPanel Pin
Sgg2458-Aug-07 2:22
Sgg2458-Aug-07 2:22 
GeneralRe: Using CAPSLOCK status in StatusBarPanel Pin
Luc Pattyn8-Aug-07 3:37
sitebuilderLuc Pattyn8-Aug-07 3:37 
QuestionWord compatibility Pin
Spaz807-Aug-07 23:14
Spaz807-Aug-07 23:14 
AnswerRe: Word compatibility Pin
satsumatable8-Aug-07 1:44
satsumatable8-Aug-07 1:44 
GeneralRe: Word compatibility Pin
Spaz808-Aug-07 1:59
Spaz808-Aug-07 1:59 
GeneralRe: Word compatibility Pin
satsumatable8-Aug-07 3:29
satsumatable8-Aug-07 3:29 
GeneralRe: Word compatibility Pin
Spaz808-Aug-07 5:09
Spaz808-Aug-07 5:09 
Questionproblem with printer Pin
help as an alias7-Aug-07 23:02
help as an alias7-Aug-07 23:02 
QuestionSetting network adapter to promiscuous mode Pin
dotman17-Aug-07 22:45
dotman17-Aug-07 22:45 
QuestionResponse.Content Type Pin
sarodam7-Aug-07 22:43
sarodam7-Aug-07 22:43 
AnswerRe: Response.Content Type Pin
asithangae7-Aug-07 23:51
asithangae7-Aug-07 23:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.