#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv) {
Mat res, dst;
res = imread("D:\picture/caomei.jpg");
if (!res.data) {
printf("could not load caomei Image... \r\n");
return -1;
}
namedWindow("Input Image",CV_WINDOW_AUTOSIZE);
imshow("Input Image",res);
//dst = Mat(res); //部分复制
//dst = Mat::zeros(res.size(),res.type()); //复制一张空白黑框图像
//res.copyTo(dst); // 完全复制
dst = res.clone(); // 克隆
imshow("Output Image",dst);
int i = 0;
int num[3] = { 100,200,300 };
while (1) {
Mat str(500,num[i++],CV_8UC3,Scalar(0,0,100)); // 创建一定大小的图像
imshow("OUT_1",str);
waitKey(500);
if (i > 2) break;
}
Mat opk;
opk.create(4,4,CV_8UC2);
opk = Scalar(127,127);
cout << "opk = " << endl << "" << opk << ";" << endl;
uchar * pinter = opk.ptr<uchar>(0);
printf("%d\n",*pinter);
Mat kl = (Mat_<double>(3, 3) << 0, -1, 0, -1, 5, -1, 0, -1, 0);
cout << "kl = " << endl << "" << kl << endl << endl;
waitKey(0);
return 0;
}
opencv——Mat对象
最新推荐文章于 2024-06-29 16:55:26 发布