各位高人,有个问题想请教,还望解答。我刚学OPENCV,刚好用到opencv下的bitwise_xor函数,就想测试一下,该函数与matalb下的bitxor两个运行速度快慢。以下是程序:
matlab code:
function test
a=uint8(zeros(288,512));
b=uint8(ones(288,512));
tic
bitxor(a,b);
toc
end
结果:
Elapsed time is 0.000149 seconds.
opencv code:
#include "stdafx.h"
#include "cv.h"
#include "opencv2\opencv.hpp"
#include "highgui.h"
using namespace cv;
int _tmain(int argc, char* argv[])
{
Mat dat1(288,512,CV_8UC1),dat2(288,512,CV_8UC1),dst(288,512,CV_8UC1);
TickMeter tm;
tm.reset();
tm.start();
bitwise_xor(dat1,dat2,dst);
tm.stop();
double temp=tm.getTimeMilli();
}
测试结果:temp=0.0012915049259053875 seconds
我想在MATLAB中bitxor是个内嵌函数,其运行效率应该与OPENCV下的bitwise_xor相当,但结果令我很困惑,两者相关十倍,希望高人能帮忙分析,谢谢!