Find section of an image within an image

Gopher2011

Well-known member
Joined
Mar 3, 2011
Messages
111
Location
South England
Programming Experience
10+
MainImage.PNG Big screen grab example

PartImage.PNG Little image example

Sorry for this and I really would appreciate any comments.. or help..

I am working with a home made industrial OCR recondition (but not actually OCR), and I know some of you will say 'this is better' and 'that is better' but my company's application is very precise, so this is the best way I can put it..

What I need to do - and I make the example as simple as possible here - is to get a screen grab. I then need to compare the screen grab with a stored tiny image, just showing a small image. I then need to compare the screen grab, and then if a match is found, return the x/y of the co-ordinates of the little image in the big screen grab image..

I really do hope this makes sense..

If you can help or point me in the right direction I would appreciate it.
 

Gopher2011

Well-known member
Joined
Mar 3, 2011
Messages
111
Location
South England
Programming Experience
10+
A pixel by pixel comparison takes forever, any suggestions for a quicker way? I can grab screen shots and find the data with a pixel by pixel comparison but this takes*forever*
 
Last edited:

ThomasT

Member
Joined
Aug 7, 2010
Messages
11
Programming Experience
1-3
If the small image will ALWAYS be an exact copy of a smaller part of the big screen capture Pixel Comparison is the best way(There are faster methods I just forgot where :( ) If the small Image looks like a Section of the big image but not exactly matches then you'd be better of creating a Artificial Neural Network. ANN's are used for things like OCR but they can be adapted for almost anything you can use a algorithm for. The only and i think biggest Con of a ANN is that you better gear up for some hard coding.
 

ThomasT

Member
Joined
Aug 7, 2010
Messages
11
Programming Experience
1-3
Then You can use Bitmap.lockbits. I suggest you create a C# dll That compairs the img's because in C# you can use pointers wich is faster than the vb.net Marshal.
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,466
Location
Norway
Programming Experience
10+
I suggest you create a C# dll That compairs the img's because in C# you can use pointers wich is faster than the vb.net Marshal.
Not relevant, copying all image data from unmanaged memory using Marshal class can be done in a single operation (and fast too, typically 1/3ms), from there the comparisons is the same.
Here's an explanation of Lockbits: Using the LockBits method to access image data
 
Top Bottom