Right, Step 1 in our Game Player program is capturing the game board.
This is actually an incredibly easy step so before we do that let's do a little setting up of our system's architecture. Yuk, I hate phrases like that, over complicated computing science terms are a pain in the butt and will not feature in this blog where avoidable. I'd much rather say let's get all the bits of our system in place...
As mentioned we are going to use OpenCV for all our reasoning purposes so we need a way of accessing OpenCV from Java. In order to do this we make a native library that we can call from within our Java code using the Java Native Interface (JNI). What is a native library you ask? It is code written in another language, often C, that can be called from other programs. All those .dll files in your Windows system or all those .so files in your Linux distribution are examples of native libraries and are what we are about to make. Don't worry, it's not as scary as it sounds!
A blog discussing my successes, failures and in-betweeners whilst working on computer vision related projects.
Saturday, 7 July 2012
The Game Player Project
I've decided my C and C++ skills really need to be improved since more and more of my work appears to depend on them. So in order to improve them I've decided to take on a project in my spare time that covers both programming in C and C++, OpenCV, Java and JNI. These are all pretty useful tools to use together so hopefully these entries will be of help to others as well.
The project is going to be called 'Game Player' and the aim is to develop an automated system, based on computer vision techniques, that can be used to play games. I make a point of emphasising the computer vision techniques part because there are already lots of automated game players out there that use data held in the computer's memory to play games and that's not what I'm looking to do. I want to build a system that can play a game based purely on what it can 'see' in front of it, the same a regular player does.
The project is going to be called 'Game Player' and the aim is to develop an automated system, based on computer vision techniques, that can be used to play games. I make a point of emphasising the computer vision techniques part because there are already lots of automated game players out there that use data held in the computer's memory to play games and that's not what I'm looking to do. I want to build a system that can play a game based purely on what it can 'see' in front of it, the same a regular player does.
Friday, 6 July 2012
Fixes in OpenCV and RTSP
We've finally got it going!
I'll get onto what was wrong in a second but first I want to share this line with you:
As you can see it is the same as my camera connection url in the previous post except I've added ?tcp to the end. I've found that this forces the rtsp connection to run using the tcp protocol instead of the udp protocol which is useful if you can't afford to have any packet loss. This gives us a decent picture but still performed very poorly, freezing often and dropping the frame rate down to something terrible.
I'll get onto what was wrong in a second but first I want to share this line with you:
CvCapture *camera = cvCreateFileCapture("rtsp://admin:admin@192.168.1.128/ch1-s1?tcp");
As you can see it is the same as my camera connection url in the previous post except I've added ?tcp to the end. I've found that this forces the rtsp connection to run using the tcp protocol instead of the udp protocol which is useful if you can't afford to have any packet loss. This gives us a decent picture but still performed very poorly, freezing often and dropping the frame rate down to something terrible.
Subscribe to:
Posts (Atom)