I am currently working on a final year project in my school. It has to do with making a motion detector with a webcam. After many failed attempts I decided to go online to get some help. I found some code for the class that would help do what I want for my project, but it didn’t have any tutorial on how to understand the code. The code wasn’t so perfectly commented. There is a method in the code that is of concern to me. It is the process method. Can anyone tell me how to create the objects that would serve as parameters for the method cos I don’t know the fully qualified name of the Buffer class. And again I also need to fully understand the rest of the method. Here is the URL of the code.
Thanks men for the link. I downloaded the source code. It compiled successfully, but when I plugged my web-cam to my computer and ran the ‘TestMotionDetection’ class with the main method the visual display did not show any sign of motion detection. Have you tried the program with a USB web-cam?
I really need some help here(as soon as possible) cos I have to defend the project in a week plus. Thanks
Yeah I tested it with my laptop webcam and also a usb webcam. I later replaced the effect in this code with the effect from the link in your first posting.
Sorry I just remembered that one of the effects they used did not work. Take note of the digital clock on the screen, it on runs when motion is detected and stops when no motion is detected. That is the work of “TimeStampEffect class” Also add the class from the link in your first posting to the package of this example.
There’s an object Codec codec[] = {new MotionDetectionEffect(),new TimeStampEffect()};
Replace new MotionDetectionEffect() with the class name of effect from your first posting and see what happens
Thanks soooooo much. It worked. There were weird red and orange outlines on objects that moved over the viewing area of my web-cam. How did you figure out the problem? That must have been some good thinking.
I just couldn’t believe that all that source code from the link you posted could have a problem. I taught the problem was from my computer(that maybe I was missing a driver or something), cos I’ve done some pretty messed up stuff with it.
If you could give me a break down of what is going on the various source files I would really appreciate. I want to understand it, not just for my project, but cos I love programming.
I don’t mean to be dumping the work that I should be doing on you, but you know how hard it is to come about a good standard JMF ebook.
Hey, there. I’ve gotten to a road block with my project. I am supposed to save an image to the computer when motion detection happens. How can I do that? Thanks. I’ve made the GUI with JRadioButtons to turn on and to turn off the motion detector. I also created a JCheckBox that would enable or disenabale an alarm sound. By using a JFlieChooser I was able to make it possible to change the directory where motion detection images will be saved. If you give me your email address I could send you my code.
Attached is a zipped file of my code(and the executable jar file) at its present state. Run the MotionDetectionApp jar file, and see how you could input the image snapping functionality when motion detection occurs, cos I couldn’t apply the advice you gave. Thanks
thanks 4 all ur help 4rm d very beginning.i got ur message late, so yesterday afternoon i came up wit an idea 2 get d job done.I was able 2 do d image saving by using the ImageIO class.I tink this way is easier and shorter. If u want i could send a zipped file of my final source code and jar file. That’s d least i could do.
For anyone who is interested here is source code and executable jar file in a zipped file for the completely functional webcam(both USB and in-built) motion detector program. You must have the java runtime environment and jmf installed on your computer. Once extracted, the jar file and the folder within the zipped file must be in the same directory. Hope someone finds this useful.