eduardolundgren / tracking.js

A modern approach for Computer Vision on the web
http://trackingjs.com
Other
9.44k stars 1.45k forks source link

Find image in image? #155

Open Darker opened 8 years ago

Darker commented 8 years ago

Hello, I want to make a simple AI that plays a game using the screenshots. The game is simple 2D game so it shouldn't be hard. Main thing to do is to be able to find image in the screenshots to locate interactive objects. What's a good getting started guide to do that?

thiago-rocha commented 8 years ago

The answer is it depends. =P Depends of how is the image to be found, this image can be rotated, this image is a simple geometric object, this image has particular color.... So, for a better answer I will need more details about this image.

Darker commented 8 years ago

The image will be simply cropped screenshot from the game - for example image of an enemy. The object might be animated in the game but will retain the same colors. The image will be the same size and will not rotate. I can't just compare all the pixels due to possible animation. Last time I did this, I made an integral image of the screenshot then seeked by average color of the small image. But I am very lazy to implement all this again in javascript, it's a lot of code...

thiago-rocha commented 8 years ago

Ok, so I think you can use the color tracker in your game. My suggestion is as following, choice a color to identify the enemy, this color shouldn't in any other object. Use the color tracker to find the position of this color on the screenshot.

So, @Darker , that can work?

tomasdev commented 5 years ago

This could also be useful for tracking purposes. Where AR.JS uses Hiro markers, this could provide bitmap support to that.