您好,登錄后才能下訂單哦!
這篇文章給大家介紹如何進(jìn)行opencv vector 測(cè)試,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。
#include <iostream> #include <cv.h> #include <cxcore.h> #include <highgui.h> using namespace std; using namespace cv; int main( ) { #if 1 //聲明一個(gè)2維點(diǎn)向量,2列,自定義行數(shù) vector<Point2f> vp2f; //二維點(diǎn)向量賦值 vp2f.push_back(Point2f(3, 3)); cout << "【二維點(diǎn)向量】" << endl << vp2f << endl; //定義4*2的矩陣,并賦值,若沒(méi)有賦值,則默認(rèn)為0 vector<Point2f> corners(4); corners[0] = Point2f(0,0); corners[1] = Point2f(200-1,0); corners[2] = Point2f(0,300-1); corners[3] = Point2f(200-1,300-1); cout << "【corners(4)】" << endl << corners << endl; //定義一個(gè)5*2的矩陣,未賦值,默認(rèn)為0 vector<Point2f> corners_trans(5); cout << "【corners_trans(5)】" << endl << corners_trans << endl; //定義20*3的矩陣,并賦值 vector<Point3f> vp3f(20); for (size_t i = 0; i < vp3f.size(); i++) { vp3f[i] = Point3f((float)(i + i), (float)(i * i), (float)(i + 1)); } cout << "【三維點(diǎn)向量】" << endl << vp3f << endl; #endif system("pause"); cvWaitKey(50000); return 0; }
關(guān)于如何進(jìn)行opencv vector 測(cè)試就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。