المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How can I find a Bitmap within another Bitmap?



C# Programming
07-23-2009, 03:40 PM
Hello.

I have two Bitmaps. I know that the small one is contained within the big one, and I want to search for it and return its position (a Rectangle):

public Rectangle findBitmap(Bitmap smallBmp, Bitmap bigBmp);

I can do this by making lots of pixel comparations in nested fors, but obviously it's too time-consuming since there can be literally hundreds of thousands of comparations. I need a *very* fast way to do this.

I've been reading for a while about Template Matching and I think it could be the way, but it's a difficult subject and I have not found any example or code that could help me. Could you please give me some advice?

Thanks in advance.