compare 2 bitmaps?
compare 2 bitmaps?
What's the fastest way to compare 2 bitmaps?
Re: compare 2 bitmaps?
Use only very different bitmaps...So you can see it with your own eyes (Ok joke, sorryJimboi wrote:What's the fastest way to compare 2 bitmaps?

Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Run through the two images, comparing pixel by pixel in a For-loop by reading the image buffer with DrawingBuffer().
PB 4.30
Code: Select all
onErrorGoto(?Fred)
It depends what answer you are looking for.
Do you just want "isIdentical" True/False or "how different" answer is a distance function (number of identical pixels or distance of the colour etc).
When you compare pixel by pixel you could just jump out of the loop at the first point that doesn't match.
You could compare to CRC's of the image too perhaps.
Do you just want "isIdentical" True/False or "how different" answer is a distance function (number of identical pixels or distance of the colour etc).
When you compare pixel by pixel you could just jump out of the loop at the first point that doesn't match.
You could compare to CRC's of the image too perhaps.
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
No, that's wrong.
Comparing pixel by pixel with Point() is very slow...
Comparing pixel by pixel with the method I've described above is very fast!
If you only find 100% identical double images, you can also use MD5FileFingerprint(), but then the whole file must be abso-fuckin-lutely identical!!
Comparing pixel by pixel with Point() is very slow...
Comparing pixel by pixel with the method I've described above is very fast!
If you only find 100% identical double images, you can also use MD5FileFingerprint(), but then the whole file must be abso-fuckin-lutely identical!!
PB 4.30
Code: Select all
onErrorGoto(?Fred)
Also, .bmp are very simple to read with ReadFile()
http://en.wikipedia.org/wiki/BMP_file_format
So you have not to "ask" necessarily the video buffer
http://en.wikipedia.org/wiki/BMP_file_format
So you have not to "ask" necessarily the video buffer
Something like this (I didn't test it):
Code: Select all
ReadFile(0, "c:\file1.bmp")
ReadFile(1, "c:\file2.bmp")
Len = Lof(0)
If Len = Lof(1)
Mem1 = AllocateMemory(Len)
Mem2 = AllocateMemory(Len)
ReadData(0, Mem1, Len)
ReadData(1, Mem2, Len)
Result = CompareMemory(Mem1, Mem2, Len)
EndIf
CloseFile(0)
CloseFile(1)
This might be faster than the MD5-method, but the file must be present on your HDD. For example, you cannot compare 2 images that you received via network.
And you code fails, when comparing a PNG to a GIF for example.
I think it would be the best, if the thread creator tells us more details about his needs.
//Edit
Do you only want to compare BMPs or all image formats?
And you code fails, when comparing a PNG to a GIF for example.
I think it would be the best, if the thread creator tells us more details about his needs.
//Edit
Do you only want to compare BMPs or all image formats?
PB 4.30
Code: Select all
onErrorGoto(?Fred)
That enough for today..i will try yours guide when get home..
anyway..this is just an idea... i try to compare internet captcha image with my collections captcha image stored in my harddisk.. since coding someting like OCR is very tough for me.. this might be usefull for auto login to website that i visit everyday like bux site..
anyway..this is just an idea... i try to compare internet captcha image with my collections captcha image stored in my harddisk.. since coding someting like OCR is very tough for me.. this might be usefull for auto login to website that i visit everyday like bux site..
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
If you copy both images over each other with XOr, each difference will leave a set bit in a desert of zeros.
... but I doubt it would be faster, because you could do the compare in the first loop, instead of first copy it and then find a zero...
but it's the most effektive method if you want to compare the pictures visually.
... but I doubt it would be faster, because you could do the compare in the first loop, instead of first copy it and then find a zero...
but it's the most effektive method if you want to compare the pictures visually.
oh... and have a nice day.
Okay, first up i want to tell that captcha's are made so bots/other software will be restricted from doing things. They are there for a purpose, not to annoy users, rather to protect them. They are MADE to be very very hard for software to read/understand, so the chance that you or practically anybody can read the newer generation captchas is VERY little.i try to compare internet captcha image with my collections captcha image stored in my harddisk
Secondly, neither of the above solutions will work here as these captchas are probably generated on the fly. You need some kind of estimate to see if they are likely to be equal. So you need some analysis tools, byte to byte will have no effect with captchas. Neural networks might be used to create some sort of heuristic analysis, but this is not an easy thing to code and it will be tricket by artifacts and traps in the images.
And with the more and more advanced captchas on today, you will need code to eliminate vertical lines and bogus characters/graphic. This is not an easy job, trust me on that one. Simply comparing bytes will get you no where in this situation.
edit:
i know you are also looking for an OCR dll to help you with this, but i can tell you that i really doubt you'll find anything that works with just the slightly more advanced captchas. Again, captchas are MADE not to be machine-readable.
Could you eventually post an example captcha, eg take a screenshot of one from there so we can see what exactly it is we are dealing with?
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
oh, I just overlooked the sentence with the captchas...
I agree to thefool
it would be absolutely useless I think, because one captcha just have to be altered in one pixel to be two different images but still the same captcha.
you won't be able to store enough comparison images and compare them in time before the universe ends to identify ANY captcha.
... better pay someone to read the captchas for you, that would be far far more effektive.
I agree to thefool
it would be absolutely useless I think, because one captcha just have to be altered in one pixel to be two different images but still the same captcha.
you won't be able to store enough comparison images and compare them in time before the universe ends to identify ANY captcha.
... better pay someone to read the captchas for you, that would be far far more effektive.
oh... and have a nice day.