All entries for Thursday 09 November 2006
November 09, 2006
Whilst I haven’t done much more on improving the image processor, I have modified a codec which is used by a Java example program that reads in an avi file and passes the frames through the codec.
The ImageProcessor and all the classes that go with it has been modified to make it more usable externally. Some bugs have also been fixed including calculation of the standard deviation before pixel dialation, a divide by zero problem when no pixels are matched, and added a median filter which eliminates very small amounts of noise in the image.
The codec simply applies the ImageProcessor on every single frame, using a target colour that is obtained from only the first frame. Once this has completed, the result is dumped to a
All the code up till now can be downloaded here
This also includes Chris’ new Histogram class. Along with the code, is a 352×288 video of Ant strutting his stuff in the DCS lobby, recorded using my phone. The quality is probably going to be very comparable to that of the webcam.
To use the code, compile the video processor using: -
and then to run it type
which will pop up a file browser for you to choose your video file. Alternatively you can run it by specifying a file://c:\blah\video.avi argument on the end (in windows!). You will need the Java Media Framework in order to compile this stuff. You may want to comment out all the print statements because it gets a bit spammy. Just to do a find & replace in the text editor for System.out.print (no ln!) with //System.out.print
The Jpeg one is an arse to use (not my code again!) because you have to specify width, height, framerate and output arguments. You’re supposed to supply arguments for the files for it to use as well but I’ve bodged it using a for loop in the main method. You’ll have to manually change the truth conditions in the for loop (it’s commented at the appropriate part).
“java JpegImagesToMovie” will show you how to specify the arguments.
Sorry for the long post! Hopefully this will get everyone up to date.
I have been looking at the methods that we have available to us to move the robot.
Currently there doesn’t appear to be a clear header file that does everything, as its work in progress. Although there is a demo file “DigIOdemoDlg.cpp” that I believe that they have been using for testing that we should be able to adapt.
There is a document on the CD, that describes how they have been controlling it.
In essence, the robot has a queue of moves,
to add moves to the queue a function
CInstruction(int port, int starboard, int port_dir, int starboard_dir)
This tells the stepper motors to turn so many steps in a certain direction.
In the case of our robot, when the robot is turning in place
1 degree = 338 2/3 steps
also due to the motors being the same if the last two parameters in the function are set too:
( port_dir = 1, starboard_dir = -1 ) = Forward
( port_dir = 1, starboard_dir = 1 ) = Clockwise
( port_dir = -1, starboard_dir = 1 ) = Backwards
( port_dir = -1, starboard_dir = -1 ) = Anti-Clockwise
This queue can either then be executed one move at a time with a call to a function or with another function that will run though the whole queue until the queue is empty.
So in conclusion with a bit of tweaking and testing it should not be too hard to get the robot to move.