zoukankan      html  css  js  c++  java
  • 图像处理---《对一张图片进行简单读入、修改、保存图像》

    《图像处理---对一张图片进行简单读入、修改、保存图像》

     

    /************************************************************************
    作者:@WP20190611
    功能:opencv加载、修改、保存图像
    说明:
        加载图像 cv::imread , 加载图像成为一个Mat格式
        修改图像 cv::cvtColor ,图像转换到看了另外一个颜色空间上去
        保存图像 cv::imwrite
        显示图像 cv::namedWindows  cv::imshow  不是nameWindows字母遗漏d
    ************************************************************************/
    #include <opencv2/opencv.hpp>
    #include <iostream>
    #include <math.h>
    
    using namespace cv;
    
    int main(int argc, char** argv)
    {
        //加载图像
        Mat src = imread("D:\work_VS2010\example_opencv\test001.png");
        if (src.empty())
        {
            printf("could not load image ...
    ");
            return -1;
        }
        //显示加载的图像
        namedWindow("显示原图", CV_WINDOW_AUTOSIZE);
        imshow("显示原图", src);
        
        //----------------------------开始处理图像---------------------------------------
        //处理图像,并显示图像
        namedWindow("输出图像",CV_WINDOW_AUTOSIZE);
        Mat output_image;
        cvtColor(src, output_image, CV_BGR2HSV);
        imshow("输出图像", output_image);
    
        //保存图像
        imwrite("D:\work_VS2010\example_opencv\test001_result.png", output_image);
        //----------------------------结束处理图像---------------------------------------
    
        waitKey(0);  //暂停
        return 0;
    }

  • 相关阅读:
    什么是微服务架构?
    docker 安装 mongo he SCRAM_SHA_1 authentication mechanism requires libmongoc built with ENABLE_SSL
    好用的JsonView插件
    新建vmware虚拟机无法访问网络
    安装Docker到CentOS(YUM)
    CentOS7下安装MySQL5.7安装与配置
    mongodb 阿里云centos7安装
    JS数组
    前端基本知识
    JS算法
  • 原文地址:https://www.cnblogs.com/carle-09/p/11027755.html
Copyright © 2011-2022 走看看