header image
wxWidgets application out of focus in Mac OS X
August 29th, 2010 under Mac OS X, Programming. [ Comments: none ]

When starting a compiled wxWidgets application in Mac OS X you may have problems getting the focus of the application. You can solve this problem by creating a Mac OS X bundle application and start this instead of the binary:

http://wiki.wxwidgets.org/WxMac_Issues#Building_a_MacOSX_application_bundle

Make sure you configure Xcode (or whatever IDE you are using) to use the bundle or start the application manually.


OpenCV Mat and its Data Types
June 14th, 2010 under Programming. [ Comments: none ]

Since, OpenCV’s documentation is more than lacking a few sentences I’ll post some important facts that can easily be missed.

To access the elements of a cv::Mat one can use the at<T>(int y, int x) method. Usually, the elements are stored as doubles (CV_64F). So to get for example elements (1,1) the call is

mat.at<double>(1,1);

but you’re not forbidden to call

mat.at<float>(1,1);

OpenCV won’t complain that you’re reading the wrong data type. OpenCV also doesn’t perform a type conversion. Hence, you’ll end up with the wrong data.

In summary, make sure you’re reading the correct data type. You might use the depth() method to figure out the internal type of the matrix


Enable Warnings, Debugging and Profiling with CMake
March 15th, 2010 under Programming. [ Comments: none ]

To tell the compiler to print warnings, add debugging symbols and profiling code add the following line to your CMakeLists.txt

set(CMAKE_CXX_FLAGS "-Wall -g -pg")

as usual -Wall specifies the warning level -g enables debugging and -pg profiling.