1
현재이 도구를 사용하여 화면의 다른 이미지 (즉, 창)에서 발생하는 비트 맵을 찾을 수 있지만 도구가 느리므로 1 초 또는 그 미만의 시간이 걸릴 수 있습니다. 이미지를 섹션 0,0에서 80,60 섹션으로 잘라내서 검색하면 거기에서 검색하면 같은 자르기를하지만 y + 60을 수행하고 전체 이미지를 덮을 때까지 계속됩니다. 그것은 800큰 이미지에서 빠른 이미지 검색
내가 현재 사용하는 코드 픽셀 600이다 :
public bool findImage(Bitmap small, Bitmap large, out Point location)
{
//Loop through large images width
for (int largeX = 0; largeX < large.Width; largeX++)
{
//And height
for (int largeY = 0; largeY < large.Height; largeY++)
{
//Loop through the small width
for (int smallX = 0; smallX < small.Width; smallX++)
{
//And height
for (int smallY = 0; smallY < small.Height; smallY++)
{
//Get current pixels for both image
Color currentSmall = small.GetPixel(smallX, smallY);
Color currentLarge = large.GetPixel(largeX + smallX, largeY + smallY);
//If they dont match (i.e. the image is not there)
if (!colorsMatch(currentSmall, currentLarge))
//Goto the next pixel in the large image
goto nextLoop;
}
}
//If all the pixels match up, then return true and change Point location to the top left co-ordinates where it was found
location = new Point(largeX, largeY);
return true;
//Go to next pixel on large image
nextLoop:
continue;
}
}
//Return false if image is not found, and set an empty point
location = Point.Empty;
return false;
}
관심 분야 : http://stackoverflow.com/a/11004944/1373170 –