摘要: int main(){ cv::Mat m1(5,5, CV_8UC1); for(int i=0;i<m1.rows;++i) for(int j=0;j<m1.cols;++j) m1.at<uchar>(i,j)=i*2+j*2+1; // uchar与8U匹配。 std::cout<<m1< 阅读全文
posted @ 2019-09-09 20:09 hiligei 阅读(302) 评论(0) 推荐(0) 编辑
摘要: int main(){ cv::Mat m1=(cv::Mat_<int>(3,2)<<1,2,3,4,5,6); cv::Mat m2=(cv::Mat_<int>(3,2)<<2,4,6,8,10,12); cv::Mat m3=(cv::Mat_<int>(3,2)<<3,6,9,12,15, 阅读全文
posted @ 2019-09-08 18:40 hiligei 阅读(1049) 评论(0) 推荐(0) 编辑
摘要: 一:构造并访问单通道。 int main(){ cv::Mat m=(cv::Mat_<int>(3,2)<<1,2,3,4,5,6); for(int i=0;i<m.rows;++i){ for(int j=0;j<m.cols;++j) std::cout<<m.at<int>(i,j)<<" 阅读全文
posted @ 2019-09-08 18:32 hiligei 阅读(1969) 评论(0) 推荐(0) 编辑
摘要: cv::Scalar scalar1(v); cv::Mat mat3(size,CV_8UC1,scalar1); std::cout<<mat3<<std::endl; std::cout<<std::endl; int a[2][3][3]={ {{0,0,0},{0,0,0},{0,0,0} 阅读全文
posted @ 2019-09-08 09:42 hiligei 阅读(1969) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<vector> int main(){ std::vector<int> arr(5); // 创建一维数组 for(int i=0;i<5;++i) std::cout << arr[i]<<" "; std::cout << std::en 阅读全文
posted @ 2019-09-06 21:05 hiligei 阅读(2989) 评论(0) 推荐(0) 编辑
摘要: template<typename _Tp> class Scalar_ : public Vec<_Tp, 4> { public: //! various constructors Scalar_(); Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0); S 阅读全文
posted @ 2019-09-06 20:49 hiligei 阅读(719) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<memory> using namespace std; class PokerGame{ public: int cards; int mumber; string name; PokerGame(int cards, int mumber) 阅读全文
posted @ 2019-09-04 19:42 hiligei 阅读(155) 评论(0) 推荐(0) 编辑
摘要: C++ 中关键字struct和class都是用来定义类的,二者除了默认访问限定符不同,其他所有方面都一样。故以下把类和结构体统称类。 class的默认权限为private,而struct的默认权限为public。 class默认继承为private,struct默认继承问public。 struct 阅读全文
posted @ 2019-09-04 11:35 hiligei 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 在c++的继承控制中,有三种不同的控制权限,分别是public、protected和private。定义派生类时,若不显示加上这三个关键字,就会使用默认的方式,用struct定义的类是默认public继承,class定义的类是默认private继承。这和Java有很大的不同,Java默认使用publ 阅读全文
posted @ 2019-09-04 10:00 hiligei 阅读(1009) 评论(0) 推荐(0) 编辑
摘要: zsh: echo "alias g++='g++ -std=c++11'" >> ~/.zshrc source ~/.zshrc bash: echo "alias g++='g++ -std=c++11'" >> ~/.bashrc source ~/.bashrc 阅读全文
posted @ 2019-09-03 21:05 hiligei 阅读(345) 评论(0) 推荐(0) 编辑