为了读取资源文件到cpp。供opencv处理,采取的方式是把之前的cpp文件的后缀改成:.mm
然后会出现各种报错,原因是因为命名冲突,前面加上cv::就行。
const char* imagePath = [[[NSBundle mainBundle] pathForResource:@"GlassMaterial/eye_brow_mask_03" ofType:@"png"] UTF8String]; std::string target_brow_filename(imagePath); Mat mask = cv::imread(target_brow_filename, cv::IMREAD_UNCHANGED);