ok this is my first time ever posting. Sorry if i am not specific enough.
i am trying to make a bot using java coding, using eclipse. the game i am playing(dark summoner) does not have status bars but, fractions such as 23/47 energy 240/300 battle points. i can't find a way to get the values from the top or the screen into my code. also to make this easier i thought i could get my code to focus on the window opened with the game in it, and can not find a way to do that.
the idea behind the bot so far is to have it attack when i reach enough battle points. when this is achieved i plan on making it usable on any or most energy based games like mafia wars age of baymont millions to list
so in short my question is how do i get values from a specific area of an image, to my code using java
oh yeah i am a noob
You cannot get the number from the image, but you can assign number to the image. After displaying proper image, you will know what number is connected with it. Divide whole number into digits and display each digit alone, composing the whole number.
If the only aim of the application is to get text from a image, you can think about image processing and some algorithms, but it time consuming.
Related
I'll start saying what I'm doing:
I'll take a photo with a webcam, in this photo there will be an object, always the same object, in a square format with letters inside it. I need to identify those letters. The step of identifying those letters is already done, the problem is the quality of the image coming from the webcam: it won't be the best nor in the best positioning, and the api I'm using to identify those letters requires positioning and quality.
The reason why I have a square is to help to identify where those letters are, so I can 'look for an square' in the image an then do what I've already done to identify the letters. My question is: is there more things I have to do in order to achieve this? Os is it only 're positioning the image, look for the square and then it's done'. If I need to study image processing there is no problem, I'm here because I don't even know what I have to look for.
I'm developing in Java because 'school things', so if there's already and api (I've heard and tried OpenCV, but I don't know what to do with it) it would really help me.
Thanks in advance.
Edit 1: As asked by Springfield762, I took some photos and I'll explain them below.
First let me explain what are the photos: the 'square thing' that will contain the letters isn't done yet, another department is taking care of it, so I had to improvise something here with pens and batteries. The letters will all be made of wood in a nice shape, I had to replace them with some Magicka cards as I don't have them yet, but the cards fits well to explain the example. I also made an example of the the square (that actually ended as an rectangle) in paint, so it has absolutely nothing of beautiful.
I took 3 photos, one using the light coming from the window, the second using the light of my room and the third using the flash of the webcam. (Sorry about links, I can't post images nor links, although I'm always here, this is the first time I post a question...)
Window light:
Room light:
Flash:
Square (rectangle) example:
The 'project' of the square you guys can ignore, I did it so that you can understand the images. And the reason I took 3 different photos was just to show all different possibilities that the webcam might be in. Also, the quality of the Magicka cards isn't a problem, since each card represents one letter, so it'll be easy to 'see' them.
Well, I found most answers to this question, I'll explain them below.
First it's not a square, but a rectangle, and it is still to be made. So I started testing the software using anything that was a rectangle, first I had to 'locate' the rectangle in the frame captured by the camera, then show it in the original image seen by the user, I accomplished that by:
Capturing the actual frame
Converting that frame to HSV;
Applying some kind of threshold (using the Core.inRange function, so that I could find a specific color in the range specified in the function);
Applying the Imgproc.findContours to find the contours of the rectangle;
Finally drawing a rectangle using the points found by the findContours;
How it ended: i.imgur.com/wmNVai0.jpg
After that I knew that I could place the rectangle in a way that all the letters inside it would be in a straight line, so I didn't need to care about the positioning of the letters. Now I had to fight with the OCR.
I chose Tesseract as it is OpenSource and seems to be a strong tool (supported by Google, that's for sure something), then I started to test some images.
In the beginning it was tough and I thought I'd have to train OCR even more, but the thing is that it has some kind of dictionary that tries to find words which are listed in this dictionary, and I didn't need that as I was looking for characters that could be in a total random way. I had to turn off that dictionary by adding the following line to a conf file:
load_system_dawg F
load_freq_dawg F
After that I had to change somethings in the image as well:
Transform into Grayscale;
Resize it by ~80%;
Original images (I can't post links...):
i.imgur.com/DFqNSYB.jpg
i.imgur.com/2Ntfqy3.jpg
Grayscale:
imgur.com/XUZ9b1Z.jpg
i.imgur.com/yjXMH5Q.jpg
Resized:
i.imgur.com/zgX9bKF.jpg
i.imgur.com/CWPRU3I.jpg
(Sometimes I had problems with resized images and on other moments I didn't, that's something I have to test even more.)
Then I could get some good results, though I'm still afraid as the light of the environment makes a whole difference, I still have to test it and mainly I still need the god da** base, I'll post it as an edit later.
If I did anything wrong or if anyone wants to correct me, please feel free to say it!
I am doing my final Year project on Speed Calculation using webcam. In this project we want to calculate speed of object by taking three sequential images whenever motion is detected. As given here: Raser Abwehr SpeedCam 2012, in this three line RED BLUE and GREEN are made and whenever any vehicle cross it, it takes one snap.
For this I have idea that suppose my camera resolution is 640*480 hence I can divide X-Axis in three parts of 210px each therefore I can have three rectangular screens of size (210*480). Now, I want that whenever any vehicle enters in Screen1 then it click a picture then it start second screen detector and when vehicle enters into second screen it takes second picture and at last it detect in third and click picture. Hence we have three picture and we can calculate Speed by process given here Calculating Speed using a Webcam
Presently, I am using JavaCV as Image Processing Library. It is just like running multiple instance of a single Java program to detect motion in different screen. Please suggest to me how i can do. Can Thread be useful here?
(More like a comment but it doesn't fit)
I'd suggest by starting try making it work by taking three pictures at a fixed interval (which you guess).
Then, if you want to address the issue of detecting speed of objects that are moving at quite different speeds, I'd just suggest by starting with taking as many pictures as possible once you detect any movement, for a sufficiently long time, and then figuring out afterwards which one you should use for the analysis.
I can see what you are trying to do but you should probably start with dumb things first. Just my two cents...
Ok so I was asked to do a 2d graph calculator as a college project, I was able to do one using java swing components and rendering an array with x,y values at real time. However there are several problems with this approach:
The array has a limit to the amount of values it can hold.
Its not very good in terms of performance because it has to loop through the whole array at 60 fps or so.
My way of fixing the first problem would be to use a dynamic array list instead of a regular array, but there is still the second problem. The idea of rendering one big image and using it as a 'map' of the graph sounds like a solution however this then brings it's own complications like:
What happens when the field of view goes out of the image boundaries.
How to know what values of the graph it should render to the image.
Now then again I face another decision making, since now we are talking more advance graphics tricks I had the idea of using lwjgl as my graphics library instead of swing which made sense from the word go, so now I can use the 3d camera system to render an orthogonal view of the 2d graph. About the first problem I thought of making chunks of image so that when we leave the FOV there is still an image to see. About the second problem am stuck, because the graph works as a function of x I don't know what my y value is until the equation has been calculated so technically I could check if the y value reaches the bottom of the image and if its lower that the top of the image (however this is still not good for performance).
Now say I have resolved all of the above there is still one last problem, and that is: because I draw the graph as very little lines (two points), how do I know how small the line have to be in order to get an accurate graph yet optimized, even when the function has some really wacky results?
Thank to everyone, and I hope you can help me :)
I'm creating a small game for my uncle (who's running for some political office), a "Find the Sign" game, where users are presented an image, and they search and click on the sign in the picture. Like, the user is shown a picture of a building, like a store or something, and they need to click on the campaign sign that's been posted in the window. There are different kinds of signs, but they all have the same logo in common.
If you truly want to go down the path of image recognition there are well known algorithms.. try Googling around for some, but a few you could look at are SIFT of SURF for instance. Getting something working might take quite an effort though - maybe you could look for a library implementation.
However in your case it seems like that's a bit overkill. If it's a small game as you say, I'm guessing you will be presenting a not too large number of images. You can just annotate each image with the coordinates of the logo you're looking for, say with a simple rectangle, and check if the user clicked within that pre-determined region. This is a small manual overhead for each image - probably not much larger than what you would already do manually to package each into your application/database.
For example, a simple hard coded map might do. You can probably think of a better approach.
Map<String,Rectangle> mapLogoLocationToImage = new HashMap<String,Rectangle>();
mapLogoLocationToImage.put("post_office.png",new Rectangle(1,1,5,5);
mapLogoLocationToImage.put("office_block.png",new Rectangle(3,7,4,6);
.
.
I have 5 images by default in the program, and I will allow the user choose an image from the desktop. The program will determine which image between the 5 images is the closest one to the user image.
Can anyone help me and take me to the start of the idea?
You can try to use a feature extraction algorithm like SIFT, SURF etc. Then compare extracted features with your database. You can select the best matching image based on the number of correct matches.
Generally SIFT works fine for 2D objects, like picture of a label or an advertisement board. Rotation on 2D plane or scale wont matter if you are using SIFT. SURF is supposed to be an improvement of SIFT but I do not have much experience on it.
These algorithms are said to be bit heavy. Anyway if you are matching just 5 images it wont be much of a problem.(Or you can simply calculate the descriptors(features) of your images before hand and store them. Then at run time all you have to do is get the descriptor of the user image and compare it) But still if you are trying to match images of basic shapes like squares and circles, using square detection or circle detection might be efficient performance wise.