get_x_of_image

get_x_of_image($src_path,$image_path,$koeff=0.95); - get the x - coordinate of the occurrence of the specified image available since version 4.9.29

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 :
  • x-coordinate – x-coordinate of occurrence of the specified image in the original
  • false – operation failed (boolean)

    PHP example: image->".basename(__FILE__)."
    "; //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 picture(similarity coefficient 0.9):"; $x = $image->get_x_of_image("test \ test.bmp", "image \ kak.bmp", 0.9); $y = $image->get_y_of_image("test \ test.bmp", "image \ kak.bmp", 0.9); echo $x."x".$y." n"; $mouse->move($x, $y, false); sleep(2); //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")." 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"; //7 echo "7.Get the coordinates of the picture(similarity coefficient 0.9):"; $x = $image->get_x_of_image("test \ test.bmp", "test \ part.bmp", 0.9); $y = $image->get_y_of_image("test \ test.bmp", "test \ part.bmp", 0.9); echo $x."x".$y." n"; $mouse->move($x, $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:") x = image.get_x_of_image("test \ test.bmp", "test \ kak1.bmp") y = image.get_y_of_image("test \ test.bmp", "test \ kak1.bmp") echo(str(x) + "x" + str(y), " ") # 4 echo("4.Move 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"), " ") # 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.Get the coordinates of the picture:") x = image.get_x_of_image("test \ test.bmp", "test \ part.bmp") y = image.get_y_of_image("test \ test.bmp", "test \ part.bmp") echo(str(x) + "x" + str(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; #endregion class Program: XHEScript { static void Main(string [] args) { //init XHE server = "127.0.0.1:7072"; 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:"); int x = image.get_x_of_image("test \ test.bmp", "image \ kak.bmp"); int y = image.get_y_of_image("test \ test.bmp", "image \ kak.bmp"); echo(x.ToString() + "x" + y.ToString() + " 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 the src image to file:"); echo(image.screenshot_by_src("test \ test.bmp", "http://www.humanemulator.net/screenshots/02.jpg") + " n"); //step 6 echo("6.Get the coordinates of the picture:"); x = image.get_x_of_image("test \ test.bmp", "image \ part.bmp"); y = image.get_y_of_image("test \ test.bmp", "image \ part.bmp"); echo(x.ToString() + "x" + y.ToString() + " n"); //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:"); x = image.get_x_of_image("test \ test.bmp", "image \ kak.bmp"); y = image.get_y_of_image("test \ test.bmp", "image \ kak.bmp"); echo(x + "x" + 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 the src image to file:"); echo(image.screenshot_by_src("test \ test.bmp", "http://www.humanemulator.net/screenshots/02.jpg") + " n"); //step 6 echo("6.Get the coordinates of the picture:"); x = image.get_x_of_image("test \ test.bmp", "image \ part.bmp"); y = image.get_y_of_image("test \ test.bmp", "image \ part.bmp"); echo(x + "x" + y + " n"); //end echo("

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