Note that there are some explanatory texts on larger screens.

plurals
  1. POFinding an Image Inside Another Image
    primarykey
    data
    text
    <p>I'm trying to build an application that solves a puzzle (trying to develop a graph algorithm), and I don't want to enter sample input by hand all the time.</p> <p><strong>Edit:</strong> I'm not trying to build a game. I'm trying to build an agent which plays the game "SpellSeeker"</p> <p>Say I have an image (see attachment) on the screen with numbers in it, and I know the locations of the boxes, and I have the exact images for these numbers. What I want to do is simply tell which image (number) is on the corresponding box. </p> <p><a href="http://i46.tinypic.com/3089vyt.jpg">Numbers http://i46.tinypic.com/3089vyt.jpg</a></p> <p>So I guess I need to implement </p> <p><code>bool isImageInsideImage(Bitmap numberImage,Bitmap Portion_Of_ScreenCap)</code> or something like that.</p> <p>What I've tried is (using <a href="http://code.google.com/p/aforge/">AForge</a> libraries)</p> <pre><code>public static bool Contains(this Bitmap template, Bitmap bmp) { const Int32 divisor = 4; const Int32 epsilon = 10; ExhaustiveTemplateMatching etm = new ExhaustiveTemplateMatching(0.9f); TemplateMatch[] tm = etm.ProcessImage( new ResizeNearestNeighbor(template.Width / divisor, template.Height / divisor).Apply(template), new ResizeNearestNeighbor(bmp.Width / divisor, bmp.Height / divisor).Apply(bmp) ); if (tm.Length == 1) { Rectangle tempRect = tm[0].Rectangle; if (Math.Abs(bmp.Width / divisor - tempRect.Width) &lt; epsilon &amp;&amp; Math.Abs(bmp.Height / divisor - tempRect.Height) &lt; epsilon) { return true; } } return false; } </code></pre> <p>But it returns false when searching for a black dot in this image.</p> <p>How can I implement this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload