inspirit / jsfeat

JavaScript Computer Vision library.
MIT License
2.74k stars 374 forks source link

Find image in image? #59

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?

Downquark7 commented 8 years ago

The type of guide you wanted is somewhat vague. However, this guide should help assuming you want to use Python and have a webcam pointed at the screen. http://community.dur.ac.uk/m.j.r.bordewich/rpi/BrickPiRobot.html This guide shows how to program a robot to chase a ball using a webcam and Python. Presumably, the 2d game you specified will have a several ball like objects to track and will use math to compare the positions of the objects. It would really help if I had a better description of the game. I want to help if possible.

Downquark7 commented 8 years ago

Sorry that comment has nothing to do with JavaScript. I didn't realize that it was in a repository because I had a link directly to this thread on a mobile device. However, how are you going to get screenshots with JavaScript?

Downquark7 commented 8 years ago

I really would recommend you use Python instead of JavaScript because it is much simpler to use complex library's and has more tutorials. Unless if you have a reason not to.

Darker commented 8 years ago

My question was regarding the jsfeat library (which is in Javascript). I want to use javascript because I already obtain screenshot using javascript. I already have a simple AI that looks for pixel color and makes decision on that, but I wanted something smarter. I wanted to know whether jsfeat library can handle the task.

Downquark7 commented 8 years ago

How did you get screenshots with JavaScript?

Darker commented 8 years ago

https://www.npmjs.com/package/adbkit

sidorares commented 8 years ago

@Darker I've used opencv MatchTemplate for this - https://github.com/peterbraden/node-opencv/blob/13a1de4f9259b5e745021f3198a8339ac99edecd/src/Matrix.cc#L95