Tag Archives: example

Basename and Dirname

Often the unix commands basename and dirname are useful in shell scripts, but how do you use these in c or c++?. The C way: libgen.h If you’re working in c, the posix header libgen.h provides dirname and basename functions, with some limitations: They only work with char *, and dirname will modify the char * you pass into it … Continue reading

Posted in <code> | Tagged , , , , , , , , , | Leave a comment

Using Gcc C++ Hash Classes With Strings

So even though hash_map and hash_set aren’t a part of the C++ standard, there are still implementations included with the gcc compiler. You have to include or and a little magic to get them to work properly with std::string keys. // Example code using a hash_set with std::string keys on gcc // Example based on hash_set code from "6.7 Using … Continue reading

Posted in <code> | Tagged , , , , , , , , , | 3 Comments

OpenCV: Corner Detection Using cvGoodFeaturesToTrack

Here’s an example opencv application which uses cvGoodFeaturesToTrack to detect corners in a webcam video feed. download good_features.cpp source // // This code displays corners found by the opencv function // GoodFeaturesToTrack (cvGoodFeaturesToTrack) // // Sample webcam code taken from // http://www.cs.iit.edu/~agam/cs512/lect-notes/ // opencv-intro/opencv-intro.html#SECTION00070000000000000000 // // compile with: // gcc `pkg-config –cflags opencv` `pkg-config –libs opencv` // -o good_features good_features.cpp … Continue reading

Posted in <code> | Tagged , , , , , , , , , , , , | 10 Comments
<RSS Feed>