// opencv_demo1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <opencv2\opencv.hpp>
int demo1()
{
cv::Mat input = cv::imread("./1024x768.png");
if (input.empty())
{
std::cout << "failed" << std::endl;
}
cv::namedWindow("read", CV_WINDOW_AUTOSIZE);
cv::imshow("read", input);
cv::namedWindow("write", CV_WINDOW_AUTOSIZE);
cv::Mat output;
cv::cvtColor(input, output, CV_BGR2GRAY);
cv::imshow("write", output);
cv::imwrite("./output.tif", output);
cv::waitKey(0);
return 0;
}
int demo2()
{
return 0;
}
int main()
{
demo1();
//demo2();
return 0;
}
打开图片并保存导本地
最新推荐文章于 2024-11-09 18:03:01 发布