摘要: #include #include #include using namespace cv;Mat img;void onMouse(int event, int x, int y, int flags, void* param){ char text[20]; Mat img2, img3; img2 = img.clone(); if (event == CV_EVENT_LBUTTONDOWN) { Vec3b p = img2.at(y,x); sprintf(text, "R=%d, G=%d, B=%d", p[2], p[... 阅读全文
posted @ 2013-08-29 13:19 亲福 阅读(1173) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace cv;using namespace std;int main( int argc, char** argv ){ if( argc != 2) { cout <<" Usage: display_image ImageToLoadAndDisplay" << endl; return -1; } Mat image; image = imread(argv[1], CV_LOAD_IMAGE_COLOR); // Read the file if(! ... 阅读全文
posted @ 2013-08-29 13:06 亲福 阅读(445) 评论(0) 推荐(0) 编辑
摘要: 我们如何衡量时间?那么OpenCV提供两个简单的函数来实现它:getTickCount() 和 getTickFrequency()。前者返回系统CPU完成某些事件发出信号的次数(比如来自你启动你的系统这个事件)。后者返回每一秒你的系统CPU发出多少次信号。以此来计算两个操作之间使用的秒数就简单了,如:double t = (double)getTickCount();// 发生的事件 ...t = ((double)getTickCount() - t)/getTickFrequency();cout << "Times passed in seconds: " 阅读全文
posted @ 2013-08-29 11:19 亲福 阅读(712) 评论(0) 推荐(0) 编辑