Hi,
How to do image recognition? please explain me briefly with example...
Kindly reply me ASAP.
Thanks & regards,
Palani
Need Image recognition sample
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
You can find the following source samples in the RanorexNet API documentation:
The following sample searches the image "TrackBar.bmp" in the ToolStrip and returns the location of the first pixel in the control if the image could be found. The sample uses the CompareImage function to demonstrate how to compare an image loaded from a file with an other image in the control.
The following example searches and compares the image "MyImage.bmp" in the first subitem of a ListView.
The sample uses the FindImage and ComparaImage functions.
Jenö
Ranorex Team
The following sample searches the image "TrackBar.bmp" in the ToolStrip and returns the location of the first pixel in the control if the image could be found. The sample uses the CompareImage function to demonstrate how to compare an image loaded from a file with an other image in the control.
Code: Select all
Point point;
if (toolStrip.FindImage("TrackBar.bmp", out point) == true)
{
Point offset = new Point(point.X - toolStrip.Location.X, point.Y - toolStrip.Location.Y);
Console.WriteLine("ToolStrip Image \"TrackBar.bmp\" found at Location= {0} Offset= {1}", point, offset);
if (toolStrip.CompareImage("TrackBar.bmp", offset) == true)
Console.WriteLine("ToolStrip ImageCompare OK");
Mouse.Move(point);
}
Code: Select all
for (int index = 1; index < itemCount; index++)
{
Point location = listView.GetSubItemLocation(index, 1, false);
Size size = listView.GetSubItemSize(index, 1, false);
string imageFileName = "MyImage.bmp";
Point point;
if (listView.FindImage(imageFileName, out point, location, size) == true)
{
Console.WriteLine(" Image found Index={0} Name={1} {2} {3}", index, listView.GetItemText(index, 0), location, size);
Point offset = new Point(point.X - listView.Location.X, point.Y - listView.Location.Y);
if ( listView.CompareImage(imageFileName, offset) == true )
Console.WriteLine(" Image compare OK");
Mouse.Click(MouseButtonType.LeftButton, point.X, point.Y);
}
}
Jenö
Ranorex Team