Tag Archives: C

Enumerations in PHP

In the C programming language, enumerations are handy little data types, which add more linguistic context to the code. They make code more readable, and enforce variables to have certain values. The latter is certainly true, if you have ever assigned string-valued codes to your variables and made a typo somewhere. For example assigning 'white' to the variable $color, and then make a typo somewhere in the code by using 'whiet' or something like that. The program would still compile or run, and not complain at all, while there is something fundamentally wrong with the code.
Continue reading Enumerations in PHP

Webcam streaming, signals, and Computer Vision

In my previous blog post, I wrote about my webcam library, which I recently applied to an SDL application to show streaming pictures in an SDL frame, and it works pretty well. The code can be found in a branch on my GitHub.

When I posted about my webcam library on a social network, someone mentioned a C++ library that would do all the computer vision stuff I mentioned in the blog post. This library is called OpenCV. I took a quick look, and it seems very feature-rich. It is supposed to have a set of functions for accessing the webcam as well. I guess I should read more on motion analysis and object tracking, but first I’ll play with some of the basic features of OpenCV, such as image processing and image analysis.

Continue reading Webcam streaming, signals, and Computer Vision

Simple webcam access in C

I have been wanting to write something that detects things in real-time, on images streamed from a webcam. People who have watched the RoboCop, Terminator, or Iron Man movies, will probably remember the rectangles or circles around objects in video, with a description next to it. While having a rectangle around my head would be a good start, I’d like my computer to also recognize other things, such as a book, a key or any other object. But to do this, I needed a simple interface to my webcam, so that I can say with one function that I want to read in a frame from the webcam.

Continue reading Simple webcam access in C