zoukankan      html  css  js  c++  java
  • opencv学习之hsv通道分解 #201906101704

    include <opencv2/opencv.hpp>

    using namespace cv;
    using namespace std;

    int main(){
    Mat pic = imread("/Users/leung/Documents/imgs/lena.jpg");
    Mat pic_half,hsvchannels[3],hsv;

    pyrDown(pic, pic_half);
    
    cvtColor(pic_half, hsv, COLOR_BGR2HSV);
    
    split(hsv, hsvchannels);
    imshow("b", hsvchannels[0]);
    imshow("g", hsvchannels[1]);
    imshow("r", hsvchannels[2]);
    waitKey();
    return 0;
    

    }
    分解通道彩色显示

    include <opencv2/opencv.hpp>

    using namespace cv;
    using namespace std;

    int main(){
    Mat img = imread("/Users/leung/Documents/imgs/lena.jpg");

    //用于之后彩色的b通道
    Mat b_color;
    vector<Mat> bchannel;
    
    split(img, bchannel);
    
    //另外两个通道置0;
    bchannel[1] = Scalar(0);
    bchannel[2] = Scalar(0);
    
    //合并三个通道
    merge(bchannel, b_color);
    
    imshow("b", bchannel);
    waitKey();
    return 0;
    

    }

  • 相关阅读:
    CentOS6.5配置网络
    php curl 总结
    laravel-5-doctrine-2 教程
    DOS 总结
    Centos如何通过yum安装php7
    sql with 写法
    php 汉字转拼音函数
    MYSQL 升序排序但值为0的排最后
    zookeeper基础知识
    初识redis
  • 原文地址:https://www.cnblogs.com/ax204/p/10998828.html
Copyright © 2011-2022 走看看