资源如下所示:
代码为:
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
//调整图像显示尺寸函数
void Myshow(std::string name, const cv::Mat& cv_src)
{
cv::namedWindow(name, 0);
/*void nameWindow(const string& winname,int flags = WINDOW_AUTOSIZE)
参数1:新建的窗口的名称。自己随便取。
参数2:窗口的标识,一般默认为WINDOW_AUTOSIZE*/
int max_rows = 400;
int max_cols = 400;
cv::resizeWindow(name, cv::Size(max_cols, max_rows));
cv::imshow(name, cv_src);
}
int main()
{
//读入图像
cv::Mat image = cv::imread("../测试图片/气泡.jpg");
//判断是否读取成功
if (image.empty())
{
std::cout << "图片为空" <<
这篇博客主要介绍了如何利用C++和OpenCV库进行气泡检测。通过提供的代码,展示了具体实现过程和应用效果。
订阅专栏 解锁全文
273

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



