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...
Related
I'm currently in the process of making a game in Java. I've recently been working on mouse input, and where I'm stuck has to do with the game recognizing when the mouse has moved. I've obviously gotten it to accept mouse input, but I can't make the in-game player rotate correctly based upon mouse position.
What I can come up with to fix it is to take a measurement of the mouse's x position at one point in time, and then compare it to another measurement one millisecond later to see whether or not the mouse has moved, and if so, to get the player to rotate linearly faster with the distance the mouse has translated.
However, I have no idea how to do that without forcing the entire program to wait or yield (which would be bad).
I've tried writing the position to a file and then re-reading it immediately after, but it tends to read from the file at different rates, causing the rotation to be spastic and uneven. But besides that, I'm open to ideas. I can't really post my code because there are many class files that go into the program, but if necessary, I can post the whole project to github for anyone to look at.
GitHub Repository link: https://github.com/isl1/Duplicity
P.S. If it helps, I'm using LWJGL 3, paulscode, and Slick-Util on Eclipse Mars.
Whenever i try to store points on drag event ,if i drag a little faster it doesn't store each and every point i drag on screen.
What should i do that it stores each and every point on my touch path?
It is not a problem of Java, or LibGDX. There are two possible causes:
Your touchscreen digitizer has low refresh rate so that it just can't
keep up with your finger's speed.
Your main loop has a performance issue and something inside loop
takes such a long time that you can't get enough number of touch
events.
Either way, the result will be the same.
I am trying to use the Java Robot class to create a bot to automate some tedious tasks for me, I have never used the Robot class. I have looked up the Class in the Java docs, usage seems straightforward but I have an issue of finding a certain image(I say image, I mean a certain part of the screen) effectively. Is there any other way other than loading 'x' ammount of pixels, checking them, checking the next ammount etc until I find the image I am looking for? Also is there any list of the Button and MouseButton identifiers needed for the Java Robot class as I cna not find any.
For the mouse button identifiers, you are supposed to use BUTTON1_MASK and other button mask constants from java.awt.event.MouseEvent. For example, to click the mouse you would do something like:
Robot r = new Robot();
r.mousePress(MouseEvent.BUTTON1_MASK);
r.mouseRelease(MouseEvent.BUTTON1_MASK);
I believe BUTTON1_MASK is the left mouse button, BUTTON2_MASK is the middle mouse button, and BUTTON3_MASK is the right mouse button, but it has been a month or so since I have used Robot.
As for the checking for an image, I have no idea how that is normally done. But the way you specified in your question where you just check every group of pixels shouldn't be too computationally expensive because you can get the screen image as an array of primitives, then just access the desired pixel with a bit of math. So when checking the "rectangle" of pixels that you are searching for your image in, only keep checking the pixels as long as the pixels keep matching. The moment you find a pixel that does not match, move onto the next "rectangle" of pixels. The probability that you will find a bunch of pixels that match the image that end up not being the image is extremely low, meaning that each rectangle will only need to check about 5 or fewer pixels on average. Any software that performs this task would have to check every pixel on the screen at least once (unless it makes a few shortcuts/assumptions based on probabilities of image variations occurring), and the algorithm I described would check each pixel about 5 times, so it is not that bad to implement, unless you have a huge image to check.
Hope this helps!
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.
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.