添加相應的宏定義和頭文件,注意宏定義必須加在頭文件 include之前。
基于 SSE2
#define CV_SIMD128
#define CV_SSE2 1
#define CV_CPU_HAS_SUPPORT_SSE2 1
#include <opencv2/core/hal/intrin.hpp>
基于 NEON
#define CV_SIMD128
#define CV_SSE2 0
#define CV_NEON 1
#define CV_CPU_HAS_SUPPORT_NEON 1
#include <opencv2/core/hal/intrin.hpp>
然后就可以使用 v_float32x4 之類的數據類型和函數用于指令集加速了,參見https://docs.opencv.org/4.1.1/df/d91/group__core__hal__intrin.html