The samples of above link lacks some important information for configuration.
To run opencv programs on iOS:
1. get opencv2.framework and add to the project.
2. insert the following lines to "project folder/Supporting Files/projectname-Prefix.pch"
#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif
3. change the extensions .m of source files to .mm.
4. to use namespace, insert the following line in the header (or source if necessary) file.
using namespace cv;