OpenCV读取图片的测试程序,仅供测试使用。
#include "stdafx.h"
#include <opencv2\opencv.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main()
{
Mat dst;
Mat img = imread("8.26.bmp");
threshold(img, dst, 254, 255, CV_THRESH_BINARY);
if (img.empty())
{
cout << "error";
return -1;
}
imshow("xx", img);
imwrite("2.bmp", dst);
waitKey();
return 0;
}
本文介绍了一个简单的OpenCV测试程序,该程序用于读取图片文件并进行二值化处理。程序首先尝试加载指定的图片文件,然后通过阈值处理将其转换为黑白图像,并将处理后的图像保存到新的文件中。
27万+

被折叠的 条评论
为什么被折叠?



