I am pretty new to programming but I recently discovered an interest in hawk-eye technology and began researching how exactly it worked. I realize that as a beginner, most of this information would not make a bunch of sense to me, but I cam across a more simpler question that I could not seem to find the answer too. I was wondering how one would write a program to analyze a video using c++? It could be something as simple as determining if something moved by analyzing the different frames of a video, but I have no idea where to start. How do I even insert the video information into the program for analysis? what kind of algorithms am I looking at? etc. If someone could help me with where to start or point me in the right direction of where I might get this information, I would really appreciate it!
you can do it. There are libraries out there that process video at the low level, so you don't have to code it from the raw bits on up.
Typically you would use the library to open a stream or a video file. Modern compression is built into the libraries, but what THOSE are doing (at a high level) is 1) it takes the "difference" in pixels from the previous frame and the current frame and get only what changed and 2) compressing what is left via jpeg like compression. These libraries can hand you an RGB(X) array (some formats may have a 4th component, graphics does, video usually not) that you can process. A lot of imagery and video etc can be handled by 3 bytes (one for red, one for green, one for blue, giving your standard 16 million color depth with all possible combos) or the similar HSL (hue/saturation/luminance) approach (you can convert between). You can do just about anything that can be done to a video or image (think of video as a series of images) with that, though there may be more efficient processing that you can do on the compressed stream without going this far for some simple tasks.
To see if something moved, you can just compare 2 frames. This can be done in a number of ways... you can reduce the resolution way, way down and compare. Because many frames are already compressed, you don't want to do a pure equality, or it will always be true. You need a threshold or tolerance approach to make your decision, as things like the colors of the pixels will vary a tiny bit even looking at a still image, the slightest change in lighting etc shouldn't register as movement.
Processing video is nontrivial. There are many large books on the subject. I would first have a good idea of exactly what you want to do in mind, then narrow down your study. For example, a lot of the books are on compression techniques, but that's a freebie in any modern library, you don't have to reinvent it. Common tasks as well... you probably don't need to understand how to code a precise bicubic image resize to use one.
So if I were trying to track movement in a video, what subjects should become proficient in? For example, trying to track a baseball moving in a video of a baseball game.