Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 20:05

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C#] Position eines Image in Screen suchen

Discussion on [C#] Position eines Image in Screen suchen within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1



 
Serraniel's Avatar
 
elite*gold: 0
The Black Market: 205/1/0
Join Date: May 2010
Posts: 6,853
Received Thanks: 5,106
[C#] Position eines Image in Screen suchen

Hallo,

ich suche eine Methode, die in einem Screenshot nach einem bestimmten Bild sucht, welches im Programm hinterlegt ist. Die Methode soll dann die Koordinaten ausgeben, wo sich das Template Image im Source Image befindet.

Natürlich hab ich versucht mich dazu schon etwas zu erkundigen und bin im Internet auf einen Code, basierend auf der AForge.net Libary, gestoßen, welcher jedoch bei mir nicht funktioniert und das Programm zum Absturz bringt:

Code:
System.Drawing.Bitmap sourceImage = (Bitmap)Bitmap.FromFile(@"C:\Users\Daniel\Desktop\source.png");
            System.Drawing.Bitmap template = (Bitmap)Bitmap.FromFile(@"C:\Users\Daniel\Desktop\template.png");
            // create template matching algorithm's instance
            // (set similarity threshold to 92.1%)

            ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0.485f);
            // find all matchings with specified above similarity

            TemplateMatch[] matchings = tm.ProcessImage(sourceImage, template);
            // highlight found matchings

            BitmapData data = sourceImage.LockBits(new Rectangle(0, 0, sourceImage.Width, sourceImage.Height), ImageLockMode.ReadWrite, sourceImage.PixelFormat);
            foreach (TemplateMatch m in matchings)
            {

                Drawing.Rectangle(data, m.Rectangle, Color.White);

                MessageBox.Show(m.Rectangle.Location.ToString());
                // do something else with matching
            }
            sourceImage.UnlockBits(data);

Gibts jemanden der dazu ne Lösung hat oder mir mit Tipps helfen kann?
Serraniel is offline  
Reply


Similar Threads Similar Threads
Image on the screen
07/09/2012 - AutoIt - 2 Replies
Hello ppls. Is it possible,in autoit,to dont make anything only an transparent background image somewhere on the screen,like a "+" or something?? If yes,please,tell me how. And to make the script to be ALWAYS ON TOP???
[VB.NET] Image From Screen?
03/20/2012 - .NET Languages - 2 Replies
Hey, Is there any understandable way to found image X from screen? For example if I have set image X as elitepvpers logo. I come to this site and click "find" button -> msgbox("imagefound" + image.size + image.location....). This above is the main question but if someone knows how to draw perfectly to screen it would be nice to know. I know how to draw dot, squares, etc but they stay on screen just until I draw other window above them. (=how to get them to stay on screen (topmost) even...
Position eines Spielers über der db ändern?
05/14/2010 - Metin2 Private Server - 1 Replies
Wie kann ich die Position des Spielers (das heißt, Map, Position, etc.) über der db ändern?
[Request][Help] Moving clients to position on screen (right-top corner)
02/02/2010 - CO2 Programming - 1 Replies
Just found an easy way to do this with autohotkey. for who ever is interested the ahk script would be: WinWait, Raiding Clans WinMove, 0, 0 ; For top left corner, for right top corner you have to look at what your resolution is to know where to put it. EDIT:// Ok now, with the new chat in conquer i noticed moving my CO with this is not a correct way.
X,Y-Position eines Targets
06/15/2005 - World of Warcraft - 12 Replies
Mahlzeit. Kann mir jemand sagen, wie ich die X,Y-Position von etwas rausbekomme? Mein Problem ist, das ich mit "GetPlayerMapPosition("unit");" ; anscheinend nur die Position von Spielern bestimmen kann, aber nicht die pos von mobs. Wäre sehr schön, wenn mir da einer helfen könnte. Zur Info: Ich möchte mir ein Addon basteln, das mir die Entfernung zum Gegner anzeigt, um nicht andauernd per try&error die optimale entfernung für meine Zauber rausfinden zu müssen. Gruß, Sine



All times are GMT +1. The time now is 20:05.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.