Results 1 to 8 of 8
  1. #1
    Kanyenke is offline Member
    Join Date
    Oct 2011
    Posts
    4
    Rep Power
    0

    Default Getting coordinates of an Image within another Image

    Hey there!

    Im trying to make some kind of bot program, based on patterns recognitions in Java.

    So... my plan is to take an screenshot, and using some images stored, clicking on the coordinates where that image has a pattern.

    Any ideas? Or at least... any other idea to automate non-web stuff?

    Thanks!

  2. #2
    jammas615 is offline Senior Member
    Join Date
    Jul 2011
    Location
    Melbourne, Victoria, Australia
    Posts
    155
    Rep Power
    4

    Default Re: Getting coordinates of an Image within another Image

    You can use getSubImage(x-coord, y-coord, width, height); to make a new image from an existing image object.
    I dont clearly understand what you want to do,
    Do YOU want to select the image pattern or does your program do that?

  3. #3
    Kanyenke is offline Member
    Join Date
    Oct 2011
    Posts
    4
    Rep Power
    0

    Default Re: Getting coordinates of an Image within another Image

    The pattern image is already there; i just need to compare it to the screenshot image and get the position it is.

    Using getsubimage() would need me to know where the pattern image is already! Doesn't it?

  4. #4
    jammas615 is offline Senior Member
    Join Date
    Jul 2011
    Location
    Melbourne, Victoria, Australia
    Posts
    155
    Rep Power
    4

    Default Re: Getting coordinates of an Image within another Image

    Well if you use getSubImage(); your pattern recognition code could call getSubImage(); with the coordinates.
    If that is what you are doing.

  5. #5
    Kanyenke is offline Member
    Join Date
    Oct 2011
    Posts
    4
    Rep Power
    0

    Default Re: Getting coordinates of an Image within another Image

    I need something like this:

    image1 = getScreenshot(); //an application, with a login form (1024x768)
    image2 = loadImage("image.jpg"); //a previously taken pic of the app form (500x100)

    position = image1.indexOf(image2)); //(200, 100) the position of where image2 is within image1.

    How could i develop "indexOf" method? How can I get the coordinates of where image2 is on image1?

  6. #6
    jammas615 is offline Senior Member
    Join Date
    Jul 2011
    Location
    Melbourne, Victoria, Australia
    Posts
    155
    Rep Power
    4

    Default Re: Getting coordinates of an Image within another Image

    These two threads on other forums have tried something similar:
    Finding A Sub-image In A Larger Image - Java | Dream.In.Code
    Comparing Images, Need To Find A Sub-image In A Larger Image - Java | Dream.In.Code

    But all i can think of doing is converting each image to some comparable form, such as an array and then find the image in the array and convert it back to end up with the position. Might be a lot of work though....

    Regards, James.

  7. #7
    Kanyenke is offline Member
    Join Date
    Oct 2011
    Posts
    4
    Rep Power
    0

    Default Re: Getting coordinates of an Image within another Image

    I used the first post method... It works... but in some casess (like white buttons) it may have some problems.

    Any other suggestions? Or at least, any guide on applications automation development in Java?

  8. #8
    jammas615 is offline Senior Member
    Join Date
    Jul 2011
    Location
    Melbourne, Victoria, Australia
    Posts
    155
    Rep Power
    4

    Default Re: Getting coordinates of an Image within another Image

    Not that i know of, but if you stick at it you will come out with your own 100% working algorithm for comparing with no problems. Only thing is that it will be a massive amount of work though.

Similar Threads

  1. Replies: 1
    Last Post: 07-28-2011, 08:48 AM
  2. Replies: 12
    Last Post: 04-14-2011, 01:58 PM
  3. Help Getting Image Coordinates
    By Witik in forum New To Java
    Replies: 2
    Last Post: 09-06-2010, 01:02 PM
  4. Replies: 14
    Last Post: 04-10-2009, 08:46 AM
  5. Replies: 0
    Last Post: 01-08-2008, 05:29 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •