Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Detect Identical Image Once C#

image detection c#

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 pshoes92

pshoes92

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 17 March 2019 - 04:16 PM

The problem I'm having is that I have an image that appears on two pages in the same book.

I wish the script to only react once to the image and then ignore the same image on another page. Once it has done that I want it to reset so the process is repeated.

namespace testpad
{
    class Interaction: Scene
    {
        public override string Name => "Interaction";

        public static RectMap imageone = new RectMap()
        {
            X = 239,
            Y = 199,
            Width = 125,
            Height = 18
        };
        public static RectMap imagetwo = new RectMap()
        {
            X = 217,
            Y = 317,
            Width = 428,
            Height = 12

        public override bool Match(ScriptBase script)
        {
            return script.Match(imageone, 90),
                      || script.Match(imagetwo, 90);

        }
        public override void OnMatched(ScriptBase script)
        {
            if (script.Match(imageone, 90))
            {
                script.PressKey() { A = true });
                Thread.Sleep(100);
            }
            else if (script.Match(imagetwo, 90))
            {
                script.Press() { B = true });
                Thread.Sleep(1000);
            }
    }

}

Would a hashset be of use in this paticular case?






Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download