图像读取、显示与保存

一、图像读取

  

二、图像显示

namedWindow(const String &winname, int flags = WINDOW_AUTOSIZE)

 

imshow(const String &winname, InputArray mat)

三、图像保存

 

#include <opencv2/opencv.hpp>         //the basic building blocks of the library
#include <iostream>
using namespace cv;
using namespace std;

int main()
{
    Mat img, gray;
    img = imread("pic_saved.jpg", IMREAD_COLOR);

    namedWindow("img", WINDOW_NORMAL);

    imshow("img", img);

    imwrite("img.jpg", img);

    waitKey(0);

    return 0;
}

猜你喜欢

转载自blog.csdn.net/m0_46521579/article/details/132487462