Opencv常用记录(一)

opencv 按帧读取视频。C++

	VideoCapture cap;
	cap.open("D:\\c_ji_shui\\ji_shui_model_show\\a0.mp4");
	Mat frame;
	while (true) {
		if (!cap.read(frame)) {
			break;
		}
		imshow("r", frame);
		waitKey(1);
	}

rgb转灰度图C++

cvtColor(frame, output, cv::COLOR_RGB2GRAY);

图片大小resize python

img_test2 = cv.resize(img, (0, 0), fx=0.25, fy=0.25, interpolation=cv.INTER_NEAREST)

新建mat

Mat mask = Mat(foreground.rows, foreground.cols, CV_8UC1, Scalar(0));

画圆

circle(mask, Point(400, 100), 10, Scalar(255),-1);

你可能感兴趣的:(opencv,opencv,人工智能,c++)