get_all_pos_of_image

get_all_pos_of_image($src_path,$image_path,$koeff=0.95); - get all positions of the specified image available since version 7.0.34

The function accepts parameters as input:br>
  • $src_path – the path to the original image (may be relative)
  • $image_path – the path to the picture, the entry of which is necessary to find (can be relative)
  • $koeff – image similarity coefficient (from 0.1 to 1)

    After testing, the function returns the result of its work to the script :
  • image position in the image – a string of the form : "x1:y1@x2:y2@....xn:yn" - coordinates of the occurrence of the specified image in the source or empty string, if no occurrences were found

    PHP example: image->".basename(__FILE__)."
    "; $pp = new XHEPosition(1,1); //1 echo "1.Let's go to the polygon:"; echo $browser->navigate("http://bigfozzy.com")."
    "; sleep(1); //2 echo "2.Screenshot of web page to file:"; echo $webpage->print_screen("test \ test.bmp")." n"; sleep(1); //3 echo "3.Get the coordinates of the image(similarity coefficient 0.97):"; $pos = $image->get_all_pos_of_image("test \ test.bmp", "image \ kak.bmp", 0.97); print_r($pos); $mouse->move($pos [0]->x, $pos [0]->y, false); sleep(2); //4 echo " n4.Go to polygon:"; echo $browser->navigate("http://www.humanemulator.net/poligon/image.html")."
    "; //five echo "5.Screenshot of the src image to file:"; echo $image->screenshot_by_src("test \ test.bmp", "http://www.humanemulator.net/screenshots/02.jpg")." n"; //6 echo "6.Cut the picture from the file:"; echo $image->get_image("test \ test.bmp", "test \ part.bmp", 126,72,40,33)." n"; sleep(2); //7 echo "7.Screenshot of the whole page:"; echo $webpage->print_screen("test \ test.bmp")." n"; //8 echo "8.Get the coordinates of the image(similarity coefficient 0.99):"; $pos = $image->get_all_pos_of_image("test \ test.bmp", "test \ part.bmp", 0.99); print_r($pos); $mouse->move($pos [0]->x, $pos [0]->y, false); sleep(2); //end echo "

    "; //Quit $app->quit(); ?>
    Python example: # Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7070" from xweb_human_emulator import * # Start echo("
    image.xxxxxxxxx
    ") # 1 echo("1.Let's go to the polygon:") echo(browser.navigate("http://bigfozzy.com"), "
    ") time.sleep(1) # 2 echo("2.Screenshot of web page to file:") echo(webpage.print_screen("test \ test.bmp"), " ") time.sleep(1) # 3 echo("3.Get the coordinates of the picture:") pos = image.get_all_pos_of_image("test \ test.bmp", "test \ kak1.bmp") echo(pos [0] .x + "x" + pos [0] .y) # 4 echo(" 4.Let's go to the polygon: ") echo(browser.navigate("http://www.humanemulator.net/poligon/image.html"), "
    ") # five echo("5.Screenshot of the src image to file:") echo(image.screenshot_by_src("test \ test.bmp", "http://www.humanemulator.net/screenshots/02.jpg"), " ") # 6 echo("6.Cut the picture from the file:") echo(image.get_image("test \ test.bmp", "test \ part.bmp", 126,72,40,33), " ") # 7 echo("7.Cut the picture from the file:") echo(webpage.print_screen("test \ test.bmp"), " ") # 8 echo("8.Get the coordinates of the picture:") pos = image.get_all_pos_of_image("test \ test.bmp", "test \ part.bmp") echo(pos [0] .x + "x" + pos [0] .y + "" + pos [1] .x + "x" + pos [1] .y) # end echo("

    ") # Quit app.quit()
    C# example: #region using using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading; using XHE; using XHE.XHE_DOM; using XHE.XHE_System; using XHE.XHE_Window; using XHE.XHE_Web; using System.Drawing; #endregion class Program: XHEScript { static void Main(string [] args) { //init XHE server = "127.0.0.1:7070"; InitXHE(); //Start echo("
    image.get_x_of_image
    "); //1 step echo("1.Let's go to the polygon:"); echo(browser.navigate("http://bigfozzy.com") + "
    "); //step 2 echo("2.Screenshot of web page to file:"); echo(webpage.print_screen("test \ test.bmp") + " n"); //step 3 echo("3.Get the coordinates of the picture:"); List pts = image.get_all_pos_of_image("test \ test.bmp", "image \ kak.bmp"); echo(pts [0] .X + "x" + pts [0] .Y + " n"); //step 4 echo("4.Let's go to the polygon:"); echo(browser.navigate("http://www.humanemulator.net/poligon/image.html") + "
    "); //step 5 echo("5.Screenshot of page to file:"); echo(webpage.print_screen("test \ test.bmp") + " n"); //step 6 echo("6.Get the coordinates of the picture:"); pts = image.get_all_pos_of_image("test \ test.bmp", "image \ part.bmp"); echo(pts [0] .X + "x" + pts [0] .Y + "" + pts [1] .X + "x" + pts [1] .Y); //end echo("

    "); app.quit(); } }
    Java Script example: //connect the object to control the emulator, if not already connected xhe_host = "127.0.0.1:7070"; echo = require("../../../Templates JS/xweb_human_emulator.js"); //Start echo("
    image.get_x_of_image
    "); //1 step echo("1.Let's go to the polygon:"); echo(browser.navigate("http://bigfozzy.com") + "
    "); //step 2 echo("2.Screenshot of web page to file:"); echo(webpage.print_screen("test \ test.bmp") + " n"); //step 3 echo("3.Get the coordinates of the picture:"); var pos = image.get_all_pos_of_image("test \ test.bmp", "image \ kak.bmp"); console.log(pos); //step 4 echo("4.Let's go to the polygon:"); echo(browser.navigate("http://www.humanemulator.net/poligon/image.html") + "
    "); //step 5 echo("5.Screenshot of the src image to file:"); echo(image.screenshot_by_src("test \ test.bmp", "http://www.humanemulator.net/screenshots/02.jpg") + " n"); //6 echo("6.Screenshot of the whole page:"); echo(webpage.print_screen("test \ test.bmp") + " n"); //step 7 echo("7.Get the coordinates of the picture:"); pos = image.get_all_pos_of_image("test \ test.bmp", "image \ part.bmp"); console.log(pos); //end echo("

    "); //Quit app.quit();